trusty¶
Top-level classes and functions: the world and its settings, materials, meshes and solver reports. Each module has its own page in the menu.
Trusty โ a modular physics simulation library.
Backend
¶
ConvergenceCriterion
¶
HexMesh
¶
IterReport
¶
LinearSystemReport
¶
FungParams
¶
StableFung's parameters: the ground state (mu0, lam) plus the exponential-hardening pair (mu1, gamma).
FungParamsGrid
¶
A regular axis-aligned grid of the parameters a law reads, over a body's rest space. Sampling clamps to the edge outside the box.
GridInterpolation
¶
LameParams
¶
LameParamsGrid
¶
A regular axis-aligned grid of the parameters a law reads, over a body's rest space. Sampling clamps to the edge outside the box.
LinearSolverType
¶
LoggingObserver
¶
Bases: SolverObserver
ARAP
¶
Corotational
¶
NeohookeanBW
¶
QuadraticVolume
¶
StableFung
¶
StableNeoHookean
¶
MaterialModel
¶
Bases: Enum
NewtonConfig
¶
SolveReport
¶
SolverObserver
¶
TetMesh
¶
TimeStepping
¶
World
¶
gravity
property
¶
Uniform body acceleration (m/s^2), as an (x, y, z) tuple.
last_report
¶
The last step's solve report; a default-constructed report before the first step.
alive
¶
Whether the handle refers to a live entity of this world. False for a destroyed entity and for an integer no factory returned; a handle from a different world is not detected.
make_beam_hex_mesh
¶
Structured axis-aligned hex mesh; size is (Lx, Ly, Lz), res is (nx, ny, nz).
make_beam_tet_mesh
¶
Structured axis-aligned tet mesh (6-tet Kuhn decomposition per hex cell). size is (Lx, Ly, Lz), res is (nx, ny, nz).
make_hex_mesh
¶
Wrap externally-built (vertices, hexes) arrays into a HexMesh. Use this when reading via meshio from Python.
make_tet_mesh
¶
Wrap externally-built (vertices, tets) arrays into a TetMesh. Use this when reading via meshio from Python (TetMesh has no Python constructor for the underlying connectivity).
get_max_threads
¶
Worker threads currently available -- the machine's concurrency unless set_max_threads lowered it.
read_tet_msh
¶
Read a Gmsh .msh file (format 2.2) and return the contained tet mesh. Only 4-node tetrahedra are extracted; orientation is fixed to det([X1-X0|X2-X0|X3-X0]) > 0.
set_max_threads
¶
Cap the worker-thread count for this process. Unset by default, so a lone simulation uses every core. Set 1 when running N independent simulations in parallel (one per process, or one per thread since step() releases the GIL): their internal parallelism otherwise oversubscribes the machine and the pool loses most of what it gained. Takes effect on the next parallel region, so it can be raised or lowered at any time.
triangle_components
¶
Connected component (through shared vertices) of each row of a (F, 3) triangle array, numbered from 0 in order of each component's first triangle. Splits a solid's boundary into its outer surface and the surface of each internal void.
generate_particle_grid
¶
generate_particle_grid(
lo,
hi,
spacing: float,
mode: SamplingMode = "poisson",
*,
seed: int = 12345,
poisson_r_factor: float = 1.0,
) -> np.ndarray
Fill an axis-aligned box with MPM particles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lo
|
(array - like, shape(3))
|
Lower / upper corners of the seed box. |
required |
hi
|
(array - like, shape(3))
|
Lower / upper corners of the seed box. |
required |
spacing
|
float
|
Target inter-particle spacing. For |
required |
mode
|
('poisson', 'uniform')
|
Sampling strategy. Default |
'poisson'
|
seed
|
int
|
RNG seed for Poisson-disk sampling (ignored for uniform). |
12345
|
poisson_r_factor
|
float
|
Scales |
1.0
|
Returns:
| Type | Description |
|---|---|
np.ndarray of shape (N, 3), dtype float64.
|
|
check_capabilities
¶
Raise RuntimeError if any named capability is missing from
this build of trusty. Use at the top of examples to fail fast with
a clear message instead of dying inside a builder later.
add_floor_plane
¶
Attach a horizontal floor plane (origin=(0,0,z), normal=(0,0,1))
to world as a contact.ContactPlane component. Returns the new
entity (an int). friction_mu is the floor's Coulomb
coefficient; 0 (the default) is a frictionless floor. Requires a
build with contact enabled (contact.add_plane is only registered
then).