|
peclet-amr 0.2.0
Block-local-Morton AMR octree + collocated cut-cell Navier–Stokes solver (header-only C++20, Kokkos + MPI)
|
#include <distributed_flow_mg.hpp>
Public Types | |
| using | DO = DistributedOctree< Dim, Bits > |
| using | Octree = typename DO::Octree |
| using | Poisson = AmrPoisson< Dim, Bits > |
| using | M = typename Octree::M |
| using | Code = typename Octree::Code |
| using | StagePolicy = PressureStagePolicy |
Which stage fires where the in-place ladder blocks (docs/amr_mg_core_boundary.md §11.1, §9.6, §9.7; the type and its defaults live in mg_predict.hpp so predictPressureLadder reads the same policy). | |
Public Member Functions | |
| template<class OpenFn > | |
| void | build (const DO &finest, double h0, OpenFn &&openFn, const LeafHalo< Dim, Bits > *shared0=nullptr, bool liftRoot=true, Index bottomExtent=4) |
Build with cut-cell openness openFn(faceCentreWorld, axis) → [0,1] on the flow's distributed octree (graded + cross-block 2:1 balanced). | |
| template<class OpenFn > | |
| void | build (const DO &finest, const Vec< Dim > &h0, OpenFn &&openFn, const LeafHalo< Dim, Bits > *shared0=nullptr, bool liftRoot=true, Index bottomExtent=4) |
| Phase 3: the finest spacing per axis; every level inherits the aspect ratio (AM1). | |
| void | buildRaw (const DO &finest, const Vec< Dim > &h0, const std::vector< double > &alphaLocal, bool liftRoot=true, Index bottomExtent=4) |
Build on finest with its level-0 openness GIVEN as raw rows (AmrPoisson::opennessRaw() layout, the numLeaves() LOCAL rows only) instead of sampled from a geometry — the distributed counterpart of Multigrid::buildRaw, and how a sibling-merge or repartition stage continues the ladder on its target (docs/amr_mg_depth.md §6.5): the moved level's α rows are carried over, never re-sampled. | |
| void | setStagePolicy (const StagePolicy &p) |
| const StagePolicy & | stagePolicy () const |
| void | setRemoveMean (bool on) |
| Per-level nullspace projection for the singular (periodic pure-Neumann) pressure. | |
| std::size_t | numLevels () const |
| std::size_t | numInPlaceLevels () const |
| How many of those levels are IN PLACE — octree coarsenings plus lifted levels, i.e. | |
| Index | liftDepth () const |
| How many levels the ladder gained BELOW the root brick by lifting (§6.2). | |
| bool | hasStage () const |
Whether a STAGE fires below the in-place ladder (docs/amr_mg_depth.md §5.6/§6.5): the coarsest in-place level is still larger than bottomExtent on some axis, so that level moves onto a new decomposition of its own grid and the ladder continues there: the REPLICATED tail (one block on every rank), or — with the stage policy enabled (the default; setStagePolicy) — a sibling merge or a repartition onto fewer ranks (DistributedStage), as core's chooseStageTarget decides. | |
| const char * | stageKind () const |
"replicated", "sibling" or "repartition", or "none" without a stage. | |
| std::size_t | numStageLevels () const |
Levels of the continued ladder (its level 0 IS the moved level, so the full ladder is numInPlaceLevels() + numStageLevels() — the convention predictPressureLadder reports). | |
| Index | stageLeaves (std::size_t L=0) const |
Cells of continued-ladder level L on this rank's target block (GLOBAL counts for the replicated stage). | |
| const IVec< Dim > & | stageFrom () const |
| The global grid the stage moves (the coarsest in-place level's extent). | |
| View< double > | stageSolution () |
| The moved level's solution on THIS rank's target block. | |
| MgStage< Dim, Bits > & | stage () |
| The stage itself, for tests and diagnostics. | |
| std::string | bottomName () const |
"jacobi" | "amg", suffixed by the stage's own spelling — "+tail" for the replicated one (docs/amr_mg_depth.md §6.7). | |
| void | setBottom (typename Multigrid< Dim, Bits >::Bottom b) |
| Select what solves the coarsest level (docs/amr_mg_depth.md §6.6). | |
| Index | numLeaves (std::size_t L=0) const |
| Index | extendedSize (std::size_t L=0) const |
| View< double > | x (std::size_t L=0) |
| View< double > | b (std::size_t L=0) |
| const FvOp & | op (std::size_t L=0) const |
| MPI_Comm | comm () const |
| const Poisson & | poisson (std::size_t L=0) const |
| const LeafHalo< Dim, Bits > & | halo (std::size_t L=0) const |
| void | sync (std::size_t L, View< double > v) const |
| Refresh the ghost tail of a level-L vector (the PCG matvec hook uses level 0). | |
| void | vcycle (int pre=2, int post=2, int bottom=40, double omega=0.8, std::size_t L=0) |
| One V-cycle on level L (correction scheme), the distributed mirror of Multigrid::vcycle: ghost refresh before every Jacobi sweep / residual, local transfers, Allreduce'd mean removal. | |
Definition at line 109 of file distributed_flow_mg.hpp.
| using peclet::amr::DistributedFlowMultigrid< Dim, Bits >::DO = DistributedOctree<Dim, Bits> |
Definition at line 111 of file distributed_flow_mg.hpp.
| using peclet::amr::DistributedFlowMultigrid< Dim, Bits >::Octree = typename DO::Octree |
Definition at line 112 of file distributed_flow_mg.hpp.
| using peclet::amr::DistributedFlowMultigrid< Dim, Bits >::Poisson = AmrPoisson<Dim, Bits> |
Definition at line 113 of file distributed_flow_mg.hpp.
| using peclet::amr::DistributedFlowMultigrid< Dim, Bits >::M = typename Octree::M |
Definition at line 114 of file distributed_flow_mg.hpp.
| using peclet::amr::DistributedFlowMultigrid< Dim, Bits >::Code = typename Octree::Code |
Definition at line 115 of file distributed_flow_mg.hpp.
| using peclet::amr::DistributedFlowMultigrid< Dim, Bits >::StagePolicy = PressureStagePolicy |
Which stage fires where the in-place ladder blocks (docs/amr_mg_core_boundary.md §11.1, §9.6, §9.7; the type and its defaults live in mg_predict.hpp so predictPressureLadder reads the same policy).
A negative maxBlockCells is resolved at build to the Allreduce(MAX) of level 0's local LEAF count; a stage's continued ladder inherits the resolved policy. Takes effect at the next build.
Definition at line 174 of file distributed_flow_mg.hpp.
|
inline |
Build with cut-cell openness openFn(faceCentreWorld, axis) → [0,1] on the flow's distributed octree (graded + cross-block 2:1 balanced).
Collective.
shared0 (optional): a FINALIZED LeafHalo whose registry is a superset of level 0's face probes — the distributed AmrFlow passes its ±2 flow registry so the level-0 operator's ghost columns index the SAME extended layout as the flow's cell vectors (φ, the overlay chains, the PCG/BiCGStab scratch): one layout, no cross-indexing. Level-0 probes (±1 face reach incl. finer sub-neighbours) are a subset of the flow's forEachFaceFull discovery, so every probe resolves from the frozen registry.
liftRoot / bottomExtent continue the ladder BELOW the root brick (docs/amr_mg_depth.md §6.2/§6.4): the lift is LOCKSTEP across ranks, so every rank builds the same number of levels and every per-level collective still pairs up.
Definition at line 131 of file distributed_flow_mg.hpp.
References peclet::amr::DistributedFlowMultigrid< Dim, Bits >::build(), and peclet::amr::transferFieldGradients().
Referenced by peclet::amr::DistributedFlowMultigrid< Dim, Bits >::build().
|
inline |
Phase 3: the finest spacing per axis; every level inherits the aspect ratio (AM1).
Definition at line 139 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Build on finest with its level-0 openness GIVEN as raw rows (AmrPoisson::opennessRaw() layout, the numLeaves() LOCAL rows only) instead of sampled from a geometry — the distributed counterpart of Multigrid::buildRaw, and how a sibling-merge or repartition stage continues the ladder on its target (docs/amr_mg_depth.md §6.5): the moved level's α rows are carried over, never re-sampled.
The ghost rows are exchanged from their owners through the level-0 halo, as every coarser level's are. Collective on finest.comm().
Definition at line 159 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Definition at line 175 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Definition at line 176 of file distributed_flow_mg.hpp.
|
inline |
Per-level nullspace projection for the singular (periodic pure-Neumann) pressure.
The stage's continued ladder follows this flag rather than being pinned on: on the production path flow sets it true, which is docs/amr_mg_depth.md §6.5.1 step 4's setRemoveMean(true), and with it off the stage stays what §6.5 calls it — the continuation of the same V-cycle — so the WORLD==SELF bitwise contract of §10 still holds where the stage fires.
Definition at line 183 of file distributed_flow_mg.hpp.
|
inline |
Definition at line 189 of file distributed_flow_mg.hpp.
|
inline |
How many of those levels are IN PLACE — octree coarsenings plus lifted levels, i.e.
the ones that keep the ORB and whose transfers are local. A stage's levels (docs/amr_mg_depth.md §6.5) are appended after them. Compare against predictPressureLadder(...).numInPlace().
Definition at line 193 of file distributed_flow_mg.hpp.
|
inline |
How many levels the ladder gained BELOW the root brick by lifting (§6.2).
Definition at line 195 of file distributed_flow_mg.hpp.
|
inline |
Whether a STAGE fires below the in-place ladder (docs/amr_mg_depth.md §5.6/§6.5): the coarsest in-place level is still larger than bottomExtent on some axis, so that level moves onto a new decomposition of its own grid and the ladder continues there: the REPLICATED tail (one block on every rank), or — with the stage policy enabled (the default; setStagePolicy) — a sibling merge or a repartition onto fewer ranks (DistributedStage), as core's chooseStageTarget decides.
Definition at line 202 of file distributed_flow_mg.hpp.
|
inline |
"replicated", "sibling" or "repartition", or "none" without a stage.
Definition at line 204 of file distributed_flow_mg.hpp.
|
inline |
Levels of the continued ladder (its level 0 IS the moved level, so the full ladder is numInPlaceLevels() + numStageLevels() — the convention predictPressureLadder reports).
Definition at line 207 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Cells of continued-ladder level L on this rank's target block (GLOBAL counts for the replicated stage).
hasStage(). Definition at line 210 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
The global grid the stage moves (the coarsest in-place level's extent).
Definition at line 212 of file distributed_flow_mg.hpp.
|
inline |
The moved level's solution on THIS rank's target block.
For the replicated stage every rank holds an identical copy, which is what §11.2's cross-rank bitwise check reads.
Definition at line 215 of file distributed_flow_mg.hpp.
|
inline |
The stage itself, for tests and diagnostics.
hasStage(). Definition at line 217 of file distributed_flow_mg.hpp.
|
inline |
"jacobi" | "amg", suffixed by the stage's own spelling — "+tail" for the replicated one (docs/amr_mg_depth.md §6.7).
Without a stage the coarsest in-place level is already at or below bottomExtent, where the 60 damped-Jacobi sweeps are exact.
Definition at line 221 of file distributed_flow_mg.hpp.
|
inline |
Select what solves the coarsest level (docs/amr_mg_depth.md §6.6).
The exact bottom lives in the single-rank Multigrid, so on this path it is the STAGE's bottom: without a stage the coarsest in-place level is at or below bottomExtent and the sweeps there are exact, which is why §6.6 scopes the agglomerated solve to Multigrid and the stage.
COLLECTIVE whenever no stage exists yet: the selection is re-decided by buildStage, which may BUILD the replicated stage (an Allgatherv of the coarsest level) — e.g. Agglomerated at np > 1 on a ladder that stopped at or below bottomExtent. With a stage already built it only re-selects the stage's own bottom; the stage stays. Call it on every rank. Before build it just stores the selection.
Definition at line 237 of file distributed_flow_mg.hpp.
References peclet::amr::DistributedFlowMultigrid< Dim, Bits >::b().
|
inline |
Definition at line 244 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Definition at line 245 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Definition at line 246 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
Referenced by peclet::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle().
|
inline |
Definition at line 247 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
Referenced by peclet::amr::DistributedFlowMultigrid< Dim, Bits >::setBottom().
|
inline |
Definition at line 248 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Definition at line 249 of file distributed_flow_mg.hpp.
|
inline |
Definition at line 250 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Definition at line 251 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
Refresh the ghost tail of a level-L vector (the PCG matvec hook uses level 0).
Definition at line 254 of file distributed_flow_mg.hpp.
References peclet::amr::transferFieldGradients().
|
inline |
One V-cycle on level L (correction scheme), the distributed mirror of Multigrid::vcycle: ghost refresh before every Jacobi sweep / residual, local transfers, Allreduce'd mean removal.
Definition at line 259 of file distributed_flow_mg.hpp.
References peclet::amr::jacobiFv(), peclet::amr::prolongAdd(), peclet::amr::removeMeanFvDist(), peclet::amr::residualFv(), peclet::amr::restrictField(), peclet::amr::transferFieldGradients(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle(), and peclet::amr::DistributedFlowMultigrid< Dim, Bits >::x().
Referenced by peclet::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle().