Two- and three-dimensional material point mechanics in JAX: quadratic B-splines, APIC transfers, explicit dynamics, constitutive history, and two-body contact.
Gallery · Examples · Verification
![]() Single fibre tension |
||
![]() Crossed fibre Hertz contact |
![]() Crossed fibre MD contact |
![]() Crossed fibre JKR contact |
![]() Three-strand tension |
![]() Three-strand forming |
![]() Dry three-strand forming |
![]() Deep woven plate impact |
![]() 0°/90° plain weave · In-plane shear |
![]() 0°/90° plain weave · Transverse in-plane tension |
![]() 0°/90° plain weave · Warp tension |
![]() 0°/±60° weave · In-plane shear |
![]() 0°/±60° weave · Transverse in-plane tension |
![]() 0°/±60° weave · Warp tension |
![]() 2×2 twill · In-plane shear |
![]() 2×2 twill · Transverse in-plane tension |
![]() 2×2 twill · Warp tension |
![]() JC round-bar necking |
![]() JC pressure panel damage |
![]() JC pressure panel · 75 MPa · backside damage |
![]() Equivalent plastic strain |
![]() Temperature |
![]() Damage |
![]() Plastic strain rate |
![]() Equivalent plastic strain |
![]() Temperature |
![]() Damage |
![]() Plastic strain rate |
![]() Equivalent plastic strain |
![]() Temperature |
![]() Damage |
![]() Plastic strain rate |
![]() Equivalent plastic strain |
![]() Temperature |
![]() Damage |
![]() Plastic strain rate |
![]() HJC beam bending |
![]() HJC legacy-v3 pressure panel damage |
![]() HJC pressure panel · 25 MPa · backside damage |
![]() JH2 ceramic impact and debris |
![]() JH-2 pressure panel damage |
![]() Plastic activity |
![]() Shear softening |
![]() Displacement |
![]() Plastic activity |
![]() Shear softening |
![]() Nonadhesive pull-off |
![]() Adhesive pull-off |
![]() Radial sinusoidal pull-off |
![]() Lateral release |
![]() Three-sphere array |
![]() Ball–beam contact |
![]() Frictional sliding |
![]() Head-on contact |
![]() Oblique contact |
![]() Rebound |
![]() Rubber-ball drop |
![]() Spherical indentation |
![]() Dam break |
![]() Sloshing |
![]() Unbaffled tank |
![]() Elastic gate |
![]() Flexible baffles |
![]() Floating block |
![]() Flow past an elastic obstacle |
![]() Water entry · reference |
![]() Water entry · refined |
![]() Cellular cushioning |
![]() Cyclic bending |
![]() Cyclic torsion |
![]() Large bending |
![]() Large simple shear |
![]() Large twist |
![]() Perforated panel |
![]() Pressure-loaded panel |
![]() Square symmetry |
![]() Rectangular symmetry |
![]() Sixfold symmetry |
![]() Eightfold symmetry |
![]() Isotropic |
![]() Classic cantilever material layout |
![]() Minimum-material cantilever |
![]() Central pressure · material distribution |
Peak deflection · reduced model |
![]() X–Z material section |
![]() Y–Z material section |
![]() Central blast response |
![]() Side view |
Python 3.12 or later:
git clone https://github.com/lililii124/jax-mpm.git
cd jax-mpm
python -m venv .venvActivate with source .venv/bin/activate on Linux/macOS or
.venv\Scripts\Activate.ps1 on Windows, then install:
python -m pip install -e ".[test]"On Windows, setup.ps1 creates .venv312. Its -PythonPath and -JaxSource
options select an interpreter and an optional local JAX source archive.
python -m examples.suite --list
python -m examples.suite --case oblique --gif
python -m examples.suite --case fsi --gif
python -m examples.suite --case elastic-gate --grid 48 --ppc 3 --gif
python -m examples.suite --case perforated-panel --grid 48 --ppc 3 --gif
python -m examples.suite --case cellular-cushion --grid 48 --ppc 3 --gif
python -m examples.pressure_pulse_panels --model jc --grid 128 --ppc 2
python -m examples.adhesive_contact --case sphere-contact --grid 48 --ppc 3 --gif
python -m examples.material_engineering --case jc-tension --grid 80 --frames 60 --gif
python -m examples.material_engineering --case concrete-bending --frames 40 --gif
python -m examples.material_engineering --case ceramic-indentation --frames 40 --gif
python -m examples.woven_composite --architecture plain --loading warp-tension --resume--grid and --ppc control spatial resolution; the spatial suite also accepts
--dt-factor to reduce the time step.
--frames changes output frequency while preserving the physical duration.
For examples.suite, --case all runs the scenarios with their default materials.
Completed runs and animations are included in the results
and gallery.
| Elastic dynamics | Longitudinal wave, cantilever vibration, torsional release, large bending/twist |
| Prescribed loading | Simple shear, platen compression, pressure-loaded clamped panel |
| Contact | Head-on collision, oblique collision, frictional sliding, rebound, rubber-ball drop, ball–beam contact |
| Spherical contact | Prescribed rigid sphere indentation; Hertz and JKR pressure footprints |
| Fluids | Dam break, sloshing |
| Fluid–solid interaction | Clamped obstacle, elastic-block water entry, top-clamped gate, floating block |
| Engineering structures | Perforated panel under a pressure pulse, cellular elastomer cushion under a falling mass |
| Accelerated tanks | Harmonic base excitation, with and without perforated flexible baffles |
| Material engineering | JC round-bar tension to failure, concrete beam bending, ceramic indentation |
| Woven composites | Plain, triaxial and 2×2 twill under in-plane tension/shear and transverse compression/bending |
The woven composite examples use bonded elastic yarns and matrix with explicit local material axes. They write numerical output by default; use the separate ParaView command in the guide to show yarn families.
Each spatial run saves particle trajectories and final states as NPZ, diagnostics
and observables as CSV, and a JSON definition/result summary. Rendering adds
ParaView images and animations.
--gif adds an animation; --no-render skips rendering. ParaView renders
every particle, with a fixed camera and no axes or annotations. Compressed
VTK files and a ParaView state accompany the images. Install ParaView and put
pvpython on PATH, or set PARAVIEW_PYTHON to its executable. See
the rendering guide.
Long runs save a checkpoint after every output frame:
python -m examples.suite --case water-entry --grid 72 --ppc 3 --frames 60 --no-render --resume --output outputs/production
python -m mpm_jax.visualization outputs/production/water-entry/neo-hookean --gifRepeat the first command to resume an interrupted run. status.json records
progress; summary.json is written after the full duration completes.
Output histories use file-backed arrays so memory use does not grow with the
number of saved frames.
The original 2D examples and material-gradient check remain available:
python -m mpm_jax --scene elastic --gif
python -m mpm_jax --scene dam-break --dim 3 --gif
python -m examples.gradientSee the example guide for geometry, boundary conditions, observables, and refinement commands. The finite-motion guide gives the loading cycles and shear-wave comparisons shown above. The material engineering guide describes the round bar, concrete beam and ceramic tile, their material sources, and the interpretation of grip forces, section forces and damage.
| Linear elasticity | Isotropic, orthotropic, transverse isotropic; rotated material axes |
| Hyperelasticity | Compressible Neo-Hookean, selected Blatz–Ko rubber branch |
| Metal plasticity | Mixed/isotropic bilinear J2, prescribed-temperature plasticity, Johnson–Cook, selected Steinberg–Guinan branch |
| Brittle materials | JH-2, HJC, three-surface RHT with p-alpha compaction |
| Fluid | Compressible inviscid volumetric law |
| Woven composite | Orthotropic Saint Venant–Kirchhoff yarns in a Neo-Hookean matrix; fully bonded interface |
The incremental models use three-dimensional stress/history tensors. Defaults are demonstration parameters. Model conventions, source scopes, and omitted branches are recorded in docs/MATERIALS.md.
from mpm_jax import Config, advance, block, fixed_box, neo_hookean, validate_state
config = Config(
dim=3, n_grid=48, dt=2e-4, material="neo-hookean",
gravity=(0., 0., 0.), boundary_cells=0,
boundaries=(fixed_box((0., 0., 0.), (.2, 1., 1.)),),
)
material = neo_hookean(young=2e4, poisson=.2)
state = block(config, (.15, .4, .35), (.8, .6, .65), density=1000.)
state = advance(state, material, config, steps=1000)
validate_state(state, config)PlaneWall supplies unilateral slip/friction walls, including constant wall
velocity. VelocityBox supplies prescribed velocity components in a physical
coordinate region with an activation interval. fixed_box is its zero-velocity
form. MovingVelocityBox translates this region with the integrated prescribed
velocity and supports a half-cosine startup ramp.
step(..., force=...) accepts an (N, dim) array of particle forces in N.
coupled_step advances two bodies on separate grids with balanced normal and
Coulomb impulses. See examples/scenarios.py for complete setups.
RigidSphereBoundary adds a prescribed frictionless sphere. Hertz and JKR laws
are available in mpm_jax.contact_laws, with stable-branch derivatives and
conservative pressure-footprint assignment. The JKR footprint prescribes a load;
it does not solve self-consistent three-dimensional adhesive contact.
See spherical contact for equations and examples.
- Dense background grid on
[0, L]^dim; 2D particle volumes assume unit thickness. - Stress is evaluated before P2G; deformation/history are updated after G2P.
- Incremental constitutive integration uses a polar rotation and logarithmic strain increment. Linear elasticity assumes small strain and small rotation.
- The fluid is compressible and inviscid. The interface treatment is nonadhesive normal contact; there is no incompressible pressure solve, cavitation, turbulence model, or thermal conduction.
- Failed particles retain mass. The default keeps grid participation; optional ballistic failure removes their load-carrying capacity and advances them as noncontacting debris. That debris model has no crack-surface reconstruction, fragment recontact, or fracture-energy regularization. The separate cohesive fracture solver resolves two velocity fields with prescribed interface strength and fracture energy.
- Elastic material gradients are tested in 2D and 3D. Plasticity/damage return maps and their adaptive loops are not advertised as differentiable.
- Invalid deformation, missing grid support, nonfinite states, and failed constitutive convergence are reported. Time-step stability and spatial convergence remain problem dependent.
python -m pytest -qTests cover transfers, conservation, elasticity, constitutive limits, boundary conditions, contact, gradients, and checkpoint recovery. VALIDATION.md records quantitative checks; the run catalogue lists completed cases. GPU execution has not been validated.
AGPL-3.0-or-later. The earlier solver and Taichi-derived transfer code
retain their Apache-2.0 attribution in NOTICE and third_party/.
Sources are listed in REFERENCES.md.


































































































