trusty.mpm¶
MPM (CDPI) particle bodies (CPU / Accelerate / CUDA).
MpmScheme
¶
add_mpm_particles
¶
add_mpm_particles(
world: World,
positions: ndarray[float64, (N, M)],
particle_volume: float,
material: object,
density: float,
*,
scheme: MpmScheme | str = MpmScheme.Cdpi,
cell_size: float = 0.05,
cdpi_domain_scale: float = 0.5,
particle_contact_radius: float = 0.0,
friction_mu: float = 0.0,
) -> int
Add an MPM body; its presence activates the MPM module. positions is a (P, 3) array of particle positions; all particles share particle_volume, material and density (kg/m^3). material is QuadraticVolume (a fluid) or StableNeoHookean (an elastic solid; MpmScheme.Cdpi on the cpu and accelerate backends only), with one parameter set; any other model raises. The keyword arguments are the body's scheme, background grid and solver settings; scheme takes an MpmScheme or 'cdpi' / 'lite'. friction_mu is the body's surface Coulomb coefficient (>= 0); 0 is frictionless. One MPM body per world.
grid_cells
¶
Return (ijks, cell_size) for the last step's active sparse grid. ijks is an (N, 3) int32 array of cell integer coordinates; the cell with index (i, j, k) spans world AABB ([ics, (i+1)cs] x [jcs, (j+1)cs] x [kcs, (k+1)cs]). Empty before the first step or without an MPM body.
particles
¶
Return the current particle positions of the (single) MPM body as a (P, 3) array. Empty if the world has no MPM body.
set_project_positive_definite
¶
PSD-project this module's Hessians on every Newton iteration (default on). Call before the first step().