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

Functions

 mir_c (f)
 
 mir_v (v)
 
 sphere (c, r, sub=6)
 
 build (mode, mirror, variable_mu=True, harmonic=False)
 
 mirror_asymmetry (mode, **kw)
 
 steady_varmu_error (N, A=1e-3, nz=4)
 
 main ()
 

Variables

 NX
 
 NY
 
 NZ
 
 DT
 
 NSTEPS
 
float R = 3.6
 

Detailed Description

Wall-normal mirror symmetry of the MAC step, and the placement of the variable viscosity.

A bubble column between two walls (y = 0 and y = NY, x/z periodic) collected its bubbles at the
LOW wall -- and so did the same column with every bubble mirrored to the other side. The cause
was the variable-viscosity momentum operator: it averaged mu across the faces of CELL i, but the
staggered unknown u_c(i) lives on the -c face of cell i, so every component saw mu shifted half a
cell towards +c -- first-order accurate, and in a walled direction a mirror asymmetry (VarFaceProps,
src/face_props.hpp). Two checks:

  1. mirror pair -- solver A and its y-mirror B (cell fields reflected, v negated onto the mirrored
     face), same fixed dt, A(y) against mirror(B)(y) after a few steps. Round-off only (~1e-14);
     the shifted viscosity gave 1e-3..1e-2. Variants: single phase with a transported scalar
     driving rho, the body force and (or not) mu, arithmetic and harmonic viscosity means; the
     structured VoF with CSF; the block container with its per-marker CSF. The blob touches the
     LOW wall (the mirror touches the high one) and straddles the periodic x seam.
  2. placement -- steady variable-viscosity Stokes, u = A (sin kx cos ky, -cos kx sin ky, 0),
     mu = 1 + sin(kx + 0.3) cos(ky + 0.7) / 2, forced by -div(mu grad u_c): second order in h
     (the shifted viscosity was first order: 1.39 then 1.05).

Run: OMP_NUM_THREADS=4 PYTHONPATH=<build> python tests/python/test_mirror_symmetry.py
Exit 0 pass, 1 fail, 77 skipped (no module).

Function Documentation

◆ mir_c()

test_mirror_symmetry.mir_c (   f)
Mirror of a cell-centred (and x/z-face) field: row j <-> NY-1-j.

Definition at line 39 of file test_mirror_symmetry.py.

Referenced by build(), and mirror_asymmetry().

◆ mir_v()

test_mirror_symmetry.mir_v (   v)
Mirror of the y-face field: get_v's index j is the face j - 1/2 (index 0 the low wall face),
so the face j maps to NY - j and changes sign.

Definition at line 44 of file test_mirror_symmetry.py.

Referenced by build(), and mirror_asymmetry().

◆ sphere()

test_mirror_symmetry.sphere (   c,
  r,
  sub = 6 
)

Definition at line 52 of file test_mirror_symmetry.py.

Referenced by build().

◆ build()

test_mirror_symmetry.build (   mode,
  mirror,
  variable_mu = True,
  harmonic = False 
)

Definition at line 66 of file test_mirror_symmetry.py.

References mir_c(), mir_v(), and sphere().

◆ mirror_asymmetry()

test_mirror_symmetry.mirror_asymmetry (   mode,
**  kw 
)

Definition at line 106 of file test_mirror_symmetry.py.

References mir_c(), and mir_v().

Referenced by main().

◆ steady_varmu_error()

test_mirror_symmetry.steady_varmu_error (   N,
  A = 1e-3,
  nz = 4 
)

Definition at line 121 of file test_mirror_symmetry.py.

Referenced by main().

◆ main()

test_mirror_symmetry.main ( )

Definition at line 167 of file test_mirror_symmetry.py.

References main(), mirror_asymmetry(), and steady_varmu_error().

Referenced by main().

Variable Documentation

◆ NX

test_mirror_symmetry.NX

Definition at line 34 of file test_mirror_symmetry.py.

◆ NY

test_mirror_symmetry.NY

Definition at line 34 of file test_mirror_symmetry.py.

◆ NZ

test_mirror_symmetry.NZ

Definition at line 34 of file test_mirror_symmetry.py.

◆ DT

test_mirror_symmetry.DT

Definition at line 35 of file test_mirror_symmetry.py.

◆ NSTEPS

test_mirror_symmetry.NSTEPS

Definition at line 35 of file test_mirror_symmetry.py.

◆ R

float test_mirror_symmetry.R = 3.6

Definition at line 36 of file test_mirror_symmetry.py.