MPMSolver#

The MPMSolver implements the Material Point Method (MPM) for simulating elastic solids, granular materials, fluids, and phase transitions. It combines Lagrangian particles that track material points with a background Eulerian grid that solves the momentum equations, transferring between them with the moving least squares material point method (MLS-MPM) scheme, which fuses stress and the affine velocity field into one transfer. The materials it supports are listed in MPM. For usage, see Beyond rigid bodies.

Options#

class genesis.options.solvers.MPMOptions(*, use_sparse_grid: bool = False, leaf_block_size: int = 8, dt: float | None = None, gravity: tuple[float, float, float] | None = None, particle_size: float | None = None, grid_density: float = 64, enable_CPIC: bool = False, lower_bound: tuple[float, float, float] = (-1.0, -1.0, 0.0), upper_bound: tuple[float, float, float] = (1.0, 1.0, 1.0)) None[source]#

Options configuring the MPMSolver.

Note

MPM is a hybrid lagrangian-eulerian method for simulating soft materials. In the eulerian phase, it uses a grid representation. The upper_bound and lower_bound specify the simulation domain, but a safety padding will be added to the actual grid boundary. Therefore, the actual boundary could be slightly tighter than the specified one. Note that the size of the domain affects the performance of the simulation, hence you should set it as tight as possible.

Parameters:
  • particle_size (float, optional) – Particle diameter in meters. If not given, we will compute particle_size based on grid_density, where particle_size will be linearly proportional to the grid cell size. A reference value is particle_size = 0.01 for grid_density = 64. Defaults to None.

  • grid_density (float, optional) – Number of grid cells per meter. Defaults to 64.

  • enable_CPIC (bool, optional) – Whether to enable CPIC (Compatible Particle-in-Cell) to support coupling with thin objects. Defaults to False.

  • lower_bound (tuple, shape (3,), optional) – Lower bound of the simulation domain. Defaults to (-1.0, -1.0, 0.0).

  • upper_bound (tuple, shape (3,), optional) – Upper bound of the simulation domain. Defaults to (1.0, 1.0, 1.0).

  • use_sparse_grid (bool, optional) – This option is deprecated.

  • leaf_block_size (int, optional) – This option is deprecated.

MPMSolver#

class genesis.engine.solvers.mpm_solver.MPMSolver(scene: Scene, sim: Simulator, options: MPMOptions)[source]#

Bases: GravityMixin, TimeBasedMixin, Solver

material_cls#

alias of Base

setup_boundary()[source]#
init_particle_fields()[source]#
init_grid_fields()[source]#
init_vvert_fields()[source]#
init_ckpt()[source]#
init_constraints()[source]#

Lazy initialization of particle constraint fields.

reset_grad()[source]#
build()[source]#
property is_active#
add_entity(idx, material, morph, surface, visualize_contact=False, name: str | None = None, desc=None) MPMEntity[source]#
add_material(material)[source]#
stencil_range()[source]#
compute_F_tmp(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
svd(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
compute_F_tmp_and_svd(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
compute_F_tmp_only(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
svd_grad(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
p2g(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, geoms_state: ~genesis.utils.array_class.GeomsState, geoms_info: ~genesis.utils.array_class.GeomsInfo, links_state: ~genesis.utils.array_class.LinksState, rigid_info: ~genesis.utils.array_class.RigidInfo, sdf_info: ~genesis.utils.array_class.SDFInfo, collider_static_config: <quadrants.types.annotations.Template object at 0x797f41beddf0>)[source]#
g2p(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, geoms_info: ~genesis.utils.array_class.GeomsInfo, links_state: ~genesis.utils.array_class.LinksState, rigid_info: ~genesis.utils.array_class.RigidInfo)[source]#
process_input(in_backward=False)[source]#
process_input_grad()[source]#
substep_pre_coupling(f)[source]#
substep_pre_coupling_grad(f)[source]#
substep_post_coupling(f)[source]#
substep_post_coupling_grad(f)[source]#
copy_frame(source: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, target: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
copy_grad(source: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, target: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
reset_grid_and_grad(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
reset_dirty_cells(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
reset_grad_till_frame(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>)[source]#
collect_output_grads()[source]#

Collect gradients from downstream queried states.

add_grad_from_state(state)[source]#
add_grad_from_pos(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, pos_grad: NdarrayType(dtype=None, ndim=None, layout=Layout.AOS, needs_grad=None))[source]#
add_grad_from_vel(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, vel_grad: NdarrayType(dtype=None, ndim=None, layout=Layout.AOS, needs_grad=None))[source]#
add_grad_from_C(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, C_grad: NdarrayType(dtype=None, ndim=None, layout=Layout.AOS, needs_grad=None))[source]#
add_grad_from_F(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, F_grad: NdarrayType(dtype=None, ndim=None, layout=Layout.AOS, needs_grad=None))[source]#
add_grad_from_Jp(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, Jp_grad: NdarrayType(dtype=None, ndim=None, layout=Layout.AOS, needs_grad=None))[source]#
save_ckpt(ckpt_name)[source]#
load_ckpt(ckpt_name)[source]#
set_state(f, state, envs_idx=None)[source]#
get_state(f)[source]#
update_render_fields()[source]#
apply_particle_constraints(f: <quadrants._lib.core.quadrants_python.DataTypeCxx object at 0x798033d1b9b0>, links_state: ~genesis.utils.array_class.LinksState)[source]#
property n_particles#
property n_vverts#
property n_vfaces#
property grid_density#
property particle_size#
property particle_radius#
property upper_bound#
property lower_bound#
property leaf_block_size#
property use_sparse_grid#
property dx#
property inv_dx#
property particle_volume_real#
property particle_volume#
property particle_volume_scale#
property is_built#
property lower_bound_cell#
property upper_bound_cell#
property grid_res#
property grid_offset#
property enable_CPIC#
property enable_particle_constraints#

See also#