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

#include <scalar_mg.hpp>

Classes

struct  Level
struct  Inputs
 Everything build reads from the scalar operator and the geometry record. More...

Public Types

using Fill = std::function<void(CCField)>

Public Member Functions

void setMetric (const double w[3], const double hp[3])
 Per-axis metric (VelocityMG::setMetric): w_a = 1/h_a'^2 and h_a'. Call before init.
void setPeriodic (const bool per[3])
 Periodicity per axis (the flow's domain faces); a non-periodic axis' ghosts are pinned.
void setLevel0Wrap (bool on)
 Declare that the injected level-0 fill is the single-rank periodic wrap of ALL three axes (Solver::fillGhosts: fillAxis on x, y, z, regardless of the domain bc), so the level-0 passes may read the wrapped neighbours directly instead of filling first (WO-9b, wrapReads).
void init (int nx, int ny, int nz, Fill fill0)
 Single-rank level table (VelocityMG::init's rule, no depth cap).
int levels () const
int levelsUsed () const
 Levels the last build set up for the V-cycle (1: level 0 alone, the transient rule).
const Level & level (int L) const
std::vector< C3 > levelRatios () const
 The per-level coarsening ratios (the level table; equal to VelocityMG's on the same grid).
void build (const Inputs &in)
 Rebuild the surrogate on every level from the current operator (the level table is kept).
void apply (CCField z, CCField r)
 z = M^-1 r: one V-cycle on the surrogate (level 0 alone: 2 + 2 sweeps) from z = 0.
void applyTwo (CCField zf, CCField zs, CCField rf, CCField rs)
 The two-field z = M^-1 r (WO-7): one V-cycle on the coupled surrogate from z = 0 (level 0 alone: 2 + 2 two-field sweeps).
void applySurrogateTwo (CCField yf, CCField ys, CCField xf, CCField xs)
 y = S x for the two-field surrogate on level 0 (exchanges x first): y_f = S_ff x_f - W x_s, y_s = S_ss x_s - W x_f.
void applySurrogate (CCField y, CCField x)
 y = S x on level 0 (exchanges x first). For the contraction instrument and tests.
std::vector< double > contraction (int iters, CCField e, CCField t, CCField z)
 Power estimate of the V-cycle's error contraction rho(I - M^-1 S) on the current surrogate (§11 G-iter): e <- e - M^-1 S e from a deterministic pseudo-random start on the unknowns (a function of the GLOBAL index, so decomposition-independent), mean-free when singular.
void vcycle (int L)
void vcycleTwo (int L)
 The two-field V-cycle (WO-7): vcycle's structure on both phases — the same sweeps (the 2x2 block update), restrictAvg / trilinear prolongAdd per phase with its own pins, the mean over BOTH phases' unknowns removed when singular (the null vector is constant in psi).
void restrictZeroX (Level &cs, Level &lv, CCField crhs, CCField fres, CCField cx)
 The coarse rhs = restrictAvg of the fine residual, and the coarse iterate x = 0.
void sweepColor (int L, int rb)
 One colour of red-black Gauss-Seidel on level L: rb = 0 red (global (gx+gy+gz) even), 1 black.
void sweep (int L, bool fwd)
 One full red-black sweep: R -> B forward, B -> R backward.
void fill (int L, CCField f)
 Ghost exchange of a level-L field: level 0 the solver's own; coarse levels the per-level halo (or the single-rank periodic wrap), then 0 on the ghosts beyond a non-periodic global face.
int wrapReads (int L) const
 WO-9b, the fused periodic-wrap reads (flow's A3): the axes (bit a) a level-L pass may read across the block face through the wrapped inner index instead of a filled ghost, or -1 when it must fill first.
int wrapSmooth (int L) const
 A red-black pass reads the wrapped neighbour safely only when it has the OTHER colour (so it still holds what the fill would have copied before the pass): every inner dimension even.
bool touches (const Level &lv, int f) const
 Does this rank's block on level lv touch global face f (0..5 = -x,+x,-y,+y,-z,+z)?
C3 chooseRatio (const bool canA[3], C3 cf) const
void allocate (Level &v, int L)
CCConst unkOf (int L) const
CCConst unkSOf (int L) const
void allocateSolid (Level &v, int L)
 WO-7: the solid-phase arrays of level L (and W on coarse levels), on the first two-field build.
double countUnknownS (int L) const
void removeMeanTwo (int L, CCField f, CCField s)
 f, s -= their joint mean over both phases' unknown cells of level L (the singular two-field problem: the null vector is constant in psi on both phases).
void buildLevel0SolidFaces (const Inputs &in)
 WO-7, level 0: the solid faces AF_a(i) = -(w_a P_a(i)) from the operator's guarded products — the expression of sco::solidBands' AW/AS/AB, so the face form is the band form.
void buildCoarseSolid (const Inputs &in, int L)
 WO-7: the coarse solid phase of level L (after assembleCoarse, which gathered W): pins = max of the children's solid flags; faces = coarsenOpenAvg of the products, w_a(L) times; mass = restrictAvg; AC_s = m + faces + W on solid unknowns; identity rows and W = 0 elsewhere.
void zeroNonPeriodicGhosts (Level &lv, CCField f)
void allSum (double *v, int k) const
double countUnknown (int L) const
void removeMean (int L, CCField f)
 f -= its mean over the unknown cells of level L (CutcellMG::removeMean's form, unweighted).
double norm2 (CCField f) const
void buildLevel0Faces (const Inputs &in)
 Level-0 faces: AF_a(i) = -(Lam w_a a_a(i)) when cells i - st_a and i are both unknowns — the same expression as sco::buildBands' AW/AS/AB, so the face-form sweep is bitwise the band sweep.
bool buildCutLists (const Inputs &in)
 Per coarse level L the overlay rows (cut cells) under each coarse inner cell, in increasing level-0 linear index — the (dz, dy, dx) order in which the wall gather of assembleCoarse visited the descendants — as a CSR over the coarse inner cells (WO-9b).
bool wallKeep (const Inputs &in)
 The gathered coarse wall terms W (and the conjugate W_c) of the last build are reused when their inputs are unchanged BY CONTENT (WO-9b; the caching ruling D-WO3-3 deferred to WO-9): the same cut lists, the same level-0 unknown flags (view), the same two-phase mode and level count, and every per-facet cw (and cc) bitwise equal to the snapshot taken when they were gathered.
void buildPlane0 (const Inputs &in, int f)
 Level-0 Dirichlet boundary plane of face f: <Lam a_bf> = Lam a_bf on unknown boundary cells (sco::dirichletFaceFold's aperture), indexed (j1, j2) over the inner tangential cells.
void buildCoarse (const Inputs &in, int L)
void coarsenAdvection (const Inputs &in, int L)
 A2: Qp/Qm of level L from level L - 1 — level 1 from the guarded positive parts of the level-0 flux, deeper levels from the finer level's Q — by coarsenOpenAvgCell's sum and division in its fixed order, then one multiplication by 1/r_a (r_a the ratio on the face's normal axis): Q = sum_sub max(+-phi, 0) V / V_L.
void assembleBands (int L)
 A2: the coarse bands from the face form (assembleCoarse) and Q.
void coarsenPlane (int L, int f)
void assembleCoarse (const Inputs &in, int L)
 Coarse face form + diagonal: AF_a = -w_a(L) <Lam a> over the full extent; on unknown inner cells AC = m + the six face terms + W (the level-0 facet average) + the Dirichlet folds; pinned cells are identity rows.

Static Public Member Functions

static bool can (int d)
static void tangents (int a, int &t1, int &t2)

Static Public Attributes

static constexpr int G0 = 2
 level 0: the scalar's own block
static constexpr int GC = 1
 coarse levels
static constexpr double kFullTableKappa = 25.0
 The transient level rule (design §5.2, Amendment A3 + ruling D-WO9-3): kappa_A = 1 + 4 dt' D' sum_a w_a below this uses level 0 alone (2 + 2 sweeps), at or above it the full table; steady always the full table.
static constexpr int kMaxLevels = 64
 no depth cap in practice (the full table)
static constexpr int kPre = 2
static constexpr int kPost = 2
static constexpr int kBottom = 16
static constexpr double kAspectTheta = 2.0

Detailed Description

Definition at line 582 of file scalar_mg.hpp.

Member Typedef Documentation

◆ Fill

using peclet::flow::ScalarMG::Fill = std::function<void(CCField)>

Definition at line 595 of file scalar_mg.hpp.

Member Function Documentation

◆ setMetric()

void peclet::flow::ScalarMG::setMetric ( const double w[3],
const double hp[3] )
inline

Per-axis metric (VelocityMG::setMetric): w_a = 1/h_a'^2 and h_a'. Call before init.

Definition at line 630 of file scalar_mg.hpp.

◆ setPeriodic()

void peclet::flow::ScalarMG::setPeriodic ( const bool per[3])
inline

Periodicity per axis (the flow's domain faces); a non-periodic axis' ghosts are pinned.

Definition at line 638 of file scalar_mg.hpp.

◆ setLevel0Wrap()

void peclet::flow::ScalarMG::setLevel0Wrap ( bool on)
inline

Declare that the injected level-0 fill is the single-rank periodic wrap of ALL three axes (Solver::fillGhosts: fillAxis on x, y, z, regardless of the domain bc), so the level-0 passes may read the wrapped neighbours directly instead of filling first (WO-9b, wrapReads).

Definition at line 646 of file scalar_mg.hpp.

◆ init()

void peclet::flow::ScalarMG::init ( int nx,
int ny,
int nz,
Fill fill0 )
inline

Single-rank level table (VelocityMG::init's rule, no depth cap).

Definition at line 649 of file scalar_mg.hpp.

References allocate(), can(), chooseRatio(), G0, GC, kMaxLevels, peclet::flow::C3::x, peclet::flow::C3::y, and peclet::flow::C3::z.

◆ levels()

int peclet::flow::ScalarMG::levels ( ) const
inline

Definition at line 739 of file scalar_mg.hpp.

◆ levelsUsed()

int peclet::flow::ScalarMG::levelsUsed ( ) const
inline

Levels the last build set up for the V-cycle (1: level 0 alone, the transient rule).

Definition at line 741 of file scalar_mg.hpp.

◆ level()

const Level & peclet::flow::ScalarMG::level ( int L) const
inline

Definition at line 742 of file scalar_mg.hpp.

◆ levelRatios()

std::vector< C3 > peclet::flow::ScalarMG::levelRatios ( ) const
inline

The per-level coarsening ratios (the level table; equal to VelocityMG's on the same grid).

Definition at line 744 of file scalar_mg.hpp.

◆ build()

◆ apply()

void peclet::flow::ScalarMG::apply ( CCField z,
CCField r )
inline

z = M^-1 r: one V-cycle on the surrogate (level 0 alone: 2 + 2 sweeps) from z = 0.

r must be 0 on the cells that are not unknowns (the Krylov's identity rows guarantee it); in the singular case it must already be mean-free (the caller projects, and removes z's mean after).

Definition at line 829 of file scalar_mg.hpp.

References peclet::flow::ScalarMG::Level::rhs, sweepColor(), vcycle(), and peclet::flow::ScalarMG::Level::x.

Referenced by contraction().

◆ applyTwo()

void peclet::flow::ScalarMG::applyTwo ( CCField zf,
CCField zs,
CCField rf,
CCField rs )
inline

The two-field z = M^-1 r (WO-7): one V-cycle on the coupled surrogate from z = 0 (level 0 alone: 2 + 2 two-field sweeps).

r must be 0 on each phase's non-unknown cells; in the singular case mean-free over both phases' unknowns.

Definition at line 851 of file scalar_mg.hpp.

References peclet::flow::ScalarMG::Level::rhs, peclet::flow::ScalarMG::Level::rhss, sweepColor(), vcycleTwo(), peclet::flow::ScalarMG::Level::x, and peclet::flow::ScalarMG::Level::xs.

◆ applySurrogateTwo()

◆ applySurrogate()

◆ contraction()

std::vector< double > peclet::flow::ScalarMG::contraction ( int iters,
CCField e,
CCField t,
CCField z )
inline

Power estimate of the V-cycle's error contraction rho(I - M^-1 S) on the current surrogate (§11 G-iter): e <- e - M^-1 S e from a deterministic pseudo-random start on the unknowns (a function of the GLOBAL index, so decomposition-independent), mean-free when singular.

Returns the per-iteration ratios ||e_k|| / ||e_{k-1}|| (2-norm over the unknowns).

Definition at line 926 of file scalar_mg.hpp.

References apply(), applySurrogate(), peclet::flow::ccFor3(), peclet::flow::ScalarMG::Level::ext, peclet::flow::ScalarMG::Level::g, norm2(), peclet::flow::ScalarMG::Level::og, removeMean(), peclet::flow::C3::x, peclet::flow::C3::y, and peclet::flow::C3::z.

◆ vcycle()

◆ vcycleTwo()

void peclet::flow::ScalarMG::vcycleTwo ( int L)
inline

The two-field V-cycle (WO-7): vcycle's structure on both phases — the same sweeps (the 2x2 block update), restrictAvg / trilinear prolongAdd per phase with its own pins, the mean over BOTH phases' unknowns removed when singular (the null vector is constant in psi).

Definition at line 1016 of file scalar_mg.hpp.

References fill(), kBottom, kPost, kPre, peclet::flow::prolongAdd(), removeMeanTwo(), peclet::flow::smg::residualTwo(), restrictZeroX(), unkOf(), unkSOf(), vcycleTwo(), wrapReads(), and peclet::flow::smg::zeroPinned().

Referenced by applyTwo(), and vcycleTwo().

◆ restrictZeroX()

void peclet::flow::ScalarMG::restrictZeroX ( Level & cs,
Level & lv,
CCField crhs,
CCField fres,
CCField cx )
inline

The coarse rhs = restrictAvg of the fine residual, and the coarse iterate x = 0.

Single rank (WO-9b; flow's A5): in ONE kernel over the coarse inner cells (restrictAvgZeroX) — the coarse ghosts are not zeroed, and need not be: every pass fills before reading them or reads the periodic wrap instead, and a non-periodic ghost of x is 0 already (zero-initialized, and fill only ever writes 0 there). Distributed: the plain restriction and the full zero fill.

Definition at line 1066 of file scalar_mg.hpp.

References peclet::flow::restrictAvg(), and peclet::flow::restrictAvgZeroX().

Referenced by vcycle(), and vcycleTwo().

◆ sweepColor()

void peclet::flow::ScalarMG::sweepColor ( int L,
int rb )
inline

One colour of red-black Gauss-Seidel on level L: rb = 0 red (global (gx+gy+gz) even), 1 black.

The kernel's colour counts the ghost offset (lx = gx + g on every axis), hence + 3g.

Definition at line 1077 of file scalar_mg.hpp.

References fill(), peclet::flow::smg::sweepColorBand(), peclet::flow::smg::sweepColorFace(), peclet::flow::smg::sweepColorTwo(), unkOf(), and wrapSmooth().

Referenced by apply(), applyTwo(), and sweep().

◆ sweep()

void peclet::flow::ScalarMG::sweep ( int L,
bool fwd )
inline

One full red-black sweep: R -> B forward, B -> R backward.

Definition at line 1109 of file scalar_mg.hpp.

References sweepColor().

◆ fill()

void peclet::flow::ScalarMG::fill ( int L,
CCField f )
inline

Ghost exchange of a level-L field: level 0 the solver's own; coarse levels the per-level halo (or the single-rank periodic wrap), then 0 on the ghosts beyond a non-periodic global face.

Definition at line 1116 of file scalar_mg.hpp.

References peclet::flow::smg::fillShell(), and zeroNonPeriodicGhosts().

Referenced by applySurrogate(), applySurrogateTwo(), buildCoarse(), buildCoarseSolid(), coarsenAdvection(), sweepColor(), vcycle(), and vcycleTwo().

◆ wrapReads()

int peclet::flow::ScalarMG::wrapReads ( int L) const
inline

WO-9b, the fused periodic-wrap reads (flow's A3): the axes (bit a) a level-L pass may read across the block face through the wrapped inner index instead of a filled ghost, or -1 when it must fill first.

Single rank only. Coarse levels: the periodic axes (a non-periodic ghost of x is 0 — zeroed with x before its level's cycle and only ever rewritten to 0 by fill — which the pass reads in place). Level 0: all three axes when the injected fill is the single-rank periodic wrap of every axis (setLevel0Wrap), else -1. A read-only pass (residual) needs nothing more.

Definition at line 1139 of file scalar_mg.hpp.

Referenced by vcycle(), vcycleTwo(), and wrapSmooth().

◆ wrapSmooth()

int peclet::flow::ScalarMG::wrapSmooth ( int L) const
inline

A red-black pass reads the wrapped neighbour safely only when it has the OTHER colour (so it still holds what the fill would have copied before the pass): every inner dimension even.

Definition at line 1154 of file scalar_mg.hpp.

References wrapReads().

Referenced by sweepColor().

◆ touches()

bool peclet::flow::ScalarMG::touches ( const Level & lv,
int f ) const
inline

Does this rank's block on level lv touch global face f (0..5 = -x,+x,-y,+y,-z,+z)?

Definition at line 1162 of file scalar_mg.hpp.

Referenced by assembleCoarse(), build(), buildCoarse(), buildCoarseSolid(), coarsenAdvection(), and zeroNonPeriodicGhosts().

◆ can()

bool peclet::flow::ScalarMG::can ( int d)
inlinestatic

Definition at line 1174 of file scalar_mg.hpp.

Referenced by init().

◆ chooseRatio()

C3 peclet::flow::ScalarMG::chooseRatio ( const bool canA[3],
C3 cf ) const
inline

Definition at line 1175 of file scalar_mg.hpp.

References kAspectTheta, and peclet::flow::CutcellMG::mgChooseRatio().

Referenced by init().

◆ allocate()

void peclet::flow::ScalarMG::allocate ( Level & v,
int L )
inline

Definition at line 1181 of file scalar_mg.hpp.

Referenced by init().

◆ unkOf()

CCConst peclet::flow::ScalarMG::unkOf ( int L) const
inline

Definition at line 1203 of file scalar_mg.hpp.

Referenced by countUnknown(), removeMean(), removeMeanTwo(), sweepColor(), vcycle(), and vcycleTwo().

◆ unkSOf()

CCConst peclet::flow::ScalarMG::unkSOf ( int L) const
inline

Definition at line 1204 of file scalar_mg.hpp.

Referenced by countUnknownS(), removeMeanTwo(), and vcycleTwo().

◆ allocateSolid()

void peclet::flow::ScalarMG::allocateSolid ( Level & v,
int L )
inline

WO-7: the solid-phase arrays of level L (and W on coarse levels), on the first two-field build.

Definition at line 1208 of file scalar_mg.hpp.

Referenced by buildCoarse(), and buildLevel0SolidFaces().

◆ countUnknownS()

double peclet::flow::ScalarMG::countUnknownS ( int L) const
inline

Definition at line 1228 of file scalar_mg.hpp.

References allSum(), peclet::flow::ccReduce3(), and unkSOf().

Referenced by build(), and buildCoarseSolid().

◆ removeMeanTwo()

void peclet::flow::ScalarMG::removeMeanTwo ( int L,
CCField f,
CCField s )
inline

f, s -= their joint mean over both phases' unknown cells of level L (the singular two-field problem: the null vector is constant in psi on both phases).

Definition at line 1247 of file scalar_mg.hpp.

References allSum(), peclet::flow::ccFor3(), peclet::flow::ccReduce3(), mean(), unkOf(), and unkSOf().

Referenced by vcycleTwo().

◆ buildLevel0SolidFaces()

void peclet::flow::ScalarMG::buildLevel0SolidFaces ( const Inputs & in)
inline

WO-7, level 0: the solid faces AF_a(i) = -(w_a P_a(i)) from the operator's guarded products — the expression of sco::solidBands' AW/AS/AB, so the face form is the band form.

Definition at line 1278 of file scalar_mg.hpp.

References peclet::flow::ScalarMG::Level::AFXs, peclet::flow::ScalarMG::Level::AFYs, peclet::flow::ScalarMG::Level::AFZs, allocateSolid(), peclet::flow::ccFor3(), peclet::flow::ScalarMG::Level::ext, peclet::flow::ScalarMG::Inputs::spx, peclet::flow::ScalarMG::Inputs::spy, and peclet::flow::ScalarMG::Inputs::spz.

Referenced by build().

◆ buildCoarseSolid()

void peclet::flow::ScalarMG::buildCoarseSolid ( const Inputs & in,
int L )
inline

◆ zeroNonPeriodicGhosts()

void peclet::flow::ScalarMG::zeroNonPeriodicGhosts ( Level & lv,
CCField f )
inline

Definition at line 1359 of file scalar_mg.hpp.

References touches(), and peclet::flow::smg::zeroPlanes().

Referenced by fill().

◆ allSum()

void peclet::flow::ScalarMG::allSum ( double * v,
int k ) const
inline

Definition at line 1372 of file scalar_mg.hpp.

Referenced by countUnknown(), countUnknownS(), norm2(), removeMean(), and removeMeanTwo().

◆ countUnknown()

double peclet::flow::ScalarMG::countUnknown ( int L) const
inline

Definition at line 1384 of file scalar_mg.hpp.

References allSum(), peclet::flow::ccReduce3(), and unkOf().

Referenced by build(), and buildCoarse().

◆ removeMean()

void peclet::flow::ScalarMG::removeMean ( int L,
CCField f )
inline

f -= its mean over the unknown cells of level L (CutcellMG::removeMean's form, unweighted).

Definition at line 1401 of file scalar_mg.hpp.

References allSum(), peclet::flow::ccFor3(), peclet::flow::ccReduce3(), mean(), and unkOf().

Referenced by contraction(), and vcycle().

◆ norm2()

double peclet::flow::ScalarMG::norm2 ( CCField f) const
inline

Definition at line 1427 of file scalar_mg.hpp.

References allSum(), and peclet::flow::ccReduce3().

Referenced by contraction().

◆ buildLevel0Faces()

void peclet::flow::ScalarMG::buildLevel0Faces ( const Inputs & in)
inline

Level-0 faces: AF_a(i) = -(Lam w_a a_a(i)) when cells i - st_a and i are both unknowns — the same expression as sco::buildBands' AW/AS/AB, so the face-form sweep is bitwise the band sweep.

Written over the full extent (index 0 of each axis: 0).

Definition at line 1447 of file scalar_mg.hpp.

References peclet::flow::ScalarMG::Level::AFX, peclet::flow::ScalarMG::Level::AFY, peclet::flow::ScalarMG::Level::AFZ, peclet::flow::ccFor3(), peclet::flow::ScalarMG::Level::ext, peclet::flow::ScalarMG::Inputs::lam, peclet::flow::ScalarMG::Inputs::sax, peclet::flow::ScalarMG::Inputs::say, peclet::flow::ScalarMG::Inputs::saz, and peclet::flow::ScalarMG::Inputs::unknown.

Referenced by build().

◆ buildCutLists()

bool peclet::flow::ScalarMG::buildCutLists ( const Inputs & in)
inline

Per coarse level L the overlay rows (cut cells) under each coarse inner cell, in increasing level-0 linear index — the (dz, dy, dx) order in which the wall gather of assembleCoarse visited the descendants — as a CSR over the coarse inner cells (WO-9b).

The gather then visits only the cut descendants, in the same order: the same additions, bitwise, at O(cut cells) per level instead of O(N0) (the former loop over every descendant ran one serial thread per coarse cell: 30 ms per advance on the GPU at 128^3, most of it on the deepest levels). Geometry only: built once per facet overlay (its cutCell view and count), on the host. Returns whether it (re)built them.

Definition at line 1475 of file scalar_mg.hpp.

References peclet::flow::ScalarMG::Level::ext, peclet::flow::ScalarMG::Inputs::fac, peclet::flow::ScalarMG::Level::g, peclet::flow::ScalarMG::Level::inner, peclet::flow::C3::x, peclet::flow::C3::y, and peclet::flow::C3::z.

Referenced by build().

◆ wallKeep()

bool peclet::flow::ScalarMG::wallKeep ( const Inputs & in)
inline

The gathered coarse wall terms W (and the conjugate W_c) of the last build are reused when their inputs are unchanged BY CONTENT (WO-9b; the caching ruling D-WO3-3 deferred to WO-9): the same cut lists, the same level-0 unknown flags (view), the same two-phase mode and level count, and every per-facet cw (and cc) bitwise equal to the snapshot taken when they were gathered.

W is a pure function of those, so the reuse is bitwise; under advection only the mass changes from step to step, and the gather — O(cut cells) per level, serial per coarse cell — then runs only when a wall setting or dt-independent table actually changes. One reduction per build.

Definition at line 1539 of file scalar_mg.hpp.

References peclet::flow::ScalarMG::Inputs::fac, peclet::flow::ScalarMG::Inputs::facetC, peclet::flow::ScalarMG::Inputs::facetW, same(), peclet::flow::ScalarMG::Inputs::twoPhase, and peclet::flow::ScalarMG::Inputs::unknown.

Referenced by build().

◆ buildPlane0()

void peclet::flow::ScalarMG::buildPlane0 ( const Inputs & in,
int f )
inline

◆ tangents()

void peclet::flow::ScalarMG::tangents ( int a,
int & t1,
int & t2 )
inlinestatic

Definition at line 1608 of file scalar_mg.hpp.

Referenced by assembleCoarse(), buildPlane0(), and coarsenPlane().

◆ buildCoarse()

◆ coarsenAdvection()

void peclet::flow::ScalarMG::coarsenAdvection ( const Inputs & in,
int L )
inline

A2: Qp/Qm of level L from level L - 1 — level 1 from the guarded positive parts of the level-0 flux, deeper levels from the finer level's Q — by coarsenOpenAvgCell's sum and division in its fixed order, then one multiplication by 1/r_a (r_a the ratio on the face's normal axis): Q = sum_sub max(+-phi, 0) V / V_L.

Then the ghosts (exchange / wrap, 0 beyond a non-periodic global face) and the low-face plane of every non-periodic axis zeroed, as the face products are.

Definition at line 1697 of file scalar_mg.hpp.

References peclet::flow::ccFor3(), peclet::flow::coarsenOpenAvgCell(), peclet::flow::ScalarMG::Level::ext, fill(), peclet::flow::ScalarMG::Level::g, peclet::flow::ScalarMG::Inputs::phi, peclet::flow::ScalarMG::Level::qm, peclet::flow::ScalarMG::Level::qp, peclet::flow::ScalarMG::Level::ratio, touches(), peclet::flow::ScalarMG::Inputs::unknown, and peclet::flow::smg::zeroPlanes().

Referenced by buildCoarse().

◆ assembleBands()

void peclet::flow::ScalarMG::assembleBands ( int L)
inline

A2: the coarse bands from the face form (assembleCoarse) and Q.

Unknown inner cells: AC += ((Qm_x(i) + Qp_x(i+e_x)) + (Qm_y(i) + Qp_y(i+e_y))) + (Qm_z(i) + Qp_z(i+e_z)), AW = AFX(i) - Qp_x(i), AE = AFX(i+e_x) - Qm_x(i+e_x) (y, z alike); pinned rows stay identity rows (AC = 1, bands 0).

Definition at line 1758 of file scalar_mg.hpp.

References AC, and peclet::flow::ccFor3().

Referenced by buildCoarse().

◆ coarsenPlane()

void peclet::flow::ScalarMG::coarsenPlane ( int L,
int f )
inline

◆ assembleCoarse()

void peclet::flow::ScalarMG::assembleCoarse ( const Inputs & in,
int L )
inline

Coarse face form + diagonal: AF_a = -w_a(L) <Lam a> over the full extent; on unknown inner cells AC = m + the six face terms + W (the level-0 facet average) + the Dirichlet folds; pinned cells are identity rows.

Definition at line 1828 of file scalar_mg.hpp.

References AC, peclet::flow::ccFor3(), peclet::flow::scg::ScalarFacetOverlay::cellFacetStart, peclet::flow::scg::ScalarFacetOverlay::cutCell, peclet::flow::ScalarMG::Inputs::fac, peclet::flow::ScalarMG::Inputs::facetC, peclet::flow::ScalarMG::Inputs::facetW, tangents(), touches(), and peclet::flow::ScalarMG::Inputs::unknown.

Referenced by buildCoarse().

Member Data Documentation

◆ G0

int peclet::flow::ScalarMG::G0 = 2
staticconstexpr

level 0: the scalar's own block

Definition at line 584 of file scalar_mg.hpp.

Referenced by init().

◆ GC

int peclet::flow::ScalarMG::GC = 1
staticconstexpr

coarse levels

Definition at line 585 of file scalar_mg.hpp.

Referenced by init().

◆ kFullTableKappa

double peclet::flow::ScalarMG::kFullTableKappa = 25.0
staticconstexpr

The transient level rule (design §5.2, Amendment A3 + ruling D-WO9-3): kappa_A = 1 + 4 dt' D' sum_a w_a below this uses level 0 alone (2 + 2 sweeps), at or above it the full table; steady always the full table.

Measured (D-WO9-2, 128^3 bed, koren, host OpenMP 2 threads, per advance, level 0 vs full): kappa 7: 1.05-1.24 vs 1.93 s; 13: 1.23 vs 1.69 s (10/9 vs 9 iterations); 25: 1.35-1.55 vs 1.86-2.04 s (10-12 vs 9-10); 49: tie (15 vs 10 iterations); 97: 2.5 vs 2.05 s (21 vs 12). D-WO9-3 relaxed G-iter's COLD first step to <= 12 (warm steps stay <= 10; level 0 at kappa 13 takes 11 cold, 9 warm), so the switch moves to 25, the largest measured kappa at which level 0 is measurably cheaper (at 49 the two tie). Was 13 (D-WO9-2).

Definition at line 594 of file scalar_mg.hpp.

Referenced by peclet::flow::scd::mgInputs().

◆ kMaxLevels

int peclet::flow::ScalarMG::kMaxLevels = 64
staticconstexpr

no depth cap in practice (the full table)

Definition at line 1171 of file scalar_mg.hpp.

Referenced by init().

◆ kPre

int peclet::flow::ScalarMG::kPre = 2
staticconstexpr

Definition at line 1172 of file scalar_mg.hpp.

Referenced by vcycle(), and vcycleTwo().

◆ kPost

int peclet::flow::ScalarMG::kPost = 2
static

Definition at line 1172 of file scalar_mg.hpp.

Referenced by vcycle(), and vcycleTwo().

◆ kBottom

int peclet::flow::ScalarMG::kBottom = 16
static

Definition at line 1172 of file scalar_mg.hpp.

Referenced by vcycle(), and vcycleTwo().

◆ kAspectTheta

double peclet::flow::ScalarMG::kAspectTheta = 2.0
staticconstexpr

Definition at line 1179 of file scalar_mg.hpp.

Referenced by chooseRatio().


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