|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Functions | |
| arg (name, default, cast=str) | |
| depth (s) | |
| build_swarm () | |
| build_bc () | |
| _ibm_sdf (name, N) | |
| build_ibm () | |
| build_channel () | |
| build_anchored () | |
| build_porous () | |
| one (timed) | |
| fmt (v) | |
Variables | |
| A = list(sys.argv) | |
| CASE = arg("--case", None) | |
| LEVELS = arg("--levels", 0, int) | |
| STEPS = arg("--steps", 30, int) | |
| WARM = arg("--warm", 5, int) | |
| DUMP = arg("--dump", None) | |
| JSON = arg("--json", None) | |
| RTOL = arg("--rtol", None, float) | |
| TAG = arg("--tag", "") | |
| LINE = arg("--line-relaxation", None) | |
| SYM = arg("--vcycle-symmetric", None) | |
| load0 = os.getloadavg() | |
| NP_ENV = int(os.environ.get("OMPI_COMM_WORLD_SIZE", os.environ.get("PMI_SIZE", "1"))) | |
| comm = MPI.COMM_WORLD | |
| rank | |
| size | |
| dict | info = {} |
| FLUID_MASK = None | |
| bool | fields_C = False |
| dict | BUILD |
| t_setup0 = time.perf_counter() | |
| s | |
| GRID | |
| dt_of | |
| IBM | |
| t_setup = time.perf_counter() - t_setup0 | |
| step_ms | |
| iters | |
| divs | |
| prec | |
| failed | |
| pres | |
| str | POROUS = "porous" |
| w0 = time.perf_counter() | |
| wall = time.perf_counter() - w0 | |
| float | prev = 0.0 |
| m = float(s.get_u().mean()) | |
| u = s.get_u() | |
| umean = float(u.mean()) | |
| dict | sdf = info.pop("_sdf") |
| dict | deep = sdf < -2.0 |
| list | ratios = [tuple(int(v) for v in r) for r in s.diagnostics.pressure_mg_level_ratios()] |
| g = list(GRID) | |
| list | dims = [tuple(g)] |
| list | bottom = dims[-1] |
| h = hashlib.sha256() | |
| dict | fx = {"u": s.get_u, "v": s.get_v, "w": s.get_w, "p": lambda: s.get_field("p")} |
| dict | arrs = {k: np.ascontiguousarray(f()) for k, f in fx.items()} |
| allv = comm.gather((list(info.get("origin", [0, 0, 0])), arrs), root=0) | |
| dict | out = {} |
| digest = h.hexdigest() | |
| ds = comm.gather(digest, root=0) | |
| gg = hashlib.sha256() | |
| load1 = os.getloadavg() | |
| sm = np.asarray(step_ms) | |
| prec_flips = sum(1 for a, b in zip(prec, prec[1:]) if a == "fp32" and b == "fp64") | |
| dict | res |
| porous_res_max | |
| porous_res_last | |
| tuple | keep |
| flush | |
| step_ms_list | |
| iters_list | |
| div_list | |
| prec_list | |
| failed_list | |
| porous_res_list | |
| fo | |
| indent | |
| default | |
MG-depth measurement driver (doc/mg_depth_policy.md ยง6 WO-0; reused by the WO-2 gates).
One process = one case at one pressure-multigrid depth. Every case takes
--levels L L >= 1: set_pressure_multigrid(True, L) BEFORE the geometry (an exact depth);
L = 0 (the default): do NOT call set_pressure_multigrid -- the solver default
(depth 4 on the pre-WO-2 module, AUTO after WO-2).
--steps N timed steps (default 30); --warm W untimed warm-up steps (default 5)
--dump F.npz u, v, w, p (and C where present) at the end; per rank under MPI (keys u_r<k>, ...,
origin_r<k>)
--json F the per-row metrics below plus the per-step lists
--rtol R the case's Krylov tolerance, where the case has a Krylov driver (see each case)
--line-relaxation on|off
diagnostics.set_pressure_line_relaxation (doc/mg_depth_policy.md A2.4) before the
geometry; absent: no call (the solver default, on since WO-7)
--vcycle-symmetric on|off
diagnostics.set_pressure_vcycle_symmetric (doc/mg_depth_policy.md A3) before the
geometry; absent: no call (the solver default)
Cases (--case):
swarm periodic bubble swarm, case A groups, single rank: the --single path of
tests/study/vof_perf/weak_swarm.py, code for code (--cells n, default 192;
--d-over-h 20, --bubbles-per-axis 2). --driver pcg (default; MG-PCG cap 800 at
--rtol, default 1e-8, as weak_swarm) or --driver default (no driver call: the
variable-density default, Chebyshev).
--dims NX NY NZ: an anisotropic box instead of --cells^3 (row M10: an axis that
stops coarsening early, doc/mg_depth_policy_log.md); the bubble lattice then has
max(1, N_axis // 64) bubbles along each axis (measurement choice) unless
--bubbles-per-axis is given, which stays one count for every axis.
bc the peclet-examples bubble column (run_peclet.build(), MG-PCG rtol 1e-8 as built)
at --cells-per-d S (default 32: 256 x 192 x 128), FRESH START from the seeded
spheres at rest (the 128 x 96 x 64 checkpoint does not exist at other
resolutions). --rtol re-selects MG-PCG cap 800 at R.
zh_sphere / random_spheres
the cut-cell Stokes geometries of tests/regression/sdflow_regression.py at --n N
with its CFG (MG-PCG cap 300 rtol 1e-8; --rtol overrides), marched to steady with
its stop test (--max-steps, default 400; --steps is ignored, --warm 0). Records K / k*.
--solver colocated: SolverColocated with NO scheme call, i.e. the AUTO default
('ghost': BiCGStab preconditioned by the V-cycle, at the MG-PCG cap / rtol above);
--dump then also writes the fluid-cell mask `fluid` (sdf > 0 at the cell centres,
where every colocated field lives). Row M9 (doc/mg_depth_policy_log.md); its exit
trace is the solver's PECLET_FLOW_MG_DEBUG=2 line (debug output only).
channel single-phase all-fluid channel --nx x --ny x --nz (default 2048 x 64 x 64):
periodic x, walls on +-y and +-z, body force along x, from rest plus a fixed-seed
non-solenoidal low-mode perturbation (--perturb, default 1e-2). Single rank:
the default driver (MG-PCG, auto-enabled); --rtol selects MG-PCG cap 800 at R.
Under mpirun (np > 1): mpi_block + init_mpi, the multi-rank default (the
standalone V-cycle, no Krylov driver selected; --rtol is refused).
anchored inflow/outflow channel --nx x --ny x --nz (default 128 x 32 x 32): uniform inflow
U at -x, outflow at +x, walls on +-y, +-z, all fluid; MG-PCG cap --maxit
(default 300) at --rtol (default 1e-12) -- the divergence floor at an identical
budget at every depth.
porous CFD-DEM-style fixed porous bed --n^3 (default 128): add 'eps' via
set_porous_continuity(True) with implicit drag (enable_drag), drag_beta from the
viscous Ergun term, advection + implicit advection ON (as peclet_coupling's
CfdDem), periodic, body force along x; the driver is the solver default for that
configuration (no driver call). --no-drag drops enable_drag.
Per step: wall ms of step() alone, last_pressure_iterations(), max_open_divergence_projected()
(read after the step, outside the timer), pressure_vcycle_precision(), pressure_solve_failed(),
and for the porous case max_porous_residual() (the continuity the porous projection solves).
At the end: the level ratios, the bottom's global dims, the load average before/after. The bottom
ENGINE is not visible through the API; run_matrix.sh reads it from a short probe run with
PECLET_FLOW_MG_DEBUG=1 PECLET_FLOW_AGMG_DEBUG=1 (debug output only).
Rank 0 prints one `RESULT key=value ...` line.
| mgd_case.arg | ( | name, | |
| default, | |||
| cast = str ) |
Definition at line 79 of file mgd_case.py.
Referenced by build_anchored(), build_bc(), build_channel(), build_ibm(), build_porous(), and build_swarm().
| mgd_case.depth | ( | s | ) |
--levels L >= 1: an exact depth, before the geometry; 0: leave the solver default. --line-relaxation on|off: the A2.4 line smoother switch (absent: the default). --vcycle-symmetric on|off: the A3 symmetric V-cycle switch (absent: the default).
Definition at line 115 of file mgd_case.py.
Referenced by build_anchored(), build_channel(), build_ibm(), build_porous(), and build_swarm().
| mgd_case.build_swarm | ( | ) |
weak_swarm.py --single, code for code (case A groups, cell units).
Definition at line 128 of file mgd_case.py.
| mgd_case.build_bc | ( | ) |
Definition at line 197 of file mgd_case.py.
References arg().
|
protected |
Definition at line 231 of file mgd_case.py.
Referenced by build_ibm().
| mgd_case.build_ibm | ( | ) |
Definition at line 254 of file mgd_case.py.
References _ibm_sdf(), arg(), and depth().
| mgd_case.build_channel | ( | ) |
Definition at line 276 of file mgd_case.py.
| mgd_case.build_anchored | ( | ) |
Definition at line 318 of file mgd_case.py.
| mgd_case.build_porous | ( | ) |
Definition at line 337 of file mgd_case.py.
| mgd_case.one | ( | timed | ) |
| mgd_case.fmt | ( | v | ) |
Definition at line 514 of file mgd_case.py.
| mgd_case.A = list(sys.argv) |
Definition at line 76 of file mgd_case.py.
| mgd_case.CASE = arg("--case", None) |
Definition at line 83 of file mgd_case.py.
| mgd_case.LEVELS = arg("--levels", 0, int) |
Definition at line 86 of file mgd_case.py.
| mgd_case.STEPS = arg("--steps", 30, int) |
Definition at line 87 of file mgd_case.py.
| mgd_case.WARM = arg("--warm", 5, int) |
Definition at line 88 of file mgd_case.py.
| mgd_case.DUMP = arg("--dump", None) |
Definition at line 89 of file mgd_case.py.
| mgd_case.JSON = arg("--json", None) |
Definition at line 90 of file mgd_case.py.
| mgd_case.RTOL = arg("--rtol", None, float) |
Definition at line 91 of file mgd_case.py.
| mgd_case.TAG = arg("--tag", "") |
Definition at line 92 of file mgd_case.py.
| mgd_case.LINE = arg("--line-relaxation", None) |
Definition at line 93 of file mgd_case.py.
| mgd_case.SYM = arg("--vcycle-symmetric", None) |
Definition at line 96 of file mgd_case.py.
| mgd_case.load0 = os.getloadavg() |
Definition at line 99 of file mgd_case.py.
| mgd_case.NP_ENV = int(os.environ.get("OMPI_COMM_WORLD_SIZE", os.environ.get("PMI_SIZE", "1"))) |
Definition at line 102 of file mgd_case.py.
| mgd_case.comm = MPI.COMM_WORLD |
Definition at line 105 of file mgd_case.py.
| mgd_case.rank |
Definition at line 106 of file mgd_case.py.
| mgd_case.size |
Definition at line 106 of file mgd_case.py.
| dict mgd_case.info = {} |
Definition at line 110 of file mgd_case.py.
| dict mgd_case.FLUID_MASK = None |
Definition at line 111 of file mgd_case.py.
| bool mgd_case.fields_C = False |
Definition at line 112 of file mgd_case.py.
| dict mgd_case.BUILD |
Definition at line 378 of file mgd_case.py.
| mgd_case.t_setup0 = time.perf_counter() |
Definition at line 382 of file mgd_case.py.
| mgd_case.s |
Definition at line 383 of file mgd_case.py.
| mgd_case.GRID |
Definition at line 383 of file mgd_case.py.
| mgd_case.dt_of |
Definition at line 383 of file mgd_case.py.
Referenced by one().
| mgd_case.IBM |
Definition at line 383 of file mgd_case.py.
| mgd_case.t_setup = time.perf_counter() - t_setup0 |
Definition at line 386 of file mgd_case.py.
| mgd_case.step_ms |
Definition at line 389 of file mgd_case.py.
| mgd_case.iters |
Definition at line 389 of file mgd_case.py.
| mgd_case.divs |
Definition at line 389 of file mgd_case.py.
| mgd_case.prec |
Definition at line 389 of file mgd_case.py.
| mgd_case.failed |
Definition at line 389 of file mgd_case.py.
| mgd_case.pres |
Definition at line 389 of file mgd_case.py.
| str mgd_case.POROUS = "porous" |
Definition at line 390 of file mgd_case.py.
| mgd_case.w0 = time.perf_counter() |
Definition at line 414 of file mgd_case.py.
| mgd_case.wall = time.perf_counter() - w0 |
Definition at line 419 of file mgd_case.py.
| mgd_case.prev = 0.0 |
Definition at line 421 of file mgd_case.py.
| mgd_case.m = float(s.get_u().mean()) |
Definition at line 426 of file mgd_case.py.
| mgd_case.u = s.get_u() |
Definition at line 432 of file mgd_case.py.
| mgd_case.umean = float(u.mean()) |
Definition at line 433 of file mgd_case.py.
| dict mgd_case.sdf = info.pop("_sdf") |
Definition at line 434 of file mgd_case.py.
| dict mgd_case.deep = sdf < -2.0 |
Definition at line 437 of file mgd_case.py.
| list mgd_case.ratios = [tuple(int(v) for v in r) for r in s.diagnostics.pressure_mg_level_ratios()] |
Definition at line 448 of file mgd_case.py.
| list mgd_case.g = list(GRID) |
Definition at line 449 of file mgd_case.py.
| list mgd_case.dims = [tuple(g)] |
Definition at line 450 of file mgd_case.py.
| list mgd_case.bottom = dims[-1] |
Definition at line 454 of file mgd_case.py.
| mgd_case.h = hashlib.sha256() |
Definition at line 456 of file mgd_case.py.
| dict mgd_case.fx = {"u": s.get_u, "v": s.get_v, "w": s.get_w, "p": lambda: s.get_field("p")} |
Definition at line 457 of file mgd_case.py.
| dict mgd_case.arrs = {k: np.ascontiguousarray(f()) for k, f in fx.items()} |
Definition at line 460 of file mgd_case.py.
| mgd_case.allv = comm.gather((list(info.get("origin", [0, 0, 0])), arrs), root=0) |
Definition at line 467 of file mgd_case.py.
| dict mgd_case.out = {} |
Definition at line 469 of file mgd_case.py.
| mgd_case.digest = h.hexdigest() |
Definition at line 475 of file mgd_case.py.
| mgd_case.ds = comm.gather(digest, root=0) |
Definition at line 477 of file mgd_case.py.
| mgd_case.gg = hashlib.sha256() |
Definition at line 479 of file mgd_case.py.
| mgd_case.load1 = os.getloadavg() |
Definition at line 483 of file mgd_case.py.
| mgd_case.sm = np.asarray(step_ms) |
Definition at line 486 of file mgd_case.py.
Definition at line 487 of file mgd_case.py.
| mgd_case.res |
Definition at line 488 of file mgd_case.py.
| mgd_case.porous_res_max |
Definition at line 508 of file mgd_case.py.
| mgd_case.porous_res_last |
Definition at line 508 of file mgd_case.py.
| tuple mgd_case.keep |
Definition at line 509 of file mgd_case.py.
| mgd_case.flush |
Definition at line 519 of file mgd_case.py.
| mgd_case.step_ms_list |
Definition at line 521 of file mgd_case.py.
| mgd_case.iters_list |
Definition at line 521 of file mgd_case.py.
| mgd_case.div_list |
Definition at line 521 of file mgd_case.py.
| mgd_case.prec_list |
Definition at line 521 of file mgd_case.py.
| mgd_case.failed_list |
Definition at line 522 of file mgd_case.py.
| mgd_case.porous_res_list |
Definition at line 522 of file mgd_case.py.
| mgd_case.fo |
Definition at line 524 of file mgd_case.py.
| mgd_case.indent |
Definition at line 524 of file mgd_case.py.
| mgd_case.default |
Definition at line 524 of file mgd_case.py.