Skip to content

About

Fast physical prediction with Taichi WCSPH and learned free-surface probe reconstruction. Reproducible SPHERIC Test 02 benchmarks.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

English | 简体中文

PhysicalAI-Engine

A GPU WCSPH solver with a learned output correction for free-surface prediction.

License: MIT Python 3.9–3.12 Benchmark: SPHERIC Test 02

Status: v0.2 — single benchmark, single geometry, held-out depth interpolation. See Limitations.

AI-selected solver benchmark

On a 0.52 m staggered-baffle case, Cosmos proposed changing fluid spacing from 36.67 to 30 mm. Four paired comparisons against independent numerical references improved spatial IoU by 0.082–0.125. The trial passed the budget, while the model predicted the wrong direction for regional water volume. Experiment, trajectories and replay instructions

Approved cases can run their solver configuration directly after offline selection. Physical forecast audit and fixed 30 mm policy comparison

Run a new water depth or calibrate the splash

A case configuration runs the frozen solver and 3-D correction, exports the predicted liquid volume and reports which checks have evidence. The offline calibration command tests shared surface thresholds on development and regression trajectories before considering an independent depth. In the first 13-frame impact window, both CPU and CUDA reconstructions covered more of the visible plume at low thresholds. Four experimental frames left droplet separation unresolved, so the program kept 0.50. Commands, published inputs and results · Machine decision

Replay the impact in 3-D

Coarse SPH, coarse with learned volumetric correction, and fine SPH at the same physical time

The centre panel reconstructs a 3-D liquid occupancy field from the same particles as the left. In the held-out CUDA run, whole-tank overlap with fine SPH rises from 0.8473 to 0.8632. Around the obstacle during impact (0.50–0.80 s), it falls from 0.1260 to 0.1229. The particle archive, checkpoint and replay CLI let you examine both results. Videos, per-frame scores and reproduction instructions

SPHERIC Test 02 water level at H2 and H4: experiment, coarse, fine, corrected


Results

3D dam break, SPHERIC Test 02. 2 s physical time, 25 ms output interval, 81 frames, two gauges (H2 downstream, H4 in the reservoir). Median of 3 independent runs per method on one RTX 4080 SUPER.

Method Particles Wall time H2 RMSE H4 RMSE Pooled RMSE
Coarse SPH, 55 mm 3,960 5.27 s 8.21 cm 2.41 cm 6.05 cm
Coarse SPH + correction 3,960 5.50 s 5.84 cm 2.31 cm 4.42 cm
Cost control, 53 mm 4,370 6.25 s 7.55 cm 2.47 cm 5.71 cm
Fine SPH, 36.67 mm 13,365 8.45 s 5.01 cm 1.85 cm 3.78 cm

Reading the table:

  • The correction costs +0.23 s and cuts pooled RMSE by 27%.
  • It dominates the 53 mm cost control: 0.75 s faster and 1.29 cm more accurate.
  • Fine SPH stays 0.64 cm more accurate for +2.95 s. A real tradeoff, not a clean win.

Raw per-run data: repeats.csv · metrics.json · simulated.csv · protocol in METHOD.md

Error vs. wall time across methods and repeats


Install

Python 3.9–3.12. The CUDA backend needs an NVIDIA GPU; the CPU backend works without one.

git clone https://github.com/7insidefragr/PhysicalAI-Engine.git
cd PhysicalAI-Engine
python -m pip install ".[benchmark]"

Dependencies are declared in pyproject.toml. The benchmark extra adds matplotlib and xlrd for plotting and for reading the SPHERIC workbook.

Quickstart

python -m physicalai_engine.run --backend cuda --model models/test02.json --out runs/prediction.npz
import numpy as np

with np.load("runs/prediction.npz") as run:
    print(run["time"][-1])          # physical time, s
    print(run["water_level"][-1])   # H2, H4, m
