flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
mac_cutcell_mg.hpp File Reference

flow — portable (Kokkos) geometric multigrid for the cut-cell (variable-openness) pressure Poisson. More...

#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <Kokkos_Core.hpp>
#include <limits>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <vector>
#include "ghost_projection.hpp"
#include "mac_bc.hpp"
#include "mac_pressure.hpp"
#include "mg_bottom_direct.hpp"
#include "peclet/core/solver/graph_amg.hpp"
#include "star_elimination.hpp"
#include "mg_fp32_vcycle.hpp"
#include "mg_line_relax.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::BottomLevel
struct  peclet::flow::BottomLabelKernel
struct  peclet::flow::BottomKernel< FacReal >
class  peclet::flow::CutcellMG
struct  peclet::flow::CutcellMG::Level
struct  peclet::flow::CutcellMG::ExitDot
struct  peclet::flow::CutcellMG::StartResidual
struct  peclet::flow::CutcellMG::OverlayScope
struct  peclet::flow::CutcellMG::AmgRows
struct  peclet::flow::CutcellMG::AmgRhsAnatomy
struct  peclet::flow::CutcellMG::ExitDotDist

Namespaces

namespace  peclet
namespace  peclet::flow

Typedefs

using peclet::flow::MReal = float
using peclet::flow::FPV = Kokkos::View<MReal*, CCMem>
using peclet::flow::FPC = Kokkos::View<const MReal*, CCMem>
using peclet::flow::VReal = float

Enumerations

enum  : int { peclet::flow::kOpFp64None = 0 , peclet::flow::kOpFp64Diag = 1 , peclet::flow::kOpFp64Full = 2 }
enum  : int { peclet::flow::kCaMomentum = 1 , peclet::flow::kCaMg = 2 , peclet::flow::kCaBoth = kCaMomentum | kCaMg }

Functions

