FEM · Shells · Rigid Bodies · Frictional Contact · Strong Coupling
Docs · PDF · IEEE Page
STARK is a C++ and Python simulation platform for strongly coupled simulation of rigid and deformable bodies with frictional contact. It provides a broad set of physics models, including volumetric FEM, discrete shells, rods, rigid body joints, attachments, and IPC-based frictional contact. STARK is built on top of SymX, a symbolic differentiation and JIT compilation engine that automates derivative generation, evaluation, and much of the solver plumbing.
STARK is very easy to use and it is great for research. It has been validated through real-world, challenging cases of interactions between robots and deformable objects, see the STARK ICRA'24 paper.
- Deformable objects
- 1D rods and cables — axial strain with optional strain limiting
- 2D cloth and shells — Neo-Hookean membrane strain (Stable Neo-Hookean) + discrete shell bending, inflation pressure
- 3D soft bodies — linear tetrahedral FEM with a Neo-Hookean constitutive model
- Strain limiting, inertial and material damping, quasistatic mode
- Composite materials: freely mix volume, surface, and rod energies on a single mesh
- Rigid bodies
- Comprehensive joint library: fix, ball, hinge, slider, universal, planar, point-on-axis, and more
- Velocity controllers with smooth force/torque caps (paper)
- Damped springs and distance limits
- Automatic stiffness hardening to enforce tight tolerances without hand-tuning
- Frictional contact
- IPC-based, intersection-free contact handling
- All coupling modes: deformable–deformable, rigid–deformable, rigid–rigid
- Per-pair Coulomb friction and per-object contact thickness
- Attachments — penalty-based gluing by point list, barycentric coordinates, or proximity search; deformable–deformable and rigid–deformable
- Powered by SymX — symbolic differentiation, automatic code generation, JIT compilation, OpenMP parallelism, and a robust Newton solver with line search and positive-definite projection
- Python API (
pystark) — access to the C++ API from Python with NumPy interoperability - Event-based scripting — time events, callbacks, and animated boundary conditions
- Extensible — add custom SymX energy potentials without modifying STARK internals; symbolic gradients and Hessians are derived automatically
import numpy as np
import pystark
# 1. Configure output and solver settings
settings = pystark.Settings()
settings.output.simulation_name = "spinning_box_cloth"
settings.output.output_directory = "output_folder"
settings.output.codegen_directory = "codegen_folder"
# 2. Create the simulation
simulation = pystark.Simulation(settings)
# 3. Set global contact parameters
contact_params = pystark.EnergyFrictionalContact.GlobalParams()
contact_params.default_contact_thickness = 0.0025
simulation.interactions().contact().set_global_params(contact_params)
# 4. Add a deformable cloth surface
cV, cT, cH = simulation.presets().deformables().add_surface_grid(
"cloth",
size=np.array([0.4, 0.4]),
subdivisions=np.array([32, 32]),
params=pystark.Surface.Params.Cotton_Fabric()
)
# 5. Add a rigid body box
bV, bT, bH = simulation.presets().rigidbodies().add_box("box", mass=1.0, size=0.08)
bH.rigidbody.add_translation(np.array([0.0, 0.0, -0.08]))
fix_handler = simulation.rigidbodies().add_constraint_fix(bH.rigidbody)
# 6. Script: spin the box over time
duration = 10.0
def script(t):
fix_handler.set_transformation(
np.array([0.0, 0.0, -0.08]),
90.0*t,
np.array([0.0, 0.0, 1.0])
)
# 7. Run
simulation.run(duration, script)The native C++ scene definition follows the same API structure. Output is written as VTK files; you can open them in ParaView or in Blender with the Sequence Loader Addon.
STARK physics models are SymX symbolic definitions of energy potentials. You can add custom physics without worrying about differentiation or other implementation details.
The following example adds an strongly coupled implicit magnetic attraction to deformable vertices, just with a small symbolic energy definition:
stark::core::Stark& stark_core = simulation.get_stark();
stark::PointDynamics* dyn = simulation.deformables->point_sets.get();
stark_core.global_potential->add_potential("EnergyMagneticAttraction", magnetic_vertices,
[&](MappedWorkspace<double>& mws, Element& elem)
{
Vector v1 = mws.make_vector(dyn->v1.data, elem["point"]);
Vector x0 = mws.make_vector(dyn->x0.data, elem["point"]);
Scalar dt = mws.make_scalar(stark_core.dt);
Scalar k = mws.make_scalar(magnet_force);
Vector m = mws.make_vector(magnet_center);
Vector x1 = stark::time_integration(x0, v1, dt);
Vector r = x1 - m;
return -k / r.norm();
}
);The repository includes C++ and Python examples to get you started.
C++ examples (examples/main.cpp):
hanging_net— a net of rods fixed at its perimeter and hanging under gravityhanging_cloth— cloth fixed by two corners and hanging under gravityhanging_deformable_box— a FEM soft body fixed by two cornershanging_box_with_composite_material— volume + surface + rod on one meshquasistatic_column_extrusion— quasistatic Neo-Hookeanattachments— two cloth panels and a rigid body glued by attachmentsdeformable_and_rigid_collisions— stacked soft boxes on a rigid floorspinning_box_cloth— cloth on a spinning rigid box, IPC contact and frictionsimple_grasp— parallel gripper grasping a deformable objecttwisting_cloth— cloth twisted by animated boundary conditionsmagnetic_deformables_implicit— external magnetic energy definition
Python examples (pystark/examples/):
spinning_box_cloth.py— the hello world sceneboxes_on_cloth.py— stack of rigid boxes landing on a pinned clothtwisting_cloth.py— cloth twisted by prescribed boundary conditionsinflation.py— inflatable membrane with animated internal pressureviscoelasticity.py— viscoelastic soft body compressed by a rigid torus
STARK requires CMake 3.18+, a C++20 compiler, and OpenMP.
cmake -S . -B build
cmake --build build --parallel
build/examples/examples # run C++ examplesSee the setup documentation for the full integration guide.
Build from source with CMake:
cmake -S . -B build \
-DSTARK_BUILD_PYTHON_BINDINGS=ON \
-DSTARK_PYTHON_EXECUTABLE=$(which python)
cmake --build build --parallel --target pystark
export PYTHONPATH=/path/to/stark/pystark:$PYTHONPATHSee the setup documentation for Conda/virtualenv instructions and Windows notes.
Full documentation: https://stark.physics-simulation.org/
- Hello World
- Setup
- Architecture Overview
- Settings
- Deformables
- Rigid Bodies
- Rigid Body Constraints
- Frictional Contact
- Attachments
- Extending STARK
- Progressively Projected Newton's Method
- Strongly coupled simulation of magnetic rigid bodies
- Micropolar Elasticity in Physically-Based Animation
- Curved Three-Director Cosserat Shells with Strong Coupling
If STARK contributes to your research, please cite the paper.
@InProceedings{FLL+24,
author={Fern\'{a}ndez-Fern\'{a}ndez, Jos\'{e} Antonio and Lange, Ralph and Laible, Stefan and Arras, Kai O. and Bender, Jan},
booktitle={2024 IEEE International Conference on Robotics and Automation (ICRA)},
title={STARK: A Unified Framework for Strongly Coupled Simulation of Rigid and Deformable Bodies with Frictional Contact},
year={2024},
pages={16888-16894},
doi={10.1109/ICRA57147.2024.10610574}
}STARK benefits from real use in demanding simulation environments.
If you are:
- simulating soft robots, surgical tools, garments, or other compliant mechanisms
- building FEM pipelines for animation or engineering
- exploring differentiable simulation, contact, or multi-physics coupling
- interested in extending the physics models, solver, or Python API
then feel free to reach out!
|
|
Robert Bosch GmbH is acknowledged for generous financial support of the development of the initial version of STARK from 2019 to 2021. |
Contributors to the codebase:
- José Antonio Fernández-Fernández (corresponding author)
- Fabian Löschner


