flow 1.4.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, full=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
dict TIED_EDGES = {"vof": 78, "blocks": 92}

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 velocity gate is 1e-12 in every row);
     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.
     The three variable-mu variants run with set_viscous_stress('laplacian') and again with 'full'
     (WO-2 of doc/full_viscous_stress.md: the transpose term keeps the mirror symmetry to the same
     bound). The placement gate (2.) pins 'laplacian': its forcing is the Laplacian form.
  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 43 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 48 of file test_mirror_symmetry.py.

Referenced by build(), and mirror_asymmetry().

◆ sphere()

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

Definition at line 56 of file test_mirror_symmetry.py.

Referenced by build().

◆ build()

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

Definition at line 70 of file test_mirror_symmetry.py.

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

Referenced by mirror_asymmetry().

◆ mirror_asymmetry()

test_mirror_symmetry.mirror_asymmetry ( mode,
** kw )

Definition at line 122 of file test_mirror_symmetry.py.

References build(), 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 141 of file test_mirror_symmetry.py.

Referenced by main().

◆ main()

test_mirror_symmetry.main ( )

Definition at line 191 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 38 of file test_mirror_symmetry.py.

◆ NY

test_mirror_symmetry.NY

Definition at line 38 of file test_mirror_symmetry.py.

◆ NZ

test_mirror_symmetry.NZ

Definition at line 38 of file test_mirror_symmetry.py.

◆ DT

test_mirror_symmetry.DT

Definition at line 39 of file test_mirror_symmetry.py.

◆ NSTEPS

test_mirror_symmetry.NSTEPS

Definition at line 39 of file test_mirror_symmetry.py.

◆ R

float test_mirror_symmetry.R = 3.6

Definition at line 40 of file test_mirror_symmetry.py.

◆ TIED_EDGES

dict test_mirror_symmetry.TIED_EDGES = {"vof": 78, "blocks": 92}

Definition at line 119 of file test_mirror_symmetry.py.