flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
peclet::flow::vof::MomentumConsistentAdvector Class Reference

Momentum-consistent companion to WyAdvector. More...

#include <momentum_advect.hpp>

Classes

struct  Diagnostics
 

Public Member Functions

void init (const WyAdvector &w, double rhoG, double rhoL)
 
bool initialized () const
 
void setPhaseDensities (double rhoG, double rhoL)
 
SField advectedVelocity (int e) const
 The advected velocity of component e, indexed exactly like the solver's u_e (inner cells).
 
SField shiftedColour (int e) const
 The half-shifted colour of component e, same indexing.
 
double phaseRhoG () const
 
double phaseRhoL () const
 
double lastRhoFloor () const
 
long clampedFluxes () const
 
void advect (WyAdvector &w, double dt, long step)
 One momentum-consistent Weymouth-Yue step: advances BOTH the colour field inside w and the half-shifted rho^e u_e, sharing the planes, the sweep order and the frozen flag.
 
Diagnostics diagnostics () const
 
void buildShiftedColour (const WyAdvector &w)
 C^e(i) = slab(cell i-s_e, e, [1/2,1]) + slab(cell i, e, [0,1/2]), over the inner region.
 
void freezeShiftedState (const WyAdvector &w)
 Freeze flag^e = H(C^{e,n} - 1/2) and seed M = rho^e u^n_e.
 
void momentumFluxes (const WyAdvector &w, int d, int comp, double dth)
 Face Courant number, geometric liquid flux and momentum flux of the shifted CV of component comp, for a sweep in direction d.
 
void momentumUpdate (const WyAdvector &w, int d, int comp)
 C^e_i += (F_- - F_+) + flag (a_+ - a_-) and M_i += (G_- - G_+) + rho^ u^n_i (a_+ - a_-), with ONE frozen flag and the SAME a in both — see the consistency identity in the header.
 
void buildShiftedColourCut (const WyAdvector &w)
 C^e = [eps(i-s_e) slabHi(i-s_e) + eps(i) slabLo(i)] / eps^e(i) — each half cell's PLIC slab weighted by its OWN fluid volume, then divided by the CV's fluid volume.
 
void momentumFluxesCut (const WyAdvector &w, int d, int comp, double dth)
 Face Courant number, geometric liquid flux and momentum flux on a CUT shifted CV.
 
void momentumUpdateCut (const WyAdvector &w, int d, int comp)
 The cut update: both increments divided by the CV's fluid volume, everything else identical — in particular dev is still a sum of velocity DIFFERENCES, so a uniform field is stationary bit for bit in cut cells too.
 
long strideOf (int d) const
 

Static Public Member Functions

static double cvEps (const SField &ep, const UCField &kd, long i, long se)
 The CV's fluid volume eps^e(i) (0 when the whole CV is solid).
 

Public Attributes

double rhoFloor = 0.0
 Floor on rho^e in the recovery divide, in the same units as the phase densities.
 
double rhoFloorFrac = 1e-6
 
bool momentumMuscl = false
 Opt-in MinMod-limited linear reconstruction of the donor velocity in the momentum flux, instead of the DEFAULT plain donor-cell (first-order upwind) value.
 
bool useCellDilationFlag = false
 Ablation: use the PRESSURE-cell frozen dilation flag H(C^n - 1/2) on the shifted CV instead of the structural analogue H(C^{e,n} - 1/2).
 
bool clampFluxes = true
 Ablation: drop the Weymouth flux clamp of point 3 (the raw geometric flux).
 

Detailed Description

Momentum-consistent companion to WyAdvector.

Owns the half-shifted colour C^e, the conserved momentum rho^e u_e and the recovered advected velocity for the three components, all on the advector's own g = 3 block. Drives the step itself (see the class note in advect_wy.hpp).

Definition at line 167 of file momentum_advect.hpp.

Member Function Documentation

◆ init()

void peclet::flow::vof::MomentumConsistentAdvector::init ( const WyAdvector &  w,
double  rhoG,
double  rhoL 
)
inline
Parameters
wthe colour advector whose block, planes and face velocities are shared
rhoGthe density of the C = 0 phase
rhoLthe density of the C = 1 phase

Definition at line 182 of file momentum_advect.hpp.

References peclet::flow::I3::x, peclet::flow::I3::y, and peclet::flow::I3::z.

Referenced by peclet::flow::Solver< Grid >::buildVofBlock(), and peclet::flow::Solver< Grid >::enableVofMomentum().

◆ initialized()

bool peclet::flow::vof::MomentumConsistentAdvector::initialized ( ) const
inline

Definition at line 202 of file momentum_advect.hpp.

Referenced by advect().

◆ setPhaseDensities()

void peclet::flow::vof::MomentumConsistentAdvector::setPhaseDensities ( double  rhoG,
double  rhoL 
)
inline

◆ advectedVelocity()

SField peclet::flow::vof::MomentumConsistentAdvector::advectedVelocity ( int  e) const
inline

The advected velocity of component e, indexed exactly like the solver's u_e (inner cells).

Definition at line 208 of file momentum_advect.hpp.

