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

Classes

class  Case
 

Functions

 edge_frac (pa, pb)
 
 smoothstep (s)
 
 level_op (n, h, tx, ty, px, mx, py, my, unk, W, omega=None)
 
 transfers (n, prol)
 
 hierarchy (C, pe, mode, prol, nmin=None)
 
 prep (levels)
 
 sweep (lv, x, b, order)
 
 vcycle (levels, l, b, singular, nu, kind=None)
 
 precond (levels, singular, nu)
 
 contraction (A, levels, singular, nu, its=40)
 
 krylov_its (A, levels, singular, nu, method="bicgstab", maxit=300)
 

Variables

int SNAP = 1e-3
 
int NMIN = 4
 
int GAMMA = 1
 
str BOTTOM = "exact"
 

Detailed Description

2-D prototype (architect, Amendment A2 to doc/scalar_ibm_design.md): how should the STEADY cut-cell
scalar solve with implicit first-order upwind (FOU) advection be preconditioned?

Operator (per unit cell volume, D = 1, steady, periodic box [0,1]^2, n x n cells):
  A = aperture 5-point diffusion (a D / h^2 per face)  +  lumped Dirichlet wall sink W = alpha / s0
      (A1's level-0 term; Neumann discs: W = 0, singular)  +  conservative FOU advection from a
      discretely divergence-free face flux f = F/V (node stream function, zero inside the discs,
      no-slip ramp outside them).  The probe off-diagonals are left out on purpose: they are the
      SAME gap at every Pe and the WO-3/4 evidence already prices them (A = S here).
Preconditioners (one V-cycle, BiCGStab on A, rtol 1e-10; the 3-D code's cycle: RB-GS from global
parity, pre nu R->B, post nu B->R, average restriction, bilinear prolongation, pinned re-zeroed,
coarse faces rediscretized, coarse wall = A1 average at s0; bottom 4x4 exact):
  l0only: level 0 = A (FOU couplings), coarse levels = the 'sym' ones (is coarse advection needed?)
  sym   : the shipped WO-5 surrogate - symmetric diffusion + wall + LUMPED outflow on the diagonal,
          the outflow restricted by average onto the coarse levels (WO-5's restrictAvg of omega)
  split : FOU couplings IN the surrogate; coarse advection = the piecewise-constant Galerkin value:
          per coarse face the summed positive parts of the sub-face fluxes, each direction kept
          (q+_C = sum_sub max(f, 0) / N_ratio, q-_C likewise), so every level is a conservative
          M-matrix with zero column sums
  net   : FOU couplings in the surrogate; coarse face flux = summed SIGNED sub-face fluxes, upwinded
  split-pc / split-nu3: piecewise-constant prolongation / 3 + 3 sweeps (variants, not shipped)
Cases: P1 periodic + Dirichlet disc R = L/4 (WO-5's C3 analogue), P2 Neumann 2x2 disc array (closure,
singular), P4 closed-streamline eddies without a solid (singular), P3 the P2 array with Dirichlet discs.
Output per case: BiCGStab iterations [V-cycle contraction rho(I - M^-1 A), power estimate];
"n!(r)" = not converged in 300, true relative residual r.
Run:  python mg_advection.py [n ...] [case prefixes] [variants] [pe=a,b,..] [gmres] [wcycle|fcycle]
      [bottom=sweeps] [nmin=16]        (OMP_NUM_THREADS=4; n = 64..256 for all cases: ~35 s)
Results: doc/scalar_ibm_design.md, Amendment A2 (under ยง6.7). 'split' is what A2 ships.

Function Documentation

◆ edge_frac()

mg_advection.edge_frac (   pa,
  pb 
)
fluid fraction of an edge from its end-node SDF values (> 0 fluid), snapped at 1e-3.

Definition at line 36 of file mg_advection.py.

◆ smoothstep()

mg_advection.smoothstep (   s)

Definition at line 47 of file mg_advection.py.

◆ level_op()

mg_advection.level_op (   n,
  h,
  tx,
  ty,
  px,
  mx,
  py,
  my,
  unk,
  W,
  omega = None 
)
per-volume operator; tx/ty diffusion coefficients (already / h^2), px/mx (py/my) advective
coefficients of the LOW faces: p = flow toward +axis (low cell -> high cell), m = toward -axis.
omega: lumped extra diagonal (the 'sym' baseline). Identity rows on pinned cells.

Definition at line 118 of file mg_advection.py.

Referenced by hierarchy().

◆ transfers()

mg_advection.transfers (   n,
  prol 
)

Definition at line 142 of file mg_advection.py.

Referenced by hierarchy().

◆ hierarchy()

mg_advection.hierarchy (   C,
  pe,
  mode,
  prol,
  nmin = None 
)

Definition at line 161 of file mg_advection.py.

References level_op(), mean(), and transfers().

Referenced by krylov_its().

◆ prep()

mg_advection.prep (   levels)

Definition at line 206 of file mg_advection.py.

Referenced by krylov_its().

◆ sweep()

mg_advection.sweep (   lv,
  x,
  b,
  order 
)

Definition at line 220 of file mg_advection.py.

Referenced by vcycle().

◆ vcycle()

mg_advection.vcycle (   levels,
  l,
  b,
  singular,
  nu,
  kind = None 
)

Definition at line 231 of file mg_advection.py.

References mean(), sweep(), and vcycle().

Referenced by precond(), and vcycle().

◆ precond()

mg_advection.precond (   levels,
  singular,
  nu 
)

Definition at line 264 of file mg_advection.py.

References mean(), and vcycle().

Referenced by contraction(), and krylov_its().

◆ contraction()

mg_advection.contraction (   A,
  levels,
  singular,
  nu,
  its = 40 
)

Definition at line 274 of file mg_advection.py.

References mean(), and precond().

Referenced by krylov_its().

◆ krylov_its()

mg_advection.krylov_its (   A,
  levels,
  singular,
  nu,
  method = "bicgstab",
  maxit = 300 
)

Definition at line 292 of file mg_advection.py.

References contraction(), hierarchy(), krylov_its(), mean(), precond(), and prep().

Referenced by krylov_its().

Variable Documentation

◆ SNAP

int mg_advection.SNAP = 1e-3

Definition at line 32 of file mg_advection.py.

◆ NMIN

int mg_advection.NMIN = 4

Definition at line 158 of file mg_advection.py.

◆ GAMMA

int mg_advection.GAMMA = 1

Definition at line 227 of file mg_advection.py.

◆ BOTTOM

str mg_advection.BOTTOM = "exact"

Definition at line 228 of file mg_advection.py.