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::MgStage< Dim, Bits > Class Template Referenceabstract

One stage of the pressure hierarchy (docs/amr_mg_depth.md §6.5). More...

#include <mg_stage.hpp>

Inheritance diagram for peclet::amr::MgStage< Dim, Bits >:
peclet::amr::ReplicatedTailStage< Dim, Bits >

Public Types

using Octree = BlockOctree< Dim, Bits >
 a level's cells on one block
 
using Decomposition = core::decomp::BlockDecomposer< Dim >
 the target partition's type
 

Public Member Functions

virtual ~MgStage ()=default
 
virtual const char * kind () const =0
 "replicated" | "sibling" | "repartition".
 
virtual const char * diagnosticSuffix () const =0
 What pressure_mg_bottom appends for this stage — "+tail" for the replicated one, which is the spelling docs/amr_mg_depth.md §6.7 fixes.
 
virtual const Decomposition & targetDecomposition () const =0
 The decomposition of the moved level's grid this stage targets.
 
virtual MPI_Comm targetComm () const =0
 The communicator every collective of the continued ladder runs on.
 
virtual bool active () const =0
 Whether THIS rank owns a target block, i.e.
 
virtual const Octree & targetOctree () const =0
 The moved level's cells on this rank's target block.
 
virtual std::size_t numLevels () const =0
 Levels of the continued ladder, its level 0 (the moved level) included. Local.
 
virtual Index numLeaves (std::size_t L) const =0
 Cells of continued-ladder level L on this rank's target block — the GLOBAL count for the replicated stage, whose one block is the whole level.
 
virtual std::string bottomName () const =0
 "jacobi" | "amg": what solves the continued ladder's coarsest level, WITHOUT the stage's diagnosticSuffix() (the owner appends it).
 
virtual void setRemoveMean (bool on)=0
 Per-level constant-nullspace projection for the singular periodic pressure; the owner forwards its own flag (DistributedFlowMultigrid::setRemoveMean).
 
virtual void setBottom (typename Multigrid< Dim, Bits >::Bottom b)=0
 What solves the continued ladder's coarsest level (docs/amr_mg_depth.md §6.6).
 
virtual View< double > targetX ()=0
 The continued ladder's level-0 solution — what moveDown reads.
 
