peclet-amr 0.2.0
Block-local-Morton AMR octree + collocated cut-cell Navier–Stokes solver (header-only C++20, Kokkos + MPI)
Loading...
Searching...
No Matches
peclet::amr::AmgBottom< Dim, Bits > Class Template Reference

The agglomerated exact bottom of the pressure multigrid (docs/amr_mg_depth.md §6.6): the coarsest level's FV Laplacian assembled as the SPD matrix S = −Vol·L, with identity rows for fully closed cells and the constant nullspace projected per connected fluid component, solved by GraphAMG-preconditioned CG to relative kTol = 1e-10 (cap kMaxIters = 100). More...

#include <amg_bottom.hpp>

Public Types

using Poisson = AmrPoisson<Dim, Bits>
 the level operator the matrix is assembled from

Public Member Functions

void build (const Poisson &ap, bool singular)
 Assemble S from the coarsest level's AmrPoisson and build the GraphAMG hierarchy.
bool ready () const
 True once build() has assembled a non-empty level.
bool onDevice () const
 Whether the per-V-cycle solve runs on the device (size() > kHostMax).
Index size () const
 Rows of the bottom matrix = cells of the coarsest level.
Index numIdentityRows () const
 Fully closed cells (every face openness 0), solved as identity rows with solution 0.
int numComponents () const
 Connected fluid components; each carries its own constant nullspace mode.
int lastIters () const
 CG iterations of the last solve (0 for a zero right-hand side).
double lastRelResidual () const
 ‖rhs − S x‖∞ / ‖rhs‖∞ of the last solve, measured on the CSR the bottom itself assembled.
void solve (View< const double > b, View< double > x) const
 x ← the solution of L x = b on the coarsest level, i.e.
void projectDevice (View< double > v) const
 Subtract the per-component mean on the device.
void applyS (View< const double > in, View< double > out) const
void solveDevice () const

Static Public Member Functions

static double dotDevice (Index n, View< const double > a, View< const double > b)
static double maxAbs (Index n, View< const double > a)

Static Public Attributes

static constexpr Index kHostMax = 10000
 Above this many rows the per-V-cycle solve runs on the device (§5.5).

Detailed Description

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
class peclet::amr::AmgBottom< Dim, Bits >

The agglomerated exact bottom of the pressure multigrid (docs/amr_mg_depth.md §6.6): the coarsest level's FV Laplacian assembled as the SPD matrix S = −Vol·L, with identity rows for fully closed cells and the constant nullspace projected per connected fluid component, solved by GraphAMG-preconditioned CG to relative kTol = 1e-10 (cap kMaxIters = 100).

