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

Functions

 radius (N)
 
 point_grid (N, c)
 
 nimg (d, N)
 
 sdf_at (N, X, Y, Z)
 
 exact_crossings (N)
 
 exact_openness (N)
 
 run (N, scheme, warm_tol=1e-7, tail=40, max_steps=5000, dt=80.0)
 
 sample_ref (ref, refN, N, comp)
 
 norms (fields, refs, refN, N)
 
 main ()
 

Variables

float PHI = 0.125
 
float MU = 0.1
 
int F = 1e-3
 
float KREF = 4.2920
 
 HERE = os.path.dirname(os.path.abspath(__file__))
 

Detailed Description

Zick & Homsy comparison with ANALYTIC-SDF exact IBM points: cut-cell vs ghost (1,1)/(1,2)/(2,2).

Exact geometry for the simple-cubic sphere lattice (phi = 0.125), all in grid units:
  * exact wall crossings t[c][k] (line-sphere intersection, nearest image) feed
    set_exact_crossings -> exact theta in BOTH the momentum cut-cell stencil and the
    ghost-projection closures (replaces the O(h^2) linear-interp anchoring);
  * exact face apertures (analytic disk-chord integration) feed set_openness_override ->
    the cut-cell projection's openness is exact.

Reports, per scheme and N: Z&H drag error, and L1/L2/Linf norms of the velocity and pressure
fields against a fine cut-cell-exact reference (default N=192), interpolated to the coarse
sample points by periodic cubic splines (scipy map_coordinates, grid-wrap). Norms over fluid
sample points, relative to the reference field's rms on the same mask; pressure mean-aligned.
Linf additionally reported on the interior fluid (sdf > 2 h_coarse) because the reference
spline carries O(h_ref^2) kink error in the first wall band. Pairwise Richardson orders.

Run:  SDFLOW_BUILD=build_cuda2 python tests/study/staggered_zh_exact_norms.py [--quick]
      (--run-ref to (re)compute the reference; otherwise loaded from zh_exact_ref_N<ref>.npz)

Function Documentation

◆ radius()

staggered_zh_exact_norms.radius (   N)

Definition at line 38 of file staggered_zh_exact_norms.py.

Referenced by exact_crossings(), exact_openness(), run(), and sdf_at().

◆ point_grid()

staggered_zh_exact_norms.point_grid (   N,
  c 
)
Staggered point coordinates for component c (or cell centers for c=None).

Definition at line 43 of file staggered_zh_exact_norms.py.

Referenced by exact_crossings(), exact_openness(), norms(), and run().

◆ nimg()

staggered_zh_exact_norms.nimg (   d,
  N 
)

Definition at line 52 of file staggered_zh_exact_norms.py.

Referenced by exact_crossings(), exact_openness(), and sdf_at().

◆ sdf_at()

staggered_zh_exact_norms.sdf_at (   N,
  X,
  Y,
  Z 
)

Definition at line 56 of file staggered_zh_exact_norms.py.

References nimg(), and radius().

Referenced by exact_openness(), norms(), and run().

◆ exact_crossings()

staggered_zh_exact_norms.exact_crossings (   N)
t[(c*3+k)*n + i]: exact crossing fraction from component-c staggered point i toward its
+k neighbour (NaN = no sign change). Line-sphere with nearest image; roots of
t^2 + 2 t d_k + |d|^2 - R^2 = 0 restricted to the sign-changing segment.

Definition at line 61 of file staggered_zh_exact_norms.py.

References nimg(), point_grid(), and radius().

Referenced by run().

◆ exact_openness()

staggered_zh_exact_norms.exact_openness (   N)
Exact fluid area fraction of every -a face (analytic chord integral of the disk cut,
1024-pt midpoint rule; faces are unit squares in grid units).

Definition at line 94 of file staggered_zh_exact_norms.py.

References nimg(), point_grid(), radius(), and sdf_at().

Referenced by run().

◆ run()

staggered_zh_exact_norms.run (   N,
  scheme,
  warm_tol = 1e-7,
  tail = 40,
  max_steps = 5000,
  dt = 80.0 
)

Definition at line 141 of file staggered_zh_exact_norms.py.

References exact_crossings(), exact_openness(), point_grid(), radius(), and sdf_at().

Referenced by main().

◆ sample_ref()

staggered_zh_exact_norms.sample_ref (   ref,
  refN,
  N,
  comp 
)
Cubic-spline (periodic) sample of a reference field at the N-grid points of comp.

Definition at line 181 of file staggered_zh_exact_norms.py.

Referenced by norms().

◆ norms()

staggered_zh_exact_norms.norms (   fields,
  refs,
  refN,
  N 
)
Relative L1/L2/Linf of velocity (3 comps pooled) and pressure vs the reference.
The solver works in grid units (dx = 1), so each N is a RESCALED physical problem:
u ~ F N^2/mu and p ~ F N. Nondimensionalize by bringing the coarse fields to the
reference scale (u * (refN/N)^2, p * refN/N) before differencing.

Definition at line 199 of file staggered_zh_exact_norms.py.

References point_grid(), sample_ref(), and sdf_at().

Referenced by main().

◆ main()

staggered_zh_exact_norms.main ( )

Definition at line 249 of file staggered_zh_exact_norms.py.

References main(), norms(), and run().

Referenced by main().

Variable Documentation

◆ PHI

float staggered_zh_exact_norms.PHI = 0.125

Definition at line 31 of file staggered_zh_exact_norms.py.

◆ MU

float staggered_zh_exact_norms.MU = 0.1

Definition at line 32 of file staggered_zh_exact_norms.py.

◆ F

int staggered_zh_exact_norms.F = 1e-3

Definition at line 33 of file staggered_zh_exact_norms.py.

◆ KREF

float staggered_zh_exact_norms.KREF = 4.2920

Definition at line 34 of file staggered_zh_exact_norms.py.

◆ HERE

staggered_zh_exact_norms.HERE = os.path.dirname(os.path.abspath(__file__))

Definition at line 35 of file staggered_zh_exact_norms.py.