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::DistributedStage< Dim, Bits > Class Template Reference

A SIBLING-MERGE or REPARTITION stage (docs/amr_mg_depth.md §5.6, WO4b; docs/amr_mg_core_boundary.md §5): the moved level lands on a decomposition of its own grid on FEWER ranks — agglomerated(d) for a sibling merge, a fresh proportional ORB on the first np_L ranks for a repartition, both chosen by core's chooseStageTarget — and the ladder continues there as a DistributedFlowMultigrid on the stage's sub-communicator, with its own lockstep lifts, its own halos and, where it blocks again, its own stage. More...

#include <distributed_flow_mg.hpp>

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

Public Types

using Base = MgStage< Dim, Bits >
 the stage interface
 
using Octree = typename Base::Octree
 a level's cells on one block
 
using Decomposition = typename Base::Decomposition
 the target partition's type
 
using DO = DistributedOctree< Dim, Bits >
 the level the stage fires at
 
using Poisson = AmrPoisson< Dim, Bits >
 that level's FV operator
 
using MG = DistributedFlowMultigrid< Dim, Bits >
 the continued ladder
 
using Policy = typename MG::StagePolicy
 inherited by the continued ladder
 
- 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, const core::decomp::StageTarget< Dim > &target, int id, Index bottomExtent, const Policy &policy, typename Multigrid< Dim, Bits >::Bottom bottom, bool removeMean)
 Build the stage from the level it fires at (d, ap, n as for ReplicatedTailStage) onto target, a SiblingMerge or Repartition result of chooseStageTarget on d.decomposition().
 
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
 Collective on the PARENT communicator (it re-publishes the continued ladder's shape, which a bottom change may alter by building or dropping the continuation's own stage).
 
View< double > targetX () override
 The continued ladder's level-0 solution — what moveDown reads.
 
MG & multigrid ()
 The continued ladder (active ranks only).
 
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>
class peclet::amr::DistributedStage< Dim, Bits >

A SIBLING-MERGE or REPARTITION stage (docs/amr_mg_depth.md §5.6, WO4b; docs/amr_mg_core_boundary.md §5): the moved level lands on a decomposition of its own grid on FEWER ranks — agglomerated(d) for a sibling merge, a fresh proportional ORB on the first np_L ranks for a repartition, both chosen by core's chooseStageTarget — and the ladder continues there as a DistributedFlowMultigrid on the stage's sub-communicator, with its own lockstep lifts, its own halos and, where it blocks again, its own stage.

Everything that moves is core's: makeStageComm for the communicators, one RedistributeTopology for the level's rows (group Gatherv/Scatterv for a sibling merge, a planned Isend/Irecv over the box intersections for a repartition). What stays here is what a level IS on the target — the octree (DistributedOctree::initDecomposed), its α rows carried over from the moved level rather than re-sampled, and the continued ladder built from them (DistributedFlowMultigrid::buildRaw).

Ranks that own no target block take part in the movement on the parent communicator and skip the recursion; they report the continued ladder's LEVEL COUNT and bottom (broadcast from parent rank 0, which always owns target block 0) and zero cells on every level.

Definition at line 723 of file distributed_flow_mg.hpp.

Member Typedef Documentation

◆ Base

template<int Dim, unsigned Bits>
using peclet::amr::DistributedStage< Dim, Bits >::Base = MgStage<Dim, Bits>

the stage interface

Definition at line 725 of file distributed_flow_mg.hpp.

◆ Octree

template<int Dim, unsigned Bits>
using peclet::amr::DistributedStage< Dim, Bits >::Octree = typename Base::Octree

a level's cells on one block

Definition at line 726 of file distributed_flow_mg.hpp.

◆ Decomposition

template<int Dim, unsigned Bits>
using peclet::amr::DistributedStage< Dim, Bits >::Decomposition = typename Base::Decomposition

the target partition's type

Definition at line 727 of file distributed_flow_mg.hpp.

◆ DO

template<int Dim, unsigned Bits>
using peclet::amr::DistributedStage< Dim, Bits >::DO = DistributedOctree<Dim, Bits>

the level the stage fires at

Definition at line 728 of file distributed_flow_mg.hpp.

◆ Poisson

template<int Dim, unsigned Bits>
using peclet::amr::DistributedStage< Dim, Bits >::Poisson = AmrPoisson<Dim, Bits>

that level's FV operator

Definition at line 729 of file distributed_flow_mg.hpp.

◆ MG

the continued ladder

Definition at line 730 of file distributed_flow_mg.hpp.

◆ Policy

inherited by the continued ladder

Definition at line 731 of file distributed_flow_mg.hpp.

Member Function Documentation

◆ build()

template<int Dim, unsigned Bits>
void peclet::amr::DistributedStage< Dim, Bits >::build ( const DO &  d,
const Vec< Dim > &  h0,
const Poisson &  ap,
Index  n,
const core::decomp::StageTarget< Dim > &  target,
int  id,
Index  bottomExtent,
const Policy &  policy,
typename Multigrid< Dim, Bits >::Bottom  bottom,
bool  removeMean 
)
inline

