|
flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Classes | |
| class | SolveWatch |
Functions | |
| all_fluid (n) | |
| scene_slab (n) | |
| scene_tilted (n, mx=0.6, my=-0.5, mz=0.62456) | |
| _plic_volume (mx, my, mz, alpha) | |
| scene_droplet (n, r=None) | |
| make_solver (n, C, rho_g, rho_l, mu, dt, U, momentum, rho0=None) | |
| uniform_error (s, U) | |
| gate_uniform (n=32, steps=200, scenes=("tilted",), ratios=(10.0, 1e2, 1e3, 1e4)) | |
| gate_uniform_advection_only (n=32, steps=1, ratios=(10.0, 1e2, 1e3, 1e4)) | |
| gate_single_phase (n=32, steps=50) | |
| gate_momentum_conservation (n=32, steps=200, R=1000.0) | |
| gate_rho_floor (n=32, steps=200, R=1000.0) | |
| gate_falling_drop (n=48, D=15, R=800.0, mu_ratio=100.0, steps=500, quiet=False) | |
| gate_rt (res=(24, 48), R=1000.0, steps=300) | |
Variables | |
| int | PRESS_MAXIT = 300 |
| int | PRESS_RTOL = 1e-13 |
| dict | SCENES = {"slab": scene_slab, "tilted": scene_tilted, "droplet": scene_droplet} |
| dict | GATES |
| want = sys.argv[1:] or ["uniform_adv", "uniform", "single_phase", "momentum", "floor"] | |
| t0 = time.time() | |
WO-K (rung V2b) — momentum-consistent transport: the gate battery.
The decisive gate is the **uniform-velocity consistency test**: an arbitrary sharp colour field
carried by a spatially uniform velocity, no gravity, no viscosity. A momentum-consistent scheme
holds the velocity uniform to machine precision at ANY density ratio; an inconsistent one is wrong
at O(delta rho), so the test is pass/fail at 1e-15 with no tuning knob — the momentum analogue of
the hydrostatic acid test.
Every gate here also asserts that **no pressure solve hit its iteration cap**. Weymouth-Yue's exact
conservation is conditioned on a discretely divergence-free face field, so an under-solved
projection degrades precisely the quantities these gates measure, and a capped solve can look like
a momentum-consistency failure. A run with a capped solve is reported INVALID, not degraded.
Usage:
PYTHONPATH=$PWD/build_wok_omp python tests/study/vof_momentum_consistency.py [gate ...]
| vof_momentum_consistency.all_fluid | ( | n | ) |
Definition at line 62 of file vof_momentum_consistency.py.
Referenced by gate_falling_drop(), and make_solver().
| vof_momentum_consistency.scene_slab | ( | n | ) |
Grid-aligned slab: no mixed cell at all (the configuration with the fewest degrees of freedom, and the one the interface-local CFL band had to be redefined for in WO-J).
Definition at line 69 of file vof_momentum_consistency.py.
| vof_momentum_consistency.scene_tilted | ( | n, | |
mx = 0.6, |
|||
my = -0.5, |
|||
mz = 0.62456 |
|||
| ) |
A plane at a generic angle, with exact PLIC fractions from the analytic plane->volume map.
Definition at line 77 of file vof_momentum_consistency.py.
References _plic_volume().
|
protected |
Fluid fraction of the unit cube under mx x + my y + mz z < alpha (independent oracle).
Definition at line 92 of file vof_momentum_consistency.py.
Referenced by scene_tilted().
| vof_momentum_consistency.scene_droplet | ( | n, | |
r = None |
|||
| ) |
A sphere, sampled by 5-level octree subdivision (exact to ~1e-6 per cell).
Definition at line 136 of file vof_momentum_consistency.py.
References mean().
Referenced by gate_falling_drop(), gate_momentum_conservation(), and gate_rho_floor().
| vof_momentum_consistency.make_solver | ( | n, | |
| C, | |||
| rho_g, | |||
| rho_l, | |||
| mu, | |||
| dt, | |||
| U, | |||
| momentum, | |||
rho0 = None |
|||
| ) |
Definition at line 158 of file vof_momentum_consistency.py.
References all_fluid().
Referenced by gate_momentum_conservation(), gate_rho_floor(), gate_single_phase(), gate_uniform(), and gate_uniform_advection_only().
| vof_momentum_consistency.uniform_error | ( | s, | |
| U | |||
| ) |
Definition at line 175 of file vof_momentum_consistency.py.
Referenced by gate_uniform().
| vof_momentum_consistency.gate_uniform | ( | n = 32, |
|
steps = 200, |
|||
scenes = ("tilted",), |
|||
ratios = (10.0, 1e2, 1e3, 1e4) |
|||
| ) |
THE gate: uniform velocity at four density ratios, consistent vs inconsistent.
Definition at line 184 of file vof_momentum_consistency.py.
References make_solver(), and uniform_error().
| vof_momentum_consistency.gate_uniform_advection_only | ( | n = 32, |
|
steps = 1, |
|||
ratios = (10.0, 1e2, 1e3, 1e4) |
|||
| ) |
The same identity on the ADVECTION alone — projection and momentum solve out of the picture. This isolates whether the two advections truly share fluxes.
Definition at line 212 of file vof_momentum_consistency.py.
References make_solver().
| vof_momentum_consistency.gate_single_phase | ( | n = 32, |
|
steps = 50 |
|||
| ) |
With C == const the consistent advection must be a SINGLE-PHASE transport: bitwise independent of the density ratio (the rho_g/rho_l factors cancel), and volume-preserving.
Definition at line 238 of file vof_momentum_consistency.py.
References make_solver().
| vof_momentum_consistency.gate_momentum_conservation | ( | n = 32, |
|
steps = 200, |
|||
R = 1000.0 |
|||
| ) |
Total momentum sum(rho_f u) in a periodic box, no forces: conserved to round-off.
Definition at line 263 of file vof_momentum_consistency.py.
References make_solver(), and scene_droplet().
| vof_momentum_consistency.gate_rho_floor | ( | n = 32, |
|
steps = 200, |
|||
R = 1000.0 |
|||
| ) |
The rho^c floor: how often it bites and how much it matters.
Definition at line 297 of file vof_momentum_consistency.py.
References make_solver(), and scene_droplet().
| vof_momentum_consistency.gate_falling_drop | ( | n = 48, |
|
D = 15, |
|||
R = 800.0, |
|||
mu_ratio = 100.0, |
|||
steps = 500, |
|||
quiet = False |
|||
| ) |
A viscous drop falling under buoyancy at density ratio ~800 and 15 cells/diameter.
WO-K asks for the Arrufat raindrop (ratio 831.8, 15 cells/D, terminal velocity within 15%).
That case is held together by SURFACE TENSION, which is rung V4 — without it a raindrop at its
terminal Weber number flattens and breaks up, so the literal case cannot be run at V2b and a
"terminal velocity" would not exist to measure. The surface-tension-free case with the same
payoff structure is a VISCOUS drop in the Stokes regime, whose terminal velocity is the
Hadamard-Rybczynski result
U_HR = (2/3) g R^2 (rho_d - rho_c)/mu_c * (mu_c + mu_d)/(2 mu_c + 3 mu_d)
(-> the rigid-sphere Stokes value (2/9) g R^2 drho/mu_c as mu_d/mu_c -> infinity). In a periodic
box the drop feels its own images, so the measured plateau sits below U_HR by the usual
Sangani-Acrivos-type factor at this volume fraction; the number to trust is the CONSISTENT vs
INCONSISTENT comparison at identical settings, with U_HR quoted as the scale.
Buoyancy is imposed as f_z = -(rho - <rho>) g through a LinearMix force closure, so the box
carries no net force and the drop falls relative to a quiescent mean.
Definition at line 320 of file vof_momentum_consistency.py.
References all_fluid(), and scene_droplet().
| vof_momentum_consistency.gate_rt | ( | res = (24, 48), |
|
R = 1000.0, |
|||
steps = 300 |
|||
| ) |
Rayleigh-Taylor at two resolutions — the WO-K near-Nyquist check (Arrufat section 5). A momentum-consistent scheme can excite growth near the grid scale on under-resolved shear layers. Reported here as the interface amplitude growth AND the peak |u| relative to the inconsistent run at the same resolution; a near-Nyquist artefact shows up as the finer grid being WORSE, which is the opposite of a convergence signature.
Definition at line 423 of file vof_momentum_consistency.py.
| int vof_momentum_consistency.PRESS_MAXIT = 300 |
Definition at line 27 of file vof_momentum_consistency.py.
| int vof_momentum_consistency.PRESS_RTOL = 1e-13 |
Definition at line 28 of file vof_momentum_consistency.py.
| dict vof_momentum_consistency.SCENES = {"slab": scene_slab, "tilted": scene_tilted, "droplet": scene_droplet} |
Definition at line 154 of file vof_momentum_consistency.py.
| dict vof_momentum_consistency.GATES |
Definition at line 498 of file vof_momentum_consistency.py.
| vof_momentum_consistency.want = sys.argv[1:] or ["uniform_adv", "uniform", "single_phase", "momentum", "floor"] |
Definition at line 509 of file vof_momentum_consistency.py.
| vof_momentum_consistency.t0 = time.time() |
Definition at line 511 of file vof_momentum_consistency.py.