Owned by Multigrid (single-rank, and therefore the replicated stage's continued ladder) and by DistributedFlowMultigrid at np = 1; selected by Multigrid::setBottom — Flow.set_pressure_bottom('auto' | 'smoother' | 'agglomerated'). It changes the preconditioner, never the converged pressure. LOCAL: no MPI anywhere in the class — a replicated tail runs one identical copy per rank. Setup is host, once per build(); the per-V-cycle solve is host or device by size (kHostMax). Throws nothing of its own.

Definition at line 63 of file amg_bottom.hpp.

Member Typedef Documentation

◆ Poisson

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::amr::AmgBottom< Dim, Bits >::Poisson = AmrPoisson<Dim, Bits>

the level operator the matrix is assembled from

Definition at line 65 of file amg_bottom.hpp.

Member Function Documentation

◆ build()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::AmgBottom< Dim, Bits >::build ( const Poisson & ap,
bool singular )
inline

Assemble S from the coarsest level's AmrPoisson and build the GraphAMG hierarchy.

singular = the operator has a constant nullspace per connected fluid component (the periodic pure-Neumann pressure, which is every AmrFlow path).

Definition at line 73 of file amg_bottom.hpp.

References peclet::amr::AmrPoisson< Dim, Bits >::assembleFv(), and kHostMax.

◆ ready()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
bool peclet::amr::AmgBottom< Dim, Bits >::ready ( ) const
inline

True once build() has assembled a non-empty level.

Definition at line 126 of file amg_bottom.hpp.

◆ onDevice()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
bool peclet::amr::AmgBottom< Dim, Bits >::onDevice ( ) const
inline

Whether the per-V-cycle solve runs on the device (size() > kHostMax).

Definition at line 128 of file amg_bottom.hpp.

◆ size()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::amr::AmgBottom< Dim, Bits >::size ( ) const
inline

Rows of the bottom matrix = cells of the coarsest level.

Definition at line 130 of file amg_bottom.hpp.

◆ numIdentityRows()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::amr::AmgBottom< Dim, Bits >::numIdentityRows ( ) const
inline

Fully closed cells (every face openness 0), solved as identity rows with solution 0.

Definition at line 132 of file amg_bottom.hpp.

◆ numComponents()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
int peclet::amr::AmgBottom< Dim, Bits >::numComponents ( ) const
inline

Connected fluid components; each carries its own constant nullspace mode.

Definition at line 134 of file amg_bottom.hpp.

◆ lastIters()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
int peclet::amr::AmgBottom< Dim, Bits >::lastIters ( ) const
inline

CG iterations of the last solve (0 for a zero right-hand side).

Definition at line 136 of file amg_bottom.hpp.

◆ lastRelResidual()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
double peclet::amr::AmgBottom< Dim, Bits >::lastRelResidual ( ) const
inline

‖rhs − S x‖∞ / ‖rhs‖∞ of the last solve, measured on the CSR the bottom itself assembled.

The V-cycle's own FvOp check (the §6.6 consistency gate) lives in Multigrid::vcycle and is the one §10 quotes.

Definition at line 140 of file amg_bottom.hpp.

◆ solve()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::AmgBottom< Dim, Bits >::solve ( View< const double > b,
View< double > x ) const
inline

x ← the solution of L x = b on the coarsest level, i.e.

S x = −b/invVol, projected onto the complement of the per-component nullspace. Device views, which may be LONGER than size() (the distributed levels carry a ghost tail); only the first size() rows are read and written, and everything runs through this class's own scratch so a subview is never needed.

Definition at line 146 of file amg_bottom.hpp.

References solveDevice().

◆ projectDevice()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::AmgBottom< Dim, Bits >::projectDevice ( View< double > v) const
inline

Subtract the per-component mean on the device.

The component count is 1 on a connected pore space and a handful with sealed pockets, so one reduction per component is the cheap shape.

Definition at line 275 of file amg_bottom.hpp.

Referenced by solveDevice().

◆ applyS()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::AmgBottom< Dim, Bits >::applyS ( View< const double > in,
View< double > out ) const
inline

Definition at line 297 of file amg_bottom.hpp.

Referenced by solveDevice().

◆ dotDevice()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
double peclet::amr::AmgBottom< Dim, Bits >::dotDevice ( Index n,
View< const double > a,
View< const double > b )
inlinestatic

Definition at line 311 of file amg_bottom.hpp.

Referenced by solveDevice().

◆ maxAbs()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
double peclet::amr::AmgBottom< Dim, Bits >::maxAbs ( Index n,
View< const double > a )
inlinestatic

Definition at line 317 of file amg_bottom.hpp.

Referenced by solveDevice().

◆ solveDevice()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::AmgBottom< Dim, Bits >::solveDevice ( ) const
inline

Definition at line 330 of file amg_bottom.hpp.

References applyS(), dotDevice(), maxAbs(), and projectDevice().

Referenced by solve().

Member Data Documentation

◆ kHostMax

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::amr::AmgBottom< Dim, Bits >::kHostMax = 10000
staticconstexpr

Above this many rows the per-V-cycle solve runs on the device (§5.5).

Definition at line 68 of file amg_bottom.hpp.

Referenced by build().


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