flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
scalar_mg.hpp File Reference
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <functional>
#include <Kokkos_Core.hpp>
#include <limits>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "mac_cutcell_mg.hpp"
#include "mac_pressure.hpp"
#include "policy.hpp"
#include "scalar_cutcell_geometry.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::smg::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  peclet::flow::smg::MassField
 Level-0 mass m = kappa idt on unknowns, 0 elsewhere (read by restrictAvgCell). More...
 
struct  peclet::flow::smg::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...
 
struct  peclet::flow::smg::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...
 
class  peclet::flow::ScalarMG
 
struct  peclet::flow::ScalarMG::Level
 
struct  peclet::flow::ScalarMG::Inputs
 Everything build reads from the scalar operator and the geometry record. More...
 

Namespaces

namespace  peclet
 
namespace  peclet::flow
 
namespace  peclet::flow::smg
 

Functions

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)
 coarse flag = max of the children's flags (1 unknown, 0 pinned), over the coarse inner cells.
 
void peclet::flow::smg::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 peclet::flow::smg::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 peclet::flow::smg::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 peclet::flow::smg::nbrs (int lx, int ly, int lz, C3 n, int g, long i, long sy, long sz, int wrap)
 
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.
 
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)
 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 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)
 r = b - A x (face form, double), inner cells.
 
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.
 
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)
 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 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).
 
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.
 
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)
 One colour of the two-field red-black sweep (same launch forms as cutcellSmoothColorFace).
 
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)
 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 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)
 r = b - (AC x + bandOff) over the inner cells (A2's band-form residual).