virtual void moveUp (View< const double > src, Index nSrc)=0
 src (this rank's rows of the moved level, device; may be longer than nSrc) → the target's level-0 rhs.
 
virtual void cycle (int pre, int post, int bottom, double omega)=0
 One cycle of the continued ladder on targetComm(). Called on active ranks only.
 
virtual void moveDown (View< double > dst, Index nDst)=0
 The target's level-0 solution → the first nDst rows of dst.
 
void apply (View< const double > residual, View< double > correction, Index n, int pre, int post, int bottom, double omega)
 The whole stage for one V-cycle, in the CORRECTION SCHEME §6.5 prescribes: the caller hands in the residual at resolution L and gets back a correction to ADD.
 

Detailed Description

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

One stage of the pressure hierarchy (docs/amr_mg_depth.md §6.5).

The five things a stage IS — a target decomposition, a target communicator with an active flag, the moved fields, the level's cells on the target block as a BlockOctree, and the continued ladder below it — are the five accessors below; the two movement steps are the only part the instantiations differ in.

Owned by DistributedFlowMultigrid (at most one, built in its buildStage after the openness ladder) and driven from its vcycle through apply at the stage point; pressure_mg_levels and pressure_mg_bottom report it. Collective semantics are per method, below: movement is collective on the PARENT communicator, the continued ladder on targetComm().

Definition at line 60 of file mg_stage.hpp.

Member Typedef Documentation

◆ Octree

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::amr::MgStage< Dim, Bits >::Octree = BlockOctree<Dim, Bits>

a level's cells on one block

Definition at line 62 of file mg_stage.hpp.

◆ Decomposition

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::amr::MgStage< Dim, Bits >::Decomposition = core::decomp::BlockDecomposer<Dim>

the target partition's type

Definition at line 63 of file mg_stage.hpp.

Constructor & Destructor Documentation

◆ ~MgStage()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual peclet::amr::MgStage< Dim, Bits >::~MgStage ( )
virtualdefault

Member Function Documentation

◆ kind()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual const char * peclet::amr::MgStage< Dim, Bits >::kind ( ) const
pure virtual

"replicated" | "sibling" | "repartition".

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ diagnosticSuffix()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual const char * peclet::amr::MgStage< Dim, Bits >::diagnosticSuffix ( ) const
pure virtual

What pressure_mg_bottom appends for this stage — "+tail" for the replicated one, which is the spelling docs/amr_mg_depth.md §6.7 fixes.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ targetDecomposition()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual const Decomposition & peclet::amr::MgStage< Dim, Bits >::targetDecomposition ( ) const
pure virtual

The decomposition of the moved level's grid this stage targets.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ targetComm()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual MPI_Comm peclet::amr::MgStage< Dim, Bits >::targetComm ( ) const
pure virtual

The communicator every collective of the continued ladder runs on.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ active()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual bool peclet::amr::MgStage< Dim, Bits >::active ( ) const
pure virtual

Whether THIS rank owns a target block, i.e.

takes part in the continued ladder. Ranks that do not still take part in the MOVEMENT, on the parent communicator, and skip the recursion.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

Referenced by peclet::amr::MgStage< Dim, Bits >::apply().

◆ targetOctree()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual const Octree & peclet::amr::MgStage< Dim, Bits >::targetOctree ( ) const
pure virtual

The moved level's cells on this rank's target block.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ numLevels()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual std::size_t peclet::amr::MgStage< Dim, Bits >::numLevels ( ) const
pure virtual

Levels of the continued ladder, its level 0 (the moved level) included. Local.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ numLeaves()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual Index peclet::amr::MgStage< Dim, Bits >::numLeaves ( std::size_t  L) const
pure virtual

Cells of continued-ladder level L on this rank's target block — the GLOBAL count for the replicated stage, whose one block is the whole level.

Local.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ bottomName()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual std::string peclet::amr::MgStage< Dim, Bits >::bottomName ( ) const
pure virtual

"jacobi" | "amg": what solves the continued ladder's coarsest level, WITHOUT the stage's diagnosticSuffix() (the owner appends it).

Local.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ setRemoveMean()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual void peclet::amr::MgStage< Dim, Bits >::setRemoveMean ( bool  on)
pure virtual

Per-level constant-nullspace projection for the singular periodic pressure; the owner forwards its own flag (DistributedFlowMultigrid::setRemoveMean).

Local.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ setBottom()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual void peclet::amr::MgStage< Dim, Bits >::setBottom ( typename Multigrid< Dim, Bits >::Bottom  b)
pure virtual

What solves the continued ladder's coarsest level (docs/amr_mg_depth.md §6.6).

The exact bottom lives in the single-rank Multigrid, so this is where the selector lands.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ targetX()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual View< double > peclet::amr::MgStage< Dim, Bits >::targetX ( )
pure virtual

The continued ladder's level-0 solution — what moveDown reads.

A test uses it to assert the stage produced the same answer everywhere it is replicated (§11.2).

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

◆ moveUp()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual void peclet::amr::MgStage< Dim, Bits >::moveUp ( View< const double >  src,
Index  nSrc 
)
pure virtual

src (this rank's rows of the moved level, device; may be longer than nSrc) → the target's level-0 rhs.

Collective on the PARENT communicator: every rank takes part, active or not.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

Referenced by peclet::amr::MgStage< Dim, Bits >::apply().

◆ cycle()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual void peclet::amr::MgStage< Dim, Bits >::cycle ( int  pre,
int  post,
int  bottom,
double  omega 
)
pure virtual

One cycle of the continued ladder on targetComm(). Called on active ranks only.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

Referenced by peclet::amr::MgStage< Dim, Bits >::apply().

◆ moveDown()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
virtual void peclet::amr::MgStage< Dim, Bits >::moveDown ( View< double >  dst,
Index  nDst 
)
pure virtual

The target's level-0 solution → the first nDst rows of dst.

Implemented in peclet::amr::DistributedStage< Dim, Bits >, and peclet::amr::ReplicatedTailStage< Dim, Bits >.

Referenced by peclet::amr::MgStage< Dim, Bits >::apply().

◆ apply()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::MgStage< Dim, Bits >::apply ( View< const double >  residual,
View< double >  correction,
Index  n,
int  pre,
int  post,
int  bottom,
double  omega 
)
inline

The whole stage for one V-cycle, in the CORRECTION SCHEME §6.5 prescribes: the caller hands in the residual at resolution L and gets back a correction to ADD.

That is what makes the stage legal at every level, including L = 0 — where the level being moved is the finest one (no in-place lift was possible at all) and its iterate must not be thrown away. Where the stage fires below level 0 the incoming iterate is zero, so residual == rhs and add == overwrite, and this is bit-for-bit §6.5.1's simpler description.

Definition at line 117 of file mg_stage.hpp.

References peclet::amr::MgStage< Dim, Bits >::active(), peclet::amr::MgStage< Dim, Bits >::cycle(), peclet::amr::MgStage< Dim, Bits >::moveDown(), peclet::amr::MgStage< Dim, Bits >::moveUp(), and peclet::amr::transferFieldGradients().


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