|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
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 |
| long | cappedFaces () const |
| Faces whose slope the mass-aware cap scaled in the last step (capped schemes only). | |
| bool | cappedScheme () 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. | |
| void | freezeGhostFlags () |
| The frozen flag on the GHOST shell of every component, H(C^{e,n} - 1/2) from the exchanged shifted colour — the inner formula on the owner's own values, so a ghost flag equals the owner's bitwise and no exchange is needed (note §4.8 item 3). | |
| void | momentumFluxesCapped (const WyAdvector &w, int d, int comp, double dth) |
| momentumFluxes for the capped schemes: the same a and clamped F, then the slopes of note §4.2 ('muscl_phase': per phase; 'muscl_mixed_capped': MinMod of the mixed velocity), the cap of §4.3 and the face values of §4.4 (fluxU_ = uL, fluxUG_ = uG; the mixed variant stores uL == uG into fluxU_ only). | |
| void | momentumUpdatePhase (const WyAdvector &w, int d, int comp) |
| momentumUpdate for 'muscl_phase' (note §4.4): each phase's mass flux carries its own face velocity; everything else — dC, the dilation coefficient, rn, the floor, the division — exactly as in momentumUpdate. | |
| void | momentumFluxesCutCapped (const WyAdvector &w, int d, int comp, double dth) |
| momentumFluxesCut for the capped schemes: masses in cell-volume units (eps_q, at, F openness-weighted), the time-centring on the geometric |a| (note §4.8 item 1). | |
| void | momentumUpdateCutPhase (const WyAdvector &w, int d, int comp) |
| momentumUpdateCut for 'muscl_phase': the per-phase dev of momentumUpdatePhase, divided by the CV's fluid volume exactly as in momentumUpdateCut. | |
| 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 |
| MomentumScheme | momentumScheme = MomentumScheme::MusclPhase |
| The transported face velocity of the momentum flux; MusclPhase by default (note §12). | |
| 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). | |
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 252 of file momentum_advect.hpp.
|
inline |
| w | the colour advector whose block, planes and face velocities are shared |
| rhoG | the density of the C = 0 phase |
| rhoL | the density of the C = 1 phase |
Definition at line 268 of file momentum_advect.hpp.
|
inline |
Definition at line 289 of file momentum_advect.hpp.
Referenced by advect().
|
inline |
Definition at line 290 of file momentum_advect.hpp.
|
inline |
The advected velocity of component e, indexed exactly like the solver's u_e (inner cells).
Definition at line 295 of file momentum_advect.hpp.
|
inline |
The half-shifted colour of component e, same indexing.
Definition at line 297 of file momentum_advect.hpp.
|
inline |
Definition at line 323 of file momentum_advect.hpp.
|
inline |
Definition at line 324 of file momentum_advect.hpp.
|
inline |
Definition at line 325 of file momentum_advect.hpp.
|
inline |
Definition at line 326 of file momentum_advect.hpp.
|
inline |
Faces whose slope the mass-aware cap scaled in the last step (capped schemes only).
Definition at line 328 of file momentum_advect.hpp.
|
inline |
Definition at line 329 of file momentum_advect.hpp.
References momentumScheme, peclet::flow::vof::MusclMixedCapped, and peclet::flow::vof::MusclPhase.
Referenced by advect(), momentumFluxes(), and momentumFluxesCut().
|
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 338 of file momentum_advect.hpp.
References buildShiftedColour(), buildShiftedColourCut(), cappedScheme(), freezeGhostFlags(), freezeShiftedState(), initialized(), peclet::flow::vof::kWySweepPerm, momentumFluxes(), momentumFluxesCut(), momentumUpdate(), momentumUpdateCut(), perm(), and useCellDilationFlag.
|
inline |
Definition at line 397 of file momentum_advect.hpp.
References peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::capped, peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::clamped, peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::floored, peclet::flow::L3(), peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::maxCc, peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::minCc, peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::minRhoC, peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::sumM, peclet::flow::vof::MomentumConsistentAdvector::Diagnostics::sumM0, and peclet::flow::vof::vofPhaseRho().
|
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 452 of file momentum_advect.hpp.
References peclet::flow::L3(), strideOf(), and peclet::flow::vof::vofCellBox().
Referenced by advect().
|
inline |
Freeze flag^e = H(C^{e,n} - 1/2) and seed M = rho^e u^n_e.
Definition at line 481 of file momentum_advect.hpp.
References peclet::flow::L3(), strideOf(), useCellDilationFlag, and peclet::flow::vof::vofPhaseRho().
Referenced by advect().
|
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 521 of file momentum_advect.hpp.
References cappedScheme(), clampFluxes, F, peclet::flow::L3(), momentumFluxesCapped(), momentumScheme, peclet::flow::vof::MusclMixed, strideOf(), peclet::flow::vof::vofCellBox(), and peclet::flow::vof::vofMinmod().
Referenced by advect().
|
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 625 of file momentum_advect.hpp.
References peclet::flow::L3(), momentumScheme, momentumUpdatePhase(), peclet::flow::vof::MusclPhase, rhoFloor, rhoFloorFrac, strideOf(), and peclet::flow::vof::vofPhaseRho().
Referenced by advect().
|
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 715 of file momentum_advect.hpp.
References peclet::flow::L3(), strideOf(), and peclet::flow::vof::vofCellBox().
Referenced by advect().
|
inlinestatic |
The CV's fluid volume eps^e(i) (0 when the whole CV is solid).
Definition at line 752 of file momentum_advect.hpp.
Referenced by momentumFluxesCut(), momentumFluxesCutCapped(), momentumUpdateCut(), and momentumUpdateCutPhase().
|
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 760 of file momentum_advect.hpp.
References cappedScheme(), clampFluxes, cvEps(), F, peclet::flow::L3(), momentumFluxesCutCapped(), momentumScheme, peclet::flow::vof::MusclMixed, strideOf(), peclet::flow::vof::vofCellBox(), and peclet::flow::vof::vofMinmod().
Referenced by advect().
|
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 862 of file momentum_advect.hpp.
References cvEps(), peclet::flow::L3(), momentumScheme, momentumUpdateCutPhase(), peclet::flow::vof::MusclPhase, rhoFloor, rhoFloorFrac, strideOf(), and peclet::flow::vof::vofPhaseRho().
Referenced by advect().
|
inline |
The frozen flag on the GHOST shell of every component, H(C^{e,n} - 1/2) from the exchanged shifted colour — the inner formula on the owner's own values, so a ghost flag equals the owner's bitwise and no exchange is needed (note §4.8 item 3).
On the advector's instance, no fence of its own: the flux kernels that read it are ordered after it on that instance.
Definition at line 915 of file momentum_advect.hpp.
References peclet::flow::L3().
Referenced by advect().
|
inline |
momentumFluxes for the capped schemes: the same a and clamped F, then the slopes of note §4.2 ('muscl_phase': per phase; 'muscl_mixed_capped': MinMod of the mixed velocity), the cap of §4.3 and the face values of §4.4 (fluxU_ = uL, fluxUG_ = uG; the mixed variant stores uL == uG into fluxU_ only).
Definition at line 936 of file momentum_advect.hpp.
References peclet::flow::vof::VofMomCount::capped, peclet::flow::vof::VofMomCount::clamped, clampFluxes, F, peclet::flow::L3(), momentumScheme, peclet::flow::vof::MusclPhase, strideOf(), peclet::flow::vof::vofCellBox(), peclet::flow::vof::vofMinmod(), peclet::flow::vof::vofMomentumCap(), and peclet::flow::vof::vofPhaseSlope().
Referenced by momentumFluxes().
|
inline |
momentumUpdate for 'muscl_phase' (note §4.4): each phase's mass flux carries its own face velocity; everything else — dC, the dilation coefficient, rn, the floor, the division — exactly as in momentumUpdate.
Algebraically equal to that form when uL == uG, not bit-equal.
Definition at line 1047 of file momentum_advect.hpp.
References peclet::flow::L3(), rhoFloor, rhoFloorFrac, strideOf(), and peclet::flow::vof::vofPhaseRho().
Referenced by momentumUpdate().
|
inline |
momentumFluxesCut for the capped schemes: masses in cell-volume units (eps_q, at, F openness-weighted), the time-centring on the geometric |a| (note §4.8 item 1).
Definition at line 1088 of file momentum_advect.hpp.
References peclet::flow::vof::VofMomCount::capped, peclet::flow::vof::VofMomCount::clamped, clampFluxes, cvEps(), F, peclet::flow::L3(), momentumScheme, peclet::flow::vof::MusclPhase, strideOf(), peclet::flow::vof::vofCellBox(), peclet::flow::vof::vofMinmod(), peclet::flow::vof::vofMomentumCap(), and peclet::flow::vof::vofPhaseSlope().
Referenced by momentumFluxesCut().
|
inline |
momentumUpdateCut for 'muscl_phase': the per-phase dev of momentumUpdatePhase, divided by the CV's fluid volume exactly as in momentumUpdateCut.
Definition at line 1208 of file momentum_advect.hpp.
References cvEps(), peclet::flow::L3(), rhoFloor, rhoFloorFrac, strideOf(), and peclet::flow::vof::vofPhaseRho().
Referenced by momentumUpdateCut().
|
inline |
Definition at line 1252 of file momentum_advect.hpp.
Referenced by buildShiftedColour(), buildShiftedColourCut(), freezeShiftedState(), momentumFluxes(), momentumFluxesCapped(), momentumFluxesCut(), momentumFluxesCutCapped(), momentumUpdate(), momentumUpdateCut(), momentumUpdateCutPhase(), and momentumUpdatePhase().
| 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 301 of file momentum_advect.hpp.
Referenced by momentumUpdate(), momentumUpdateCut(), momentumUpdateCutPhase(), and momentumUpdatePhase().
| double peclet::flow::vof::MomentumConsistentAdvector::rhoFloorFrac = 1e-6 |
Definition at line 302 of file momentum_advect.hpp.
Referenced by momentumUpdate(), momentumUpdateCut(), momentumUpdateCutPhase(), and momentumUpdatePhase().
| MomentumScheme peclet::flow::vof::MomentumConsistentAdvector::momentumScheme = MomentumScheme::MusclPhase |
The transported face velocity of the momentum flux; MusclPhase by default (note §12).
See the file header, "The transported velocity in the flux", and doc/vof_momentum_second_order.md.
The measured history of the former opt-in (MinMod of the mixed velocity, MusclMixed): on the uniform-velocity gate at ratio 1e4, 50 steps, double-storage build, its error grew 3.3e-16 -> 6.1e-16 -> 4.3e-14 -> 5.1e-13 -> 2.2e-10 over steps 10..50, while upwind stayed FLAT at 3.3e-16 ... 6.7e-16; at P1 it converged to a wrong limit (+3.0 / +3.1 % at d/h 16 / 24). The cap removes the noise growth (MusclMixedCapped stays at upwind's level) but NOT the wrong limit (G-D refuted the note's §2 attribution of both to the stayer debit; the limit's mechanism is OPEN). MusclPhase (per-phase slopes + the cap) passes both gates.
Definition at line 314 of file momentum_advect.hpp.
Referenced by cappedScheme(), momentumFluxes(), momentumFluxesCapped(), momentumFluxesCut(), momentumFluxesCutCapped(), momentumUpdate(), and momentumUpdateCut().
| 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 317 of file momentum_advect.hpp.
Referenced by advect(), and freezeShiftedState().
| 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 321 of file momentum_advect.hpp.
Referenced by momentumFluxes(), momentumFluxesCapped(), momentumFluxesCut(), and momentumFluxesCutCapped().