peclet-dem 1.1.0
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
Loading...
Searching...
No Matches
Solver implementation details

What peclet.dem actually computes, and where each piece lives. The engine is header-only Kokkos + ArborX under src/ (compiled as C++; the Kokkos launch compiler routes device code through nvcc/hipcc — there are no .cu files, the CUDA sources were retired in 2026-06). The Python module is peclet.dem; drive it from Python, there is no C++ main.

peclet.dem ships two contact engines over the same particle SoA (src/particles.hpp):

engine entry point driver contact model time step
impulse / XPBD (default) Simulation.step(n), relax(n), step_mpi(n) demSolveContacts (src/solve_driver.hpp) velocity-level impulses + a position-level non-penetration projection; contacts are hard constraints set by the collision scale, not by a stiffness
force-based Simulation.step_hertz(substeps), step_hertz_mpi(substeps) demStepForce + HertzMindlinLaw (src/solve_driver_force.hpp, src/solver_hertz.hpp) explicit soft-sphere Hertz–Mindlin (Dosta 2024 / LIGGGHTS formulas) Rayleigh-time limited

Both engines run the same sequence single-GPU and distributed: the MPI form is the same driver with a different Hooks policy (SoloSolveHooks vs MpiSolveHooks / SoloForceHooks vs MpiForceHooks), so there are no drifting copies. See mpi.md.

Everything below assumes set_dt(dt) has been called — every stepper raises otherwise, there is no default time step.


1. The impulse step (demStep, src/step_solve.hpp)

growth ramp updateGrowthScales (growth_rate > 0)
predict predictVelocity gravity + gyroscopic + ext. force/torque
freeze sleepers freezeAsleep (sleeping, |g| > 0, no ext. drive)
ghosts generateGhosts periodic band = 2 R_max + margin
broad phase findCollisionsArborX / ...Verlet ArborX BVH over real + ghost
narrow phase detectContacts / detectWallSdf
manifolds reduceContactsToManifolds per-pair aggregate
wake / sleep masks wakeDisturbed, ... (sleeping)
SOLVE demSolveContacts §3-§6, shared with step_mpi
commit finalCommit wrap + write pos/quat
sleep detection updateSleep (sleeping)
thermostat applyThermostat (thermostat_tau > 0)

relax(n) runs the same pipeline at dt = 0 and restores the stored dt afterwards — overlap removal only, no gravity, no velocity update, and it is the one stepper that does not require set_dt. It is what step(0.0) used to be before 1.0.0.

Prediction — src/integration.hpp (predictVelocity)

From state $\mathbf{x}_n, \mathbf{v}_n$ and step $\Delta t$:

  1. $\mathbf{v}_{pred} = \mathbf{v}_n + (\mathbf{g} + m^{-1}\mathbf{F}_{ext})\,\Delta t$
  2. angular prediction including the gyroscopic term (Euler's equations in the body frame, $