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

Functions

 make (cls, N, variable, dt, drag=False)
 
 set_cell (s, name, a)
 
 run_steady (s, tol=1e-13, max_steps=2000)
 
 tg_force (N, A)
 
 tg_case (cls, N, variable, A=1e-3)
 
 placement (cls, variable, N=16)
 
 tg_error (cls, N, variable, A=1e-3)
 
 drag_case (cls, variable, N=16, U0=0.1)
 
 cases ()
 
 main ()
 
 test_cell_force_placement ()
 

Variables

int NZ = 4
 
float MU = 1.0
 
 SKIP = set()
 

Detailed Description

Placement of the per-cell body force and drag coefficient in the momentum equation.

The per-cell fields ``force_x/y/z`` (enable_cell_force; the CFD-DEM drag feedback, Boussinesq) and
``drag_beta`` (enable_drag) live at CELL CENTRES. The velocity unknown they act on does not always:

  * staggered (MAC): u_c(i) is the face between cells i - e_c and i, so the force it feels is the
    second-order face interpolant 0.5*(f(i - e_c) + f(i)) -- and the implicit drag coefficient on
    its diagonal is the same face mean of beta, so the drag target beta*u_p and the diagonal agree;
  * collocated: u_c(i) is the cell centre, so it feels the cell value f(i).

The placement follows the GRID, never the density model (the constant- and variable-density RHS
builders used to disagree). Three checks, each on both density models:

  1. placement -- a Taylor-Green force f = A (sin kx cos ky, -cos kx sin ky, 0) sampled at the cell
     centres. Its face mean on the MAC grid (and its cell values under the collocated ABC face
     interpolation) is EXACTLY discretely solenoidal, so the steady Stokes state is p = 0 and
     u = F / (mu * lam_h), lam_h = (8/h^2) sin^2(kh/2) -- the force actually placed is recovered
     pointwise as mu * lam_h * u and compared with the two candidates (cell value, face mean);
  2. convergence -- the same steady state against the continuum u = f(x_u) / (2 mu k^2) at the
     velocity's own location, N = 16, 32, 64: second order (a half-cell shift is first order);
  3. drag consistency -- beta = 2 + sin(kx) cos(ky), force_x = beta * U0 (a uniform particle velocity):
     the exact steady state is u = U0 everywhere iff the RHS target and the diagonal carry the SAME
     beta at the velocity's location.

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

Function Documentation

◆ make()

test_cell_force_placement.make (   cls,
  N,
  variable,
  dt,
  drag = False 
)

Definition at line 43 of file test_cell_force_placement.py.

Referenced by drag_case(), and tg_case().

◆ set_cell()

test_cell_force_placement.set_cell (   s,
  name,
  a 
)

Definition at line 60 of file test_cell_force_placement.py.

Referenced by drag_case(), and tg_case().

◆ run_steady()

test_cell_force_placement.run_steady (   s,
  tol = 1e-13,
  max_steps = 2000 
)

Definition at line 65 of file test_cell_force_placement.py.

Referenced by drag_case(), and tg_case().

◆ tg_force()

test_cell_force_placement.tg_force (   N,
  A 
)

Definition at line 76 of file test_cell_force_placement.py.

Referenced by tg_case().

◆ tg_case()

test_cell_force_placement.tg_case (   cls,
  N,
  variable,
  A = 1e-3 
)
Steady Stokes under the Taylor-Green force. Returns (u, v, k, fx, fy).

Definition at line 86 of file test_cell_force_placement.py.

References make(), run_steady(), set_cell(), and tg_force().

Referenced by placement(), and tg_error().

◆ placement()

test_cell_force_placement.placement (   cls,
  variable,
  N = 16 
)
Relative misfit of the recovered placed force against (cell value, face mean).

Definition at line 98 of file test_cell_force_placement.py.

References tg_case().

Referenced by main().

◆ tg_error()

test_cell_force_placement.tg_error (   cls,
  N,
  variable,
  A = 1e-3 
)
Max error of the steady velocity vs the continuum solution at the velocity's location.

Definition at line 113 of file test_cell_force_placement.py.

References tg_case().

Referenced by main().

◆ drag_case()

test_cell_force_placement.drag_case (   cls,
  variable,
  N = 16,
  U0 = 0.1 
)

Definition at line 126 of file test_cell_force_placement.py.

References make(), run_steady(), and set_cell().

Referenced by main().

◆ cases()

test_cell_force_placement.cases ( )

Definition at line 149 of file test_cell_force_placement.py.

Referenced by main().

◆ main()

test_cell_force_placement.main ( )

Definition at line 158 of file test_cell_force_placement.py.

References cases(), drag_case(), placement(), and tg_error().

Referenced by test_cell_force_placement().

◆ test_cell_force_placement()

test_cell_force_placement.test_cell_force_placement ( )

Definition at line 194 of file test_cell_force_placement.py.

References main().

Variable Documentation

◆ NZ

int test_cell_force_placement.NZ = 4

Definition at line 39 of file test_cell_force_placement.py.

◆ MU

float test_cell_force_placement.MU = 1.0

Definition at line 40 of file test_cell_force_placement.py.

◆ SKIP

test_cell_force_placement.SKIP = set()

Definition at line 146 of file test_cell_force_placement.py.