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

Classes

struct  GuardedPart
 Level-0 guarded positive part of the signed low-face flux: P(i) = max(sgn phi_a(i), 0) when cells i - st and i are both fluid unknowns (advectionBands' implicit-coupling predicate in steady mode), else 0. More...
 
struct  GuardedProduct
 Level-0 guarded face product Lam a (no metric weight): the face between cell i - st and cell i carries Lam a only when both are unknowns (sco::buildBands' guard). More...
 
struct  MassField
 Level-0 mass m = kappa idt on unknowns, 0 elsewhere (read by restrictAvgCell). More...
 
struct  Nb
 Neighbour indices of an inner cell for the fused periodic-wrap reads (WO-9b; flow's A3, ccWrapNbrs, here per axis): on an axis whose bit is set in wrap the neighbour of a boundary cell across the block face is the inner cell the single-rank ghost fill copies into that ghost, on every other axis it is the ghost index itself (wrap = 0: the plain i +- s). More...
 

Functions

template<class FV >
void restrictMax (CCField coarse, const FV &fine, C3 cext, C3 fext, int gc, int gf, C3 cinner, C3 ratio)
 coarse flag = max of the children's flags (1 unknown, 0 pinned), over the coarse inner cells.
 
void zeroPinned (CCField x, CCConst unk, C3 e, int g)
 x(i) = 0 on the inner cells that are not unknowns (re-zero the pinned cells).
 
void zeroPlanes (CCField f, C3 e, int a, int lo, int hi)
 f = 0 on the planes [lo, hi) of axis a (full transverse extent).
 
void fillShell (CCField f, C3 e, C3 inner, int g, const bool per[3])
 The single-rank ghost fill of a level in ONE launch (WO-9b; CutcellMG::fillWrap's form): a ghost cell with a coordinate in the ghost layer of a NON-periodic axis takes 0, every other ghost cell the value of the inner cell its three coordinates wrap to.
 
Nb nbrs (int lx, int ly, int lz, C3 n, int g, long i, long sy, long sz, int wrap)
 
Nb nbrsOn (int lx, int ly, int lz, C3 n, int g, long i, long sy, long sz, int wrap)
 nbrs in the kernels: on a host backend always the plain i +- s (ScalarMG::wrapReads never asks a host pass to wrap), as a compile-time constant, so the x-row loop vectorizes exactly as the former kernels did; on a device backend nbrs itself.
 
template<class OpV >
void sweepColorFace (CCField x, CCConst rhs, OpV AC, OpV AFX, OpV AFY, OpV AFZ, C3 e, C3 og, int g, int color, C3 n, int wrap)
 One colour of the face-form red-black Gauss-Seidel: cutcellSmoothColorFace (mac_pressure.hpp) with the neighbours of nbrs (wrap = 0: that kernel, the same launch forms and cell body).
 
void residualFace (CCField r, CCConst x, CCConst b, CCField AC, CCField AFX, CCField AFY, CCField AFZ, C3 e, int g, C3 n, int wrap)
 r = b - A x (face form, double), inner cells.
 
template<class XV , class BV >
double bandOff (const XV &x, const BV &AW, const BV &AE, const BV &AS, const BV &AN, const BV &AB, const BV &AT, long i, const Nb &w)
 The band-form off-diagonal sum of A2, in its fixed order: ((AW x_W + AE x_E) + (AS x_S + AN x_N)) + (AB x_B + AT x_T); x's neighbours from nbrs.
 
template<class BV , class UV >
void sweepColorBand (CCField x, CCConst rhs, BV AC, BV AW, BV AE, BV AS, BV AN, BV AB, BV AT, UV unk, C3 e, C3 og, int g, int color, C3 n, int wrap)
 One colour of the band-form Gauss-Seidel (A2), on the unknown inner cells of the colour: x_i <- (rhs_i - bandOff) / AC_i.
 
template<class XV , class OV >
double faceOff (const XV &x, const OV &AFX, const OV &AFY, const OV &AFZ, long i, long sx, long sy, long sz, const Nb &w)
 The face-form neighbour sum of cutcellSmoothFaceCell, in its order; x's neighbours from nbrs (the coefficients at their own indices).
 
template<bool Band, class XV , class BV >
void twoPhaseCell (const XV &x, const XV &rhs, const BV &AC, const BV &AFX, const BV &AFY, const BV &AFZ, const BV &AW, const BV &AE, const BV &AS, const BV &AN, const BV &AB, const BV &AT, const XV &xs, const XV &rhss, const BV &ACs, const BV &AFXs, const BV &AFYs, const BV &AFZs, const BV &W, const CCConst &unkF, long i, long sx, long sy, long sz, const Nb &w)
 The two-field cell update of the conjugate V-cycle (§5.2, WO-7; design A2's WO-7 note): where both phases are unknown and the same-cell coupling W > 0, the 2x2 block [S_ff, -W; -W, S_ss][x_f; x_s] = [rhs_f - N_f; rhs_s - N_s] is solved exactly (guard: det <= 1e-300 S_ff S_ss -> a point update, fluid then solid); elsewhere each phase takes its point update.
 
template<bool Band>
void sweepColorTwo (CCField x, CCField rhs, CCField AC, CCField AFX, CCField AFY, CCField AFZ, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCField xs, CCField rhss, CCField ACs, CCField AFXs, CCField AFYs, CCField AFZs, CCField W, CCConst unkF, C3 e, C3 og, int g, int color, C3 n, int wrap)
 One colour of the two-field red-black sweep (same launch forms as cutcellSmoothColorFace).
 
template<bool Band>
void residualTwo (CCField r, CCConst x, CCConst b, CCField AC, CCField AFX, CCField AFY, CCField AFZ, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCField rs, CCConst xs, CCConst bs, CCField ACs, CCField AFXs, CCField AFYs, CCField AFZs, CCField W, C3 e, int g, C3 n, int wrap)
 The two-field residual: r_f = rhs_f - (S_ff x_f + N_f) + W x_s (N_f from the bands or the faces), r_s = rhs_s - (S_ss x_s + N_s) + W x_f.
 
void residualBand (CCField r, CCConst x, CCConst b, CCField AC, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, C3 e, int g, C3 n, int wrap)
 r = b - (AC x + bandOff) over the inner cells (A2's band-form residual).
 

Function Documentation

◆ restrictMax()

template<class FV >
void peclet::flow::smg::restrictMax ( CCField  coarse,
const FV &  fine,
C3  cext,
C3  fext,
int  gc,
int  gf,
C3  cinner,
C3  ratio 
)
inline

coarse flag = max of the children's flags (1 unknown, 0 pinned), over the coarse inner cells.

Definition at line 112 of file scalar_mg.hpp.

References peclet::flow::ccFor3().

Referenced by peclet::flow::ScalarMG::buildCoarse(), and peclet::flow::ScalarMG::buildCoarseSolid().

◆ zeroPinned()

void peclet::flow::smg::zeroPinned ( CCField  x,
CCConst  unk,
C3  e,
int  g 
)
inline

x(i) = 0 on the inner cells that are not unknowns (re-zero the pinned cells).

Definition at line 133 of file scalar_mg.hpp.

References peclet::flow::ccFor3().

Referenced by peclet::flow::ScalarMG::vcycle(), and peclet::flow::ScalarMG::vcycleTwo().

◆ zeroPlanes()

void peclet::flow::smg::zeroPlanes ( CCField  f,
C3  e,
int  a,
int  lo,
int  hi 
)
inline

f = 0 on the planes [lo, hi) of axis a (full transverse extent).

No fence: the next kernel on the same execution space is ordered after it (WO-9b).

Definition at line 145 of file scalar_mg.hpp.

References peclet::flow::hostRunSerial().

Referenced by peclet::flow::ScalarMG::buildCoarse(), peclet::flow::ScalarMG::buildCoarseSolid(), peclet::flow::ScalarMG::coarsenAdvection(), and peclet::flow::ScalarMG::zeroNonPeriodicGhosts().

◆ fillShell()

void peclet::flow::smg::fillShell ( CCField  f,
C3  e,
C3  inner,
int  g,
const bool  per[3] 
)
inline

The single-rank ghost fill of a level in ONE launch (WO-9b; CutcellMG::fillWrap's form): a ghost cell with a coordinate in the ghost layer of a NON-periodic axis takes 0, every other ghost cell the value of the inner cell its three coordinates wrap to.

That is exactly what the former sequence left: the periodic wrap of all three axes (x, then y, then z, each over the full transverse extent; a ghost written by an earlier pass is overwritten by a later one with the wrapped-inner value) followed by the zeroing of the non-periodic ghost planes, so the two are bitwise identical (pure copies and zeros); inner cells are only read. Needs inner >= g per axis. The ghost shell is enumerated as three slabs: the z-ghost planes (all x, y), the y-ghost rows of the inner z range (all x), the x-ghost cells of the inner (y, z) rows.

Definition at line 179 of file scalar_mg.hpp.

References peclet::flow::hostRunSerial().

Referenced by peclet::flow::ScalarMG::fill().

◆ nbrs()

Nb peclet::flow::smg::nbrs ( int  lx,
int  ly,
int  lz,
C3  n,
int  g,
long  i,
long  sy,
long  sz,
int  wrap 
)

Definition at line 286 of file scalar_mg.hpp.

Referenced by nbrsOn().

◆ nbrsOn()

Nb peclet::flow::smg::nbrsOn ( int  lx,
int  ly,
int  lz,
C3  n,
int  g,
long  i,
long  sy,
long  sz,
int  wrap 
)

nbrs in the kernels: on a host backend always the plain i +- s (ScalarMG::wrapReads never asks a host pass to wrap), as a compile-time constant, so the x-row loop vectorizes exactly as the former kernels did; on a device backend nbrs itself.

Definition at line 301 of file scalar_mg.hpp.

References nbrs().

Referenced by residualBand(), residualFace(), residualTwo(), sweepColorBand(), sweepColorFace(), and sweepColorTwo().

◆ sweepColorFace()

template<class OpV >
void peclet::flow::smg::sweepColorFace ( CCField  x,
CCConst  rhs,
OpV  AC,
OpV  AFX,
OpV  AFY,
OpV  AFZ,
C3  e,
C3  og,
int  g,
int  color,
C3  n,
int  wrap 
)
inline

One colour of the face-form red-black Gauss-Seidel: cutcellSmoothColorFace (mac_pressure.hpp) with the neighbours of nbrs (wrap = 0: that kernel, the same launch forms and cell body).

Definition at line 314 of file scalar_mg.hpp.

References AC, peclet::flow::cutcellSmoothFaceCell(), peclet::flow::hostRunSerial(), nbrsOn(), and PECLET_FLOW_OMP_SIMD.

Referenced by peclet::flow::ScalarMG::sweepColor().

◆ residualFace()

void peclet::flow::smg::residualFace ( CCField  r,
CCConst  x,
CCConst  b,
CCField  AC,
CCField  AFX,
CCField  AFY,
CCField  AFZ,
C3  e,
int  g,
C3  n,
int  wrap 
)
inline

r = b - A x (face form, double), inner cells.

x's neighbours from nbrs (n the inner dims; wrap = 0: the ghosts).

Definition at line 357 of file scalar_mg.hpp.

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

Referenced by peclet::flow::ScalarMG::vcycle().

◆ bandOff()

template<class XV , class BV >
double peclet::flow::smg::bandOff ( const XV &  x,
const BV &  AW,
const BV &  AE,
const BV &  AS,
const BV &  AN,
const BV &  AB,
const BV &  AT,
long  i,
const Nb &  w 
)

The band-form off-diagonal sum of A2, in its fixed order: ((AW x_W + AE x_E) + (AS x_S + AN x_N)) + (AB x_B + AT x_T); x's neighbours from nbrs.

Definition at line 388 of file scalar_mg.hpp.

Referenced by peclet::flow::ScalarMG::applySurrogateTwo(), residualBand(), residualTwo(), sweepColorBand(), and twoPhaseCell().

◆ sweepColorBand()

template<class BV , class UV >
void peclet::flow::smg::sweepColorBand ( CCField  x,
CCConst  rhs,
BV  AC,
BV  AW,
BV  AE,
BV  AS,
BV  AN,
BV  AB,
BV  AT,
UV  unk,
C3  e,
C3  og,
int  g,
int  color,
C3  n,
int  wrap 
)
inline

One colour of the band-form Gauss-Seidel (A2), on the unknown inner cells of the colour: x_i <- (rhs_i - bandOff) / AC_i.

Colour = (og + l) parity, as cutcellSmoothColorFace (same launch forms: host pencils, device MDRange).

Definition at line 399 of file scalar_mg.hpp.

References AC, bandOff(), peclet::flow::hostRunSerial(), and nbrsOn().

Referenced by peclet::flow::ScalarMG::sweepColor().

◆ faceOff()

template<class XV , class OV >
double peclet::flow::smg::faceOff ( const XV &  x,
const OV &  AFX,
const OV &  AFY,
const OV &  AFZ,
long  i,
long  sx,
long  sy,
long  sz,
const Nb &  w 
)

The face-form neighbour sum of cutcellSmoothFaceCell, in its order; x's neighbours from nbrs (the coefficients at their own indices).

Definition at line 444 of file scalar_mg.hpp.

Referenced by peclet::flow::ScalarMG::applySurrogateTwo(), residualTwo(), and twoPhaseCell().

◆ twoPhaseCell()

template<bool Band, class XV , class BV >
void peclet::flow::smg::twoPhaseCell ( const XV &  x,
const XV &  rhs,
const BV &  AC,
const BV &  AFX,
const BV &  AFY,
const BV &  AFZ,
const BV &  AW,
const BV &  AE,
const BV &  AS,
const BV &  AN,
const BV &  AB,
const BV &  AT,
const XV &  xs,
const XV &  rhss,
const BV &  ACs,
const BV &  AFXs,
const BV &  AFYs,
const BV &  AFZs,
const BV &  W,
const CCConst &  unkF,
long  i,
long  sx,
long  sy,
long  sz,
const Nb &  w 
)

The two-field cell update of the conjugate V-cycle (§5.2, WO-7; design A2's WO-7 note): where both phases are unknown and the same-cell coupling W > 0, the 2x2 block [S_ff, -W; -W, S_ss][x_f; x_s] = [rhs_f - N_f; rhs_s - N_s] is solved exactly (guard: det <= 1e-300 S_ff S_ss -> a point update, fluid then solid); elsewhere each phase takes its point update.

N_f is the fluid neighbour sum: from the BANDS on the advective path (Band), from the faces otherwise; the solid is always in face form (it never advects). The face-form fluid point update is cutcellSmoothFaceCell's (skipped where AC < 1e-30), the band-form one the unknown-cell update of sweepColorBand.

Definition at line 459 of file scalar_mg.hpp.

References AC, bandOff(), and faceOff().

◆ sweepColorTwo()

template<bool Band>
void peclet::flow::smg::sweepColorTwo ( CCField  x,
CCField  rhs,
CCField  AC,
CCField  AFX,
CCField  AFY,
CCField  AFZ,
CCField  AW,
CCField  AE,
CCField  AS,
CCField  AN,
CCField  AB,
CCField  AT,
CCField  xs,
CCField  rhss,
CCField  ACs,
CCField  AFXs,
CCField  AFYs,
CCField  AFZs,
CCField  W,
CCConst  unkF,
C3  e,
C3  og,
int  g,
int  color,
C3  n,
int  wrap 
)
inline

One colour of the two-field red-black sweep (same launch forms as cutcellSmoothColorFace).

Definition at line 496 of file scalar_mg.hpp.

References AC, peclet::flow::hostRunSerial(), and nbrsOn().

◆ residualTwo()

template<bool Band>
void peclet::flow::smg::residualTwo ( CCField  r,
CCConst  x,
CCConst  b,
CCField  AC,
CCField  AFX,
CCField  AFY,
CCField  AFZ,
CCField  AW,
CCField  AE,
CCField  AS,
CCField  AN,
CCField  AB,
CCField  AT,
CCField  rs,
CCConst  xs,
CCConst  bs,
CCField  ACs,
CCField  AFXs,
CCField  AFYs,
CCField  AFZs,
CCField  W,
C3  e,
int  g,
C3  n,
int  wrap 
)
inline

The two-field residual: r_f = rhs_f - (S_ff x_f + N_f) + W x_s (N_f from the bands or the faces), r_s = rhs_s - (S_ss x_s + N_s) + W x_f.

Definition at line 542 of file scalar_mg.hpp.

References AC, bandOff(), peclet::flow::ccFor3(), faceOff(), and nbrsOn().

◆ residualBand()

void peclet::flow::smg::residualBand ( CCField  r,
CCConst  x,
CCConst  b,
CCField  AC,
CCField  AW,
CCField  AE,
CCField  AS,
CCField  AN,
CCField  AB,
CCField  AT,
C3  e,
int  g,
C3  n,
int  wrap 
)
inline

r = b - (AC x + bandOff) over the inner cells (A2's band-form residual).

Definition at line 562 of file scalar_mg.hpp.

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

Referenced by peclet::flow::ScalarMG::vcycle().