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::ReplicatedTailStage< Dim, Bits > Class Template Referencefinal

The REPLICATED stage (docs/amr_mg_depth.md §6.5.1): the target decomposition is one block — the whole level — on every rank, and the continued ladder is a single-rank Multigrid on the gathered grid, running its own §6.2 lifts down to its own §6.6 bottom. More...

#include <mg_stage.hpp>

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

Public Types

using Base = MgStage< Dim, Bits >
 the stage interface
 
using Octree = typename Base::Octree
 the gathered level, one block
 
using Decomposition = typename Base::Decomposition
 one block: the whole level
 
using DO = DistributedOctree< Dim, Bits >
 the level the stage fires at
 
using Poisson = AmrPoisson< Dim, Bits >
 that level's FV operator
 
- Public Types inherited from peclet::amr::MgStage< Dim, Bits >
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

void build (const DO &d, const Vec< Dim > &h0, const Poisson &ap, Index n, Index nExt, Index bottomExtent, MPI_Comm comm)
 Build the stage from the level it fires at: d is that level's distributed octree (lifted, so its decomposition and globalRootSize() are in the level's own cell units), ap its AmrPoisson — whose opennessRaw() rows are the DISTRIBUTED openness ladder's own output and are carried over rather than re-sampled — and n its local cell count.
 
const char * kind () const override
 "replicated" | "sibling" | "repartition".
 
const char * diagnosticSuffix () const override
 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.
 
const Decomposition & targetDecomposition () const override
 The decomposition of the moved level's grid this stage targets.
 
MPI_Comm targetComm () const override
 The communicator every collective of the continued ladder runs on.
 
bool active () const override
 Whether THIS rank owns a target block, i.e.
 
const Octree & targetOctree () const override
 The moved level's cells on this rank's target block.
 
std::size_t numLevels () const override
 Levels of the continued ladder, its level 0 (the moved level) included. Local.
 
Index numLeaves (std::size_t L) const override
 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.
 
std::string bottomName () const override
 "jacobi" | "amg": what solves the continued ladder's coarsest level, WITHOUT the stage's diagnosticSuffix() (the owner appends it).
 
void setRemoveMean (bool on) override
 Per-level constant-nullspace projection for the singular periodic pressure; the owner forwards its own flag (DistributedFlowMultigrid::setRemoveMean).
 
void setBottom (typename Multigrid< Dim, Bits >::Bottom b) override
 What solves the continued ladder's coarsest level (docs/amr_mg_depth.md §6.6).
 
View< double > targetX () override
 The continued ladder's level-0 solution — what moveDown reads.
 
Multigrid< Dim, Bits > & multigrid ()
 The continued ladder itself — a single-rank Multigrid, exposed for the WO5 bottom selector.
 
void moveUp (View< const double > src, Index nSrc) override
 src (this rank's rows of the moved level, device; may be longer than nSrc) → the target's level-0 rhs.
 
void cycle (int pre, int post, int bottom, double omega) override
 One cycle of the continued ladder on targetComm(). Called on active ranks only.
 
void moveDown (View< double > dst, Index nDst) override
 The target's level-0 solution → the first nDst rows of dst.
 
- Public Member Functions inherited from peclet::amr::MgStage< Dim, Bits >
virtual ~MgStage ()=default
 
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::ReplicatedTailStage< Dim, Bits >

The REPLICATED stage (docs/amr_mg_depth.md §6.5.1): the target decomposition is one block — the whole level — on every rank, and the continued ladder is a single-rank Multigrid on the gathered grid, running its own §6.2 lifts down to its own §6.6 bottom.

Every rank is active and every rank computes the identical tail, so moveDown is a local pick with no communication and the result is decomposition-independent by construction.

The movement is core's (peclet::core::decomp, amr_mg_core_boundary.md §5): a StageKind::Replicated target, its StageComm, and one RedistributeTopology — an Allgatherv in parent-rank order, each rank's block x-fastest, unpacked through the tail's own leaf index. Pure copies, so the tail sees bitwise the values the former hand-written gid-keyed Allgatherv delivered.

Definition at line 138 of file mg_stage.hpp.

Member Typedef Documentation

◆ Base

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

the stage interface

Definition at line 140 of file mg_stage.hpp.

◆ Octree

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

the gathered level, one block

Definition at line 141 of file mg_stage.hpp.

◆ Decomposition

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::amr::ReplicatedTailStage< Dim, Bits >::Decomposition = typename Base::Decomposition

one block: the whole level

Definition at line 142 of file mg_stage.hpp.

◆ DO

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::amr::ReplicatedTailStage< Dim, Bits >::DO = DistributedOctree<Dim, Bits>

the level the stage fires at

Definition at line 143 of file mg_stage.hpp.

◆ Poisson

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

that level's FV operator

Definition at line 144 of file mg_stage.hpp.

Member Function Documentation

◆ build()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::amr::ReplicatedTailStage< Dim, Bits >::build ( const DO &  d,
const Vec< Dim > &  h0,
const Poisson &  ap,
Index  n,
Index  nExt,
Index  bottomExtent,
MPI_Comm  comm 
)
inline

Build the stage from the level it fires at: d is that level's distributed octree (lifted, so its decomposition and globalRootSize() are in the level's own cell units), ap its AmrPoisson — whose opennessRaw() rows are the DISTRIBUTED openness ladder's own output and are carried over rather than re-sampled — and n its local cell count.

