|
flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Functions | |
| check (cond, msg) | |
| rms (v) | |
| order (ec, ef) | |
| grid (s) | |
| face_points (s, face) | |
| walled (cells, extent, origin=(0.0, 0.0, 0.0), periodic_z=False) | |
| add_cc (s, D, box="neumann", periodic_z=False) | |
| giter_check (tag, its) | |
| field_errors (s, exact) | |
| solve_info (s) | |
| g1_case (Rh, off, aniso=False) | |
| gate_g1 () | |
| two_body_scene (c0, Ri, Ro) | |
| mg_box (n, rungs=3) | |
| g2_case (Rih, off, mgbox=False) | |
| gate_g2 () | |
| g3a_case (Rh, off, Da) | |
| gate_g3a () | |
| robin_root (Bi) | |
| g3b_case (Rh, off, Bi, nsteps=30) | |
| gate_g3b () | |
| pipe (Rh, off, D) | |
| j0 (x) | |
| j1 (x) | |
| g7a_case (Rh, off, neumann, nsteps=30) | |
| g7b_case (Rh, off, iters=25) | |
| gate_g7 () | |
| giter_transient_case (Rh, off, nsteps=6) | |
| g5b_geometry_case (n, off) | |
| gate_giter () | |
| psi_node (X, Y) | |
| annulus_case (Rh, off, scheme="koren") | |
| annulus_fluxes (s, h) | |
| set_annulus_velocity (s, fx, fy) | |
| g9_case (Rh, off, scheme, cr, rtol=None, nsteps=None) | |
| g9_offsets (Rh, want=3) | |
| koren_bulk_control (cr, n=32) | |
| gate_g9 () | |
| g9b_case (kind, scheme, n=32, nsteps=50) | |
| gate_g9b () | |
| channel_case (kind="staggered", n=24, dt=0.008, D=0.01, scheme="koren", out_bc="neumann", c0=0.2, cin=1.0, cap=True) | |
| g9c_run (nsteps, **kw) | |
| gate_g9c () | |
| capture_stderr (fn) | |
| backflow_steady_row (n=12, nsteps=10) | |
| low_face_flux (s, name, a) | |
| cell_velocity (s, name, periodic=(True, True, True)) | |
| mean_flux_fields (s, name, D, G, periodic) | |
| poiseuille_face_average (s, c0, R, U, oz, m=24) | |
| g8_case (Rh, off, U=1.0, Pe=10.0, nbox=None, nz=4, exact_flux=True) | |
| gate_g8 () | |
| g5b_case (n, off, D=0.6) | |
| no_solid_case (G, vel=None, D=0.6, n=16) | |
| gate_g5b () | |
| rescale_peclet (s, name, target) | |
| gadv_budget (s, name) | |
| gadv_a_case (Rh, pe) | |
| sc_array (n) | |
| closure_source (s, name) | |
| closure_rhs_density (s, name, D, G) | |
| gadv_b_case (n, pe, wall) | |
| gadv_c_case (pe) | |
| gadv_row (tag, s, name, pe, bound, rate=None) | |
| gadv_growth (tag, lo, hi) | |
| gate_gadv () | |
| fmt (v, spec) | |
| conj_box (n, L) | |
| sealed_check (tag, cen) | |
| solid_isolated (s, name="c") | |
| maxwell_fields (X, Y, Z, c0, R, G, ratio) | |
| g4_case (Rh, off, ratio, K=1.0, rtol=None, G=(0.3, -0.5, 0.8)) | |
| interior_gradient (X, Y, Z, psi, mask) | |
| gate_conj_unit () | |
| gate_g4 () | |
| a_t_keff_sc (c) | |
| g5a_case (n, off, D=0.6, ratio=1e4) | |
| gate_g5a () | |
| g6_exact (Ls, CK, Rc, R=1.0, Ro=2.0) | |
| g6_case (Rh, off, case, nsteps=30) | |
| gate_g6 (cases=None) | |
| gate_gadv_conj () | |
| raises (exc, fn, msg) | |
| raises_naming (exc, fn, needles, msg) | |
| gate_api () | |
| sphere_pair_scene (c1, c2, R) | |
| g13_case (Rh, off, case) | |
| g13_rungs (cen) | |
| g13_thin_plate () | |
| gate_g13 (cases=G13_CASES, rungs=(8, 16, 32)) | |
Variables | |
| tuple | FACES = ("-x", "+x", "-y", "+y", "-z", "+z") |
| OFFSETS = np.random.default_rng(20261003).uniform(-0.5, 0.5, size=(3, 3)) | |
| list | failures = [] |
| float | J01_SQ = 5.783185962946784 |
| float | J11P_SQ = 3.389957 |
| float | GRAETZ = 3.656793 |
| R_I | |
| R_O | |
| tuple | GADV_PE = (0.1, 1.0, 10.0) |
| dict | GADV_SRC = {} |
| tuple | G6_CASES |
| tuple | G6_BOUND |
| tuple | G13_CASES = ("gap", "contact", "conj") |
| dict | GATES |
| c | |
| names = sys.argv[1:] or list(GATES) | |
| t0 = time.time() | |
Cut-cell scalar transport: the accuracy and iteration gates of WO-3 to WO-6 (doc/scalar_ibm_design.md §11).
Single phase; diffusion, and advection by the projection's face flux (WO-5); BiCGStab preconditioned by one ScalarMG V-cycle (WO-4; level 0 alone
under the transient level rule). Every case is in PHYSICAL units (an extent), so the unit
conversions of §1.2 are on the path.
api the opt-in, the refusals and the name checks (cheap).
g1 Dirichlet sphere, steady: Nu -> 2 (order >= 1.7), field L1 / Linf orders (>= 1.8 / 1.5),
the steady budget identity, R0 = 100 %; plus the anisotropic h' = (1, 1, 2) ladder.
g2 concentric shells, steady: Neumann flux q on the inner sphere, an immersed Dirichlet outer
sphere (a two-instance scene): area-mean wall value c_Gamma (order >= 1.7), field L1.
g3a Robin external sphere, steady, Da = kR/D in {0.1, 1, 10, 100}: Sh = 2 Da/(1 + Da).
g3b Robin interior sphere, transient, Bi in {0.1, 1, 10, 100, inf}: the backward-Euler
late-time ratio of the total mass gives the spatial eigenvalue mu = D lam^2/R^2,
lam cot lam = 1 - Bi; the budget identity every step.
g7 pipe (an SDF along z, nz = 4 periodic): Dirichlet decay j01^2 and Neumann dipole decay
j'11^2 (BE ratio), and the Graetz number Nu_T = 3.656793 by inverse iteration with
solve_scalar_steady (G7a, G7b).
g9 advection in an annulus (WO-5): solid-body rotation carrying a Gaussian blob one revolution,
fou / koren at bulk Courant 0.5 / 0.9: per-step budget identity, conservation against the
accounted defects, positivity (koren gated at bulk Courant <= 1/2, ruling D-WO5-1; its 0.9
row is information), finiteness, slivers (min kappa < 1e-2).
g9c open domain faces (WO-5b, ruling D-WO5-3): a channel with a solid sphere, inflow / walls /
outflow, the scalar carried by flow's own projection: the per-step budget, boundary
advective and diffusive fluxes included, closes to <= 1e-13 of the mass change; constant
preservation; boundedness; a steady row; the collocated grid is refused (open question).
g9b constant preservation under flow's own projection (Stokes through an SC array, c = 1):
staggered and the collocated 'gauge-exact', 'plain', 'embed' pass; the ghost projection
is refused (§13 Q13).
gadv §11 G-adv (WO-5c, design Amendment A2: the steady advective surrogate), Pe_h = the census
max_cell_peclet 0.1 / 1 / 10 by rescaling the face field: (a) WO-5's C3 problem (periodic
box 4R, a Dirichlet sphere with a source, a projected Stokes field) at R/h 16 and 32;
(b) the closure on G9b's SC array (Neumann spheres, singular, the mean-gradient mode of
WO-6 with G = e_x) and (b')
the same with Dirichlet spheres, 32^3 and 64^3; (c) G9c's channel (open faces), Pe_h 1 and
10 (set through D). (i) converged, (ii) iteration bounds (Q20: min(prov., 2x measured)), (iii) growth per
doubling <= 1.7x, (v) the steady budget identity <= 1e-11 of the gross budget (D-WO5c-1). (iv) C4 is in the
`scalar_mg` ctest, (vi) a one-time logged check.
g8 Taylor-Aris (WO-6): G7's pipe, frozen face-averaged Poiseuille fluxes (D-WO6-1), insulating walls, the
mean-gradient mode G = e_z, steady (advecting, singular): -<u'theta> -> Pe^2 D/48 at
Pe = 10 (order >= 1.8, <= 1e-3 at R/h 32), scalar_mean_flux = its field sums to 1e-10;
G-iter (<= 30, growth <= 5) on multigrid-friendly boxes (ruling D-WO4-1).
g5b the insulating periodic SC array (c = 0.3) in the mean-gradient mode (WO-6): k* =
-J_x/(D G_x) from scalar_mean_flux, self-convergence order >= 1.7, k* below the
Hashin-Shtrikman bound; G-iter on multigrid-friendly boxes; the no-solid identity k* = 1
to 1e-12 (at rest, and under a uniform flow: the moving frame).
giter §11 G-iter, the rows not carried by g1/g2/g3a: transient at dt D/h^2 = 1 (<= 10 per warm
step, ruling D-WO4-3 restating the provisional 8; <= 12 on the cold first step, ruling
D-WO9-3, which moved the level-rule switch so that this row runs level 0 alone) and the singular
steady problem on G5b's geometry (periodic simple-cubic array, c = 0.3, insulating + flux +
source; <= 30, growth <= 5 per rung) on multigrid-friendly n.
g13 contacts (WO-8): two spheres R in a box (6R, 4R, 4R), R/h 8 / 16 / 32, steady: Dirichlet
spheres at a gap R/32 and in contact (overlap R/64), far field 0, and the contacting pair
conjugate at Lam_s/Lam_f = 100 under a far-field gradient: converged, <= 50 iterations,
census two-sided > 0 (where the gap is under a cell), R2 <= 1 % of the probes, total-flux
self-convergence order >= 1.0; the 0.4 h thin plate: num_thin_solid > 0 and the §9
warning printed.
Every gate runs its FULL resolution ladder (WO-4; ruling D-WO3-1 had deferred the steady ones).
"Order" is between successive rungs of the RMS error over 3 random grid offsets; every successive
pair is gated. G-iter on g1/g2/g3a (Da = 1): <= 20 BiCGStab iterations at every rung, growth <= 3
per doubling (the max over the offsets of each rung). Ruling Q-C (WO-4): G-iter is gated on
multigrid-friendly boxes (n rounded up to a multiple of 2^(rungs + 1) = 16); a box with few factors
of two stays gated for correctness only (G2's native box). Iteration counts are printed.
Run: OMP_NUM_THREADS=4 PYTHONPATH=<build> python tests/python/test_scalar_cutcell_gates.py <gate>
Exit 0 pass, 1 fail, 77 skipped (no module).
| test_scalar_cutcell_gates.check | ( | cond, | |
| msg | |||
| ) |
Definition at line 88 of file test_scalar_cutcell_gates.py.
Referenced by backflow_steady_row(), gadv_growth(), gadv_row(), gate_api(), gate_conj_unit(), gate_g1(), gate_g13(), gate_g2(), gate_g3a(), gate_g3b(), gate_g4(), gate_g5a(), gate_g5b(), gate_g6(), gate_g7(), gate_g8(), gate_g9(), gate_g9b(), gate_g9c(), gate_gadv(), gate_gadv_conj(), gate_giter(), giter_check(), raises(), raises_naming(), and sealed_check().
| test_scalar_cutcell_gates.rms | ( | v | ) |
Definition at line 94 of file test_scalar_cutcell_gates.py.
Referenced by gate_g1(), gate_g2(), gate_g3a(), gate_g3b(), gate_g4(), gate_g5b(), gate_g6(), gate_g7(), and gate_g8().
| test_scalar_cutcell_gates.order | ( | ec, | |
| ef | |||
| ) |
Definition at line 99 of file test_scalar_cutcell_gates.py.
Referenced by gate_g1(), gate_g13(), gate_g2(), gate_g3a(), gate_g3b(), gate_g4(), gate_g5b(), gate_g6(), gate_g7(), and gate_g8().
| test_scalar_cutcell_gates.grid | ( | s | ) |
Definition at line 103 of file test_scalar_cutcell_gates.py.
Referenced by annulus_case(), backflow_steady_row(), channel_case(), g13_thin_plate(), g1_case(), g2_case(), g3a_case(), g3b_case(), g4_case(), g5a_case(), g5b_case(), g5b_geometry_case(), g6_case(), g8_case(), g9_case(), g9b_case(), gadv_a_case(), gate_api(), gate_conj_unit(), giter_transient_case(), koren_bulk_control(), pipe(), and sc_array().
| test_scalar_cutcell_gates.face_points | ( | s, | |
| face | |||
| ) |
Face-centre coordinates (X, Y, Z) of a domain face, shaped (N_t1, N_t2).
Definition at line 108 of file test_scalar_cutcell_gates.py.
Referenced by g13_case(), g1_case(), g3a_case(), and g4_case().
| test_scalar_cutcell_gates.walled | ( | cells, | |
| extent, | |||
origin = (0.0, 0.0, 0.0), |
|||
periodic_z = False |
|||
| ) |
Definition at line 123 of file test_scalar_cutcell_gates.py.
Referenced by conj_box(), g13_case(), g13_thin_plate(), g1_case(), g2_case(), g3a_case(), g3b_case(), g6_case(), g8_case(), giter_transient_case(), and pipe().
| test_scalar_cutcell_gates.add_cc | ( | s, | |
| D, | |||
box = "neumann", |
|||
periodic_z = False |
|||
| ) |
Definition at line 133 of file test_scalar_cutcell_gates.py.
Referenced by g13_case(), g13_thin_plate(), g1_case(), g2_case(), g3a_case(), g3b_case(), g4_case(), g6_case(), g8_case(), giter_transient_case(), and pipe().
| test_scalar_cutcell_gates.giter_check | ( | tag, | |
| its | |||
| ) |
§11 G-iter on a ladder: {rung: [iterations per offset]} -> <= 20 each, growth <= 3.
Definition at line 141 of file test_scalar_cutcell_gates.py.
References check().
Referenced by gate_g1(), gate_g2(), and gate_g3a().
| test_scalar_cutcell_gates.field_errors | ( | s, | |
| exact | |||
| ) |
Definition at line 150 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.solve_info | ( | s | ) |
Definition at line 158 of file test_scalar_cutcell_gates.py.
Referenced by g1_case(), g2_case(), g3a_case(), g3b_case(), g7a_case(), and g7b_case().
| test_scalar_cutcell_gates.g1_case | ( | Rh, | |
| off, | |||
aniso = False |
|||
| ) |
Definition at line 164 of file test_scalar_cutcell_gates.py.
References add_cc(), face_points(), field_errors(), grid(), solve_info(), and walled().
Referenced by gate_g1().
| test_scalar_cutcell_gates.gate_g1 | ( | ) |
Definition at line 190 of file test_scalar_cutcell_gates.py.
References check(), g1_case(), giter_check(), order(), and rms().
| test_scalar_cutcell_gates.two_body_scene | ( | c0, | |
| Ri, | |||
| Ro | |||
| ) |
Instance 0: a sphere Ri. Instance 1: a huge box minus a sphere Ro (solid outside Ro).
Definition at line 237 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.mg_box | ( | n, | |
rungs = 3 |
|||
| ) |
Ruling Q-C (WO-4): G-iter is gated on a multigrid-friendly box — n rounded UP to a multiple of 2^(levels + 1) per axis, read as levels = the number of ladder rungs (3 -> 16).
Definition at line 256 of file test_scalar_cutcell_gates.py.
Referenced by g2_case(), gate_g5b(), gate_g8(), and gate_giter().
| test_scalar_cutcell_gates.g2_case | ( | Rih, | |
| off, | |||
mgbox = False |
|||
| ) |
Definition at line 263 of file test_scalar_cutcell_gates.py.
References add_cc(), field_errors(), grid(), mg_box(), solve_info(), two_body_scene(), and walled().
Referenced by gate_g2().
| test_scalar_cutcell_gates.gate_g2 | ( | ) |
Definition at line 293 of file test_scalar_cutcell_gates.py.
References check(), g2_case(), giter_check(), order(), and rms().
| test_scalar_cutcell_gates.g3a_case | ( | Rh, | |
| off, | |||
| Da | |||
| ) |
Definition at line 325 of file test_scalar_cutcell_gates.py.
References add_cc(), face_points(), grid(), solve_info(), and walled().
Referenced by gate_g3a().
| test_scalar_cutcell_gates.gate_g3a | ( | ) |
Definition at line 349 of file test_scalar_cutcell_gates.py.
References check(), g3a_case(), giter_check(), order(), and rms().
| test_scalar_cutcell_gates.robin_root | ( | Bi | ) |
Definition at line 369 of file test_scalar_cutcell_gates.py.
Referenced by g3b_case().
| test_scalar_cutcell_gates.g3b_case | ( | Rh, | |
| off, | |||
| Bi, | |||
nsteps = 30 |
|||
| ) |
Definition at line 383 of file test_scalar_cutcell_gates.py.
References add_cc(), grid(), robin_root(), solve_info(), and walled().
Referenced by gate_g3b().
| test_scalar_cutcell_gates.gate_g3b | ( | ) |
Definition at line 419 of file test_scalar_cutcell_gates.py.
References check(), g3b_case(), order(), and rms().
| test_scalar_cutcell_gates.pipe | ( | Rh, | |
| off, | |||
| D | |||
| ) |
Definition at line 446 of file test_scalar_cutcell_gates.py.
References add_cc(), grid(), and walled().
Referenced by g7a_case(), and g7b_case().
| test_scalar_cutcell_gates.j0 | ( | x | ) |
Definition at line 460 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.j1 | ( | x | ) |
Definition at line 470 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.g7a_case | ( | Rh, | |
| off, | |||
| neumann, | |||
nsteps = 30 |
|||
| ) |
Definition at line 480 of file test_scalar_cutcell_gates.py.
References pipe(), and solve_info().
Referenced by gate_g7().
| test_scalar_cutcell_gates.g7b_case | ( | Rh, | |
| off, | |||
iters = 25 |
|||
| ) |
Definition at line 509 of file test_scalar_cutcell_gates.py.
References pipe(), and solve_info().
Referenced by gate_g7().
| test_scalar_cutcell_gates.gate_g7 | ( | ) |
Definition at line 536 of file test_scalar_cutcell_gates.py.
References check(), g7a_case(), g7b_case(), order(), and rms().
| test_scalar_cutcell_gates.giter_transient_case | ( | Rh, | |
| off, | |||
nsteps = 6 |
|||
| ) |
G1's sphere, transient at dt D/h^2 = 1 from c = 0 (Dirichlet wall c = 1, box c = 0).
Definition at line 567 of file test_scalar_cutcell_gates.py.
References add_cc(), grid(), and walled().
Referenced by gate_giter().
| test_scalar_cutcell_gates.g5b_geometry_case | ( | n, | |
| off | |||
| ) |
G5b's geometry (periodic simple-cubic array, c = 0.3) on an n^3 grid, insulating walls with a flux and a source, steady: the singular case of §5.1 (same surrogate as G5b's closure).
Definition at line 590 of file test_scalar_cutcell_gates.py.
References grid().
Referenced by gate_giter().
| test_scalar_cutcell_gates.gate_giter | ( | ) |
Definition at line 611 of file test_scalar_cutcell_gates.py.
References check(), g5b_geometry_case(), giter_transient_case(), and mg_box().
| test_scalar_cutcell_gates.psi_node | ( | X, | |
| Y | |||
| ) |
Stream function of solid-body rotation (Omega = 1, u = d psi/dy, v = -d psi/dx), clamped to its wall values inside the solids.
Definition at line 639 of file test_scalar_cutcell_gates.py.
Referenced by annulus_fluxes().
| test_scalar_cutcell_gates.annulus_case | ( | Rh, | |
| off, | |||
scheme = "koren" |
|||
| ) |
Coaxial cylinders R_i = 0.4 < r < R_o = 1, an SDF along z, nz = 4, every face periodic.
Definition at line 646 of file test_scalar_cutcell_gates.py.
References grid().
Referenced by g9_case(), and g9_offsets().
| test_scalar_cutcell_gates.annulus_fluxes | ( | s, | |
| h | |||
| ) |
Physical F/V through the low x and y faces of every cell: the differences of a NODE potential (round 6's exact stream-function fluxes), so every cell's net flux telescopes to zero. The potential is the clamped psi, set to its wall value on both nodes of every face the projection closes (openness 0): the field is then discretely divergence-free in the openness the predicate reads (the solver's gated cut-cell openness), as a projected field is.
Definition at line 662 of file test_scalar_cutcell_gates.py.
References psi_node().
Referenced by g9_case().
| test_scalar_cutcell_gates.set_annulus_velocity | ( | s, | |
| fx, | |||
| fy | |||
| ) |
Face velocities (internal index velocity) with open * vel = F/V * tRef, the openness the projection conserves; returns max |F| on faces whose openness is 0 (lost) over max |F|.
Definition at line 683 of file test_scalar_cutcell_gates.py.
Referenced by g9_case().
| test_scalar_cutcell_gates.g9_case | ( | Rh, | |
| off, | |||
| scheme, | |||
| cr, | |||
rtol = None, |
|||
nsteps = None |
|||
| ) |
Definition at line 698 of file test_scalar_cutcell_gates.py.
References annulus_case(), annulus_fluxes(), grid(), and set_annulus_velocity().
Referenced by gate_g9().
| test_scalar_cutcell_gates.g9_offsets | ( | Rh, | |
want = 3 |
|||
| ) |
Grid offsets from a fixed sequence whose geometry carries a sliver (min kappa < 1e-2, gate (v)); the first `want` that do.
Definition at line 758 of file test_scalar_cutcell_gates.py.
References annulus_case().
Referenced by gate_g9().
| test_scalar_cutcell_gates.koren_bulk_control | ( | cr, | |
n = 32 |
|||
| ) |
No solid: a periodic box, uniform translation (1, 0.5) for one x-period, Koren at bulk Courant cr. Returns (min c, C_bulk) — the bulk scheme's own boundedness, for G9 (iii)'s reading.
Definition at line 774 of file test_scalar_cutcell_gates.py.
References grid().
Referenced by gate_g9().
| test_scalar_cutcell_gates.gate_g9 | ( | ) |
Definition at line 797 of file test_scalar_cutcell_gates.py.
References check(), g9_case(), g9_offsets(), and koren_bulk_control().
| test_scalar_cutcell_gates.g9b_case | ( | kind, | |
| scheme, | |||
n = 32, |
|||
nsteps = 50 |
|||
| ) |
Definition at line 841 of file test_scalar_cutcell_gates.py.
References grid().
Referenced by gate_g9b().
| test_scalar_cutcell_gates.gate_g9b | ( | ) |
Definition at line 866 of file test_scalar_cutcell_gates.py.
References check(), g9b_case(), and raises().
| test_scalar_cutcell_gates.channel_case | ( | kind = "staggered", |
|
n = 24, |
|||
dt = 0.008, |
|||
D = 0.01, |
|||
scheme = "koren", |
|||
out_bc = "neumann", |
|||
c0 = 0.2, |
|||
cin = 1.0, |
|||
cap = True |
|||
| ) |
A 2 x 1 x 1 channel (2n x n x n cells): inflow U = 1 on -x, outflow on +x, no-slip walls on y and z, mu 0.05; a solid sphere (R 0.23) off the axis and, with `cap`, a second one (R 0.2) centred just outside the outlet, cutting the outflow face (slivers in the outlet column). The cut-cell scalar: Dirichlet `cin` on the inflow face, `out_bc` on the outflow face (Dirichlet 0.5), Neumann on the walls and the solids; `c0` in the fluid.
Definition at line 884 of file test_scalar_cutcell_gates.py.
References grid().
Referenced by g9c_run(), and gate_g9c().
| test_scalar_cutcell_gates.g9c_run | ( | nsteps, | |
| ** | kw | ||
| ) |
Step the channel; per step the budget identity with the mass change summed exactly (math.fsum of kappa V (c - c^n) over the unknowns: the budget's own d_mass differences two O(M) reductions whose round-off, ~1e-14 M, is ~1e-12 of a step's change in a long channel), and the run's conservation, bounds and census.
Definition at line 921 of file test_scalar_cutcell_gates.py.
References channel_case().
Referenced by gadv_c_case(), and gate_g9c().
| test_scalar_cutcell_gates.gate_g9c | ( | ) |
Definition at line 961 of file test_scalar_cutcell_gates.py.
References backflow_steady_row(), channel_case(), check(), g9c_run(), and raises().
| test_scalar_cutcell_gates.capture_stderr | ( | fn | ) |
Run fn() with the C-level stderr captured; returns (fn's result, the text).
Definition at line 1019 of file test_scalar_cutcell_gates.py.
Referenced by backflow_steady_row(), and gate_api().
| test_scalar_cutcell_gates.backflow_steady_row | ( | n = 12, |
|
nsteps = 10 |
|||
| ) |
Review finding 2 (rulings D-WOR-2a/b/c): open faces but NO inflow face -- both x ends 'outflow', the flow driven by a body force, so the whole -x face backflows; walls on y and z, a Neumann sphere. A steady scalar, insulating everywhere, no source, from a non-uniform start: the problem is not the uniform-mean singular case (no compatibility projection, no gauge), the solve converges -- to a constant, the null vector --, and the backflow rows are counted and warned about once. Returns the census.
Definition at line 1036 of file test_scalar_cutcell_gates.py.
References capture_stderr(), check(), and grid().
Referenced by gate_g9c().
| test_scalar_cutcell_gates.low_face_flux | ( | s, | |
| name, | |||
| a | |||
| ) |
The scalar's advective face flux per unit area through the LOW a-face of each cell (physical, c-free: open * u), from fields: the projection's openness (get_ox/oy/oz, the staggered non-ghost openness of §6.1) times the face velocity (get_field, internal, converted), zero unless both cells are fluid unknowns (the guard of §6.1). Periodic roll; a non-periodic axis' low boundary face is zeroed by the caller's mask.
Definition at line 1082 of file test_scalar_cutcell_gates.py.
Referenced by cell_velocity().
| test_scalar_cutcell_gates.cell_velocity | ( | s, | |
| name, | |||
periodic = (True, True, True) |
|||
| ) |
U_i/V (§1.5) per cell, physical: sum_f F_out (x_f - x_i) / V = the mean of the cell's two a-face fluxes per area, per axis.
Definition at line 1095 of file test_scalar_cutcell_gates.py.
References low_face_flux(), and slice().
Referenced by closure_rhs_density(), and mean_flux_fields().
| test_scalar_cutcell_gates.mean_flux_fields | ( | s, | |
| name, | |||
| D, | |||
| G, | |||
| periodic | |||
| ) |
scalar_mean_flux recomputed from fields (§8.1): the diffusive face sum of -D a (c_j - c_i)/h (c = theta + G.x, the true displacement) over the coupled low faces, plus the advective sum (U_i/V - kappa_i Ubar) theta_i, both over the whole box's cell count. Returns (J (3,), the advective part (3,), Ubar (3,), phi = sum kappa / N).
Definition at line 1109 of file test_scalar_cutcell_gates.py.
References cell_velocity(), and slice().
Referenced by g5b_case(), and g8_case().
| test_scalar_cutcell_gates.poiseuille_face_average | ( | s, | |
| c0, | |||
| R, | |||
| U, | |||
| oz, | |||
m = 24 |
|||
| ) |
G8's velocity (ruling D-WO6-1): the Poiseuille flux through the open part of each z-face (m x m midpoint sub-samples of the face), divided by oz A, so that F = oz w A carries no point-sampling error.
Definition at line 1136 of file test_scalar_cutcell_gates.py.
Referenced by g8_case().
| test_scalar_cutcell_gates.g8_case | ( | Rh, | |
| off, | |||
U = 1.0, |
|||
Pe = 10.0, |
|||
nbox = None, |
|||
nz = 4, |
|||
exact_flux = True |
|||
| ) |
G8: G7's pipe (R = 1, nz = 4 periodic), frozen Poiseuille z-face velocities (set_field; ruling D-WO6-1: the FACE-AVERAGED flux over the open part of each face; divergence-free because z-invariant), insulating walls, mean gradient e_z, steady. Returns the Taylor-Aris coefficient -<u'theta> (interstitial, from fields) over its exact value Pe^2 D/48, Pe = U R/D. `nbox`/`nz` give G-iter's multigrid-friendly box (ruling D-WO4-1; the problem is z-invariant, so nz changes nothing but the cell count); `exact_flux=False` the INFO variant: face-centre point samples, clipped >= 0.
Definition at line 1156 of file test_scalar_cutcell_gates.py.
References add_cc(), grid(), mean_flux_fields(), poiseuille_face_average(), and walled().
Referenced by gate_g8().
| test_scalar_cutcell_gates.gate_g8 | ( | ) |
| test_scalar_cutcell_gates.g5b_case | ( | n, | |
| off, | |||
D = 0.6 |
|||
| ) |
G5b: the periodic simple-cubic array, solid fraction 0.3, on an n^3 grid of the unit period, insulating spheres, mean gradient e_x, steady (singular). k* = -J_x/(D G_x).
Definition at line 1230 of file test_scalar_cutcell_gates.py.
References grid(), and mean_flux_fields().
Referenced by gate_g5b().
| test_scalar_cutcell_gates.no_solid_case | ( | G, | |
vel = None, |
|||
D = 0.6, |
|||
n = 16 |
|||
| ) |
The no-solid identity: a box with no solid (SDF > 0 everywhere), mean gradient G, at rest or with a uniform velocity; the closure solution is theta = const and J = -D G exactly.
Definition at line 1253 of file test_scalar_cutcell_gates.py.
Referenced by gate_g5b().
| test_scalar_cutcell_gates.gate_g5b | ( | ) |
Definition at line 1273 of file test_scalar_cutcell_gates.py.
References check(), g5b_case(), mg_box(), no_solid_case(), order(), and rms().
| test_scalar_cutcell_gates.rescale_peclet | ( | s, | |
| name, | |||
| target | |||
| ) |
G-adv's parametrization (A2): one probe steady solve at the present face field, then u, v, w times target / (census max_cell_peclet), so the next solve's census reads `target`.
Definition at line 1325 of file test_scalar_cutcell_gates.py.
Referenced by gadv_a_case(), gadv_b_case(), and gate_gadv_conj().
| test_scalar_cutcell_gates.gadv_budget | ( | s, | |
| name | |||
| ) |
(v), ruling D-WO5c-1: the steady rate balance relative to the GROSS budget — the sum of the terms' absolute values, the source taken gross (V sum |r| over the unknowns, r the per-cell source density of the right-hand side: kappa s for a per-cell source, the mean-gradient terms in closure mode; |source_in| for a uniform one) — bound 1e-11. Returns (that ratio, the ratio against the largest NET term: INFO, O(1) for the mean-free closure source of (b) / (b')).
Definition at line 1334 of file test_scalar_cutcell_gates.py.
Referenced by gadv_row().
| test_scalar_cutcell_gates.gadv_a_case | ( | Rh, | |
| pe | |||
| ) |
(a) WO-5's C3 problem: a periodic box 4R, a Dirichlet sphere (c = 1) R = 1 with a source, D = 0.7, the projected Stokes field of that geometry (20 steps under a body force, mu dt/h^2 = 1), rescaled to census Pe_h = pe; steady.
Definition at line 1354 of file test_scalar_cutcell_gates.py.
References grid(), and rescale_peclet().
Referenced by gate_gadv().
| test_scalar_cutcell_gates.sc_array | ( | n | ) |
G9b's geometry and flow: the periodic simple-cubic sphere array, solid fraction 0.3, one sphere per unit period on n^3 cells; Stokes through it from step() (G9b's body force, 50 steps).
Definition at line 1381 of file test_scalar_cutcell_gates.py.
References grid().
Referenced by gadv_b_case(), and gate_gadv_conj().
| test_scalar_cutcell_gates.closure_source | ( | s, | |
| name | |||
| ) |
The B-field source for G = e_x (until WO-6's mean-gradient mode): s = u_x - <u_x> per unknown cell, u_x the cell average of its two x-face velocities (physical), <.> the kappa- weighted mean over the fluid unknowns; 0 elsewhere.
Definition at line 1399 of file test_scalar_cutcell_gates.py.
Referenced by gadv_b_case().
| test_scalar_cutcell_gates.closure_rhs_density | ( | s, | |
| name, | |||
| D, | |||
| G | |||
| ) |
The mean-gradient terms of the right-hand side per unit volume (§1.5), physical, per cell: the faces' D G_a (a_a^+ - a_a^-)/h_a over the coupled faces, minus G.(U_i/V - kappa_i Ubar); the gross scale of (v) in closure mode.
Definition at line 1412 of file test_scalar_cutcell_gates.py.
References cell_velocity().
Referenced by gadv_b_case().
| test_scalar_cutcell_gates.gadv_b_case | ( | n, | |
| pe, | |||
| wall | |||
| ) |
(b) the closure problem on the SC array (insulating spheres: steady, singular) in the mean-gradient mode of WO-6 (theta, G = e_x), or (b') the reactive bed (Dirichlet spheres, c = 0) with the per-cell source u_x - <u_x> (WO-5c's form), D = 0.05; census Pe_h = pe.
Definition at line 1431 of file test_scalar_cutcell_gates.py.
References closure_rhs_density(), closure_source(), rescale_peclet(), and sc_array().
Referenced by gate_gadv(), and gate_gadv_conj().
| test_scalar_cutcell_gates.gadv_c_case | ( | pe | ) |
(c) G9c's channel (inflow U = 1 / no-slip walls / outflow, a sphere + a cap cutting the outlet), the flow developed by 20 NS steps; a steady scalar, Dirichlet 1 at the inlet, Neumann elsewhere. The captured open-face flux cannot be rescaled through set_field, so the census Pe_h is set through D instead (Pe_h ~ 1/D: the same operator up to a factor).
Definition at line 1455 of file test_scalar_cutcell_gates.py.
References g9c_run().
Referenced by gate_gadv().
| test_scalar_cutcell_gates.gadv_row | ( | tag, | |
| s, | |||
| name, | |||
| pe, | |||
| bound, | |||
rate = None |
|||
| ) |
(i), (ii), (v) of one row; returns the iteration count.
Definition at line 1481 of file test_scalar_cutcell_gates.py.
References check(), and gadv_budget().
Referenced by gate_gadv().
| test_scalar_cutcell_gates.gadv_growth | ( | tag, | |
| lo, | |||
| hi | |||
| ) |
Definition at line 1502 of file test_scalar_cutcell_gates.py.
References check().
Referenced by gate_gadv().
| test_scalar_cutcell_gates.gate_gadv | ( | ) |
Definition at line 1508 of file test_scalar_cutcell_gates.py.
References check(), gadv_a_case(), gadv_b_case(), gadv_c_case(), gadv_growth(), and gadv_row().
| test_scalar_cutcell_gates.fmt | ( | v, | |
| spec | |||
| ) |
A list of numbers formatted with `spec` (no nested f-string quotes: Python 3.10).
Definition at line 1549 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.conj_box | ( | n, | |
| L | |||
| ) |
A walled box of physical size L (no flow).
Definition at line 1554 of file test_scalar_cutcell_gates.py.
References walled().
Referenced by g4_case().
| test_scalar_cutcell_gates.sealed_check | ( | tag, | |
| cen | |||
| ) |
Ruling D-WO7-1: the sealed solid volume (kappa_s > 0, conjugate, no open solid face and no conjugate facet: not a solid unknown) is <= 1e-6 of the conjugate solid volume (as D-WO2-1).
Definition at line 1559 of file test_scalar_cutcell_gates.py.
References check().
Referenced by g5a_case(), g6_case(), gate_conj_unit(), and gate_g4().
| test_scalar_cutcell_gates.solid_isolated | ( | s, | |
name = "c" |
|||
| ) |
Solid unknowns that no solid face and no facet couple: kappa_s > 0, every solid aperture 1 - a^snap = 0 (all six fluid apertures snapped to 1, hence no facet). Ruling D-WO7-1 makes them sealed (not unknowns): this count must be 0.
Definition at line 1567 of file test_scalar_cutcell_gates.py.
Referenced by g5a_case(), g6_case(), gate_conj_unit(), and gate_g4().
| test_scalar_cutcell_gates.maxwell_fields | ( | X, | |
| Y, | |||
| Z, | |||
| c0, | |||
| R, | |||
| G, | |||
| ratio | |||
| ) |
Maxwell's conducting sphere in a uniform gradient G (psi form, Lam_f = 1, Lam_s = ratio): outside G.x' (1 + A R^3/r^3), inside B G.x', A = (1 - ratio)/(ratio + 2), B = 3/(ratio + 2), x' = x - c0.
Definition at line 1580 of file test_scalar_cutcell_gates.py.
Referenced by g4_case().
| test_scalar_cutcell_gates.g4_case | ( | Rh, | |
| off, | |||
| ratio, | |||
K = 1.0, |
|||
rtol = None, |
|||
G = (0.3, -0.5, 0.8) |
|||
| ) |
G4: a conjugate sphere R = 1 (Lam_s = ratio, C_s = 1, partition K) in a box 6R, Lam_f = D = 1, the exact exterior field as the box Dirichlet profile, steady.
Definition at line 1592 of file test_scalar_cutcell_gates.py.
References add_cc(), conj_box(), face_points(), grid(), and maxwell_fields().
Referenced by gate_conj_unit(), and gate_g4().
| test_scalar_cutcell_gates.interior_gradient | ( | X, | |
| Y, | |||
| Z, | |||
| psi, | |||
| mask | |||
| ) |
Least-squares fit psi = a + g.x over the masked cells; returns g.
Definition at line 1618 of file test_scalar_cutcell_gates.py.
Referenced by gate_g4().
| test_scalar_cutcell_gates.gate_conj_unit | ( | ) |
The k_s = k_f checks (the brief's early unit test): with Lam_s = Lam_f, K = 1, R_c = 0 the composite must reproduce the homogeneous solution — a linear field to round-off (§1.6.3, G4(a)) and, in the closure mode, k* = 1 (theta = const).
Definition at line 1625 of file test_scalar_cutcell_gates.py.
References check(), g4_case(), grid(), sealed_check(), and solid_isolated().
| test_scalar_cutcell_gates.gate_g4 | ( | ) |
Definition at line 1669 of file test_scalar_cutcell_gates.py.
References check(), g4_case(), interior_gradient(), order(), rms(), sealed_check(), and solid_isolated().
| test_scalar_cutcell_gates.a_t_keff_sc | ( | c | ) |
k* of perfectly conducting spheres on the simple-cubic lattice, Andrianov & Topol eq. 157 (L3 §2 B6).
Definition at line 1724 of file test_scalar_cutcell_gates.py.
Referenced by gate_g5a().
| test_scalar_cutcell_gates.g5a_case | ( | n, | |
| off, | |||
D = 0.6, |
|||
ratio = 1e4 |
|||
| ) |
Definition at line 1733 of file test_scalar_cutcell_gates.py.
References grid(), sealed_check(), and solid_isolated().
Referenced by gate_g5a().
| test_scalar_cutcell_gates.gate_g5a | ( | ) |
Definition at line 1755 of file test_scalar_cutcell_gates.py.
References a_t_keff_sc(), check(), and g5a_case().
| test_scalar_cutcell_gates.g6_exact | ( | Ls, | |
| CK, | |||
| Rc, | |||
R = 1.0, |
|||
Ro = 2.0 |
|||
| ) |
The slowest decay rate mu and the mode (P, B, C) of the composite sphere in the psi form (Lam_f = C_f = 1): solid r < R, psi_s = P sin(k_s r)/r; fluid R < r < Ro, psi_f = (B sin(k_f r) + C cos(k_f r))/r; psi_f(Ro) = 0, Lam_s psi_s' = psi_f' and psi_s - psi_f + R_c Lam_s psi_s' = 0 at R (the l = 0 analogue of conj.py's exact()).
Definition at line 1786 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.g6_case | ( | Rh, | |
| off, | |||
| case, | |||
nsteps = 30 |
|||
| ) |
G6: a conjugate core R = 1 (instance 0) inside an immersed Dirichlet sphere Ro = 2 (instance 1, psi = 0); psi form (Lam_s, C_s K, K, R_c), Lam_f = C_f = 1; BE late-time ratio of the total mass (fluid + solid) with dt mu = 1, the exact mode as the initial condition.
Definition at line 1828 of file test_scalar_cutcell_gates.py.
References add_cc(), g6_exact(), grid(), sealed_check(), solid_isolated(), two_body_scene(), and walled().
Referenced by gate_g6().
| test_scalar_cutcell_gates.gate_g6 | ( | cases = None | ) |
Definition at line 1871 of file test_scalar_cutcell_gates.py.
References check(), g6_case(), g6_exact(), order(), and rms().
| test_scalar_cutcell_gates.gate_gadv_conj | ( | ) |
WO-7's extra G-adv row (design A2): G-adv(b) with conducting spheres, Lam_s/Lam_f = 10, K = 1, at Pe_h 1 and 10 (the mean-gradient mode, G = e_x): converged, in <= 1.5x the insulating (b) count of the same field.
Definition at line 1902 of file test_scalar_cutcell_gates.py.
References check(), gadv_b_case(), rescale_peclet(), and sc_array().
| test_scalar_cutcell_gates.raises | ( | exc, | |
| fn, | |||
| msg | |||
| ) |
Definition at line 1928 of file test_scalar_cutcell_gates.py.
References check().
Referenced by gate_api(), gate_g9b(), and gate_g9c().
| test_scalar_cutcell_gates.raises_naming | ( | exc, | |
| fn, | |||
| needles, | |||
| msg | |||
| ) |
`raises`, and the message names every one of `needles` (the remedy).
Definition at line 1940 of file test_scalar_cutcell_gates.py.
References check().
Referenced by gate_api().
| test_scalar_cutcell_gates.gate_api | ( | ) |
Definition at line 1954 of file test_scalar_cutcell_gates.py.
References capture_stderr(), check(), grid(), raises(), and raises_naming().
| test_scalar_cutcell_gates.sphere_pair_scene | ( | c1, | |
| c2, | |||
| R | |||
| ) |
Two sphere instances (body ids 0 and 1) of radius R centred at c1, c2.
Definition at line 2148 of file test_scalar_cutcell_gates.py.
Referenced by g13_case().
| test_scalar_cutcell_gates.g13_case | ( | Rh, | |
| off, | |||
| case | |||
| ) |
§11 G13: two spheres R = 1 along x in a box (6R, 4R, 4R) with Dirichlet box faces, steady. 'gap' / 'contact': Dirichlet spheres c = 1 at a surface gap R/32 / an overlap R/64, far field 0; the functional is the total wall flux into the fluid. 'conj': the contacting pair conjugate at Lam_s/Lam_f = 100 (K = 1), the box faces at the far-field profile c = x - x_c (the pair alone at rest would carry no flux); the functional is the heat entering through the -x box face, Q = sum 2 D (g - c_0) h over its face cells (the operator's own boundary row; no solid touches the box faces).
Definition at line 2163 of file test_scalar_cutcell_gates.py.
References add_cc(), face_points(), sphere_pair_scene(), and walled().
Referenced by gate_g13().
| test_scalar_cutcell_gates.g13_rungs | ( | cen | ) |
(R2 fraction, rungs) over both phases' probes (the solid tuple on a conjugate scalar).
Definition at line 2203 of file test_scalar_cutcell_gates.py.
Referenced by gate_g13().
| test_scalar_cutcell_gates.g13_thin_plate | ( | ) |
§11 G13 thin plate: a solid slab 0.4 h thick across the box, its mid-plane 0.05 h off a cell-centre plane (a slab between two centre planes leaves every PL sample positive); the census counts thin-solid cells and the §9 warning is printed (stderr, captured at the fd).
Definition at line 2211 of file test_scalar_cutcell_gates.py.
References add_cc(), grid(), and walled().
Referenced by gate_g13().
| test_scalar_cutcell_gates.gate_g13 | ( | cases = G13_CASES, |
|
rungs = (8, 16, 32) |
|||
| ) |
Definition at line 2240 of file test_scalar_cutcell_gates.py.
References check(), g13_case(), g13_rungs(), g13_thin_plate(), and order().
| tuple test_scalar_cutcell_gates.FACES = ("-x", "+x", "-y", "+y", "-z", "+z") |
Definition at line 83 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.OFFSETS = np.random.default_rng(20261003).uniform(-0.5, 0.5, size=(3, 3)) |
Definition at line 84 of file test_scalar_cutcell_gates.py.
| list test_scalar_cutcell_gates.failures = [] |
Definition at line 85 of file test_scalar_cutcell_gates.py.
| float test_scalar_cutcell_gates.J01_SQ = 5.783185962946784 |
Definition at line 441 of file test_scalar_cutcell_gates.py.
| float test_scalar_cutcell_gates.J11P_SQ = 3.389957 |
Definition at line 442 of file test_scalar_cutcell_gates.py.
| float test_scalar_cutcell_gates.GRAETZ = 3.656793 |
Definition at line 443 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.R_I |
Definition at line 636 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.R_O |
Definition at line 636 of file test_scalar_cutcell_gates.py.
| tuple test_scalar_cutcell_gates.GADV_PE = (0.1, 1.0, 10.0) |
Definition at line 1477 of file test_scalar_cutcell_gates.py.
| dict test_scalar_cutcell_gates.GADV_SRC = {} |
Definition at line 1478 of file test_scalar_cutcell_gates.py.
| tuple test_scalar_cutcell_gates.G6_CASES |
Definition at line 1818 of file test_scalar_cutcell_gates.py.
| tuple test_scalar_cutcell_gates.G6_BOUND |
Definition at line 1823 of file test_scalar_cutcell_gates.py.
| tuple test_scalar_cutcell_gates.G13_CASES = ("gap", "contact", "conj") |
Definition at line 2145 of file test_scalar_cutcell_gates.py.
| dict test_scalar_cutcell_gates.GATES |
Definition at line 2283 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.c |
Definition at line 2288 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.names = sys.argv[1:] or list(GATES) |
Definition at line 2291 of file test_scalar_cutcell_gates.py.
| test_scalar_cutcell_gates.t0 = time.time() |
Definition at line 2293 of file test_scalar_cutcell_gates.py.