Referenced by peclet::flow::Solver< Grid >::advectVofMomentum().

◆ shiftedColour()

SField peclet::flow::vof::MomentumConsistentAdvector::shiftedColour ( int  e) const
inline

The half-shifted colour of component e, same indexing.

Definition at line 210 of file momentum_advect.hpp.

◆ phaseRhoG()

double peclet::flow::vof::MomentumConsistentAdvector::phaseRhoG ( ) const
inline

◆ phaseRhoL()

double peclet::flow::vof::MomentumConsistentAdvector::phaseRhoL ( ) const
inline

◆ lastRhoFloor()

double peclet::flow::vof::MomentumConsistentAdvector::lastRhoFloor ( ) const
inline

Definition at line 243 of file momentum_advect.hpp.

Referenced by peclet::flow::Solver< Grid >::vofRhoFloor().

◆ clampedFluxes()

long peclet::flow::vof::MomentumConsistentAdvector::clampedFluxes ( ) const
inline

Definition at line 244 of file momentum_advect.hpp.

◆ advect()

void peclet::flow::vof::MomentumConsistentAdvector::advect ( WyAdvector &  w,
double  dt,
long  step 
)
inline

One momentum-consistent Weymouth-Yue step: advances BOTH the colour field inside w and the half-shifted rho^e u_e, sharing the planes, the sweep order and the frozen flag.

Replaces WyAdvector::advect(dt, step) — do not call both.

Definition at line 250 of file momentum_advect.hpp.

References buildShiftedColour(), buildShiftedColourCut(), freezeShiftedState(), initialized(), peclet::flow::vof::kWySweepPerm, momentumFluxes(), momentumFluxesCut(), momentumUpdate(), momentumUpdateCut(), and perm().

Referenced by peclet::flow::Solver< Grid >::advectVofMomentum().

◆ diagnostics()

Diagnostics peclet::flow::vof::MomentumConsistentAdvector::diagnostics ( ) const
inline

◆ buildShiftedColour()

void peclet::flow::vof::MomentumConsistentAdvector::buildShiftedColour ( const WyAdvector &  w)
inline

C^e(i) = slab(cell i-s_e, e, [1/2,1]) + slab(cell i, e, [0,1/2]), over the inner region.

Definition at line 353 of file momentum_advect.hpp.

References peclet::flow::L3(), strideOf(), and peclet::flow::vof::vofCellBox().

Referenced by advect().

◆ freezeShiftedState()

void peclet::flow::vof::MomentumConsistentAdvector::freezeShiftedState ( const WyAdvector &  w)
inline

Freeze flag^e = H(C^{e,n} - 1/2) and seed M = rho^e u^n_e.

Definition at line 382 of file momentum_advect.hpp.

References peclet::flow::L3(), strideOf(), useCellDilationFlag, and peclet::flow::vof::vofPhaseRho().

Referenced by advect().

◆ momentumFluxes()

void peclet::flow::vof::MomentumConsistentAdvector::momentumFluxes ( const WyAdvector &  w,
int  d,
int  comp,
double  dth 
)
inline

Face Courant number, geometric liquid flux and momentum flux of the shifted CV of component comp, for a sweep in direction d.

Stored at the CV on the face's -d side, exactly as WyAdvector::computeFluxes stores the colour flux — computing each face ONCE is what makes the sum telescope bit-exactly, in-rank and across a rank boundary alike.

Definition at line 422 of file momentum_advect.hpp.

References clampFluxes, F, peclet::flow::L3(), momentumMuscl, strideOf(), peclet::flow::vof::vofCellBox(), peclet::flow::vof::vofMinmod(), peclet::flow::I3::x, peclet::flow::I3::y, and peclet::flow::I3::z.

Referenced by advect().

◆ momentumUpdate()

void peclet::flow::vof::MomentumConsistentAdvector::momentumUpdate ( const WyAdvector &  w,
int  d,
int  comp 
)
inline

C^e_i += (F_- - F_+) + flag (a_+ - a_-) and M_i += (G_- - G_+) + rho^ u^n_i (a_+ - a_-), with ONE frozen flag and the SAME a in both — see the consistency identity in the header.

Definition at line 522 of file momentum_advect.hpp.

References peclet::flow::L3(), rhoFloor, rhoFloorFrac, strideOf(), and peclet::flow::vof::vofPhaseRho().

Referenced by advect().

◆ buildShiftedColourCut()

void peclet::flow::vof::MomentumConsistentAdvector::buildShiftedColourCut ( const WyAdvector &  w)
inline

C^e = [eps(i-s_e) slabHi(i-s_e) + eps(i) slabLo(i)] / eps^e(i) — each half cell's PLIC slab weighted by its OWN fluid volume, then divided by the CV's fluid volume.

Returns exactly 1 for a uniformly liquid field whatever the geometry.

Definition at line 608 of file momentum_advect.hpp.

References peclet::flow::L3(), strideOf(), and peclet::flow::vof::vofCellBox().

Referenced by advect().

◆ cvEps()

static double peclet::flow::vof::MomentumConsistentAdvector::cvEps ( const SField &  ep,
const UCField &  kd,
long  i,
long  se 
)
inlinestatic

