|
| 1 | +import os |
| 2 | +from pathlib import Path |
| 3 | +import jax.numpy as jnp |
| 4 | +from diffmpm.solver import MPM |
| 5 | + |
| 6 | +curr_filepath = Path(__file__).absolute() |
| 7 | +curr_dir = curr_filepath.parent |
| 8 | +os.chdir(curr_dir) |
| 9 | +mpm = MPM("mpm-nodal-forces.toml") |
| 10 | +mpm.solve() |
| 11 | + |
| 12 | +result = jnp.load("results/uniaxial-nodal-forces/particles_0300.npz") |
| 13 | +## Step 300 |
| 14 | +assert jnp.round(result["stress"][0, :, 0].min() - 0.5925210678182377, 6) == 0.0 |
| 15 | +assert jnp.round(result["stress"][0, :, 0].max() - 0.5974539476363379, 6) == 0.0 |
| 16 | + |
| 17 | +## Step 510 |
| 18 | +result = jnp.load("results/uniaxial-nodal-forces/particles_0510.npz") |
| 19 | +assert jnp.round(result["stress"][0, :, 0].min() - 1.0026665338366039, 5) == 0.0 |
| 20 | +assert jnp.round(result["stress"][0, :, 0].max() - 1.0112231542459431, 5) == 0.0 |
| 21 | + |
| 22 | +## Step 750 |
| 23 | +result = jnp.load("results/uniaxial-nodal-forces/particles_0750.npz") |
| 24 | +assert jnp.round(result["stress"][0, :, 0].min() - 1.0000053000532143, 5) == 0.0 |
| 25 | +assert jnp.round(result["stress"][0, :, 0].max() - 1.0000225119807862, 5) == 0.0 |
| 26 | + |
| 27 | +## Step 990 |
| 28 | +result = jnp.load("results/uniaxial-nodal-forces/particles_0990.npz") |
| 29 | +assert jnp.round(result["stress"][0, :, 0].min() - 0.9999990078443788, 5) == 0.0 |
| 30 | +assert jnp.round(result["stress"][0, :, 0].max() - 0.9999990292713694, 5) == 0.0 |
0 commit comments