Solvers#
A solver is the physics engine for one class of material. Each solver owns the entities built from its materials, advances their state every substep, and exposes the state back to the scene. A scene can run several solvers at once, so a single simulation can mix rigid robots, deformable solids, cloth, fluids, and smoke. For how solvers exchange forces at their interfaces, see Solvers and coupling.
You rarely construct a solver directly. You add an entity with a material, and the scene routes it to the matching solver; you configure each solver through its options object.
Available solvers#
Solver |
Method |
Simulates |
|---|---|---|
|
Rigid body and articulated dynamics |
Robots, articulated mechanisms, rigid objects |
|
Material Point Method |
Elastic and elasto-plastic solids, sand, snow, muscle, liquid |
|
Finite Element Method |
Elastic solids, muscle, cloth |
|
Position Based Dynamics |
Cloth, soft (elastic) bodies, liquid, free particles |
|
Smoothed Particle Hydrodynamics |
Liquids |
|
Stable Fluid (Eulerian grid) |
Gaseous phenomena such as smoke |
|
Kinematic tool coupling |
Rigid tools that drive soft bodies through one-way differentiable coupling |
Each solver has its own page linked below, and its own options:
RigidSolver: RigidSolver, configured by gs.options.RigidOptions.
MPMSolver: MPMSolver, configured by gs.options.MPMOptions.
FEMSolver: FEMSolver, configured by gs.options.FEMOptions.
PBDSolver: PBDSolver, configured by gs.options.PBDOptions.
SPHSolver: SPHSolver, configured by gs.options.SPHOptions.
SFSolver: SFSolver, configured by gs.options.SFOptions.
ToolSolver: ToolSolver, configured by gs.options.ToolOptions.
Note
ToolSolver is a temporary solver that provides one-way differentiable coupling from a rigid tool to soft bodies. It will be removed once the RigidSolver supports differentiability directly.
Combining solvers#
Adding entities with different materials activates their solvers automatically. All active solvers step together within one scene.step():
import genesis as gs
gs.init()
scene = gs.Scene()
# Rigid robot -> RigidSolver
robot = scene.add_entity(gs.morphs.URDF(file="urdf/franka_panda/panda.urdf"))
# Deformable solid -> MPMSolver
soft = scene.add_entity(
gs.morphs.Box(pos=(0.5, 0.0, 0.5), size=(0.2, 0.2, 0.2)),
material=gs.materials.MPM.Elastic(),
)
# Cloth -> PBDSolver
cloth = scene.add_entity(
gs.morphs.Mesh(file="meshes/cloth.obj"),
material=gs.materials.PBD.Cloth(),
)
scene.build()
for _ in range(1000):
scene.step() # every active solver advances one step
Forces are exchanged between solvers by a coupler; see Couplers.
Performance#
Solvers run on the GPU through Quadrants, the just-in-time compiler that generates the parallel kernels. Computation is parallelized across particles, grid cells, or elements, and across environments when the scene is built with multiple environments (n_envs > 1).
See also#
Solvers and coupling: how solvers are combined and coupled.
Couplers: the couplers that exchange forces between solvers.
Simulator, coupler and solver options: per-solver options.