newton.solvers.SolverImplicitMPM#

class newton.solvers.SolverImplicitMPM(model, options)[source]#

Bases: SolverBase

Implicit 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:
  • model (Model | ImplicitMPMModel) – The model to solve.

  • options (ImplicitMPMOptions) – The solver options.

Returns:

The solver.

Model#

alias of ImplicitMPMModel

Options#

alias of ImplicitMPMOptions

static enrich_state(state)#

Allocate additional per-particle and per-step fields used by the solver.

Adds velocity gradient, elastic and plastic deformation storage, and per-particle rendering transforms. Initializes grid-attached fields to None so they can be created on demand during stepping.

__init__(model, options)#
collect_collider_impulses(state)#

Collect current collider impulses and their application positions.

The impulses are returned in world units, integrating the internal nodal impulse density over the voxel volume. Collider ids can be retrieved from state.collider_ids if needed.

notify_model_changed(flags)#
project_outside(state_in, state_out, dt, max_dist=None)#

Project particles outside of colliders, and adjust their velocity and velocity gradients

Parameters:
  • state_in (State) – The input state.

  • state_out (State) – The output state. Only particle_q, particle_qd, and particle_qd_grad are written.

  • dt (float) – The time step, for extrapolating the collider end-of-step positions from its current position and velocity.

  • max_dist (float | None) – Maximum distance for closest-point queries. If None, the default is the voxel size times sqrt(3).

sample_render_grains(state, grains_per_particle)#

Generate per-particle point samples used for high-resolution rendering.

Parameters:
  • state (State) – Current Newton state providing particle positions.

  • grains_per_particle (int) – Number of grains to sample per particle.

Returns:

A wp.array with shape (num_particles, grains_per_particle) of type wp.vec3 containing grain positions.

step(state_in, state_out, control, contacts, dt)#
update_particle_frames(state_prev, state, dt, min_stretch=0.25, max_stretch=2.0)#

Update per-particle deformation frames for rendering and projection.

Integrates the particle deformation gradient using the velocity gradient and clamps its principal stretches to the provided bounds for robustness.

update_render_grains(state_prev, state, grains, dt)#

Advect grain samples with the grid velocity and keep them inside the deformed particle.

Parameters:
  • state_prev (State) – Previous state (t_n).

  • state (State) – Current state (t_{n+1}).

  • grains (array) – 2D array of grain positions per particle to be updated in place. See sample_render_grains.

  • dt (float) – Time step duration.