|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Classes | |
| class | Case |
| class | Layered |
| class | PCase |
| class | StepMap |
Functions | |
| cube_frac (m, al) | |
| tangents (n) | |
| wall_dist (N) | |
| run_case (key) | |
| keyof (r) | |
| load (path) | |
| line (r) | |
| cmd_run (a) | |
| lsorder (Ns, es) | |
| cmd_table (a) | |
| _set_mom_utol (v, fixed=0) | |
| converge_momentum (s) | |
| default_momentum (s) | |
| default_step_increment (S, xs, nu) | |
| layered_fractions (n, s0, P, a, o, N) | |
| face_centres (N, c) | |
| rho_face (rho) | |
| tie_init () | |
| tie_read (s, acc, comm=None) | |
| tie_str (r) | |
| gmres_steady (S, x0, nu, umax, m=GM_RESTART, cap=GM_CAP, tol=TOL) | |
| plain_march (S, x0, nu, cap=MAX_STEPS, tol=TOL) | |
| run_pcase (key, steady="gmres", want_state=False) | |
| run_wcase (key) | |
| pkey (r) | |
| pload (path) | |
| pline (r) | |
| _run_any (key) | |
| cmd_prun (a) | |
| cmd_ptable (a) | |
| cmd_check (a) | |
| main () | |
Variables | |
| GX | |
| GW | |
| tuple | ANGLES = (0.0, 22.5, 45.0) |
| dict | SETS |
| D_HI | |
| TOL | |
| MAX_STEPS | |
| tuple | NORMALS = ((1, 0, 0), (2, 1, 0), (1, 1, 0), (0, 1, 2), (1, 0, 1), (2, 1, 1), (1, 2, 1), (1, 1, 2), (1, 1, 1)) |
| dict | TANG_CP |
| dict | PSETS |
| float | RHO_A_LAYERED = 0.5 |
| PCAP | |
| PRTOL | |
| MOM_CAP | |
| MOM_UTOL | |
| DEF_MOM_ITERS | |
| DEF_MOM_RES | |
| int | MOM_FIXED = 0 |
| GM_RESTART | |
| GM_CAP | |
| Pl = np.polynomial.Polynomial | |
G-SV1 family (doc/vof_sharp_viscous_stress.md §11, third pass §6.3/§6.4): the 3-D sharp viscous
operator on planar-interface Stokes flows, through the production stepper; steady states by WO-6s.
STEADY STATE (WO-6s, §6.4). The colour is frozen (set_vof(C0) after every step), so the step is an
affine map S(x) = G x + b on x = (u, v, w, p), p through get_field/set_field("p") in internal units
with its mean removed in and out. GMRES(60) solves (I - G) x = b with the matvec v -> v - S(v) + S(0)
(one production step; S(0) once), started from the exact face averages with p = 0. Every restart
cycle begins with a PLAIN production step: its increment S(x) - x is the residual and the
certificate, ||S(x) - x||_inf <= 1e-12 max|u| over u (the pre-registered criterion); cap 3000
steps, a case at the cap is NOT CONVERGED. Pressure: the production driver (Chebyshev under
variable rho, MG-PCG under uniform rho at np 1) with rtol 1e-13 and a cap of 20000. Momentum (§6.6 rule,
WO-6q, binding): every step of every steady set runs the converged solve (RB-GS update stop 1e-15 --
coordinator decision 2026-11-01, superseding §6.6's 1e-13 --
residual stop off, cap 200000 sweeps); one production-default step from the certified state is
taken afterwards and its increment reported ('inc_default_step', expected <= 1e-11, not judged).
PERIODIC GATES (USER Q16 pending: they replace the walled box; WO-6p):
gsv1p G-SV1P layered flow: m in NORMALS, n = m/|m|, P = 1/|m|; phase A where
frac((n.x - s0)/P) < 3/8, s0 = n.(1/2,1/2,1/2) + (k/8) h, k = 0..7; mu_A/mu_B = 1e-2, 1e2;
rho_A/rho_B = 1/2; force (rho(C) - rho_bar) g t1 through the closures
force_c = linear(rho, [-rho_bar g t1_c, g t1_c]), t1 = tangents(n)[0]; exact u = U(n.x) t1,
U periodic piecewise quadratic (mu_k U'' = -(rho_k - rho_bar) g, U and mu U' continuous).
gsv1dp the same at mu ratio 1e-3, 1e3.
gsv1cp the along mode: phase A where s' mod P in (P/4, 3P/4), s' = n.x - s0; t1 = t/|t| from
TANG_CP; u = -a sin(a eta) cos(b s') n + b cos(a eta) sin(b s') t1, a = 2 pi |t|,
b = 2 pi |m|, eta = t1.x; p_k = 2 mu_k a b sin sin; force mu(C_i) F(x_i) as a cell field
(set_field, internal units); kinds 'along' (rho = 1) and 'along+layered' (plus G-SV1P's
layered flow on the same interfaces, rho_A/rho_B = 1/2). Face averages: 4x4 Gauss-Legendre
for the smooth part, exact for the layered part.
Gauge: per component the rho_F-weighted mean of the exact face averages is removed (the discrete
momentum sum rho_F u_c is invariant, 0 from the gauged start). D_hi = 100. Error e = max|u_h -
u_bar| / max|u_bar|. PASS per normal x ratio (x kind): the LS order of the offset envelope
e_env(N) over N = 24, 32, 48, 64 is >= 1.8; e_env N^2 and the per-offset orders are reported.
gsv1w G-SV1W: walled Couette 22.5/22.5, offset 0, mu ratio 1e-2, N 24/32, option-A BCs with
wall-face-AVERAGED Dirichlet data (tangential components averaged over the h-square of the
wall plane), both modes; PASS iff at both N the 'sharp' max error over faces within one
cell of a wall <= the 'averaged' one.
pilot the WO-6s pilot (cmd_prun).
check WO-6p acceptance: equations and jump conditions at 100 random points, the layered
profile's closure, the exact face averages against brute-force quadrature.
nice -n 10 python gsv1.py run --set gsv1p --N 24,32,48,64 --mode sharp --procs 8 --out res.jsonl
python gsv1.py table --out res.jsonl ; python gsv1.py check
WALLED (the pre-registered box; a reported diagnostic since the third pass).
Cases (one planar interface, phase A = C = 1 on the side xi < 0; mu_B = 1, mu_A = ratio):
normal n = (cos b cos g, cos b sin g, sin b), b, g in {0, 22.5, 45} deg (9 orientations)
plane xi = n.(x - c) - s, c = (1/2, 1/2, 1/2), s = (k/8) h, k = 0..7
tangents (coordinator ruling B2, 2026-10-31):
t1 = normalize(e_z x n) (t1 = e_x if |n x e_z| < 1e-12), t2 = n x t1,
t = (t1 + t2)/sqrt(2) -- the shear direction AND the extension tangent
couette u = U(xi) t, U = xi/mu (tau = 1)
poiseuille u = U(xi) t, U = (xi - xi^2/2)/mu, uniform body force along t (tau_0 = 1)
extension u = eps (xi n - eta t), eta = t.x (B2), eps = 1 (the stepper finds the pressure
jump 2 eps [mu] itself)
general poiseuille + extension
Gate sets: gsv1 = couette, poiseuille at ratio 1e-2, 1e2; gsv1c = extension, general at 1e-2, 1e2;
gsv1d = couette, poiseuille at 1e-3, 1e3. N = 24, 32, 48, 64 (note §5.7 Q-C).
PASS (note §11, USER 2026-10-31): per kind x ratio x orientation, the LS order of the offset envelope
e_env(N) = max over k of err is >= 1.8 over N 24/32/48/64; couette also passes if err <= 1e-10 at every
N; extension needs err <= 1e-9 at every N. Per-offset orders are reported, not gating.
Discretization of the data: C is the exact cell volume fraction of the half-space; every velocity
datum is the exact face average of the analytic field (piecewise polynomial in xi, integrated
exactly). Boundary (coordinator ruling B1, option A): the production Dirichlet profile
(set_domain_bc_profile) on all six faces, fed with the EXACT wall-plane values: the normal
component's average over the wall face, each tangential component's average over the wall-plane
segment of its own face. Uniform rho = 1, D_hi = mu_hi dt/(rho h^2) = 100, momentum advection off,
sharp viscous interface. The colour is frozen: set_vof(C0) after every step. Start from the exact
face averages; the steady state by WO-6s (GMRES, below) to a step increment
<= 1e-12 max|u_exact| (ruling B3's criterion). Error = max|u_h - u_face| / max|u_face| over the
three face arrays.
Also recorded per case (instruments, not gate measures): the max error binned by the face's
distance to the nearest wall (half-cell bins, `wallmap`), the same joined with the distance to the
interface (`wximap[wall bin 0..3, >=4][|xi|/h in [0,1), [1,2), [2,4), >=4]`), and the location of
the max error (its wall distance and |xi|/h).
nice -n 10 python gsv1.py run --set gsv1 --N 24,32 --procs 4 --out res.jsonl (resumes)
python gsv1.py table --out res.jsonl (verdict lines)
python gsv1.py one KIND BETA GAMMA K RATIO N (one JSON line)
| gsv1.cube_frac | ( | m, | |
| al ) |
Volume fraction of {y in [0,1]^3 : m.y < al} (inclusion-exclusion, exact).
Definition at line 103 of file gsv1.py.
Referenced by layered_fractions(), run_case(), and run_wcase().
| gsv1.wall_dist | ( | N | ) |
Per component: distance (cells) of each face position to the nearest domain wall.
Definition at line 183 of file gsv1.py.
Referenced by run_case(), and run_wcase().
| gsv1.run_case | ( | key | ) |
Definition at line 196 of file gsv1.py.
References converge_momentum(), cube_frac(), default_step_increment(), gmres_steady(), and wall_dist().
Referenced by main().
| gsv1.load | ( | path | ) |
Definition at line 279 of file gsv1.py.
References keyof().
Referenced by cmd_run(), and cmd_table().
| gsv1.cmd_run | ( | a | ) |
| gsv1.lsorder | ( | Ns, | |
| es ) |
Definition at line 313 of file gsv1.py.
Referenced by cmd_ptable(), and cmd_table().
| gsv1.cmd_table | ( | a | ) |
| gsv1.converge_momentum | ( | s | ) |
Definition at line 390 of file gsv1.py.
Referenced by default_step_increment(), run_case(), gsv2.run_case(), run_pcase(), and run_wcase().
| gsv1.default_momentum | ( | s | ) |
Definition at line 401 of file gsv1.py.
Referenced by default_step_increment().
| gsv1.default_step_increment | ( | S, | |
| xs, | |||
| nu ) |
The reported production-default step from the certified state xs: max|S_def(xs) - xs|_u / max|xs_u|.
Definition at line 407 of file gsv1.py.
References converge_momentum(), and default_momentum().
Referenced by run_case(), gsv2.run_case(), run_pcase(), and run_wcase().
| gsv1.layered_fractions | ( | n, | |
| s0, | |||
| P, | |||
| a, | |||
| o, | |||
| N ) |
Exact cell volume fraction of {(n.x - s0 - o) mod P < a} on the N^3 unit grid.
Definition at line 473 of file gsv1.py.
References cube_frac(), and F.
Referenced by gsv1.PCase.build().
| gsv1.face_centres | ( | N, | |
| c ) |
Definition at line 490 of file gsv1.py.
Referenced by gsv1.PCase.build(), and run_pcase().
| gsv1.rho_face | ( | rho | ) |
The solver's face density (face_props.hpp idiag): the mean of the two cells, periodic.
Definition at line 498 of file gsv1.py.
Referenced by gsv1.PCase.gauge().
| gsv1.tie_init | ( | ) |
G-SV12 owner-tie census (WO-9.4, study only): max over steps of 'tied_edges' and 'max_tie_spread', min of 'min_untied_gap'; 'tie_reads' counts the steps read (0 on a build without the owner-set keys). With the eighth-pass ramp (§5.9): max over steps of 'blended_edges' and of (tied + blended) / band_cells -- an upper proxy for the §5.9 (b) trigger 4 fraction of band EDGES (a band cell carries several band edges).
| gsv1.tie_read | ( | s, | |
| acc, | |||
| comm = None ) |
Read the census after one step into acc (rank-local keys: summed / max / min over ranks under comm).
Definition at line 605 of file gsv1.py.
Referenced by gsv1.StepMap.__call__().
| gsv1.gmres_steady | ( | S, | |
| x0, | |||
| nu, | |||
| umax, | |||
| m = GM_RESTART, | |||
| cap = GM_CAP, | |||
| tol = TOL ) |
Restarted GMRES(m) on (I - G) x = b, G v = S(v) - S(0). Every cycle starts with a PLAIN
production step: r = S(x) - x is both the residual and the certificate (increment of u <=
tol * max|u|). Returns (state after the certifying step, status, steps, increment, cycles).
Periodic box: I - G is singular on the uniform-velocity modes (the momentum invariant), and the
solver's round-off-level momentum error would put a component there that GMRES amplifies by
1/lambda; the Krylov vectors are therefore kept in the gauge subspace (rho_F-weighted mean of
each velocity component removed), as p is kept mean-free. The certificate is the unprojected
plain-step increment.
WO-C5 (§6.8 C): an evaluation the colour-CFL guard refuses (the tail advection of the step's
OUTPUT) is re-evaluated by affinity at sigma' = sigma * 0.01 / CFL_out (sigma = 1 for a restart step,
the Krylov scaling for a matvec): S(sigma x) -> S0 + (S(sigma' x) - S0) sigma / sigma'. Bitwise no-op
for every evaluation that did not refuse. The certifying step stays a plain production step: a
restart step that refuses can never certify, and if its rescaled increment is within tol the row is
NOT CONVERGED ('certify_refused'). S(0) carries no amplitude to rescale: its refusal is not retried.
Definition at line 693 of file gsv1.py.
Referenced by run_case(), gsv2.run_case(), run_pcase(), and run_wcase().
Definition at line 775 of file gsv1.py.
Referenced by run_pcase().
| gsv1.run_pcase | ( | key, | |
| steady = "gmres", | |||
| want_state = False ) |
Definition at line 789 of file gsv1.py.
References converge_momentum(), default_step_increment(), face_centres(), gmres_steady(), and plain_march().
Referenced by _run_any().
| gsv1.run_wcase | ( | key | ) |
G-SV1W (§11): the walled Couette contact check, option-A BCs with wall-face-AVERAGED data (each tangential component's Dirichlet value is its average over the h-square of the wall plane centred at its node), steady state by WO-6s, error binned by wall distance.
Definition at line 867 of file gsv1.py.
References converge_momentum(), cube_frac(), default_step_increment(), gmres_steady(), and wall_dist().
Referenced by _run_any().
| gsv1.pkey | ( | r | ) |
Definition at line 939 of file gsv1.py.
Referenced by cmd_ptable(), and pload().
| gsv1.pload | ( | path | ) |
Definition at line 945 of file gsv1.py.
References pkey().
Referenced by cmd_prun(), cmd_ptable(), and main().
| gsv1.pline | ( | r | ) |
Definition at line 957 of file gsv1.py.
Referenced by cmd_prun().
|
protected |
Definition at line 966 of file gsv1.py.
References run_pcase(), and run_wcase().
| gsv1.cmd_prun | ( | a | ) |
| gsv1.cmd_ptable | ( | a | ) |
| gsv1.cmd_check | ( | a | ) |
WO-6p acceptance: the manufactured fields satisfy the continuous equations and the jump conditions to <= 1e-12 at 100 random points; the exact face averages against brute-force quadrature on random faces; Layered's closure (periodic V, W0).
Definition at line 1097 of file gsv1.py.
Referenced by main().
| gsv1.main | ( | ) |
Definition at line 1163 of file gsv1.py.
References cmd_check(), cmd_prun(), cmd_ptable(), cmd_run(), cmd_table(), main(), pload(), and run_case().
Referenced by main().
| dict gsv1.SETS |
| tuple gsv1.NORMALS = ((1, 0, 0), (2, 1, 0), (1, 1, 0), (0, 1, 2), (1, 0, 1), (2, 1, 1), (1, 2, 1), (1, 1, 2), (1, 1, 1)) |
| dict gsv1.TANG_CP |
| dict gsv1.PSETS |