|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Files | |
| sdflow_regression.py | |
| state_hash.py | |
sdflow_regression.py is an accuracy and efficiency regression suite for the sdflow cut-cell IBM Stokes solver. It runs three creeping-flow grid-convergence studies and compares the results against a saved baseline (perf_baseline.json), so a code change that degrades either accuracy or solver efficiency is caught.
| case | geometry | accuracy metric | reference |
|---|---|---|---|
| zh_sphere | one simple-cubic sphere (φ=0.216) | drag factor K | Zick & Homsy (1982), K≈7.442 |
| random_spheres | small packed bed of 8 jittered spheres (fixed seed) | dimensionless permeability k* = k/L² = μ⟨u⟩/(F·N²) | Richardson extrapolation |
| hollow_rings | small packed bed of 3 Raschig rings (hollow cylinders) | k* | Richardson extrapolation |
The geometry is self-similar in N (the same relative shape resolved on a finer grid), so the dimensionless metric (K, k*) converges as N→∞ and a true order of convergence can be fit.
Typical baseline orders: zh_sphere p≈2.4, random_spheres p≈2.2, hollow_rings p≈1.3 (the thin ring walls converge geometrically slower). Pressure iters are ~6–10/step and grid-independent (the MG-PCG signature).
Build the single-GPU module first (cmake -S . -B build && cmake --build build -j). Then, from the repo root with the venv active:
--solver colocated runs sdflow.SolverColocated (the cell-centered / approximate-projection grid) against its own baseline perf_baseline_colocated.json; the default staggered uses perf_baseline.json. The collocated metric converges to the same continuum value but more slowly / non-monotonically on the Stokes sphere beds (its fitted order is low — see doc/history/colocated_study/), so its baseline records that behaviour.
The full suite runs in ~20 s on an RTX 5080. Re-record the baseline (--update) only when a change is expected to move the numbers (and review the diff); otherwise a baseline change masks a regression.
metric ±1.5% per grid · order ±0.4 · extrapolated ±2% · total pressure iters ±25% · per-step pressure iters ±2 · divergence ≤ max(1e-7, 3×baseline). Wall-clock time is recorded and printed but not asserted (machine-dependent).