flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
vof_momentum_consistency.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2"""WO-K (rung V2b) — momentum-consistent transport: the gate battery.
3
4The decisive gate is the **uniform-velocity consistency test**: an arbitrary sharp colour field
5carried by a spatially uniform velocity, no gravity, no viscosity. A momentum-consistent scheme
6holds the velocity uniform to machine precision at ANY density ratio; an inconsistent one is wrong
7at O(delta rho), so the test is pass/fail at 1e-15 with no tuning knob — the momentum analogue of
8the hydrostatic acid test.
9
10Every gate here also asserts that **no pressure solve hit its iteration cap**. Weymouth-Yue's exact
11conservation is conditioned on a discretely divergence-free face field, so an under-solved
12projection degrades precisely the quantities these gates measure, and a capped solve can look like
13a momentum-consistency failure. A run with a capped solve is reported INVALID, not degraded.
14
15Usage:
16 PYTHONPATH=$PWD/build_wok_omp python tests/study/vof_momentum_consistency.py [gate ...]
17"""
18import math
19import sys
20import time
21
22import numpy as np
23
24import peclet.flow as pf
25
26# The pressure-driver cap in force for every run here (Chebyshev is the varRho default).
27PRESS_MAXIT = 300
28PRESS_RTOL = 1e-13
29
30
32 """Per-step record of the pressure solve, so a capped solve invalidates a run."""
33
34 def __init__(self, cap=PRESS_MAXIT):
35 self.cap = cap
36 self.max_iters = 0
37 self.max_div = 0.0
38 self.capped = 0
39
40 def sample(self, s):
41 it = s.diagnostics.last_pressure_iterations()
42 self.max_iters = max(self.max_iters, it)
43 if it >= self.cap:
44 self.capped += 1
45 try:
46 self.max_div = max(self.max_div, s.max_open_divergence())
47 except Exception:
48 pass
49
50 def ok(self):
51 return self.capped == 0
52
53 def __str__(self):
54 return "pressure: max_iters %d/%d%s, max|div(open u)| %.3g" % (
55 self.max_iters,
56 self.cap,
57 " ** CAPPED %d STEPS — RUN INVALID **" % self.capped if self.capped else "",
58 self.max_div,
59 )
60
61
62def all_fluid(n):
63 return np.full((n, n, n), 10.0, order="F")
64
65
66# --------------------------------------------------------------------------------------------
67# sharp colour scenes (exact fractions; VOF_PLAN: never initialise a diffuse profile)
68# --------------------------------------------------------------------------------------------
70 """Grid-aligned slab: no mixed cell at all (the configuration with the fewest degrees of
71 freedom, and the one the interface-local CFL band had to be redefined for in WO-J)."""
72 c = np.zeros((n, n, n), order="F")
73 c[:, :, n // 4 : 3 * n // 4] = 1.0
74 return c
75
76
77def scene_tilted(n, mx=0.6, my=-0.5, mz=0.62456):
78 """A plane at a generic angle, with exact PLIC fractions from the analytic plane->volume map."""
79 from itertools import product
80
81 m = np.array([mx, my, mz], dtype=float)
82 m /= np.abs(m).sum()
83 alpha = 0.5 * m.sum() * n # plane through the box centre, in cell units
84 c = np.zeros((n, n, n), order="F")
85 # exact fraction of the unit cell under m.x < alpha, via the same 5-case SZ relation the solver
86 # uses; implemented here independently (host, numpy) so the test does not lean on the kernel.
87 for i, j, k in product(range(n), repeat=3):
88 c[i, j, k] = _plic_volume(m[0], m[1], m[2], alpha - (m[0] * i + m[1] * j + m[2] * k))
89 return c
90
91
92def _plic_volume(mx, my, mz, alpha):
93 """Fluid fraction of the unit cube under mx x + my y + mz z < alpha (independent oracle)."""
94 m = np.abs(np.array([mx, my, mz], dtype=float))
95 a = alpha
96 for k in range(3):
97 if [mx, my, mz][k] < 0:
98 a += m[k]
99 s = m.sum()
100 if s == 0.0:
101 return 1.0 if a > 0 else 0.0
102 m = m / s
103 a = a / s
104 if a <= 0.0:
105 return 0.0
106 if a >= 1.0:
107 return 1.0
108 # inclusion-exclusion for the simplex volume truncated to the unit cube
109 def cub(x):
110 return x * x * x if x > 0 else 0.0
111
112 n1, n2, n3 = np.sort(m)
113 v = cub(a)
114 v -= cub(a - n1) + cub(a - n2) + cub(a - n3)
115 v += cub(a - n1 - n2) + cub(a - n1 - n3) + cub(a - n2 - n3)
116 v -= cub(a - n1 - n2 - n3)
117 den = 6.0 * n1 * n2 * n3 if n1 * n2 * n3 > 0 else 0.0
118 if den == 0.0:
119 # a degenerate (1D/2D) normal: fall back to the exact lower-dimensional closed form
120 nz = [x for x in (n1, n2, n3) if x > 1e-300]
121 if len(nz) == 1:
122 return min(1.0, max(0.0, a / nz[0]))
123 p, q = sorted(nz)
124 f = 0.0
125 f += (a * a) / (2 * p * q)
126 if a > p:
127 f -= ((a - p) ** 2) / (2 * p * q)
128 if a > q:
129 f -= ((a - q) ** 2) / (2 * p * q)
130 if a > p + q:
131 f += ((a - p - q) ** 2) / (2 * p * q)
132 return min(1.0, max(0.0, f))
133 return min(1.0, max(0.0, v / den))
134
135
136def scene_droplet(n, r=None):
137 """A sphere, sampled by 5-level octree subdivision (exact to ~1e-6 per cell)."""
138 r = r or n * 0.28
139 cx = cy = cz = n * 0.5
140 c = np.zeros((n, n, n), order="F")
141 L = 4
142 off = (np.arange(2**L) + 0.5) / 2**L
143 for i in range(n):
144 for j in range(n):
145 X = (i + off)[:, None, None] - cx
146 Y = (j + off)[None, :, None] - cy
147 for k in range(n):
148 Z = (np.arange(2**L) + 0.5) / 2**L + k - cz
149 d2 = X * X + Y * Y + Z[None, None, :] ** 2
150 c[i, j, k] = float((d2 < r * r).mean())
151 return c
152
153
154SCENES = {"slab": scene_slab, "tilted": scene_tilted, "droplet": scene_droplet}
155
156
157# --------------------------------------------------------------------------------------------
158def make_solver(n, C, rho_g, rho_l, mu, dt, U, momentum, rho0=None):
159 s = pf.Solver(n, n, n)
160 s.set_rho(rho0 if rho0 is not None else rho_l)
161 s.set_mu(mu)
162 s.set_dt(dt)
163 s.set_advection(False)
164 s.set_pressure_geometry(all_fluid(n))
165 s.set_pressure_chebyshev(True, PRESS_MAXIT, PRESS_RTOL)
166 s.enable_vof()
167 s.set_vof(C)
168 s.set_property_model("rho", "linear", "C", [rho_g, rho_l - rho_g])
169 if momentum:
170 s.enable_vof_momentum(rho_g, rho_l)
171 one = np.ones((n, n, n), order="F")
172 s.set_state(U[0] * one, U[1] * one, U[2] * one)
173 return s
174
175
177 e = 0.0
178 for c, uc in enumerate(U):
179 f = [s.get_u, s.get_v, s.get_w][c]()
180 e = max(e, float(np.max(np.abs(f - uc))))
181 return e / max(abs(x) for x in U)
182
183
184# --------------------------------------------------------------------------------------------
185def gate_uniform(n=32, steps=200, scenes=("tilted",), ratios=(10.0, 1e2, 1e3, 1e4)):
186 """THE gate: uniform velocity at four density ratios, consistent vs inconsistent."""
187 U = (1.0, 0.6, -0.4)
188 dt = 0.2 / max(abs(x) for x in U)
189 print("\n=== GATE 1 — uniform-velocity consistency (n=%d, %d steps, dt=%g, CFL=%.2f) ==="
190 % (n, steps, dt, dt * max(abs(x) for x in U)))
191 print(" U = %s, mu = 0, g = 0; error = max|u-U|/|U|_inf" % (U,))
192 for scene in scenes:
193 C = SCENES[scene](n)
194 print("\n scene: %s (sum C = %.6f)" % (scene, C.sum()))
195 print(" %-10s | %-14s | %-14s | %s" % ("ratio", "consistent", "inconsistent", "pressure"))
196 for R in ratios:
197 row = []
198 watches = []
199 for mom in (True, False):
200 s = make_solver(n, C, 1.0, R, 0.0, dt, U, mom)
201 w = SolveWatch()
202 for _ in range(steps):
203 s.step()
204 w.sample(s)
205 row.append(uniform_error(s, U))
206 watches.append(w)
207 del s
208 flag = "" if all(x.ok() for x in watches) else " ** INVALID (capped) **"
209 print(" %-10g | %-14.4e | %-14.4e | %s%s"
210 % (R, row[0], row[1], watches[0], flag))
211
212
213def gate_uniform_advection_only(n=32, steps=1, ratios=(10.0, 1e2, 1e3, 1e4)):
214 """The same identity on the ADVECTION alone — projection and momentum solve out of the picture.
215 This isolates whether the two advections truly share fluxes."""
216 U = (1.0, 0.6, -0.4)
217 dt = 0.2 / max(abs(x) for x in U)
218 print("\n=== GATE 1b — the consistency identity on the advection alone ===")
219 for scene in ("slab", "tilted", "droplet"):
220 C = SCENES[scene](n)
221 errs = []
222 for R in ratios:
223 s = make_solver(n, C, 1.0, R, 0.0, dt, U, True)
224 for _ in range(steps):
225 s.step()
226 e = 0.0
227 for c, uc in enumerate(U):
228 f = s.diagnostics.vof_advected_velocity(c)
229 e = max(e, float(np.max(np.abs(f - uc))))
230 errs.append(e / max(abs(x) for x in U))
231 d = s.diagnostics.vof_momentum_diagnostics()
232 print(" %-8s R=%-8g err %.3e C^c in [%.4e, %.6f] floored %d min rho^c %.4g"
233 % (scene, R, errs[-1], min(d["min_Cc"]), max(d["max_Cc"]), d["floored"],
234 d["min_rho_c"]))
235 del s
236 print(" %-8s " % scene + " ".join("R=%-6g %.3e" % (R, e) for R, e in zip(ratios, errs)))
237
238
239def gate_single_phase(n=32, steps=50):
240 """With C == const the consistent advection must be a SINGLE-PHASE transport: bitwise
241 independent of the density ratio (the rho_g/rho_l factors cancel), and volume-preserving."""
242 print("\n=== GATE 2 — C == const: the consistent scheme is density-ratio independent ===")
243 U = (1.0, 0.6, -0.4)
244 dt = 0.2
245 for val, name in ((1.0, "C=1 (all liquid)"), (0.0, "C=0 (all gas)")):
246 C = np.full((n, n, n), val, order="F")
247 ref = None
248 for R in (1.0, 1e2, 1e4):
249 s = make_solver(n, C, 1.0, R, 0.0, dt, U, True)
250 w = SolveWatch()
251 for _ in range(steps):
252 s.step()
253 w.sample(s)
254 u = np.stack([s.get_u(), s.get_v(), s.get_w()])
255 if ref is None:
256 ref = u
257 print(" %-18s R=%-8g reference %s" % (name, R, w))
258 else:
259 d = float(np.max(np.abs(u - ref))) / max(abs(x) for x in U)
260 print(" %-18s R=%-8g d=%.4e %s" % (name, R, d, w))
261 del s
262
263
264def gate_momentum_conservation(n=32, steps=200, R=1000.0):
265 """Total momentum sum(rho_f u) in a periodic box, no forces: conserved to round-off."""
266 print("\n=== GATE 3 — momentum conservation in a periodic box (ratio %g) ===" % R)
267 C = scene_droplet(n)
268 # a sheared, discretely divergence-free initial field would not stay uniform; use a uniform
269 # translation plus a solenoidal shear so there IS momentum transport to conserve.
270 x = (np.arange(n) + 0.5) / n
271 ux = 1.0 + 0.3 * np.sin(2 * math.pi * x)[None, None, :] * np.ones((n, n, n), order="F")
272 uy = np.full((n, n, n), 0.2, order="F")
273 uz = np.full((n, n, n), -0.1, order="F")
274 for mom in (True, False):
275 s = make_solver(n, C, 1.0, R, 0.0, 0.15, (1.3, 0.2, -0.1), mom)
276 s.set_state(np.asfortranarray(ux), uy, uz)
277 w = SolveWatch()
278
279 def total():
280 rho = s.get_field("rho")
281 p = 0.0
282 comps = [s.get_u(), s.get_v(), s.get_w()]
283 for c in range(3):
284 rf = 0.5 * (rho + np.roll(rho, 1, axis=c))
285 p += float((rf * comps[c]).sum())
286 return p
287
288 s.update_properties() # the registry rho is only filled by the first step otherwise (m0 = 0)
289 m0 = total()
290 for _ in range(steps):
291 s.step()
292 w.sample(s)
293 m1 = total()
294 print(" %-14s sum(rho_f u): %.16e -> %.16e rel %.3e %s"
295 % ("consistent" if mom else "inconsistent", m0, m1, abs(m1 - m0) / abs(m0), w))
296 s = None # not `del`: the closure `total` binds this cell (ruff F821)
297
298
299def gate_rho_floor(n=32, steps=200, R=1000.0):
300 """The rho^c floor: how often it bites and how much it matters."""
301 print("\n=== GATE 4 — the rho^c floor (ratio %g, %d steps) ===" % (R, steps))
302 C = scene_droplet(n)
303 U = (1.0, 0.6, -0.4)
304 ref = None
305 for frac in (1e-3, 1e-6, 1e-9, 1e-12):
306 s = make_solver(n, C, 1.0, R, 0.0, 0.2, U, True)
307 s.diagnostics.set_vof_rho_floor(frac)
308 for _ in range(steps):
309 s.step()
310 d = s.diagnostics.vof_momentum_diagnostics()
311 u = np.stack([s.get_u(), s.get_v(), s.get_w()])
312 dd = 0.0 if ref is None else float(np.max(np.abs(u - ref)))
313 if ref is None:
314 ref = u
315 print(" frac %-8g floor %-11.4g floored CVs %-6d min rho^c %.6f "
316 "C^c in [%.3e, %.6f] du vs frac=1e-3: %.3e"
317 % (frac, s.diagnostics.vof_rho_floor(), d["floored"], d["min_rho_c"],
318 min(d["min_Cc"]), max(d["max_Cc"]), dd))
319 del s
320
321
322def gate_falling_drop(n=48, D=15, R=800.0, mu_ratio=100.0, steps=500, quiet=False):
323 """A viscous drop falling under buoyancy at density ratio ~800 and 15 cells/diameter.
324
325 WO-K asks for the Arrufat raindrop (ratio 831.8, 15 cells/D, terminal velocity within 15%).
326 That case is held together by SURFACE TENSION, which is rung V4 — without it a raindrop at its
327 terminal Weber number flattens and breaks up, so the literal case cannot be run at V2b and a
328 "terminal velocity" would not exist to measure. The surface-tension-free case with the same
329 payoff structure is a VISCOUS drop in the Stokes regime, whose terminal velocity is the
330 Hadamard-Rybczynski result
331
332 U_HR = (2/3) g R^2 (rho_d - rho_c)/mu_c * (mu_c + mu_d)/(2 mu_c + 3 mu_d)
333
334 (-> the rigid-sphere Stokes value (2/9) g R^2 drho/mu_c as mu_d/mu_c -> infinity). In a periodic
335 box the drop feels its own images, so the measured plateau sits below U_HR by the usual
336 Sangani-Acrivos-type factor at this volume fraction; the number to trust is the CONSISTENT vs
337 INCONSISTENT comparison at identical settings, with U_HR quoted as the scale.
338
339 Buoyancy is imposed as f_z = -(rho - <rho>) g through a LinearMix force closure, so the box
340 carries no net force and the drop falls relative to a quiescent mean.
341 """
342 R_drop = D / 2.0
343 C = scene_droplet(n, r=R_drop)
344 vol = C.sum() / n**3
345 rho_g, rho_l = 1.0, R
346 rho_mean = rho_g + (rho_l - rho_g) * vol
347 # mu_g is chosen so the Stokes response time tau = 2 R^2 rho_l / (9 mu_g) is O(200) rather than
348 # O(1e4): the drop must actually REACH its plateau inside the step budget, and at Re ~ 0.02 the
349 # case stays in the Stokes regime the Hadamard-Rybczynski formula describes.
350 mu_g = 50.0
351 mu_l = mu_g * mu_ratio
352 g = 2.5e-4
353 # f_z = -(rho - rho_mean) g = -(rho_g - rho_mean) g - (rho_l - rho_g) g * C
354 f0 = -(rho_g - rho_mean) * g
355 f1 = -(rho_l - rho_g) * g
356 U_hr = (2.0 / 3.0) * g * R_drop**2 * (rho_l - rho_g) / mu_g * (mu_g + mu_l) / (
357 2 * mu_g + 3 * mu_l)
358 print("\n=== GATE 5 — falling viscous drop, ratio %g, D/h = %d, mu_l/mu_g = %g ==="
359 % (R, D, mu_ratio))
360 tau = 2.0 * R_drop**2 * rho_l / (9.0 * mu_g)
361 # Periodic array: the drop feels its images. Sangani-Acrivos / Hasimoto to leading order,
362 # K = 1 + 1.76 phi^(1/3), so the expected plateau is U_HR / K, NOT U_HR.
363 K = 1.0 + 1.76 * vol ** (1.0 / 3.0)
364 print(" Hadamard-Rybczynski U_t = %.5e (unbounded), /K = %.5e with the periodic correction "
365 "K = %.3f at phi = %.4f; tau = %.0f, box %d^3, Re = %.3f"
366 % (U_hr, U_hr / K, K, vol, tau, n, rho_g * (U_hr / K) * D / mu_g))
367 print(" %-14s | %-12s | %-12s | %-9s | %s"
368 % ("scheme", "U_drop", "U/(U_HR/K)", "max|u|", "pressure"))
369 out = {}
370 for mom in (True, False):
371 s = pf.Solver(n, n, n)
372 s.set_rho(rho_l)
373 s.set_mu(mu_g)
374 dt0 = 2.0
375 dt = dt0
376 s.set_dt(dt)
377 s.set_advection(False)
378 s.set_pressure_geometry(all_fluid(n))
379 s.set_pressure_chebyshev(True, PRESS_MAXIT, 1e-11)
380 s.enable_vof()
381 s.set_vof(C)
382 s.set_property_model("rho", "linear", "C", [rho_g, rho_l - rho_g])
383 s.set_property_model("mu", "linear", "C", [mu_g, mu_l - mu_g])
384 s.set_property_model("force_z", "linear", "C", [f0, f1])
385 if mom:
386 s.enable_vof_momentum(rho_g, rho_l)
387 w = SolveWatch()
388 hist = []
389 blew = False
390 for k in range(steps):
391 try:
392 s.step()
393 except RuntimeError as ex: # the WY CFL cap = the run went unstable
394 print(" %-14s BLEW UP at step %d: %s" % ("consistent" if mom else "inconsistent",
395 k, str(ex)[:90]))
396 blew = True
397 break
398 w.sample(s)
399 if k % 20 == 19:
400 c = s.get_vof()
401 uz = s.get_w()
402 m = c.sum()
403 hist.append(float((c * uz).sum() / m) if m > 0 else 0.0)
404 # keep the interface-local Courant number inside the WY cap
405 if k % 10 == 9:
406 cfl = s.diagnostics.vof_last_courant()
407 if cfl > 0.18:
408 dt *= 0.18 / cfl
409 s.set_dt(dt)
410 elif cfl < 0.06 and dt < dt0:
411 dt = min(dt0, dt * 1.5)
412 s.set_dt(dt)
413 if not blew:
414 u_drop = np.mean(hist[-4:]) if len(hist) >= 4 else (hist[-1] if hist else 0.0)
415 mx = max(float(np.max(np.abs(s.get_u()))), float(np.max(np.abs(s.get_v()))),
416 float(np.max(np.abs(s.get_w()))))
417 print(" %-14s | %-12.5e | %-12.4f | %-9.3e | %s"
418 % ("consistent" if mom else "inconsistent", u_drop, u_drop / (U_hr / K), mx, w))
419 print(" plateau history (every 20 steps, last 10): %s"
420 % " ".join("%.4e" % h for h in hist[-10:]))
421 out["mom" if mom else "no"] = (u_drop, hist)
422 del s
423 return out
424
425
426def gate_rt(res=(24, 48), R=1000.0, steps=300):
427 """Rayleigh-Taylor at two resolutions — the WO-K near-Nyquist check (Arrufat section 5).
428
429 A momentum-consistent scheme can excite growth near the grid scale on under-resolved shear
430 layers. Reported here as the interface amplitude growth AND the peak |u| relative to the
431 inconsistent run at the same resolution; a near-Nyquist artefact shows up as the finer grid
432 being WORSE, which is the opposite of a convergence signature.
433 """
434 print("\n=== GATE 6 — Rayleigh-Taylor at two resolutions (near-Nyquist check, ratio %g) ==="
435 % R)
436 print(" %-5s | %-13s | %-13s | %-13s | %s"
437 % ("n", "amp consistent", "amp inconsist", "max|u| cons", "pressure (consistent)"))
438 for n in res:
439 row = []
440 for mom in (True, False):
441 nx, nz = n, 2 * n
442 C = np.zeros((nx, nx, nz), order="F")
443 x = (np.arange(nx) + 0.5) / nx
444 z = (np.arange(nz) + 0.5) / nz
445 # a single-mode perturbed flat interface at mid height, exact fractions in the cut cells
446 for i in range(nx):
447 for j in range(nx):
448 h = 0.5 + 0.01 * math.cos(2 * math.pi * x[i]) * math.cos(2 * math.pi * x[j])
449 hz = h * nz
450 for k in range(nz):
451 C[i, j, k] = min(1.0, max(0.0, hz - k))
452 rho_g, rho_l = 1.0, R
453 g = 1e-4
454 vol = C.sum() / (nx * nx * nz)
455 rho_mean = rho_g + (rho_l - rho_g) * vol
456 s = pf.Solver(nx, nx, nz)
457 s.set_rho(rho_l)
458 s.set_mu(0.05)
459 dt0 = 2.0
460 dt = dt0
461 s.set_dt(dt)
462 s.set_pressure_geometry(np.full((nx, nx, nz), 10.0, order="F"))
463 s.set_pressure_chebyshev(True, PRESS_MAXIT, 1e-11)
464 s.enable_vof()
465 s.set_vof(C)
466 s.set_property_model("rho", "linear", "C", [rho_g, rho_l - rho_g])
467 s.set_property_model("force_z", "linear", "C",
468 [-(rho_g - rho_mean) * g, -(rho_l - rho_g) * g])
469 if mom:
470 s.enable_vof_momentum(rho_g, rho_l)
471 w = SolveWatch()
472 blew = False
473 for k in range(steps):
474 try:
475 s.step()
476 except RuntimeError:
477 blew = True
478 break
479 w.sample(s)
480 cfl = s.diagnostics.vof_last_courant()
481 if cfl > 0.18:
482 dt *= 0.18 / cfl
483 s.set_dt(dt)
484 elif cfl < 0.06 and dt < dt0:
485 dt = min(dt0, dt * 1.5)
486 s.set_dt(dt)
487 if blew:
488 row.append((float("nan"), float("nan"), w))
489 continue
490 cf = s.get_vof()
491 col = cf.sum(axis=(0, 1)) / (nx * nx)
492 hbar = col.sum()
493 amp = float(np.max(cf.sum(axis=2)) - np.min(cf.sum(axis=2))) / nz
494 mx = max(float(np.max(np.abs(s.get_u()))), float(np.max(np.abs(s.get_w()))))
495 row.append((amp, mx, w))
496 del s
497 print(" %-5d | %-13.5e | %-13.5e | %-13.3e | %s"
498 % (n, row[0][0], row[1][0], row[0][1], row[0][2]))
499
500
501GATES = {
502 "uniform": gate_uniform,
503 "uniform_adv": gate_uniform_advection_only,
504 "single_phase": gate_single_phase,
505 "momentum": gate_momentum_conservation,
506 "floor": gate_rho_floor,
507 "drop": gate_falling_drop,
508 "rt": gate_rt,
509}
510
511if __name__ == "__main__":
512 want = sys.argv[1:] or ["uniform_adv", "uniform", "single_phase", "momentum", "floor"]
513 for g in want:
514 t0 = time.time()
515 GATES[g]()
516 print(" [%s: %.1f s]" % (g, time.time() - t0))
make_solver(n, C, rho_g, rho_l, mu, dt, U, momentum, rho0=None)
scene_tilted(n, mx=0.6, my=-0.5, mz=0.62456)
gate_rho_floor(n=32, steps=200, R=1000.0)
gate_uniform(n=32, steps=200, scenes=("tilted",), ratios=(10.0, 1e2, 1e3, 1e4))
gate_rt(res=(24, 48), R=1000.0, steps=300)
gate_momentum_conservation(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_uniform_advection_only(n=32, steps=1, ratios=(10.0, 1e2, 1e3, 1e4))
static double mean(const std::vector< double > &a)