flow 0.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
collocated_s1_reconciliation Namespace Reference

Functions

 bed_sdf (N, npz)
 
 march (N)
 
 stats (name, v, scale)
 

Variables

 BED = os.environ.get("BED", "")
 
 MARCH_TOL = float(os.environ.get("MARCH_TOL", "1e-8"))
 
 MAXS = int(os.environ.get("MARCH_MAX", "4000"))
 
 DT = float(os.environ.get("DT", "60.0"))
 
dict prev = {}
 
 s
 
 sdf
 
 R
 
 steps
 
list U = [np.asarray(s.get_u()), np.asarray(s.get_v()), np.asarray(s.get_w())]
 
list UF = [np.asarray(s.get_uf()), np.asarray(s.get_vf()), np.asarray(s.get_wf())]
 
list OX = [np.asarray(s.get_ox()), np.asarray(s.get_oy()), np.asarray(s.get_oz())]
 
float fluid = 0.0
 
 uscale = float(np.abs(U[0][fluid]).mean())
 
dict rms = {}
 
float half = 0.5 * (U[a] + np.roll(U[a], 1, axis=a))
 
list openf = OX[a] > 0.0
 
 div = np.zeros_like(U[0])
 
list flx = OX[a] * half
 
 axis
 
 divf = np.zeros_like(U[0])
 
float cavg = 0.5 * (UF[a] + np.roll(UF[a], -1, axis=a))
 
tuple d = (U[a] - cavg)
 
float near = fluid & (np.abs(sdf) <= 2.0)
 
float bulk = fluid & (np.abs(sdf) > 2.0)
 
 lr = np.log(N / prev["N"])
 
dict orders
 
 flush
 

Detailed Description

