TrustySim¶
TrustySim is a simulator you can trust! Solids, cloth, rods, rigid bodies, fluids, you name it: just add it to the scene and it just works. Everything is fully coupled.
Our goal is that the user should be free from tuning low-level solver parameters to get the output they desire. We support frictional, interpenetration-free contact between any representation out-of-the-box. A range of material models are already supported, and many more will be added as the library expands. Both CPU and GPU backends are supported.
Fully coupled simulation with a T composed of tetrahedra, an r of jointed affine bodies, a u of an aluminium-foil shell, an s of elastic MPM particles, a t of hexahedra and a y of an embedded solid in its voxel grid, all squeezed together by elastic rods. See the code โ
Try it¶
Make an environment, install trusty-sim and the polyscope viewer, then run a cantilever beam sagging under gravity:
This is a pre-release. For uv, the GPU build, supported platforms and checking your build, see Install.
import polyscope as ps
import trusty
mesh = trusty.make_beam_hex_mesh(size=(1.0, 0.1, 0.1), res=(20, 2, 2))
material = trusty.StableNeoHookean(youngs_modulus=1e6, poisson_ratio=0.3)
world = trusty.World(timestep=1.0 / 60.0)
beam = trusty.fem.add_hex_solid(world, mesh, material, density=1000.0)
trusty.fem.pin_face(world, beam, axis=0, coord=0.0) # clamp the x = 0 end
for _ in range(60): # one second
world.step()
ps.init()
ps.set_up_dir("z_up")
sagged = trusty.fem.read_mesh(world, beam)
ps.register_volume_mesh("beam", sagged.vertices, hexes=sagged.hexes)
ps.show()
This example is examples/quickstart.py.
To run it, clone the examples and run it from the repository root; the viewer
opens on the sagged beam:
Modules¶
-
Hex and tet meshes, linear and quadratic elements, hyperelastic materials.
-
Near-rigid bodies, joints, actuators and line muscles.
-
Voxelized solids whose surface follows a fine embedded mesh.
-
Thin sheets and cloth with membrane and bending models.
-
Elastic rods with twist, and rod muscles.
-
Particle-based materials such as fluids and granular media.
-
Reduced-order bodies built from a precomputed basis.
-
IPC contact, planes and walls, friction, per-body exclusions.
-
Pins, moving targets, attachments and surface loads.
Citing¶
If you use trusty-sim in your research, please cite it:
@software{trusty_sim,
author = {Trusty, Ty},
title = {trusty-sim},
version = {0.1.0a5},
year = {2026},
url = {https://tytrusty.github.io/trusty-docs/}
}
trusty-sim is available under dual licensing.