Build the stage from the level it fires at (d, ap, n as for ReplicatedTailStage) onto target, a SiblingMerge or Repartition result of chooseStageTarget on d.decomposition().

id is the per-topology tag offset core's point-to-point movement needs (in [0, RedistributeTopology::kTagSpan)). The continued ladder inherits policy, bottom and removeMean. Collective on d.comm().

Exceptions
std::runtime_errorif an axis is not periodic or this rank's leaves are not the root cells of its block (the lift is not nested) — before any communication; core's makeStageComm / RedistributeTopology::build throw on a malformed target.

Definition at line 742 of file distributed_flow_mg.hpp.

References peclet::amr::DistributedOctree< Dim, Bits >::blockBrick(), peclet::amr::DistributedOctree< Dim, Bits >::comm(), peclet::amr::DistributedOctree< Dim, Bits >::decomposition(), peclet::amr::DistributedOctree< Dim, Bits >::findGlobalRoot(), peclet::amr::DistributedOctree< Dim, Bits >::globalGeometry(), peclet::amr::DistributedOctree< Dim, Bits >::initDecomposed(), 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(), and peclet::amr::transferFieldGradients().

◆ kind()

template<int Dim, unsigned Bits>
const char * peclet::amr::DistributedStage< Dim, Bits >::kind ( ) const
inlineoverridevirtual

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

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

Definition at line 824 of file distributed_flow_mg.hpp.

◆ diagnosticSuffix()

template<int Dim, unsigned Bits>
const char * peclet::amr::DistributedStage< 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 827 of file distributed_flow_mg.hpp.

◆ targetDecomposition()

template<int Dim, unsigned Bits>
const Decomposition & peclet::amr::DistributedStage< 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 830 of file distributed_flow_mg.hpp.

◆ targetComm()

template<int Dim, unsigned Bits>
MPI_Comm peclet::amr::DistributedStage< Dim, Bits >::targetComm ( ) const
inlineoverridevirtual

The communicator every collective of the continued ladder runs on.

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

Definition at line 831 of file distributed_flow_mg.hpp.

◆ active()

template<int Dim, unsigned Bits>
bool peclet::amr::DistributedStage< 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 832 of file distributed_flow_mg.hpp.

◆ targetOctree()

template<int Dim, unsigned Bits>
const Octree & peclet::amr::DistributedStage< 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 833 of file distributed_flow_mg.hpp.

References peclet::amr::DistributedOctree< Dim, Bits >::local().

◆ numLevels()

template<int Dim, unsigned Bits>
std::size_t peclet::amr::DistributedStage< 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 835 of file distributed_flow_mg.hpp.

◆ numLeaves()

template<int Dim, unsigned Bits>
Index peclet::amr::DistributedStage< 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 836 of file distributed_flow_mg.hpp.

References peclet::amr::transferFieldGradients().

◆ bottomName()

template<int Dim, unsigned Bits>
std::string peclet::amr::DistributedStage< 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 842 of file distributed_flow_mg.hpp.

◆ setRemoveMean()

template<int Dim, unsigned Bits>
void peclet::amr::DistributedStage< 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 843 of file distributed_flow_mg.hpp.

◆ setBottom()

template<int Dim, unsigned Bits>
void peclet::amr::DistributedStage< Dim, Bits >::setBottom ( typename Multigrid< Dim, Bits >::Bottom  b)
inlineoverridevirtual

Collective on the PARENT communicator (it re-publishes the continued ladder's shape, which a bottom change may alter by building or dropping the continuation's own stage).

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

Definition at line 849 of file distributed_flow_mg.hpp.

◆ targetX()

template<int Dim, unsigned Bits>
View< double > peclet::amr::DistributedStage< 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 854 of file distributed_flow_mg.hpp.

References peclet::amr::transferFieldGradients().

◆ multigrid()

template<int Dim, unsigned Bits>
MG & peclet::amr::DistributedStage< Dim, Bits >::multigrid ( )
inline

The continued ladder (active ranks only).

Precondition
active().

Definition at line 857 of file distributed_flow_mg.hpp.

◆ moveUp()

template<int Dim, unsigned Bits>
void peclet::amr::DistributedStage< 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 859 of file distributed_flow_mg.hpp.

References peclet::amr::transferFieldGradients().

◆ cycle()

template<int Dim, unsigned Bits>
void peclet::amr::DistributedStage< 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 877 of file distributed_flow_mg.hpp.

References peclet::amr::transferFieldGradients().

◆ moveDown()

template<int Dim, unsigned Bits>
void peclet::amr::DistributedStage< 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 881 of file distributed_flow_mg.hpp.

References peclet::amr::transferFieldGradients().


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