The CV's fluid volume eps^e(i) (0 when the whole CV is solid).

Definition at line 645 of file momentum_advect.hpp.

Referenced by momentumFluxesCut(), and momentumUpdateCut().

◆ momentumFluxesCut()

void peclet::flow::vof::MomentumConsistentAdvector::momentumFluxesCut ( const WyAdvector &  w,
int  d,
int  comp,
double  dth 
)
inline

Face Courant number, geometric liquid flux and momentum flux on a CUT shifted CV.

af(p) is stored ALREADY openness-weighted (it is the o a the dilation term needs); the slab thickness used for the PLIC clipping is the UNWEIGHTED |a|, because that is a geometric length.

Definition at line 653 of file momentum_advect.hpp.

References clampFluxes, cvEps(), F, peclet::flow::L3(), momentumMuscl, strideOf(), peclet::flow::vof::vofCellBox(), peclet::flow::vof::vofMinmod(), peclet::flow::I3::x, peclet::flow::I3::y, and peclet::flow::I3::z.

Referenced by advect().

◆ momentumUpdateCut()

void peclet::flow::vof::MomentumConsistentAdvector::momentumUpdateCut ( const WyAdvector &  w,
int  d,
int  comp 
)
inline

The cut update: both increments divided by the CV's fluid volume, everything else identical — in particular dev is still a sum of velocity DIFFERENCES, so a uniform field is stationary bit for bit in cut cells too.

Definition at line 751 of file momentum_advect.hpp.

References cvEps(), peclet::flow::L3(), rhoFloor, rhoFloorFrac, strideOf(), and peclet::flow::vof::vofPhaseRho().

Referenced by advect().

◆ strideOf()

long peclet::flow::vof::MomentumConsistentAdvector::strideOf ( int  d) const
inline

Member Data Documentation

◆ rhoFloor

double peclet::flow::vof::MomentumConsistentAdvector::rhoFloor = 0.0

Floor on rho^e in the recovery divide, in the same units as the phase densities.

Default 0 means "use `rhoFloorFrac * min(rho_g, rho_l)`".

Definition at line 214 of file momentum_advect.hpp.

Referenced by momentumUpdate(), and momentumUpdateCut().

◆ rhoFloorFrac

double peclet::flow::vof::MomentumConsistentAdvector::rhoFloorFrac = 1e-6

◆ momentumMuscl

bool peclet::flow::vof::MomentumConsistentAdvector::momentumMuscl = false

Opt-in MinMod-limited linear reconstruction of the donor velocity in the momentum flux, instead of the DEFAULT plain donor-cell (first-order upwind) value.

Off by default, and the reason is measured, not stylistic. The velocity update is u_new = u_old + [rho_g (a_- dv_- - a_+ dv_+) + drho (F_- dv_- - F_+ dv_+)]/rho_new with dv = u^ - u_old. On a control volume whose OWN outgoing flux is the donor (a_+ > 0), plain upwind gives u^_+ = u_old and hence dv_+ = 0 EXACTLY. A slope makes dv_+ = (1/2 - |a|/2) * slope, and its coefficient drho F_+ / rho_new is unbounded in the density ratio precisely when the sweep empties the volume (F_+ -> C^e, rho_new -> rho_g) — the volume's residual velocity is then a difference of two liquid-scale momenta. Measured on the uniform-velocity gate at ratio 1e4, 50 steps, in a double-storage build (so the solver's own float floor is out of the picture): with the slope the error grows 3.3e-16 -> 6.1e-16 -> 4.3e-14 -> 5.1e-13 -> 2.2e-10 over steps 10..50; without it, it is FLAT at 3.3e-16 ... 6.7e-16. At ratio 1e3 the slope is harmless (6.1e-15 at 50 steps), so this is a high-ratio robustness choice, not an accuracy verdict — turn it on deliberately and re-run the ratio sweep if you do.

Definition at line 232 of file momentum_advect.hpp.

Referenced by momentumFluxes(), momentumFluxesCut(), and peclet::flow::Solver< Grid >::setVofMomentumMuscl().

◆ useCellDilationFlag

bool peclet::flow::vof::MomentumConsistentAdvector::useCellDilationFlag = false

Ablation: use the PRESSURE-cell frozen dilation flag H(C^n - 1/2) on the shifted CV instead of the structural analogue H(C^{e,n} - 1/2).

See the file header, point 4.

Definition at line 235 of file momentum_advect.hpp.

Referenced by freezeShiftedState(), and peclet::flow::Solver< Grid >::setVofMomentumCellFlag().

◆ clampFluxes

bool peclet::flow::vof::MomentumConsistentAdvector::clampFluxes = true

Ablation: drop the Weymouth flux clamp of point 3 (the raw geometric flux).

Boundedness of C^e is then only O(a^2), which at high density ratio takes rho^e negative — this switch exists so that statement stays a measured number.

Definition at line 239 of file momentum_advect.hpp.

Referenced by momentumFluxes(), momentumFluxesCut(), and peclet::flow::Solver< Grid >::setVofFluxClamp().


The documentation for this class was generated from the following file: