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

The device slots of the resident pass, and the stop codes (exact in double). More...

Classes

struct  BiCGStabArgs
 The vectors and settings of one scalarBiCGStab call: the right-hand side, the iterate (the initial guess and the result), the scratch r, rh, p, v, t, z, z2, the iteration cap, the absolute stop threshold rtol * ref and the singular flag (§5.1). More...

Typedefs

using Slot = Kokkos::View<double, CCMem>

Enumerations

enum  : int {
  kRho = 0 , kAlpha = 1 , kOmega = 2 , kBeta = 3 ,
  kRhoNew = 4 , kRhv = 5 , kTr = 6 , kTt = 7 ,
  kStop = 8 , kRn = 9 , kRnS = 10 , kNSlots = 11
}

Functions

void axpy (CCField y, double a, CCConst x, C3 e, int g)
 y += a x over inner cells.
void aypx (CCField y, double a, CCConst x, C3 e, int g)
 y = x + a y over inner cells.
void residualFrom (CCField y, CCConst b, C3 e, int g)
 y = b - y over inner cells (the residual from a matvec result held in y).
void axpy (const ScalarVec &y, double a, const ScalarVec &x, C3 e, int g)
 The same three operations on a ScalarVec, phase by phase.
void aypx (const ScalarVec &y, double a, const ScalarVec &x, C3 e, int g)
void residualFrom (const ScalarVec &y, const ScalarVec &b, C3 e, int g)
void copy (const ScalarVec &y, const ScalarVec &x)
void zero (const ScalarVec &y)
Slot slot (const Kokkos::View< double *, CCMem > &ks, int k)
template<class F>
void scalarKernel (const char *name, F f)
 One-thread kernel on the slots (the coefficient arithmetic of the host pass, on the device).
void residentInit (const Kokkos::View< double *, CCMem > &ks)
void residentBeta (const Kokkos::View< double *, CCMem > &ks)
 (rh, r) breakdown, else beta = (rhoNew / rho) (alpha / omega) and rho = rhoNew.
void residentAlpha (const Kokkos::View< double *, CCMem > &ks)
 (rh, v) breakdown, else alpha = rho / (rh, v).
void residentOmega (const Kokkos::View< double *, CCMem > &ks)
 The tt breakdown, else omega = (t, r) / (t, t) and its breakdown.
void residentP (const ScalarVec &p, const ScalarVec &v, const ScalarVec &r, const Kokkos::View< double *, CCMem > &ks, C3 e, int g)
 p = r + beta (p - omega v): axpy(p, -omega, v) then aypx(p, beta, r), per phase; skipped on a stop.
void residentS (const ScalarVec &r, const ScalarVec &v, const Kokkos::View< double *, CCMem > &ks, C3 e, int g)
 r <- s = r - alpha v (axpy(r, -alpha, v)); skipped on a stop.
void residentXHalf (const ScalarVec &x, const ScalarVec &z, const Kokkos::View< double *, CCMem > &ks, C3 e, int g)
 x += alpha z (the half-step exit).
void residentXR (const ScalarVec &x, const ScalarVec &r, const ScalarVec &z, const ScalarVec &z2, const ScalarVec &t, const Kokkos::View< double *, CCMem > &ks, C3 e, int g)
 x += alpha z; x += omega z2; r -= omega t (the three axpys) — or, after a tt / omega breakdown, the alpha half-step alone.
void requireFinite (double rn)
 A residual max-norm that is not finite ends the solve.
template<class Ops>
void residualOf (Ops &ops, const BiCGStabArgs &w)
 r = b - A x (t as scratch), mean removed in the singular case.
bool stagnated (double rn, double &best, int &lastImprove, int it)
 The stagnation stop: true once 30 iterations brought no 0.1 % improvement of the best residual (the best-so-far level is then accepted); otherwise records an improvement.
template<class Ops>
void bicgPass (Ops &ops, const BiCGStabArgs &w, int &it)
 One BiCGStab pass from the current x (CutcellMG::solveBiCGStab's loop, with the §5.1 stop).
template<class Ops>
double readPacket (Ops &ops, const BiCGStabArgs &w, double &stop)
 The resident pass's packet {stop, max|r|} (both phases combined with std::fmax, as ops.maxabs): THE device-to-host read of a half or full step.
template<class Ops>
void bicgPassResident (Ops &ops, const BiCGStabArgs &w, int &it)
 The same pass with the scalars on the device (WO-9b; see the file comment).
template<class Ops>
double bicgTrueResidual (Ops &ops, const BiCGStabArgs &w)
 The true residual max|b - A x| after a pass (mean removed in the singular case).

Variables

constexpr double kBrkRho = 1.0
constexpr double kBrkRhv = 2.0
constexpr double kBrkTt = 3.0
constexpr double kBrkOmega = 4.0

Detailed Description

The device slots of the resident pass, and the stop codes (exact in double).

Typedef Documentation

◆ Slot

using peclet::flow::skr::Slot = Kokkos::View<double, CCMem>

Definition at line 134 of file scalar_krylov.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : int
Enumerator
kRho 
kAlpha 
kOmega 
kBeta 
kRhoNew 
kRhv 
kTr 
kTt 
kStop 

the packet the host reads: {stop, max|r_f|, max|r_s|}

kRn 
kRnS 
kNSlots 

Definition at line 119 of file scalar_krylov.hpp.

Function Documentation

◆ axpy() [1/2]

void peclet::flow::skr::axpy ( CCField y,
double a,
CCConst x,
C3 e,
int g )
inline

y += a x over inner cells.

Definition at line 61 of file scalar_krylov.hpp.

References peclet::flow::ccFor3().

Referenced by axpy(), and bicgPass().

◆ aypx() [1/2]

void peclet::flow::skr::aypx ( CCField y,
double a,
CCConst x,
C3 e,
int g )
inline

y = x + a y over inner cells.

Definition at line 70 of file scalar_krylov.hpp.

References peclet::flow::ccFor3().

Referenced by aypx(), and bicgPass().

◆ residualFrom() [1/2]

void peclet::flow::skr::residualFrom ( CCField y,
CCConst b,
C3 e,
int g )
inline

y = b - y over inner cells (the residual from a matvec result held in y).

Definition at line 79 of file scalar_krylov.hpp.

References peclet::flow::ccFor3().

Referenced by peclet::flow::scd::remeasureAfterGauge(), residualFrom(), and residualOf().

◆ axpy() [2/2]

void peclet::flow::skr::axpy ( const ScalarVec & y,
double a,
const ScalarVec & x,
C3 e,
int g )
inline

The same three operations on a ScalarVec, phase by phase.

Definition at line 89 of file scalar_krylov.hpp.

References axpy().

◆ aypx() [2/2]

void peclet::flow::skr::aypx ( const ScalarVec & y,
double a,
const ScalarVec & x,
C3 e,
int g )
inline

Definition at line 94 of file scalar_krylov.hpp.

References aypx().

◆ residualFrom() [2/2]

void peclet::flow::skr::residualFrom ( const ScalarVec & y,
const ScalarVec & b,
C3 e,
int g )
inline

Definition at line 99 of file scalar_krylov.hpp.

References residualFrom().

◆ copy()

void peclet::flow::skr::copy ( const ScalarVec & y,
const ScalarVec & x )
inline

Definition at line 104 of file scalar_krylov.hpp.

Referenced by bicgPass(), bicgPassResident(), and residualOf().

◆ zero()

void peclet::flow::skr::zero ( const ScalarVec & y)
inline

Definition at line 109 of file scalar_krylov.hpp.

Referenced by bicgPass(), and bicgPassResident().

◆ slot()

Slot peclet::flow::skr::slot ( const Kokkos::View< double *, CCMem > & ks,
int k )
inline

Definition at line 135 of file scalar_krylov.hpp.

Referenced by bicgPassResident(), and readPacket().

◆ scalarKernel()

template<class F>
void peclet::flow::skr::scalarKernel ( const char * name,
F f )
inline

One-thread kernel on the slots (the coefficient arithmetic of the host pass, on the device).

Definition at line 179 of file scalar_krylov.hpp.

References F.

Referenced by residentAlpha(), residentBeta(), residentInit(), and residentOmega().

◆ residentInit()

void peclet::flow::skr::residentInit ( const Kokkos::View< double *, CCMem > & ks)
inline

Definition at line 183 of file scalar_krylov.hpp.

References kAlpha, kOmega, kRho, kStop, and scalarKernel().

Referenced by bicgPassResident().

◆ residentBeta()

void peclet::flow::skr::residentBeta ( const Kokkos::View< double *, CCMem > & ks)
inline

(rh, r) breakdown, else beta = (rhoNew / rho) (alpha / omega) and rho = rhoNew.

Definition at line 193 of file scalar_krylov.hpp.

References kAlpha, kBeta, kBrkRho, kOmega, kRho, kRhoNew, kStop, and scalarKernel().

Referenced by bicgPassResident().

◆ residentAlpha()

void peclet::flow::skr::residentAlpha ( const Kokkos::View< double *, CCMem > & ks)
inline

(rh, v) breakdown, else alpha = rho / (rh, v).

Definition at line 206 of file scalar_krylov.hpp.

References kAlpha, kBrkRhv, kRho, kRhv, kStop, and scalarKernel().

Referenced by bicgPassResident().

◆ residentOmega()

void peclet::flow::skr::residentOmega ( const Kokkos::View< double *, CCMem > & ks)
inline

The tt breakdown, else omega = (t, r) / (t, t) and its breakdown.

Definition at line 220 of file scalar_krylov.hpp.

References kBrkOmega, kBrkTt, kOmega, kStop, kTr, kTt, and scalarKernel().

Referenced by bicgPassResident().

◆ residentP()

void peclet::flow::skr::residentP ( const ScalarVec & p,
const ScalarVec & v,
const ScalarVec & r,
const Kokkos::View< double *, CCMem > & ks,
C3 e,
int g )
inline

p = r + beta (p - omega v): axpy(p, -omega, v) then aypx(p, beta, r), per phase; skipped on a stop.

Definition at line 238 of file scalar_krylov.hpp.

References peclet::flow::ccFor3(), kBeta, kOmega, and kStop.

Referenced by bicgPassResident().

◆ residentS()

void peclet::flow::skr::residentS ( const ScalarVec & r,
const ScalarVec & v,
const Kokkos::View< double *, CCMem > & ks,
C3 e,
int g )
inline

r <- s = r - alpha v (axpy(r, -alpha, v)); skipped on a stop.

Definition at line 258 of file scalar_krylov.hpp.

References peclet::flow::ccFor3(), kAlpha, and kStop.

Referenced by bicgPassResident().

◆ residentXHalf()

void peclet::flow::skr::residentXHalf ( const ScalarVec & x,
const ScalarVec & z,
const Kokkos::View< double *, CCMem > & ks,
C3 e,
int g )
inline

x += alpha z (the half-step exit).

Definition at line 275 of file scalar_krylov.hpp.

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

Referenced by bicgPassResident().

◆ residentXR()

void peclet::flow::skr::residentXR ( const ScalarVec & x,
const ScalarVec & r,
const ScalarVec & z,
const ScalarVec & z2,
const ScalarVec & t,
const Kokkos::View< double *, CCMem > & ks,
C3 e,
int g )
inline

x += alpha z; x += omega z2; r -= omega t (the three axpys) — or, after a tt / omega breakdown, the alpha half-step alone.

Definition at line 291 of file scalar_krylov.hpp.

References peclet::flow::ccFor3(), peclet::flow::ScalarVec::f, kAlpha, kOmega, kStop, and peclet::flow::ScalarVec::s.

Referenced by bicgPassResident().

◆ requireFinite()

void peclet::flow::skr::requireFinite ( double rn)
inline

A residual max-norm that is not finite ends the solve.

Definition at line 342 of file scalar_krylov.hpp.

Referenced by bicgPass(), bicgPassResident(), and bicgTrueResidual().

◆ residualOf()

template<class Ops>
void peclet::flow::skr::residualOf ( Ops & ops,
const BiCGStabArgs & w )
inline

r = b - A x (t as scratch), mean removed in the singular case.

Definition at line 349 of file scalar_krylov.hpp.

References copy(), and residualFrom().

Referenced by bicgPass(), bicgPassResident(), and bicgTrueResidual().

◆ stagnated()

bool peclet::flow::skr::stagnated ( double rn,
double & best,
int & lastImprove,
int it )
inline

The stagnation stop: true once 30 iterations brought no 0.1 % improvement of the best residual (the best-so-far level is then accepted); otherwise records an improvement.

Definition at line 359 of file scalar_krylov.hpp.

Referenced by bicgPass(), and bicgPassResident().

◆ bicgPass()

template<class Ops>
void peclet::flow::skr::bicgPass ( Ops & ops,
const BiCGStabArgs & w,
int & it )
inline

One BiCGStab pass from the current x (CutcellMG::solveBiCGStab's loop, with the §5.1 stop).

Definition at line 370 of file scalar_krylov.hpp.

References axpy(), aypx(), copy(), requireFinite(), residualOf(), stagnated(), and zero().

Referenced by peclet::flow::scalarBiCGStab().

◆ readPacket()

template<class Ops>
double peclet::flow::skr::readPacket ( Ops & ops,
const BiCGStabArgs & w,
double & stop )
inline

The resident pass's packet {stop, max|r|} (both phases combined with std::fmax, as ops.maxabs): THE device-to-host read of a half or full step.

Definition at line 447 of file scalar_krylov.hpp.

References kRn, kRnS, kStop, and slot().

Referenced by bicgPassResident().

◆ bicgPassResident()

template<class Ops>
void peclet::flow::skr::bicgPassResident ( Ops & ops,
const BiCGStabArgs & w,
int & it )
inline

The same pass with the scalars on the device (WO-9b; see the file comment).

Statement for statement bicgPass above, through the skr::resident* kernels.

Definition at line 458 of file scalar_krylov.hpp.

References copy(), kRhoNew, kRhv, kTr, kTt, readPacket(), requireFinite(), residentAlpha(), residentBeta(), residentInit(), residentOmega(), residentP(), residentS(), residentXHalf(), residentXR(), residualOf(), slot(), stagnated(), and zero().

Referenced by peclet::flow::scalarBiCGStab().

◆ bicgTrueResidual()

template<class Ops>
double peclet::flow::skr::bicgTrueResidual ( Ops & ops,
const BiCGStabArgs & w )
inline

The true residual max|b - A x| after a pass (mean removed in the singular case).

Definition at line 514 of file scalar_krylov.hpp.

References requireFinite(), and residualOf().

Referenced by peclet::flow::scalarBiCGStab().

Variable Documentation

◆ kBrkRho

double peclet::flow::skr::kBrkRho = 1.0
constexpr

Definition at line 133 of file scalar_krylov.hpp.

Referenced by residentBeta().

◆ kBrkRhv

double peclet::flow::skr::kBrkRhv = 2.0

Definition at line 133 of file scalar_krylov.hpp.

Referenced by residentAlpha().

◆ kBrkTt

double peclet::flow::skr::kBrkTt = 3.0

Definition at line 133 of file scalar_krylov.hpp.

Referenced by residentOmega().

◆ kBrkOmega

double peclet::flow::skr::kBrkOmega = 4.0

Definition at line 133 of file scalar_krylov.hpp.

Referenced by residentOmega().