|
flow
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Functions | |
| zh_ref (phi) | |
| _grid (N) | |
| _minimg (d, N) | |
| sdf_zh_sphere (N, phi=0.216) | |
| sdf_random_spheres (N, n=8, r_frac=0.18, jit=0.06, seed=12345) | |
| _hollow_cyl_sdf (X, Y, Z, c, axis, r_out, r_in, H, N) | |
| sdf_hollow_rings (N) | |
| run_case (name, N, cfg, quiet=True, solver="staggered") | |
| fit_order (Ns, vals) | |
| run_all (cfg, cases, solver="staggered") | |
| compare (base, cur) | |
| main () | |
Variables | |
| HERE = os.path.dirname(os.path.abspath(__file__)) | |
| ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) | |
| BASELINE = os.path.join(HERE, "perf_baseline.json") | |
| list | ZH_PHI = [0.000125, 0.001, 0.008, 0.027, 0.064, 0.125, 0.216, 0.343, 0.45, 0.5236] |
| list | ZH_K = [1.096, 1.212, 1.525, 2.008, 2.810, 4.292, 7.442, 15.4, 28.1, 42.1] |
| dict | CASES |
| CFG | |
| TOL | |
Single-GPU accuracy + efficiency regression suite for the `sdflow` cut-cell IBM Stokes solver. Three creeping-flow (Stokes) cases, each as a GRID-CONVERGENCE study: * zh_sphere -- simple-cubic single sphere; drag factor K vs Zick & Homsy (1982) (external ref); * random_spheres -- a small packed bed of (reproducibly) jittered spheres; Darcy permeability k; * hollow_rings -- a small packed bed of Raschig rings (hollow cylinders); Darcy permeability k. For each grid N we record the ACCURACY metric (K or k) and the EFFICIENCY counters the solver exposes: total pressure-solver (MG-PCG) iterations, per-step pressure iterations, Picard outer iterations, the number of steps to steady state, the cut-cell flux divergence, and the wall-clock time. Across the grid sweep we fit the observed order of convergence p (f(N) = f_inf + C N^-p) and the Richardson-extrapolated value f_inf. All numbers are saved to perf_baseline.json. Re-running compares against that baseline within tolerances, so a code change that degrades accuracy OR efficiency is caught. Usage: python tests/regression/sdflow_regression.py # run + check against the baseline (exit 0/1) python tests/regression/sdflow_regression.py --update # run + (re)write the baseline python tests/regression/sdflow_regression.py --cases zh_sphere,random_spheres python tests/regression/sdflow_regression.py --build build_mpi # pick the sdflow build dir python tests/regression/sdflow_regression.py --quick # coarser grids, looser march (fast smoke)
| sdflow_regression.zh_ref | ( | phi | ) |
Definition at line 42 of file sdflow_regression.py.
|
protected |
Definition at line 47 of file sdflow_regression.py.
Referenced by sdf_hollow_rings(), sdf_random_spheres(), and sdf_zh_sphere().
|
protected |
Definition at line 52 of file sdflow_regression.py.
Referenced by _hollow_cyl_sdf(), and sdf_random_spheres().
| sdflow_regression.sdf_zh_sphere | ( | N, | |
phi = 0.216 |
|||
| ) |
Single SC sphere centred in the periodic cube; returns (sdf, info).
Definition at line 56 of file sdflow_regression.py.
References _grid().
| sdflow_regression.sdf_random_spheres | ( | N, | |
n = 8, |
|||
r_frac = 0.18, |
|||
jit = 0.06, |
|||
seed = 12345 |
|||
| ) |
Small packed bed: `n` spheres of radius r_frac*N on a jittered 2x2x2 lattice (fixed seed). The shape is self-similar in N (same relative geometry, finer grid) -> a true grid-convergence study of k*.
Definition at line 65 of file sdflow_regression.py.
|
protected |
SDF of one Raschig ring (hollow cylinder): annulus [r_in,r_out] x slab |axial|<=H/2, CSG-intersection.
Definition at line 81 of file sdflow_regression.py.
References _minimg().
Referenced by sdf_hollow_rings().
| sdflow_regression.sdf_hollow_rings | ( | N | ) |
Small packed bed of 3 Raschig rings at fixed positions/orientations (reproducible).
Definition at line 93 of file sdflow_regression.py.
References _grid(), and _hollow_cyl_sdf().
| sdflow_regression.run_case | ( | name, | |
| N, | |||
| cfg, | |||
quiet = True, |
|||
solver = "staggered" |
|||
| ) |
Definition at line 118 of file sdflow_regression.py.
| sdflow_regression.fit_order | ( | Ns, | |
| vals | |||
| ) |
Fit f(N) = f_inf + C N^-p (grid-search p, linear LS for f_inf,C). Returns (order p, f_inf).
Definition at line 167 of file sdflow_regression.py.
| sdflow_regression.run_all | ( | cfg, | |
| cases, | |||
solver = "staggered" |
|||
| ) |
Definition at line 180 of file sdflow_regression.py.
Referenced by main().
| sdflow_regression.compare | ( | base, | |
| cur | |||
| ) |
Definition at line 211 of file sdflow_regression.py.
Referenced by main().
| sdflow_regression.main | ( | ) |
| sdflow_regression.HERE = os.path.dirname(os.path.abspath(__file__)) |
Definition at line 33 of file sdflow_regression.py.
| sdflow_regression.ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) |
Definition at line 34 of file sdflow_regression.py.
| sdflow_regression.BASELINE = os.path.join(HERE, "perf_baseline.json") |
Definition at line 35 of file sdflow_regression.py.
| list sdflow_regression.ZH_PHI = [0.000125, 0.001, 0.008, 0.027, 0.064, 0.125, 0.216, 0.343, 0.45, 0.5236] |
Definition at line 38 of file sdflow_regression.py.
| list sdflow_regression.ZH_K = [1.096, 1.212, 1.525, 2.008, 2.810, 4.292, 7.442, 15.4, 28.1, 42.1] |
Definition at line 39 of file sdflow_regression.py.
| dict sdflow_regression.CASES |
Definition at line 106 of file sdflow_regression.py.
| sdflow_regression.CFG |
Definition at line 113 of file sdflow_regression.py.
| sdflow_regression.TOL |
Definition at line 207 of file sdflow_regression.py.