peclet-dem 0.4.0
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
Loading...
Searching...
No Matches
solve_driver_force.hpp File Reference

dem — the force-based DEM step driver: explicit soft-contact time stepping (the engine family that computes contact FORCES from overlap and integrates them, in contrast to the impulse/constraint XPBD engine in solve_driver.hpp). More...

#include <cstdio>
#include <cstdlib>
#include <Kokkos_Core.hpp>
#include <Kokkos_Sort.hpp>
#include <stdexcept>
#include "particles.hpp"
#include "solve_driver.hpp"
#include "solver_hertz.hpp"

Go to the source code of this file.

Classes

struct  peclet::dem::HertzMindlinLaw
 Hertz–Mindlin force-law policy (the first force law; see file comment). More...
 
struct  peclet::dem::SoloForceHooks
 Single-GPU hooks: no ghosts, reductions are already global. Everything inlines away. More...
 

Namespaces

namespace  peclet
 
namespace  peclet::dem
 

Functions

void peclet::dem::hertzRebuildPairs (Particles &P, float skin)
 Rebuild the Hertz cached pair list with margin skin, carrying the Mindlin shear history across by pair key (permutation sort of the OLD list, binary search from the NEW).
 
void peclet::dem::hertzCommitHistory (Particles &P)
 Save the current list (sorted by key) so the NEXT rebuild can carry the history.
 
void peclet::dem::zeroForceScratchKokkos (V3 dv, V3 dw, int lo, int hi)
 Zero the force/torque accumulator rows [lo, hi) — under MPI the pair kernels atomically accumulate onto ghost slots too (Newton's third law), but only owned rows are consumed and cleared by the integrator; without this the ghost rows grow without bound.
 
void peclet::dem::fillWorldRadiiKokkos (Vf scale, Vf rad, float gs, float bR, int n)
 World radii rad(i) = scale(i) * globalScale * baseRadius over [0, n) (n = owned + ghosts after a halo gather; the driver's own preamble fills the owned span).
 
template<class Law , class Hooks >
void peclet::dem::demStepForce (Particles &P, float dt, int nsteps, float skinFrac, const Law &law, const Hooks &hooks)
 nsteps explicit force-based DEM steps of size dt with force law Law (see file comment).
 
void peclet::dem::demStepHertz (Particles &P, float dt, int nsteps, float skinFrac)
 nsteps of the soft-sphere Hertz-Mindlin engine — the single-GPU instantiation of the force-based driver (kept as the historical entry point; see demStepForce).
 

Detailed Description

dem — the force-based DEM step driver: explicit soft-contact time stepping (the engine family that computes contact FORCES from overlap and integrates them, in contrast to the impulse/constraint XPBD engine in solve_driver.hpp).

The driver owns the engine-generic machinery — the cached Verlet pair list with key-carried per-pair history, the skin/rebuild cadence (rebuild when any particle moved skin/2), the wall candidate list, symplectic-Euler integration, displacement tracking and profiling — while the contact FORCE LAW is a policy: HertzMindlinLaw (viscoelastic Hertz normal + history Mindlin tangential, the Dosta-2024 / LIGGGHTS reference model) is the first implementation; other explicit laws (linear spring-dashpot, cohesive/JKR, bonded) slot in as further policies with their own per-pair state, reusing the same driver, halo choreography and tests.

Like the impulse driver, the same sequence runs single-GPU and distributed through a Hooks policy:

  • SoloForceHooks — every hook a no-op/identity; demStepHertz compiles to the historical single-GPU engine (validated bit-for-bit on the Serial backend).
  • MpiForceHooks (sim.hpp, PECLET_DEM_MPI) — domain-decomposed explicit DEM in the classical MD mold: at every pair-list rebuild the halo re-gathers ghosts in a band of (pair cutoff + skin); between rebuilds only the ghost STATE (pos/vel/angVel/quat) is forwarded owner->ghost each step. Every pair touching an owned particle is present rank-locally (broadphase emits owned-ghost pairs once), forces on ghost slots are discarded (the neighbour rank computes the mirrored pair itself — the same exact-redundant pattern as the impulse engine), and only owned particles integrate. The rebuild decision, the skin and the initial cache-validity flag are Allreduced so the collective gather/forward schedule is identical on all ranks.

Per-pair history (e.g. the Mindlin shear spring xi) is keyed by GLOBAL particle id — stable across halo rebuilds and ownership migration; the migration pack carries each particle's slice of it (see mpi_halo.hpp).

Definition in file solve_driver_force.hpp.