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

Classes

class  Geo
 

Functions

 edge_frac (pa, pb)
 
 snap (a)
 
 level_op (ax, ay, unknown, h, periodic, W)
 
 transfers (n, periodic)
 
 build_hierarchy (G, mode, nmin=4)
 
 colour_sets (n)
 
 smooth (A, x, b, sets, order)
 
 vcycle (levels, l, b, singular)
 
 contraction (levels, singular, its=60)
 
 bicgstab_its (levels, singular)
 
 disc_union (centres, R, L)
 

Variables

int SNAP = 1e-3
 
int n = int(sys.argv[1]) if len(sys.argv) > 1 else 128
 
float L = 1.0
 
float off = 0.37 / n
 
dict cases
 
 G = Geo(n, L, sdf, per)
 
str line = f"{name:34s}"
 
 lv = build_hierarchy(G, mode)
 
 rho = contraction(lv, False)
 
 its = bicgstab_its(lv, False)
 
 flush
 

Detailed Description

2-D prototype (architect, Amendment A1 to doc/scalar_ibm_design.md): which coarse construction of
the lumped-probe surrogate's WALL term makes a sound V-cycle?

Surrogate (steady, Lam = 1): S = aperture 5-point Laplacian + diagonal wall sink W_i = alpha_i/s0_i,
alpha_i = |area vector|/h^2 (aperture-consistent), s0 = 1.1 * 1/2 (|n_x|+|n_y|) h (Dirichlet wall).
Coarse constructions compared (same smoother, transfers and exact bottom, so only A_c differs):
  redisc-sL : faces averaged + wall W_C = <alpha / s_L>, s_L = probe distance at the level's H (design ยง5.2)
  avg-s0    : faces averaged + wall W_C = <alpha / s0>   (= variational for piecewise-constant P)
  rap       : Galerkin R A P, R = 4-child average, P = bilinear (zero beyond Dirichlet box faces)
Smoother: 4-colour Gauss-Seidel (colour = (i%2, j%2): race-free for 5- and 9-point), 2 pre (colours
0..3) + 2 post (3..0); bilinear prolongation, pinned cells re-zeroed; exact bottom at 4x4.
Measure: V-cycle contraction rho(I - B S) by power iteration (mean projected out when singular).
Results (n = 64 -> 128) are in doc/scalar_ibm_design.md, Amendment A1.

Function Documentation

◆ edge_frac()

mg_coarse_wall.edge_frac (   pa,
  pb 
)

Definition at line 20 of file mg_coarse_wall.py.

◆ snap()

mg_coarse_wall.snap (   a)

Definition at line 29 of file mg_coarse_wall.py.

◆ level_op()

mg_coarse_wall.level_op (   ax,
  ay,
  unknown,
  h,
  periodic,
  W 
)
5-point per-volume operator on an n x n level, identity rows at pinned cells.

Definition at line 59 of file mg_coarse_wall.py.

Referenced by build_hierarchy().

◆ transfers()

mg_coarse_wall.transfers (   n,
  periodic 
)
R: average of 4 children (nc^2 x n^2); P: cell-centred bilinear (n^2 x nc^2).

Definition at line 87 of file mg_coarse_wall.py.

Referenced by build_hierarchy().

◆ build_hierarchy()

mg_coarse_wall.build_hierarchy (   G,
  mode,
  nmin = 4 
)

Definition at line 108 of file mg_coarse_wall.py.

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

◆ colour_sets()

mg_coarse_wall.colour_sets (   n)

Definition at line 144 of file mg_coarse_wall.py.

Referenced by vcycle().

◆ smooth()

mg_coarse_wall.smooth (   A,
  x,
  b,
  sets,
  order 
)

Definition at line 149 of file mg_coarse_wall.py.

Referenced by vcycle().

◆ vcycle()

mg_coarse_wall.vcycle (   levels,
  l,
  b,
  singular 
)

Definition at line 157 of file mg_coarse_wall.py.

References colour_sets(), mean(), smooth(), and vcycle().

Referenced by bicgstab_its(), contraction(), and vcycle().

◆ contraction()

mg_coarse_wall.contraction (   levels,
  singular,
  its = 60 
)

Definition at line 180 of file mg_coarse_wall.py.

References mean(), and vcycle().

◆ bicgstab_its()

mg_coarse_wall.bicgstab_its (   levels,
  singular 
)

Definition at line 199 of file mg_coarse_wall.py.

References mean(), and vcycle().

◆ disc_union()

mg_coarse_wall.disc_union (   centres,
  R,
  L 
)

Definition at line 211 of file mg_coarse_wall.py.

Variable Documentation

◆ SNAP

int mg_coarse_wall.SNAP = 1e-3

Definition at line 17 of file mg_coarse_wall.py.

◆ n

int mg_coarse_wall.n = int(sys.argv[1]) if len(sys.argv) > 1 else 128

Definition at line 223 of file mg_coarse_wall.py.

◆ L

float mg_coarse_wall.L = 1.0

Definition at line 224 of file mg_coarse_wall.py.

◆ off

float mg_coarse_wall.off = 0.37 / n

Definition at line 225 of file mg_coarse_wall.py.

◆ cases

dict mg_coarse_wall.cases
Initial value:
1= {
2 "box+disc R=L/4 (G1-like)": (disc_union([(0.5 + off, 0.5 + off)], 0.25, L), False, False),
3 "periodic+disc R=L/8": (disc_union([(0.5 + off, 0.5 + off)], 0.125, L), True, False),
4 "periodic+disc R=L/32": (disc_union([(0.5 + off, 0.5 + off)], 1 / 32, L), True, False),
5 "periodic 4x4 dense (R=0.4 pitch)": (disc_union([((k + 0.5) / 4 + off, (m + 0.5) / 4 + off) for k in range(4) for m in range(4)], 0.1, L), True, False),
6 "box, no solid": (lambda x, y: 1.0, False, False),
7 }

Definition at line 226 of file mg_coarse_wall.py.

◆ G

mg_coarse_wall.G = Geo(n, L, sdf, per)

Definition at line 235 of file mg_coarse_wall.py.

◆ line

mg_coarse_wall.line = f"{name:34s}"

Definition at line 236 of file mg_coarse_wall.py.

◆ lv

mg_coarse_wall.lv = build_hierarchy(G, mode)

Definition at line 238 of file mg_coarse_wall.py.

◆ rho

mg_coarse_wall.rho = contraction(lv, False)

Definition at line 239 of file mg_coarse_wall.py.

◆ its

mg_coarse_wall.its = bicgstab_its(lv, False)

Definition at line 240 of file mg_coarse_wall.py.

◆ flush

mg_coarse_wall.flush

Definition at line 242 of file mg_coarse_wall.py.