S1 probe (doc/collocated_accuracy_ceiling.md #5): does the ABC cell/face reconciliation carry a
steady-state defect that could hold the ~0.3 % flow-excess plateau?

Structural background (this is what the test checks, not assumes): at the JOINT fixed point of the
mode-9 step -- velocity AND accumulated pressure both stationary -- the rotational update
P += (rho/dt)*phi - mu*div(u*) together with A phi = -div(u*) forces (A + rho/(mu dt)) phi = 0,
i.e. phi = 0 and div(u*) = 0.  Consequences, each measured here at the march's stopping point:

  m1  |uf - halfavg(u)| / <u>      the projected face field vs the plain 1/2-1/2 average of the
                                   cell field.  projectCorrect writes uf = halfavg(u*) - grad_f(phi)
                                   and the cell correction writes u = u* - gpCenterGrad(phi), so a
                                   persistent gap is EXACTLY the un-converged gauge (phi != 0) plus
                                   the gradient-pair mismatch: the S1 channel.  If m1 ~ 0 the ABC
                                   two-field loop closes and S1 is dead.
  m2  alpha-div(halfavg(u)) h/<u>  the constraint residual of the CELL field (the face field's is
                                   pinned by the solve; the cell field's is the approximate
                                   projection's O(h^2) remainder -- it should CONVERGE, not floor).
  m3  |u_cell - cellavg(uf)| / <u> the doc's S1 quantity, split by wall distance (near = |sdf|<=2h).
                                   This is a smoothing difference (h^2 D2u/4 in the bulk); the
                                   interesting part is whether the NEAR-WALL part floors.

Usage:  SDFLOW_BUILD=build_ge BED=<packing.npz> python collocated_s1_reconciliation.py [N ...]
        (defaults N = 96 128 192 -> R = 6, 8, 12 on the 16^3-box beds)

Function Documentation

◆ bed_sdf()

collocated_s1_reconciliation.bed_sdf (   N,
  npz 
)

Definition at line 43 of file collocated_s1_reconciliation.py.

Referenced by march().

◆ march()

collocated_s1_reconciliation.march (   N)

Definition at line 67 of file collocated_s1_reconciliation.py.

References bed_sdf().

◆ stats()

collocated_s1_reconciliation.stats (   name,
  v,
  scale 
)

Definition at line 91 of file collocated_s1_reconciliation.py.

Variable Documentation

◆ BED

collocated_s1_reconciliation.BED = os.environ.get("BED", "")

Definition at line 35 of file collocated_s1_reconciliation.py.

◆ MARCH_TOL

collocated_s1_reconciliation.MARCH_TOL = float(os.environ.get("MARCH_TOL", "1e-8"))

Definition at line 38 of file collocated_s1_reconciliation.py.

◆ MAXS

collocated_s1_reconciliation.MAXS = int(os.environ.get("MARCH_MAX", "4000"))

Definition at line 39 of file collocated_s1_reconciliation.py.

◆ DT

collocated_s1_reconciliation.DT = float(os.environ.get("DT", "60.0"))

Definition at line 40 of file collocated_s1_reconciliation.py.

◆ prev

dict collocated_s1_reconciliation.prev = {}

Definition at line 102 of file collocated_s1_reconciliation.py.

◆ s

collocated_s1_reconciliation.s

Definition at line 104 of file collocated_s1_reconciliation.py.

◆ sdf

collocated_s1_reconciliation.sdf

Definition at line 104 of file collocated_s1_reconciliation.py.

◆ R

collocated_s1_reconciliation.R

Definition at line 104 of file collocated_s1_reconciliation.py.

◆ steps

collocated_s1_reconciliation.steps

Definition at line 104 of file collocated_s1_reconciliation.py.

◆ U

list collocated_s1_reconciliation.U = [np.asarray(s.get_u()), np.asarray(s.get_v()), np.asarray(s.get_w())]

Definition at line 105 of file collocated_s1_reconciliation.py.

◆ UF

list collocated_s1_reconciliation.UF = [np.asarray(s.get_uf()), np.asarray(s.get_vf()), np.asarray(s.get_wf())]

Definition at line 106 of file collocated_s1_reconciliation.py.

◆ OX

list collocated_s1_reconciliation.OX = [np.asarray(s.get_ox()), np.asarray(s.get_oy()), np.asarray(s.get_oz())]

Definition at line 107 of file collocated_s1_reconciliation.py.

◆ fluid

float collocated_s1_reconciliation.fluid = 0.0

Definition at line 108 of file collocated_s1_reconciliation.py.

◆ uscale

collocated_s1_reconciliation.uscale = float(np.abs(U[0][fluid]).mean())

Definition at line 109 of file collocated_s1_reconciliation.py.

◆ rms

dict collocated_s1_reconciliation.rms = {}

Definition at line 112 of file collocated_s1_reconciliation.py.

◆ half

float collocated_s1_reconciliation.half = 0.5 * (U[a] + np.roll(U[a], 1, axis=a))

Definition at line 114 of file collocated_s1_reconciliation.py.

◆ openf

list collocated_s1_reconciliation.openf = OX[a] > 0.0

Definition at line 115 of file collocated_s1_reconciliation.py.

◆ div

collocated_s1_reconciliation.div = np.zeros_like(U[0])

Definition at line 120 of file collocated_s1_reconciliation.py.

◆ flx

list collocated_s1_reconciliation.flx = OX[a] * half

Definition at line 123 of file collocated_s1_reconciliation.py.

◆ axis

collocated_s1_reconciliation.axis

Definition at line 124 of file collocated_s1_reconciliation.py.

◆ divf

collocated_s1_reconciliation.divf = np.zeros_like(U[0])

Definition at line 127 of file collocated_s1_reconciliation.py.

◆ cavg

float collocated_s1_reconciliation.cavg = 0.5 * (UF[a] + np.roll(UF[a], -1, axis=a))

Definition at line 134 of file collocated_s1_reconciliation.py.

◆ d

tuple collocated_s1_reconciliation.d = (U[a] - cavg)

Definition at line 135 of file collocated_s1_reconciliation.py.

◆ near

float collocated_s1_reconciliation.near = fluid & (np.abs(sdf) <= 2.0)

Definition at line 136 of file collocated_s1_reconciliation.py.

◆ bulk

float collocated_s1_reconciliation.bulk = fluid & (np.abs(sdf) > 2.0)

Definition at line 137 of file collocated_s1_reconciliation.py.

◆ lr

collocated_s1_reconciliation.lr = np.log(N / prev["N"])

Definition at line 141 of file collocated_s1_reconciliation.py.

◆ orders

dict collocated_s1_reconciliation.orders
Initial value:
1= {k: np.log(prev[k] / v) / lr for k, v in rms.items()
2 if k in prev and v and prev[k]}

Definition at line 142 of file collocated_s1_reconciliation.py.

◆ flush

collocated_s1_reconciliation.flush

Definition at line 145 of file collocated_s1_reconciliation.py.