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

Functions

 stokes_u (x, y, z, comp)
 
 sdf (x, y, z)
 
 face_quadrature (fc, a, h)
 
 run (N, band=3.0)
 

Variables

float R_SPH = 0.3102
 
 C0 = np.array([0.013, -0.007, 0.004])
 
int KQ = 8
 
list Ns = [int(x) for x in (sys.argv[1:] or [32, 48, 64, 96, 128])]
 
 prev = None
 
 r = run(N)
 
dict o = {}
 
 lr = np.log(N / prev["N"])
 
 all
 
 flush
 

Detailed Description

Is the COLLOCATED constraint operator consistent? A-priori, no solver, no time stepping.

The permeability ladders show the collocated schemes converging to a fixed offset rather than to
the staggered/continuum answer. If that offset is real the operator is ZEROTH order -- plain
inconsistent -- so test the operator directly rather than inferring it from a global functional.

Method. Take Stokes flow past a sphere: exactly solenoidal, exactly no-slip at r=R. For a
solenoidal field the EXACT flux balance over the fluid part of any cell is zero,
    sum_faces  Int_{open part of face} u.n dA  =  0
(the wall fragment contributes nothing, u.n = 0 there). So for each near-wall fluid cell compute
that sum with the scheme's MODEL flux in place of the exact one, and the residual IS the operator's
consistency error -- no second discretisation, no periodicity, no solver in the loop.

Model fluxes compared, all on the same aperture geometry:
    exact    Int over the open part, by k x k quadrature on the face  (the reference)
    stag     alpha_f * h^2 * u_a(face centre)          -- face value is a free unknown
    col      alpha_f * h^2 * 1/2 (u_i + u_j)           -- interpolated from cells, solid cells
                                                          masked to 0 as the solver does
    col_nm   as col but WITHOUT the solid-cell mask (uses the analytic continuation) -- isolates
             how much of the defect is the masking rather than the interpolation

Reported per resolution: the L1 flux defect summed over near-wall cells, normalised by the
through-flux u_inf * pi * R^2, i.e. directly comparable to a permeability error in %.

    python tests/study/collocated_constraint_consistency.py [N ...]

Function Documentation

◆ stokes_u()

collocated_constraint_consistency.stokes_u (   x,
  y,
  z,
  comp 
)

Definition at line 37 of file collocated_constraint_consistency.py.

Referenced by face_quadrature(), and run().

◆ sdf()

collocated_constraint_consistency.sdf (   x,
  y,
  z 
)

Definition at line 49 of file collocated_constraint_consistency.py.

Referenced by face_quadrature(), and run().

◆ face_quadrature()

collocated_constraint_consistency.face_quadrature (   fc,
  a,
  h 
)
Exact open-area flux and the planar aperture for faces whose centres are `fc` (3, M).

Definition at line 53 of file collocated_constraint_consistency.py.

References sdf(), and stokes_u().

Referenced by run().

◆ run()

collocated_constraint_consistency.run (   N,
  band = 3.0 
)

Definition at line 69 of file collocated_constraint_consistency.py.

References face_quadrature(), sdf(), and stokes_u().

Variable Documentation

◆ R_SPH

float collocated_constraint_consistency.R_SPH = 0.3102

Definition at line 32 of file collocated_constraint_consistency.py.

◆ C0

collocated_constraint_consistency.C0 = np.array([0.013, -0.007, 0.004])

Definition at line 33 of file collocated_constraint_consistency.py.

◆ KQ

int collocated_constraint_consistency.KQ = 8

Definition at line 34 of file collocated_constraint_consistency.py.

◆ Ns

list collocated_constraint_consistency.Ns = [int(x) for x in (sys.argv[1:] or [32, 48, 64, 96, 128])]

Definition at line 119 of file collocated_constraint_consistency.py.

◆ prev

collocated_constraint_consistency.prev = None

Definition at line 124 of file collocated_constraint_consistency.py.

◆ r

collocated_constraint_consistency.r = run(N)

Definition at line 126 of file collocated_constraint_consistency.py.

◆ o

dict collocated_constraint_consistency.o = {}

Definition at line 127 of file collocated_constraint_consistency.py.

◆ lr

collocated_constraint_consistency.lr = np.log(N / prev["N"])

Definition at line 129 of file collocated_constraint_consistency.py.

◆ all

collocated_constraint_consistency.all

Definition at line 131 of file collocated_constraint_consistency.py.

◆ flush

collocated_constraint_consistency.flush

Definition at line 135 of file collocated_constraint_consistency.py.