Collective on comm (the communicator d is decomposed over).

Every rank then holds the whole level (G = d.globalRootSize() cells) and a single-rank Multigrid on it, lifted down to bottomExtent with its own §6.6 bottom (default selection auto; the owner re-sets it). nExt is unused (the extended size of the caller's views). Memory: O(G) doubles and one host Multigrid per rank.

Precondition
d is nested (every local leaf is a root cell of the lifted grid) and periodic on every axis.
Exceptions
std::runtime_errorif an axis is not periodic, or if this rank's leaves are not the root cells of its block (the lift was not nested) — both before any communication; core's RedistributeTopology throws if the blocks do not tile the level grid.

Definition at line 162 of file mg_stage.hpp.

References peclet::amr::DistributedOctree< Dim, Bits >::blockBrick(), peclet::amr::DistributedOctree< Dim, Bits >::decomposition(), peclet::amr::DistributedOctree< Dim, Bits >::findGlobalRoot(), peclet::amr::DistributedOctree< Dim, Bits >::globalRootSize(), peclet::amr::BlockOctree< Dim, Bits >::level(), peclet::amr::DistributedOctree< Dim, Bits >::lmax(), peclet::amr::DistributedOctree< Dim, Bits >::local(), peclet::amr::BlockOctree< Dim, Bits >::numLeaves(), peclet::amr::AmrPoisson< Dim, Bits >::opennessRaw(), peclet::amr::DistributedOctree< Dim, Bits >::periodic(), peclet::amr::DistributedOctree< Dim, Bits >::rootSpan(), and peclet::amr::transferFieldGradients().

◆ kind()

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

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

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 247 of file mg_stage.hpp.

◆ diagnosticSuffix()

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

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.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 248 of file mg_stage.hpp.

◆ targetDecomposition()

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

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

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 249 of file mg_stage.hpp.

◆ targetComm()

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

The communicator every collective of the continued ladder runs on.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 250 of file mg_stage.hpp.

◆ active()

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

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.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 251 of file mg_stage.hpp.

◆ targetOctree()

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

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

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 252 of file mg_stage.hpp.

◆ numLevels()

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

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

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 254 of file mg_stage.hpp.

◆ numLeaves()

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

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.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 255 of file mg_stage.hpp.

References peclet::amr::transferFieldGradients().

◆ bottomName()

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

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

Local.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 256 of file mg_stage.hpp.

◆ setRemoveMean()

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

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

Local.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 257 of file mg_stage.hpp.

◆ setBottom()

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

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.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 258 of file mg_stage.hpp.

◆ targetX()

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

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).

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 259 of file mg_stage.hpp.

◆ multigrid()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Multigrid< Dim, Bits > & peclet::amr::ReplicatedTailStage< Dim, Bits >::multigrid ( )
inline

The continued ladder itself — a single-rank Multigrid, exposed for the WO5 bottom selector.

Definition at line 262 of file mg_stage.hpp.

◆ moveUp()

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

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.

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 264 of file mg_stage.hpp.

References peclet::amr::transferFieldGradients().

◆ cycle()

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

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

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 273 of file mg_stage.hpp.

References peclet::amr::transferFieldGradients().

◆ moveDown()

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

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

Implements peclet::amr::MgStage< Dim, Bits >.

Definition at line 277 of file mg_stage.hpp.

References peclet::amr::transferFieldGradients().


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