flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
gsv9a.py
Go to the documentation of this file.
1"""G-SV9 (a) (doc/vof_sharp_viscous_stress.md §11, amended §6.1 / WO-5b): the 2-D harness
2amplification factor rho(G), G = P (M+K)^-1 (M+K-A), of the PRODUCTION split Kb (2 mu(C) m_cc
3implicit on interfacial cells, mu(C) m_cc implicit + mu(C) m_cc explicit elsewhere, face-fraction
4edges; built by gsv9_split.harness_case), A = the sharp operator with the §5.7 interfacial-mean tau
5rule, over the six planar geometries of stab5.py, the four mu/rho ratio pairs, D_hi = 0.1, 1, 10,
6100, 1e4, at N = 16 and 32. PASS: rho(G) <= 1 + 1e-12 everywhere for Kb. Control: K1 (mu(C) split
7evenly on every cell, the pre-WO-5b code) is printed and must exceed 1 at D_hi = 1e4 for every
8N x ratio pair, proving the harness models what it claims.
9
10 nice -n 10 python gsv9a.py (12 worker processes; one line per N x ratio, one verdict line)
11"""
12import sys
13from multiprocessing import Pool
14
15import numpy as np
16
17from gsv9_split import harness_case
18
19GEOMS = ((0.0, 0.6), (0.0, 0.2), (22.5, 0.0), (22.5, 0.3), (45.0, 0.3), (67.5, 0.5))
20PAIRS = ((1e-3, 1e-4), (1e-2, 1e-3), (1e2, 1e3), (1e3, 1e4))
21DS = (0.1, 1.0, 10.0, 100.0, 1e4)
22
23
24def one(args):
25 N, muA, rA, ang, off = args
26 out = harness_case(N, ang, off, muA, rA, DS, "sharp")
27 return args, {nm: np.array([out[(nm, d)] for d in DS]) for nm in ("Kb", "K1")}
28
29
30def main():
31 jobs = [(N, mu, r, a, o) for N in (16, 32) for (mu, r) in PAIRS for (a, o) in GEOMS]
32 with Pool(12) as p:
33 res = p.map(one, jobs)
34 worst = {}
35 for a, o in res:
36 for nm in ("Kb", "K1"):
37 k = a[:3] + (nm,)
38 worst[k] = np.maximum(worst.get(k, np.zeros(len(DS))), o[nm])
39 top, ctl = 0.0, True
40 for k, v in sorted(worst.items()):
41 if k[3] == "Kb":
42 top = max(top, float(np.max(v)))
43 else:
44 ctl = ctl and v[-1] > 1.0
45 print("GSV9a N=%d muA/muB=%g rhoA/rhoB=%g %s worst rho(G) at D_hi=%s: %s"
46 % (k[0], k[1], k[2], k[3], ",".join("%g" % d for d in DS), " ".join("%.4f" % x for x in v)))
47 ok = top <= 1.0 + 1e-12
48 print("GSV9a %s worst Kb rho(G)=%.6f over %d geometries x %d ratio pairs x %d D_hi x N=16,32; "
49 "control K1 > 1 at D_hi=1e4 for every N x pair: %s"
50 % ("PASS" if ok else "MISS", top, len(GEOMS), len(PAIRS), len(DS), "YES" if ctl else "NO"))
51 return 0 if (ok and ctl) else 1
52
53
54if __name__ == "__main__":
55 sys.exit(main())
main()
Definition gsv9a.py:30
one(args)
Definition gsv9a.py:24