template<class CV, class FV>
void peclet::flow::coarsenOpenAvgCell (const CV &oxc, const CV &oyc, const CV &ozc, const FV &oxf, const FV &oyf, const FV &ozf, C3 cext, C3 fext, int gc, int gf, C3 ratio, int icx, int icy, int icz)
void peclet::flow::coarsenOpenAvg (CCField oxc, CCField oyc, CCField ozc, CCConst oxf, CCConst oyf, CCConst ozf, C3 cext, C3 fext, int gc, int gf, C3 cinner, C3 ratio)
void peclet::flow::mgSaveFacePlane (CCField dst, CCConst src, C3 e, int g, int a, int s)
void peclet::flow::mgRestoreFacePlane (CCField dst, CCConst src, C3 e, int g, int a, int s)
void peclet::flow::mgCoarsenFacePlane (CCField oc, CCConst of, C3 cext, C3 fext, int gc, int gf, C3 cinner, C3 ratio, int a, int s)
template<class RV, class XV, class BV, class OpV>
void peclet::flow::cutcellResidualCell (const RV &r, const XV &x, const BV &b, const OpV &AC, const OpV &AW, const OpV &AE, const OpV &AS, const OpV &AN, const OpV &AB, const OpV &AT, long i, long xp, long xm, long yp, long ym, long zp, long zm)
void peclet::flow::residualCutcell (CCField r, CCConst x, CCConst b, FPC AC, FPC AW, FPC AE, FPC AS, FPC AN, FPC AB, FPC AT, C3 e, int g)
void peclet::flow::residualCutcellBox (CCField r, CCConst x, CCConst b, FPC AC, FPC AW, FPC AE, FPC AS, FPC AN, FPC AB, FPC AT, C3 e, C3 rlo, C3 rhi, C3 slo, C3 shi)
void peclet::flow::residualCutcellFace (CCField r, CCConst x, CCConst b, FPC AC, FPC AFX, FPC AFY, FPC AFZ, C3 e, int g)
void peclet::flow::residualCutcellBoxFace (CCField r, CCConst x, CCConst b, FPC AC, FPC AFX, FPC AFY, FPC AFZ, C3 e, C3 rlo, C3 rhi, C3 slo, C3 shi, int wrapMask=0, int g=1)
CcNbrs peclet::flow::ccWrapNbrs (int lx, int ly, int lz, C3 n, int g, long i, long sy, long sz)
template<class Cell>
void peclet::flow::ccWrapRowPeeled (int ly, int lz, C3 e, C3 n, int g, int lx0, int step, const Cell &cell)
template<class Cell>
void peclet::flow::ccWrapForPeeled (const char *name, C3 e, C3 n, int g, const Cell &cell)
void peclet::flow::cutcellSmoothColorFaceWrap (CCField phi, CCConst b, FPC AC, FPC AFX, FPC AFY, FPC AFZ, C3 e, C3 n, C3 og, int g, int color)
void peclet::flow::residualCutcellFaceWrap (CCField r, CCConst x, CCConst b, FPC AC, FPC AFX, FPC AFY, FPC AFZ, C3 e, C3 n, int g)
void peclet::flow::applyCutcellOpFaceWrap (CCField y, CCConst x, FPC AC, FPC AFX, FPC AFY, FPC AFZ, C3 e, C3 n, int g)
void peclet::flow::applyCutcellOpExactWrap (CCField y, CCConst x, CCConst ox, CCConst oy, CCConst oz, C3 e, C3 n, int g, double gfx, double gfy, double gfz)
template<class CV, class FV>
void peclet::flow::restrictAvgCell (const CV &coarse, const FV &fine, C3 cext, C3 fext, int gc, int gf, C3 ratio, int icx, int icy, int icz)
template<class FV, class CV>
void peclet::flow::prolongAddCell (const FV &fine, const CV &coarse, C3 fext, C3 cext, int gf, int gc, C3 ratio, int ifx, int ify, int ifz)
template<class FV, class CV>
void peclet::flow::prolongConstAddCell (const FV &fine, const CV &coarse, C3 fext, C3 cext, int gf, int gc, C3 ratio, int ifx, int ify, int ifz)
template<class FV, class AV>
void peclet::flow::meanSubtractCell (const FV &f, const AV &ac, long i, double mean)
void peclet::flow::restrictAvg (CCField coarse, CCConst fine, C3 cext, C3 fext, int gc, int gf, C3 cinner, C3 ratio)
void peclet::flow::restrictAvgZeroX (CCField coarse, CCField coarseX, CCConst fine, C3 cext, C3 fext, int gc, int gf, C3 cinner, C3 ratio)
template<class OpV, class WV>
void peclet::flow::buildCutcellOpFaceFp32 (OpV AC, OpV AFX, OpV AFY, OpV AFZ, WV WX, WV WY, WV WZ, CCConst ox, CCConst oy, CCConst oz, C3 e, int gb, double gfx, double gfy, double gfz, int fp64, int *bad)
void peclet::flow::prolongAdd (CCField fine, CCConst coarse, C3 fext, C3 cext, int gf, int gc, C3 finner, C3 ratio)
void peclet::flow::prolongConstAdd (CCField fine, CCConst coarse, C3 fext, C3 cext, int gf, int gc, C3 finner, C3 ratio)
int peclet::flow::mgDebugLevel ()
int peclet::flow::mgDebugSolves ()

Variables

constexpr long peclet::flow::kBottomMaxCells = 8192
constexpr int peclet::flow::kAutoMinLevels = 4
constexpr int peclet::flow::kAutoMaxLevels = 30
constexpr bool peclet::flow::kAnchoredFollowsGrid = false
constexpr double peclet::flow::kBottomTau = 1e-5
constexpr int peclet::flow::kBottomMaxComponents = 64
constexpr int peclet::flow::kBottomCap = 100
constexpr int peclet::flow::kBottomHostTeam = 1
constexpr int peclet::flow::kBottomHostFactorTeam = 6
constexpr int peclet::flow::kCaDefault = std::is_same_v<CCMem, Kokkos::HostSpace> ? kCaBoth : 0

Detailed Description

flow — portable (Kokkos) geometric multigrid for the cut-cell (variable-openness) pressure Poisson.

Single-GPU (periodic) port of CUDA's DistributedPoissonMG (mac_multigrid.cuh): a level hierarchy with the rediscretized cut-cell operator (average-coarsen the face openness per level + re-assemble the operator at the coarse spacing, mg_coarsen_open_avg_k), a V-cycle with red-black Gauss-Seidel smoothing + average restriction + trilinear prolongation + constant-null-space (mean) removal, and an MG-PCG outer driver (CG preconditioned by one symmetric V-cycle). Operator stored single-precision (mreal=float) + double iterate, exactly as CUDA. Reuses buildCutcellOp / cutcellSmoothColor / applyCutcellOp (mac_pressure). Not yet ported (noted for later): Galerkin coarse op, Chebyshev smoother, semi-coarsening, domain-BC MG, MPI. Runs on any Kokkos backend.

Definition in file mac_cutcell_mg.hpp.