Skip to content
lililii124Public

About

2D/3D material point mechanics in JAX, with constitutive models, contact, fluid-solid coupling and ParaView output.

Topics

Resources

Stars

58 stars

Watchers

0 watching

Forks

Repository files navigation

jax-mpm

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

Fibres

Single fibre tension
Single fibre tension
Crossed fibre Hertz contact
Crossed fibre Hertz contact
Crossed fibre MD contact
Crossed fibre MD contact
Crossed fibre JKR contact
Crossed fibre JKR contact
Three-strand tension
Three-strand tension
Three-strand forming
Three-strand forming
Dry three-strand forming
Dry three-strand forming

Woven composites: plate impact

Deep woven plate impact
Deep woven plate impact

Woven composites: plain weave

0°/90° plain weave · In-plane shear
0°/90° plain weave · In-plane shear
0°/90° plain weave · Transverse in-plane tension
0°/90° plain weave · Transverse in-plane tension
0°/90° plain weave · Warp tension
0°/90° plain weave · Warp tension

Woven composites: triaxial weave

0°/±60° weave · In-plane shear
0°/±60° weave · In-plane shear
0°/±60° weave · Transverse in-plane tension
0°/±60° weave · Transverse in-plane tension
0°/±60° weave · Warp tension
0°/±60° weave · Warp tension

Woven composites: twill weave

2×2 twill · In-plane shear
2×2 twill · In-plane shear
2×2 twill · Transverse in-plane tension
2×2 twill · Transverse in-plane tension
2×2 twill · Warp tension
2×2 twill · Warp tension

Metals

JC round-bar necking
JC round-bar necking
JC pressure panel damage
JC pressure panel damage
JC pressure panel backside damage at 75 MPa
JC pressure panel · 75 MPa · backside damage

Cutting

Multiple passes

Multiple passes · Equivalent plastic strain
Equivalent plastic strain
Multiple passes · Temperature
Temperature
Multiple passes · Damage
Damage
Multiple passes · Plastic strain rate
Plastic strain rate

Second pass close-up

Second pass close-up · Equivalent plastic strain
Equivalent plastic strain
Second pass close-up · Temperature
Temperature
Second pass close-up · Damage
Damage
Second pass close-up · Plastic strain rate
Plastic strain rate

Johnson parameters

Johnson parameters · Equivalent plastic strain
Equivalent plastic strain
Johnson parameters · Temperature
Temperature
Johnson parameters · Damage
Damage
Johnson parameters · Plastic strain rate
Plastic strain rate

Seo parameters

Seo parameters · Equivalent plastic strain
Equivalent plastic strain
Seo parameters · Temperature
Temperature
Seo parameters · Damage
Damage
Seo parameters · Plastic strain rate
Plastic strain rate

Concrete

HJC beam bending
HJC beam bending
HJC legacy-v3 pressure panel damage
HJC legacy-v3 pressure panel damage
HJC pressure panel backside damage at 25 MPa
HJC pressure panel · 25 MPa · backside damage

Ceramics

JH2 ceramic impact and debris
JH2 ceramic impact and debris
JH-2 pressure panel damage
JH-2 pressure panel damage

Geotechnical mechanics

Toe excavation

Plastic activity
Plastic activity
Shear softening
Shear softening
Displacement
Displacement

Slope response

Plastic activity
Plastic activity
Shear softening
Shear softening

Adhesive surface contact

Nonadhesive pull-off
Nonadhesive pull-off
Adhesive pull-off
Adhesive pull-off
Radial sinusoidal pull-off
Radial sinusoidal pull-off
Lateral release
Lateral release
Three-sphere array
Three-sphere array

Nonadhesive contact

Ball–beam contact
Ball–beam contact
Frictional sliding
Frictional sliding
Head-on contact
Head-on contact
Oblique contact
Oblique contact
Rebound
Rebound
Rubber-ball drop
Rubber-ball drop
Spherical indentation
Spherical indentation

Fluid dynamics

Dam break
Dam break
Sloshing
Sloshing
Unbaffled tank
Unbaffled tank

Fluid-solid interaction

Elastic gate
Elastic gate
Flexible baffles
Flexible baffles
Floating block
Floating block
Flow past an elastic obstacle
Flow past an elastic obstacle
Water entry · reference
Water entry · reference
Water entry · refined
Water entry · refined

Structural elasticity

Cellular cushioning
Cellular cushioning
Cyclic bending
Cyclic bending
Cyclic torsion
Cyclic torsion
Large bending
Large bending
Large simple shear
Large simple shear
Large twist
Large twist
Perforated panel
Perforated panel
Pressure-loaded panel
Pressure-loaded panel

Hyperelastic symmetry

Square symmetry under blast pressure
Square symmetry
Rectangular symmetry under blast pressure
Rectangular symmetry
Sixfold symmetry under blast pressure
Sixfold symmetry
Eightfold symmetry under blast pressure
Eightfold symmetry
Isotropic under blast pressure
Isotropic

Fracture

AT2 crack propagation
AT2 crack propagation
Anisotropic AT2 crack deflection
Anisotropic crack deflection
AT2 three-point bending fracture
Three-point bending
AT2 crack and free hole boundary
Crack–hole interaction
Localized cohesive crack propagation
Cohesive crack propagation
Cohesive crack-tip detail
Crack-tip detail
Energy-controlled cohesive crack turning
Cohesive crack turning
Cohesive crack with higher fracture energy
Higher fracture energy
Edge-notched plate under tension
Notched tension
Combined opening and shear
Mixed loading
Prescribed-path double-notch development calculation
Double notch · development
Prescribed-path opening and recontact development calculation
Opening and recontact · development

JAX design

Classic cantilever material layout
Classic cantilever material layout
Minimum-material cantilever
Minimum-material cantilever
Initial and candidate material distributions under central pressure
Central pressure · material distribution
Reduced-model peak deflection for initial and candidate designs
Peak deflection · reduced model
Central-load design X–Z material section
X–Z material section
Central-load design Y–Z material section
Y–Z material section
Central blast response
Central blast response
Central blast response, side view
Side view

Installation

Python 3.12 or later:

git clone https://github.com/lililii124/jax-mpm.git
cd jax-mpm
python -m venv .venv

Activate 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.

Examples

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 --gif

Repeat 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.gradient

See 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.

Materials

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.

Python API

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.

Numerical scope

  • 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.

Verification

python -m pytest -q

Tests 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.

License

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.

About

2D/3D material point mechanics in JAX, with constitutive models, contact, fluid-solid coupling and ParaView output.

Topics

Resources

Stars

58 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages