newton.solvers.SolverImplicitMPM#
- class newton.solvers.SolverImplicitMPM(model, config)[source]#
Bases:
SolverBaseImplicit MPM solver.
This solver implements an implicit MPM algorithm for granular materials, roughly following [1] but with a GPU-friendly rheology solver.
This variant of MPM is mostly interesting for very stiff materials, especially in the fully inelastic limit, but is not as versatile as more traditional explicit approaches.
[1] https://doi.org/10.1145/2897824.2925877
- Parameters:
- Returns:
The solver.
- class Config(max_iterations=250, tolerance=1e-05, strain_basis='P0', solver='gauss-seidel', warmstart_mode='auto', collider_velocity_mode='instantaneous', voxel_size=0.1, grid_type='sparse', grid_padding=0, max_active_cell_count=-1, transfer_scheme='apic', critical_fraction=0.0, air_drag=1.0, collider_normal_from_sdf_gradient=False, collider_basis='Q1')#
Bases:
objectImplicit MPM solver configuration.
- __init__(max_iterations=250, tolerance=1e-05, strain_basis='P0', solver='gauss-seidel', warmstart_mode='auto', collider_velocity_mode='instantaneous', voxel_size=0.1, grid_type='sparse', grid_padding=0, max_active_cell_count=-1, transfer_scheme='apic', critical_fraction=0.0, air_drag=1.0, collider_normal_from_sdf_gradient=False, collider_basis='Q1')#
- collider_basis: str = 'Q1'#
P0 (piecewise constant), Q1 (trilinear), S2 (quadratic serendipity), pic8 (particle-based with max 8 points per cell)
- Type:
Collider basis function string. Examples
- collider_normal_from_sdf_gradient: bool = False#
Compute collider normals from sdf gradient rather than closest point
- collider_velocity_mode: str = 'instantaneous'#
Collider velocity computation mode. May be one of instantaneous, finite_difference.
- max_active_cell_count: int = -1#
Maximum number of active cells to use for active subsets of dense grids. -1 means unlimited.
- solver: str = 'gauss-seidel'#
Solver to use for the rheology solver. May be one of gauss-seidel, jacobi.
- classmethod register_custom_attributes(builder)#
Register MPM-specific custom attributes in the ‘mpm’ namespace.
This method registers per-particle material parameters and state variables for the implicit MPM solver.
- Attributes registered on Model (per-particle):
mpm:young_modulus: Young’s modulus in Pampm:poisson_ratio: Poisson’s ratio for elasticitympm:damping: Viscous damping coefficientmpm:hardening: Hardening factor for plasticitympm:friction: Friction coefficientmpm:yield_pressure: Yield pressure in Pampm:tensile_yield_ratio: Tensile yield ratiompm:yield_stress: Deviatoric yield stress in Pa
- Attributes registered on State (per-particle):
mpm:particle_qd_grad: Velocity gradient for APIC transfermpm:particle_elastic_strain: Elastic deformation gradientmpm:particle_Jp: Determinant of plastic deformation gradientmpm:particle_transform: Overall deformation gradient for rendering
- __init__(model, config)#
- notify_model_changed(flags)#
- sample_render_grains(state, grains_per_particle)#
Generate per-particle point samples used for high-resolution rendering.
- setup_collider(collider_meshes=None, collider_body_ids=None, collider_thicknesses=None, collider_friction=None, collider_adhesion=None, collider_projection_threshold=None, model=None, body_com=None, body_mass=None, body_inv_inertia=None, body_q=None)#
Configure collider geometry and material properties.
By default, collisions are set up against all shapes in the model with
newton.ShapeFlags.COLLIDE_PARTICLES. Use this method to customize collider sources, materials, or to read colliders from a different model.- Parameters:
collider_meshes (list[Mesh] | None) – Warp triangular meshes used as colliders.
collider_body_ids (list[int] | None) – For dynamic colliders, per-mesh body ids.
collider_thicknesses (list[float] | None) – Per-mesh signed distance offsets (m).
collider_friction (list[float] | None) – Per-mesh Coulomb friction coefficients.
collider_adhesion (list[float] | None) – Per-mesh adhesion (Pa).
collider_projection_threshold (list[float] | None) – Per-mesh projection threshold (m).
model (Model | None) – The model to read collider properties from. Default to solver’s model.
body_com (array | None) – For dynamic colliders, per-body center of mass.
body_mass (array | None) – For dynamic colliders, per-body mass. Pass zeros for kinematic bodies.
body_inv_inertia (array | None) – For dynamic colliders, per-body inverse inertia.
body_q (array | None) – For dynamic colliders, per-body initial transform.
- step(state_in, state_out, control, contacts, dt)#