Flag Default Notes
--backend cpu cpu or cuda
--spacing 0.055 Particle spacing, m. Range 0.01–0.10
--height 0.55 Reservoir fill height, m. Range 0.1–0.9
--duration 2.0 Physical time, s
--interval 0.025 Output interval, s
--model off JSON checkpoint. Omit for plain kernel reconstruction
--training off Sample all 35 training probes instead of the 2 gauges

The checkpoint declares the spacing it was trained for; a mismatch raises an error rather than silently degrading.

Reproduce

python benchmarks/reproduce.py --backend cuda

The script integrates independent coarse/fine pairs at 0.44 m and 0.66 m, refits the correction, reruns the 0.55 m held-out case three times, and verifies the SHA-256 of the official SPHERIC archive before reading it. Output lands in runs/reproduction/report/. Pass --archive PATH to use a local copy.

How it works

  • Solver. Weakly compressible SPH on a uniform lattice, FP32, cubic-spline kernel with support radius 2 × spacing. Neighbour bins rebuild every substep; the acoustic timestep is rounded down onto the output grid. Outer tank walls use slip projection; the fixed obstacle is represented by solid particles.
  • Features. At each query location, sample cubic-kernel occupancy on a vertical line and extract five statistics: the 0.5 isosurface height, heights at the 0.30 and 0.70 thresholds, the column integral, and the highest local particle centre.
  • Correction. A standardized ridge regression predicts fine-minus-coarse height from those five features. Weights are shared across all query locations; dry neighbourhoods return zero.
  • Coupling. Output-only. The correction reads the current coarse frame and never feeds back into the integrator — the next step continues from unmodified particle state. This keeps the solver bit-identical whether the model is enabled or not.
  • Training. 0.44 m and 0.66 m reservoirs, two independently integrated spacings each, 35 query locations per frame. Target is the fine-spacing kernel height.

The checkpoint is 742 bytes of JSON — five weights, five means, five scales, one bias. Inspect it directly: models/test02.json.

Limitations

  • Interpolation, not extrapolation. Training depths are 0.44 m and 0.66 m; the reported case is 0.55 m. No evidence yet for geometries, depths, or resolutions outside this range.
  • Amplitude only, not phase. The correction fixes height error but not timing. In the first run, the corrected curve shows a local peak at 0.525 s where the experiment peaks at 1.325 s. Early oscillations from the coarse solve survive.
  • H4 gain is within noise. 2.41 → 2.31 cm. Pooled improvement is driven almost entirely by H2 (8.21 → 5.84 cm). Report gauges separately before quoting a pooled number.
  • One benchmark, one tank. SPHERIC Test 02 only. Gate motion, air phase, surface tension, and experimental wall layers are all omitted from the tank model.
  • Linear model. Five-feature ridge regression, not a neural surrogate. It is cheap and inspectable; it is also bounded by what those five statistics can express.
  • Timing varies. First-compile cost, driver version, and particle insertion order all shift wall time and trajectories. Treat the table as one machine's medians, not a spec.

Citation

If you use this benchmark setup, cite the original experiment:

@techreport{kleefsman2005spheric,
  title  = {A Volume-of-Fluid Based Simulation Method for Wave Impact Problems},
  author = {Kleefsman, K. M. T. and Fekken, G. and Veldman, A. E. P. and Iwanowski, B. and Buchner, B.},
  year   = {2005},
  note   = {SPHERIC Test 02, MARIN}
}

Acknowledgments

The WCSPH kernels derive from Mingrui Zhang's MIT-licensed SPH_Taichi at b02e13a. The upstream notice ships with the vendored files; pinned version and local changes are documented in UPSTREAM.md. Benchmark description by Issa and Violeau; measurements by SPHERIC and MARIN.

License

MIT — see LICENSE.

About

Fast physical prediction with Taichi WCSPH and learned free-surface probe reconstruction. Reproducible SPHERIC Test 02 benchmarks.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages