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 Namespace Reference

Namespaces

namespace  cc
 
namespace  detail
 
namespace  oracle
 
namespace  pybind
 

Classes

struct  AdaptResult
 
class  AmgBottom
 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...
 
class  AmrCutCell
 
class  AmrFlow
 
struct  AmrGeometry
 World-space placement of a block-local octree: fine coordinate (0,..,0) sits at origin, and one level-0 fine cell is h0[d] wide on axis d. More...
 
class  AmrMultigrid
 Geometric multigrid for AmrPoisson over a uniformly-coarsened octree hierarchy. More...
 
class  AmrPoisson
 Cell-centered FV Poisson operator on one (periodic) block octree. More...
 
class  BarnesHut
 
class  BlockOctree
 Per-block adaptive octree over block-local Morton codes. More...
 
struct  BlockOctreeView
 Device mirror of a BlockOctree's leaf arrays + device-callable queries. More...
 
struct  CfCompCsr
 Component-tagged CSR overlay (the divergence delta): out(i) += Σ_k coef·u[comp](slot). More...
 
struct  CfCompCsrDev
 
struct  CfCsr
 Scalar-input CSR overlay: out(i) += Σ_k coef·f(slot) over rows with C/F faces. More...
 
struct  CfCsrDev
 Device mirror of a CfCsr (empty when the scheme is standard / no C/F rows). More...
 
struct  CfUfDelta
 (uf_scheme − uf_std) for the div-free FACE field uf_k = ½(u_i+u_j) − (φ₊−φ₋)/d, one delta row per forEachFaceFull SLOT (cell-major enumeration — the FaceGeom / oracle faceStart CSR order, identical on both engines). More...
 
struct  Csr
 An assembled face-CSR: row offsets (size n+1), neighbour index + coefficient per face (size nFaces). More...
 
struct  CsrCountSink
 Sink passed to the emit functor during the COUNT pass: just tallies faces. More...
 
struct  CsrFillSink
 Sink passed to the emit functor during the FILL pass: writes each face into the cell's own slice [start_i, start_{i+1}) at the running cursor k (no atomics — deterministic). More...
 
class  DistributedFlowMultigrid
 
class  DistributedFvOperator
 
class  DistributedGatherHalo
 Value-only, device-resident face-neighbour gather over a fixed topology (C2). More...
 
class  DistributedMultigrid
 Distributed geometric-multigrid V-cycle for the plain Laplacian on a uniform (lmax==0) octree, the distributed analog of the host AmrMultigrid + flow's MPI-folded CutcellMG. More...
 
class  DistributedMultigridView
 Device-resident distributed geometric multigrid for the plain Laplacian (the device analogue of the host DistributedMultigrid). More...
 
class  DistributedOctree
 
class  DistributedPoisson
 
class  DistributedPoissonView
 Device-resident distributed plain-Laplacian Poisson operator: y = ∇²x with cross-block neighbours from the device gather halo. More...
 
class  DistributedStage
 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...
 
struct  FaceGeom
 
struct  FaceGeomEmit
 The device face-geometry walker: replicates AmrPoisson::forEachFaceFull + periodicNeighbor over the device octree, using FvFaceEmit's geometry helpers. More...
 
struct  FvFaceEmit
 Device-callable reproduction of AmrPoisson's per-cell face walk + geometry. More...
 
struct  FvOp
 
struct  GhostGradCsrDev
 Device CSR gradient overlay (sampled mode) + upload + apply (the variable-length analog of GhostGradOverlay / applyGhostGrad; overwrites gx/gy/gz on the overlay cells). More...
 
struct  GhostGradCsrHost
 Host CSR form of the SAMPLED directional gradient overlay (variable-length stencils — a seam row's cascade composes with its LS sample functionals, so the fixed 9-entry GhostGradOverlay cannot hold it). More...
 
struct  GhostGradOverlay
 Ghost-gradient overlay (setGhostGradient): per cut cell, a precomputed 3-point directional FD stencil per axis replacing the ABC grad3 value — central where both axis-neighbour centers are fluid, 2nd-order one-sided toward the fluid else (never reads a decoupled solid-centered value; gradOf's read of the pinned p=0 through partially-open faces is a gauge-dependent O(1/h) error at cut cells — measured in tests/study_amr_ghost_apriori.cpp). More...
 
struct  GhostOverlay
 Host ghost-projection overlay: one row per non-clean fluid leaf (== cut cell: some ±1 center sample solid). More...
 
struct  GhostOverlayDev
 Device mirror of GhostOverlay (uploaded once per setSolid). More...
 
struct  GhostOverlaySampled
 Sampled overlay: the classic per-row fields (weights, states, rescale — base; base.nbr is UNUSED) plus one linear functional per chain slot (r*15 + a*5 + (q+2)) in CSR form. More...
 
struct  GhostOverlaySampledDev
 Device mirror of GhostOverlaySampled (uploaded once per setSolid). More...
 
class  GradedDistributedMultigrid
 Geometric-multigrid V-cycle on a graded distributed octree, built on DistributedFvOperator. More...
 
struct  LeafField
 A value per leaf, in the octree's Z-order leaf slot order. More...
 
class  LeafHalo
 
class  LeafHaloExchange
 Device-resident value refresh over a finalized LeafHalo: pack the owner's local values as a Kokkos kernel, move only the compact buffers across MPI (host-staged by default, GPU-aware via PECLET_CORE_GPU_AWARE_MPI — the GridHalo/DistributedGatherHalo pattern), scatter into the ghost tail of the extended device field. More...
 
struct  MgLadderPrediction
 The whole predicted ladder: what predictPressureLadder returns and what peclet.amr.predict_hierarchy hands to Python as a dict. More...
 
struct  MgLevelPrediction
 One predicted level of the pressure ladder (docs/amr_mg_depth.md §6.7). More...
 
class  MgStage
 One stage of the pressure hierarchy (docs/amr_mg_depth.md §6.5). More...
 
class  MomentumMG
 
struct  MomFaceEmit
 Device-callable reproduction of AmrCutCell::assembleOperator's per-cell row + diagonal. More...
 
struct  MomScaleSink
 Sink adapter: forwards each face from the FvFaceEmit traversal as (j, factor·coef) to the real CSR sink — turns the plain geometric coeff into the regular-fluid momentum coupling −μ·invV·(a·c). More...
 
struct  MomSumSink
 Sink that just sums the geometric coeffs of a cell's faces (Σ a·c for the regular diagonal). More...
 
class  Multigrid
 
class  PCG
 
struct  PressureStagePolicy
 Which stage the distributed pressure ladder uses where its in-place lift blocks (docs/amr_mg_depth.md §5.6, WO4b; docs/amr_mg_core_boundary.md §11.1, §9.6, §9.7). More...
 
class  ReplicatedTailStage
 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...
 
class  ScalarTransport
 
struct  SeamReconHost
 Host-side seam-reconstruction tables (docs/amr_cf_convective.md §5.2), built once per AmrFlow::setSolid by buildSeamRecon and uploaded into FaceGeom (face_geom.hpp), where the two advective kernels read them through advect_recon.hpp. More...
 
struct  SeamView
 The seam tables as the advective kernels capture them: const Views plus the ablation flag (AmrFlow::setSeamReconstruction). More...
 
class  VelocityMG
 

Typedefs

template<unsigned Bits = 21u>
using MomentumSolver = solver::MomentumSolver
 The BiCGStab solver never touched the octree: its Bits parameter was vestigial and is gone in core.
 

Enumerations

enum  AdaptFlag : int { kCoarsen = -1 , kKeep = 0 , kRefine = 1 }
 Per-leaf adaptation flags from an indicator: refine where ind > refineThresh (and the leaf can go finer, level > finestLevel), coarsen where ind < coarsenThresh (and it can go coarser, level < lmax), else keep. More...
 
enum class  CfScheme : int { standard = 0 , quadratic = 1 }
 Coarse/fine interface scheme for the collocated flow operators. More...
 
enum class  MgLevelKind {
  Octree , Lifted , Tail , Sibling ,
  Repartition
}
 Where a predicted level comes from. More...
 
enum class  MgBottomKind { Jacobi , Amg }
 What solves the coarsest level. More...
 

Functions

template<int Dim, unsigned Bits>
std::vector< std::array< double, Dim > > transferFieldGradients (const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF)
 Per-old-leaf minmod prolongation gradients (per fine-coordinate unit) — transferField's stencil, exposed so a DISTRIBUTED caller can substitute halo-completed gradients (transferGradients in distributed_adapt.hpp): the block-local faceNeighbor returns -1 at block edges, which silently zeroes the gradient there — correct at a true domain edge (the single-rank convention) but np-DEPENDENT at interior block boundaries.
 
template<int Dim, unsigned Bits>
std::vector< double > transferField (const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF, const BlockOctree< Dim, Bits > &newT, bool linear=true, const std::type_identity_t< std::vector< std::array< double, Dim > > > *gradIn=nullptr)
 Conservative remap of a leaf field from oldT to newT (same domain).
 
template<int Dim, unsigned Bits>
std::vector< int > flagByIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &ind, double refineThresh, double coarsenThresh, unsigned finestLevel=0)
 
template<int Dim, unsigned Bits>
AdaptResult< Dim, Bits > adaptField (const BlockOctree< Dim, Bits > &t, const std::vector< double > &f, const std::vector< int > &flags, bool linear=true)
 Apply adaptation flags (one level of refine/coarsen) to t carrying field f, then 2:1-balance and remap.
 
template<int Dim, unsigned Bits>
AdaptResult< Dim, Bits > adapt (const BlockOctree< Dim, Bits > &t, const std::vector< double > &f, double refineThresh, double coarsenThresh, unsigned finestLevel=0, double eps=0.01, bool linear=true)
 All-in-one solution-adaptive step: Löhner indicator → flags → adaptField.
 
double korenPsi (double r)
 psi = max(0, min(2r, (1+2r)/3, 2)) — the Koren limiter, written once for the two reconstructions below (same operations, same order: factoring it out is bit-inert).
 
double hoFaceValue (double upup, double up, double down, int scheme)
 High-order advected face value from the two upwind cells (upup, up) and the downwind cell (down).
 
double hoFaceValueSeam (double upup, double up, double upStar, double downStar, double d1, double dUU, double dD, int scheme)
 The same reconstruction with every distance and every sample made explicit — the rule of docs/amr_cf_convective.md §5.1, for a face whose upwind-side stencil crosses an octree level:
 
template<int Dim, unsigned Bits>
FvOp assembleFv (const AmrPoisson< Dim, Bits > &ap, const BlockOctreeView< Dim, Bits > &ov)
 Assemble the FvOp entirely on the device from a host AmrPoisson's geometry (h0, periodicity, immersed-wall mode, fine extent, and openness) + a device BlockOctreeView.
 
template<class M >
Index amrLocate (const typename M::code_type *codes, const std::uint8_t *levels, Index n, typename M::code_type p)
 Locate the leaf containing Morton code p in sorted leaf arrays.
 
template<unsigned Bits, class RowFn , class FluidFn >
CfCsr buildCfLapDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, double factor, RowFn &&rowOk, FluidFn &&fluidOk, CfScheme scheme)
 (∇²_scheme − ∇²_std) as a scalar CSR, ×factor (pass μ for the momentum deferred-correction RHS, 1 for a pressure-matrix delta): row i gains scale = factor·invV·(αA/d)·(±1) per directed C/F face (+ for a coarser neighbour's substituted value, − for our own value substituted at a finer sub-face) — the same construction as Multigrid's quad CSR.
 
template<unsigned Bits, class RegularFn , class FluidFn >
CfCompCsr buildCfDivDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &&regularOk, FluidFn &&fluidOk, CfScheme scheme)
 (D_scheme − D_std) for the face-average divergence div_i = invV·Σ α·A·dir·(face value).
 
template<unsigned Bits, class RegularFn , class FluidFn >
std::array< CfCsr, 3 > buildCfGradDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &&regularOk, FluidFn &&fluidOk, CfScheme scheme)
 (G_scheme − G_std) for the ABC cell gradient gradOf/grad3.
 
template<unsigned Bits, class RegularFn , class FluidFn >
CfUfDelta buildCfUfDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &&regularOk, FluidFn &&fluidOk, CfScheme scheme)
 
template<unsigned Bits, class RegularFn , class FluidFn >
Index countCfCutFaces (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &&regularOk, FluidFn &&fluidOk)
 The C/F CENSUS (docs/amr_cf_flux_gate.md §6.5): how many OWNED forEachFaceFull slots (i, j) are a 2:1 sub-face between two FLUID cells on which the per-face gate WITHHOLDS the quadratic value, i.e.
 
void cfApplyHost (const CfCsr &c, const std::vector< double > &f, std::vector< double > &out)
 out(i) += Σ coef·f(slot) (the scalar overlay: momentum ∇² delta, gradient delta per axis).
 
void cfApplyCompHost (const CfCompCsr &c, const std::array< std::vector< double >, 3 > &u, std::vector< double > &out)
 out(i) += Σ coef·u[comp](slot) (the divergence overlay).
 
CfCsrDev uploadCfCsr (const CfCsr &h, const char *name)
 
CfCompCsrDev uploadCfCompCsr (const CfCompCsr &h, const char *name)
 
void cfApply (const CfCsrDev &c, View< const double > f, View< double > out)
 out(i) += Σ coef·f(slot).
 
void cfApplyComp (const CfCompCsrDev &c, View< const double > u0, View< const double > u1, View< const double > u2, View< double > out)
 out(i) += Σ coef·u[comp](slot).
 
template<class CountFn >
View< Index > scanOffsets (Index n, const CountFn &countFn, Index &nTotal)
 CSR row offsets (size n+1) from a per-cell count functor, via one exclusive prefix scan, with the total written to nTotal.
 
template<class Emit >
Csr buildFaceCsr (Index n, const Emit &emit)
 Build a face-CSR on device from a per-cell emit functor.
 
template<int Dim, unsigned Bits>
std::vector< double > lohnerIndicatorDistributed (const DistributedOctree< Dim, Bits > &d, const std::vector< double > &u, double eps=0.01)
 Löhner indicator per local leaf, using the owner-based face-neighbour halo so cross-block neighbours contribute exactly as in a whole-domain solve.
 
template<int Dim, unsigned Bits>
std::vector< std::array< double, Dim > > transferGradients (const DistributedOctree< Dim, Bits > &d, const std::vector< double > &f)
 transferField's minmod prolongation gradients on a DistributedOctree: bit-identical to the block-local transferFieldGradients wherever the stencil is in-block, block-crossing faces completed from the owners (coverValues + coverLevels — the covering leaf across a 2:1 interface is probed at the same corner coordinate faceNeighbor uses), and DOMAIN-crossing probes counted as missing — the single-rank faceNeighbor convention — so np=1 reproduces the local gradients bit-for-bit and the transfer is bit-exact WORLD==SELF.
 
template<int Dim, unsigned Bits>
std::vector< double > distributedAdapt (DistributedOctree< Dim, Bits > &d, const std::vector< double > &f, double refineThresh, double coarsenThresh, unsigned finestLevel=0, double eps=0.01, bool linear=true)
 One distributed solution-adaptive step.
 
void removeMeanFvDist (const FvOp &op, View< double > u, MPI_Comm comm)
 removeMeanFv with the two mean sums folded across ranks (identical kernels; the Allreduce sits between the reduce and the subtract).
 
SeamView makeSeamView (const FaceGeom &g, bool on)
 Bundle a FaceGeom's seam tables for the kernels.
 
template<unsigned Bits>
FaceGeom assembleFaceGeom (const AmrPoisson< 3, Bits > &ap, const std::vector< char > &fluidHost, const BlockOctreeView< 3, Bits > &ov)
 Assemble the collocated FaceGeom entirely on device from a built AmrPoisson (openness set) + a per-cell fluid flag + the device octree view.
 
bool amrEnvFlag (const char *name)
 Truthy environment flag (unset / "" / "0" ⇒ false).
 
template<int Dim, unsigned Bits, class FluidFn >
FaceGeom buildFaceGeom (const AmrPoisson< Dim, Bits > &ap, FluidFn &&isFluid)
 Build FaceGeom from a built AmrPoisson (openness set) + a fluid predicate.
 
void divergence (const FaceGeom &g, View< const double > u0, View< const double > u1, View< const double > u2, View< double > div)
 Openness-weighted FV divergence: div_i = invVol_i Σ_faces α·area·dir·½(u^axis_i+u^axis_j), on fluid cells (0 elsewhere).
 
void buildFaceField (const FaceGeom &g, View< const double > u0, View< const double > u1, View< const double > u2, View< const double > phi, View< double > uf)
 Build the ABC/Basilisk divergence-free FACE field: uf(k) = ½(u^axis_i+u^axis_j) − (φ₊−φ₋)/dist for face k of cell i (+axis velocity), from u* (call after the pressure solve, before the cell gradient correction).
 
double divFaceNorm (const FaceGeom &g, View< const double > uf)
 L2 norm of the divergence of the FACE field uf (the div-free flux diagnostic / host-parity check).
 
void grad3 (const FaceGeom &g, View< const double > f, View< double > gx, View< double > gy, View< double > gz)
 ABC cell-gradient of a scalar field f: gx/gy/gz = ½(g⁻+g⁺) of the adjacent face gradients along each axis, a closed face (α≤1e-12) contributing nothing (and not counted).
 
void applyGhostGrad (const GhostGradOverlay &ov, View< const double > f, View< double > gx, View< double > gy, View< double > gz)
 Overwrite gx/gy/gz on the overlay cells with the directional stencil applied to f.
 
void momRhs (View< const double > uc, View< const double > gradP, View< const double > adv, View< const double > rscale, View< const char > fluid, double idiag, double fc, View< double > b, Index n)
 Momentum RHS for one component: b_i = fluid ? (idiag·u_i + f_c − gradP_i − adv_i)·rscale_i : 0 (== AmrCutCell::makeRhs of the oracle::AmrFlow predictor source, u_bc = 0).
 
void buildFou (const FaceGeom &g, View< const double > u0, View< const double > u1, View< const double > u2, double rho, View< const double > rscale, View< double > advDiag, View< double > advCoef, View< const double > uf, bool useFace)
 Build the implicit-FOU advection operator from the lagged velocity u0..2 (uⁿ) entirely on device, as the per-cell outflow diagonal advDiag + per-face inflow coefficient advCoef over the face-geometry CSR (g.start/g.nbr).
 
template<class FldFn >
double advectedFaceValue (const SeamView &sv, Index k, bool upIsI, double phiUpUp, double phiUp, double phiDown, double distK, int advScheme, const FldFn &fld)
 THE advected face value at one (sub)face slot — written once so deferredSou and advectExplicit cannot drift (docs/amr_cf_convective.md §5.3).
 
void deferredSou (const FaceGeom &g, View< const double > u0, View< const double > u1, View< const double > u2, int comp, double rho, int advScheme, View< double > defc, View< const double > uf, bool useFace, bool seamOn)
 Deferred-correction advection term for component comp: defc = ρ·SOU − ρ·FOU (UNSCALED; the predictor RHS applies the cut-cell rscale once).
 
void advectExplicit (const FaceGeom &g, View< const double > u0, View< const double > u1, View< const double > u2, int comp, double rho, int advScheme, View< double > defc, View< const double > uf, bool useFace, bool seamOn)
 Fully-explicit high-order advection for component comp: defc = ρ·SOU (no implicit FOU; the setImplicitAdvection(false) fallback).
 
void correct (View< double > uc, View< const double > gphi, View< const char > fluid, Index n)
 u_c -= gradPhi_c on fluid cells (the projection velocity correction).
 
void presUpdate (View< double > p, View< const double > phi, View< const double > div, View< const char > fluid, double rho_dt, double mu, Index n)
 Rotational incremental pressure update: p += (ρ/dt)φ − μ·div, on fluid cells.
 
template<int Dim, unsigned Bits>
void laplacian (BlockOctreeView< Dim, Bits > dev, View< double > x, View< double > y, double inv)
 y = inv · Σ_faces (x_nb − x_i) (= ∇² in spacing h0 with inv = 1/h0²), on device.
 
template<int Dim, unsigned Bits>
void jacobiSweep (BlockOctreeView< Dim, Bits > dev, View< double > x, View< const double > b, View< double > lx, double inv, double omega)
 One weighted-Jacobi sweep of L u = b with L = ∇² (negative-definite, diagonal −2·Dim·inv), on device.
 
FvCsrOpT< View< const double >, View< const Index > > fvView (const FvOp &op)
 View the assembled FV operator through the shared backend-agnostic FvCsrOpT, so the device kernels and the host AmrPoisson run the same row arithmetic (face_csr.hpp).
 
void applyFv (const FvOp &op, View< const double > u, View< double > Lu)
 Hu = (c0·I + cD·L) u (consistent conservative FV Laplacian, c0=0/cD=1 ⇒ pure L).
 
void residualFv (const FvOp &op, View< const double > u, View< const double > rhs, View< double > res)
 res = rhs − H u.
 
void jacobiFv (const FvOp &op, View< double > u, View< const double > rhs, View< double > tmp, double omega)
 One weighted-Jacobi sweep of H u = rhs (in place).
 
void removeMeanFv (const FvOp &op, View< double > u)
 Project u to volume-weighted-mean-zero over the ACTIVE (fluid) cells of the operator — the constant-nullspace removal for the singular periodic (pure-Neumann) operator.
 
void quadDelta (View< const Index > qStart, View< const Index > qSlot, View< const double > qCoef, View< const double > u, View< double > dq, Index n)
 dq = (L_quad − L_std) u, the quadratic coarse-fine correction as its own SpMV over a precomputed CSR (built from AmrPoisson::coarseStar).
 
template<unsigned Bits>
GhostOverlay buildGhostOverlay (const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, const std::vector< double > &sdfC, int matrixOrder, int rhsOrder, bool *bandViolation=nullptr)
 Build the overlay from the octree + the cell-centered SDF samples (AmrCutCell::sdfCRaw — EXTENDED over the ghost slots in a distributed build, where pres carries the LeafHalo resolver seam and the chains may hop through ghosts).
 
template<class SdfFn >
auto makeBinaryOpenFn (SdfFn sdfFn, const Vec< 3 > &h0)
 Binary openness callable factory for the MG surrogate: a face is open iff both adjacent centers (probed at ±h0/2 along the face normal — the adjacent finest-leaf centers in the cut band; deep fluid elsewhere, where the probe distance is irrelevant) are fluid AND the float face sample (mean of the float center samples — the overlay's classification arithmetic) is fluid.
 
template<class SdfFn >
auto makeBinaryOpenFn (SdfFn sdfFn, double h0)
 Cubic-cell overload — the pre-Phase-3 spelling.
 
template<unsigned Bits>
std::vector< char > findPocketCells (const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, const std::vector< double > &sdfC)
 Fragmentation guard (the AMR port of flow's host-BFS pocket guard): the BINARY coupled-face graph (a face couples two cells iff its binary openness is 1) can FRAGMENT on tight-throat / enclosed geometries — each pocket then carries its own constant null vector and BiCGStab breaks down (fields → 1e152, measured in flow on RCP packings).
 
void ghostApplyDeltaHost (const GhostOverlay &ov, const std::vector< double > &x, std::vector< double > &y)
 Matrix overlay: y currently holds the BINARY L matvec; overwrite the overlay rows with y = rho·(y + invh²·Delta_grid) (decoupled rows → 0).
 
void ghostDivergDeltaHost (const GhostOverlay &ov, const std::array< std::vector< double >, 3 > &u, std::vector< double > &d)
 Divergence overlay: d currently holds the BINARY divergence (physical); overwrite overlay rows with d = rho·(d + invh·delta_div) (decoupled → 0).
 
GhostOverlayDev uploadGhostOverlay (const GhostOverlay &h)
 
void ghostApplyDelta (const GhostOverlayDev &ov, View< const double > x, View< double > y)
 Device matrix overlay (== ghostApplyDeltaHost). Distinct rows per thread: no atomics.
 
void ghostDivergDelta (const GhostOverlayDev &ov, View< const double > u0, View< const double > u1, View< const double > u2, View< double > d)
 Device divergence overlay (== ghostDivergDeltaHost).
 
template<unsigned Bits, class SdfFn >
auto makeBinaryOpenFnMixed (const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, SdfFn sdfFn, const Vec< 3 > &h0, Vec< 3 > origin, std::array< long, 3 > frameShift={})
 The canonical (sub)face openness for mixed-level cut bands: open iff both adjacent ACTUAL leaf centers are fluid AND the float mean of the center samples is >= 0.
 
template<unsigned Bits, class SdfFn >
GhostOverlaySampled buildGhostOverlaySampled (const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, SdfFn &&sdf, int matrixOrder, int rhsOrder, Vec< 3 > origin=Vec< 3 >{}, const std::array< long, 3 > *globalFine=nullptr, std::array< long, 3 > frameShift={}, bool discovery=false, double rhoFactor=2.2, long maxSamples=0)
 Build the sampled overlay.
 
double gpsSample (const GhostOverlaySampled &ov, Index r, int a, int q, const std::vector< double > &x)
 Evaluate slot (r, a, q) of a scalar leaf field. Empty functional reads 0.
 
void ghostApplyDeltaSampledHost (const GhostOverlaySampled &ov, const std::vector< double > &x, std::vector< double > &y)
 Matrix overlay (sampled): y currently holds the BINARY L matvec; overwrite overlay rows with y = rho·(y + invh²·Delta) — the sampled analog of ghostApplyDeltaHost.
 
void ghostDivergDeltaSampledHost (const GhostOverlaySampled &ov, const std::array< std::vector< double >, 3 > &u, std::vector< double > &d)
 Divergence overlay (sampled): the sampled analog of ghostDivergDeltaHost (u_bc = 0).
 
template<unsigned Bits, class Mom , class SdfFn >
CfCsr buildMomSeamDelta (const GhostOverlaySampled &ov, const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, const Mom &mom, SdfFn &&sdf, Vec< 3 > origin, double idiag, double mu, long *nSkipped=nullptr, std::array< long, 3 > frameShift={})
 Momentum ξ-overlay seam correction (plan §6.2, rung 1): at overlay rows with a different-level ±1 neighbour, the raw AmrCutCell row is wrong twice over — it classifies and anchors the wall from the COVERING neighbour's center sample (position-inconsistent), and its ξ branch was built with the GLOBAL β = μ/h0² (dimensionally off by 4^ΔL at a coarser row).
 
double gpsDirGrad (const GhostOverlaySampled &ov, Index r, const std::vector< double > &fld, int c, double invh)
 Directional ghost cell-gradient on a sampled row (the mixed-level gradOfDir): the same cascade — central where both axis virtual neighbours are fluid, 2nd-order one-sided toward the fluid else (2-point fallback), 0 sandwiched — on the row's sample functionals, so the gradient reads virtual uniform-position values across a seam instead of degrading.
 
template<unsigned Bits, class IsCutFn , class OkFn >
GhostGradCsrHost buildSampledGradCsr (const GhostOverlaySampled &ov, const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, IsCutFn &&isCut, OkFn &&classicOk)
 
GhostOverlaySampledDev uploadGhostOverlaySampled (const GhostOverlaySampled &h)
 
void ghostApplyDeltaSampled (const GhostOverlaySampledDev &ov, View< const double > x, View< double > y)
 Device matrix overlay (== ghostApplyDeltaSampledHost). Distinct rows per thread: no atomics.
 
void ghostDivergDeltaSampled (const GhostOverlaySampledDev &ov, View< const double > u0, View< const double > u1, View< const double > u2, View< double > d)
 Device divergence overlay (== ghostDivergDeltaSampledHost).
 
GhostGradCsrDev uploadGhostGradCsr (const GhostGradCsrHost &h)
 
void applyGhostGradCsr (const GhostGradCsrDev &ov, View< const double > f, View< double > gx, View< double > gy, View< double > gz)
 
template<int Dim, unsigned Bits>
std::vector< double > lohnerIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &u, double eps=0.01)
 Löhner normalized second-difference indicator E_i ∈ [0,1], per leaf, for scalar u (indexed by leaf slot).
 
template<int Dim, unsigned Bits>
std::vector< double > secondDiffIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &u)
 Raw second-derivative magnitude indicator, per leaf: the L2 norm over axes of the undivided second difference |u₊ − 2u_i + u₋| (so ∝ |∂²u|·h²).
 
template<int Dim>
bool amrStageLiftable (const core::decomp::BlockDecomposer< Dim > &dec)
 amr's lift rule (docs/amr_mg_depth.md §6.2) as core's stage predicate: the level grid halves into a cube level with at least two cells per axis, and every block is even in origin and size on EVERY axis.
 
const char * toString (MgLevelKind k)
 
const char * toString (MgBottomKind k)
 
template<int Dim>
MgLadderPrediction< Dim > predictPressureLadder (IVec< Dim > G, unsigned lmax, int numRanks, Index bottomExtent=4, const PressureStagePolicy &policy={})
 Predict the pressure-multigrid ladder for a global ROOT grid G (in root cells, i.e.
 
template<unsigned Bits>
void rebuildCutStencil (Index n, const double betaIn[3], double idiag, const View< double > &sdfC, const View< Index > &nbr6, const View< char > &fluid, const View< std::uint8_t > &levels, View< double > AC, View< double > off, View< char > cut, View< double > rscale)
 The per-cell ξ-overlay rebuild (build() Pass 2) on device: from the staged cell SDF + neighbour indices + fluid flag, recompute AC/off/cut/rscale exactly as the host build does.
 
template<unsigned Bits>
MomentumOp assembleMomentum (const AmrCutCell< Bits > &ccop, const BlockOctreeView< 3, Bits > &ov, bool scaleAdvByRscale=false)
 Assemble the MomentumOp entirely on the device from a built host AmrCutCell + a device octree view.
 
void restrictField (View< const Index > childStart, View< const Index > childIdx, View< const double > fine, View< double > coarse, Index nCoarse)
 Restrict: coarse(p) = mean over p's children (CSR fixed order ⇒ deterministic).
 
void restrictKappa (View< const Index > childStart, View< const Index > childIdx, View< const double > fine, View< const double > kappa, View< double > coarse, Index nCoarse)
 Restrict, κ-weighted: coarse(p) = Σ_child κ_c·fine_c / Σ_child κ_c, with κ the fine cell's fluid-fraction weight (mean face aperture).
 
void prolongAdd (View< const Index > c2p, View< const double > coarse, View< double > fine, Index nFine)
 Prolong (piecewise-constant) + correct: fine(i) += coarse(c2p(i)).
 
void prolongAddMasked (View< const Index > c2p, View< const double > coarse, View< const char > excl, View< double > fine, Index nFine)
 Masked piecewise-constant prolong + correct: fine(i) += coarse(c2p(i)) only on non-excluded fine cells (mirrors flow VelocityMG::prolongMasked — no correction into a cut/solid cell).
 
void zeroMasked (View< double > v, View< const char > excl, Index n)
 Zero v at excluded cells (excl != 0).
 
double dotVol (View< const double > u, View< const double > v, View< const double > invVol, Index n)
 Volume-weighted dot <u,v>_D = Σ_i V_i u_i v_i, V_i = 1/invVol_i.
 
void buildFluidMask (const FvOp &op, View< double > mask, Index n)
 Build the fluid mask: mask(i)=1 where the operator diagonal Σ_f w_f (+ bcDiag) is non-trivial, 0 for a solid cell (every face closed by the cut-cell openness ⇒ Σ w_f = 0).
 
void maskSolid (View< double > u, View< const double > mask, Index n)
 Zero the solid cells (project out the solid null modes).
 
void removeMeanVolReduced (View< double > u, View< const double > invVol, View< const double > mask, Index n, const std::function< double(double)> &reduce)
 Project u onto the FLUID range: zero solid cells, then subtract the volume-weighted mean over the fluid cells only (the constant null mode of the connected fluid region).
 
void removeMeanVol (View< double > u, View< const double > invVol, View< const double > mask, Index n)
 
template<int Dim, unsigned Bits, class SdfFn >
Index refineToSdf (BlockOctree< Dim, Bits > &t, const AmrGeometry< Dim > &geo, SdfFn &&sdf, unsigned targetLevel, Real band=1.0, bool balance=true)
 Refine leaves near an SDF interface down to targetLevel.
 
template<int Dim, unsigned Bits, class SdfFn , class TargetFn >
Index refineToSdfGraded (BlockOctree< Dim, Bits > &t, const AmrGeometry< Dim > &geo, SdfFn &&sdf, TargetFn &&targetFn, Real band=2.0, bool balance=true)
 Graded variant of refineToSdf: a per-point TARGET LEVEL function instead of one global targetLevel — the mesh-generator side of the mixed-level cut band (docs/amr_mixed_level_cut_band_plan.md §7).
 
template<int Dim, class GapFn >
auto gapFloorTarget (GapFn &&gapFn, Real h0, unsigned coarsestLevel, Real n=4.0)
 The plan's §7 criterion 1 as a ready-made targetFn for refineToSdfGraded: the GAP-WIDTH FLOOR.
 
template<unsigned Bits, class RegularFn , class FluidFn >
SeamReconHost buildSeamRecon (const AmrPoisson< 3, Bits > &ap, RegularFn &&regularOk, FluidFn &&fluidOk, CfScheme scheme)
 Build the seam-reconstruction tables over the LOCAL rows of ap (docs/amr_cf_convective.md §5.2).
 
template<int Dim, unsigned Bits>
void writeVtu (const std::string &path, const BlockOctree< Dim, Bits > &t, const AmrGeometry< Dim > &geo, const std::string &name, const std::vector< double > &cellData)
 Write a BlockOctree (+ world geometry + a per-leaf scalar) as a VTK UnstructuredGrid (.vtu), ASCII, one cell per leaf.
 
template<int Dim, unsigned Bits>
void writeVtu (const std::string &path, const BlockOctree< Dim, Bits > &t, const AmrGeometry< Dim > &geo, const std::string &name, const LeafField< double > &field)
 Convenience overload taking a LeafField<double>.
 

Typedef Documentation

◆ MomentumSolver

template<unsigned Bits = 21u>
using peclet::amr::MomentumSolver = typedef solver::MomentumSolver

The BiCGStab solver never touched the octree: its Bits parameter was vestigial and is gone in core.

Kept here as an alias template so MomentumSolver<Bits> keeps compiling.

Definition at line 45 of file momentum.hpp.

Enumeration Type Documentation

◆ AdaptFlag

Per-leaf adaptation flags from an indicator: refine where ind > refineThresh (and the leaf can go finer, level > finestLevel), coarsen where ind < coarsenThresh (and it can go coarser, level < lmax), else keep.

Enumerator
kCoarsen 
kKeep 
kRefine 

Definition at line 199 of file adapt.hpp.

◆ CfScheme

Coarse/fine interface scheme for the collocated flow operators.

Enumerator
standard 

raw coarse value (two-point flux; 1st-order at 2:1 faces)

quadratic 

Martin–Cartwright tangential quadratic (2nd-order at 2:1 faces)

Definition at line 73 of file cf_scheme.hpp.

◆ MgLevelKind

Where a predicted level comes from.

Enumerator
Octree 

a coarsening of the octree itself (at or above the root brick)

Lifted 

below the root brick, in place: the ORB blocks nest, transfers stay local

Tail 

below the in-place ladder: the gathered grid, solved redundantly on every rank

Sibling 

the continued ladder of a sibling-merge stage (fewer ranks, agglomerated(d))

Repartition 

the continued ladder of a repartition stage (a fresh ORB on np_L ranks)

Definition at line 77 of file mg_predict.hpp.

◆ MgBottomKind

What solves the coarsest level.

Enumerator
Jacobi 

damped Jacobi is exact there (max extent <= bottomExtent)

Amg 

the agglomerated GraphAMG-PCG bottom

Definition at line 86 of file mg_predict.hpp.

Function Documentation

◆ transferFieldGradients()

template<int Dim, unsigned Bits>
std::vector< std::array< double, Dim > > peclet::amr::transferFieldGradients ( const BlockOctree< Dim, Bits > &  oldT,
const std::vector< double > &  oldF 
)

Per-old-leaf minmod prolongation gradients (per fine-coordinate unit) — transferField's stencil, exposed so a DISTRIBUTED caller can substitute halo-completed gradients (transferGradients in distributed_adapt.hpp): the block-local faceNeighbor returns -1 at block edges, which silently zeroes the gradient there — correct at a true domain edge (the single-rank convention) but np-DEPENDENT at interior block boundaries.

Definition at line 51 of file adapt.hpp.

References peclet::amr::BlockOctree< Dim, Bits >::faceNeighbor(), peclet::amr::detail::minmod(), and peclet::amr::BlockOctree< Dim, Bits >::numLeaves().

Referenced by peclet::amr::BarnesHut< Dim, Bits >::acceleration(), peclet::amr::BarnesHut< Dim, Bits >::accelerationDirect(), peclet::amr::BarnesHut< Dim, Bits >::accelerations(), adapt(), peclet::amr::pybind::Octree::adapt(), peclet::amr::pybind::DistributedOctree::adapt(), adaptField(), advectedFaceValue(), advectExplicit(), peclet::amr::oracle::AmrFlow< Bits >::advectTerm(), peclet::amr::AmrFlow< Bits >::allSum(), amrEnvFlag(), amrLocate(), peclet::amr::AmrPoisson< Dim, Bits >::AmrPoisson(), peclet::amr::AmrPoisson< Dim, Bits >::AmrPoisson(), amrStageLiftable(), peclet::amr::DistributedFvOperator< Dim, Bits >::apply(), peclet::amr::DistributedPoisson< Dim, Bits >::apply(), peclet::amr::pybind::Poisson::apply(), peclet::amr::MgStage< Dim, Bits >::apply(), peclet::amr::DistributedPoissonView< Dim, Bits >::apply(), applyFv(), peclet::amr::AmrPoisson< Dim, Bits >::applyFvShared(), applyGhostGrad(), applyGhostGradCsr(), peclet::amr::AmrPoisson< Dim, Bits >::applyLaplacian(), peclet::amr::AmrPoisson< Dim, Bits >::applyLaplacianQuad(), peclet::amr::AmrCutCell< Bits >::applyOp(), peclet::amr::AmrCutCell< Bits >::applyOpGeometric(), peclet::amr::FvFaceEmit< Dim, Bits >::areaOf(), peclet::amr::pybind::asField(), assembleFaceGeom(), peclet::amr::AmrPoisson< Dim, Bits >::assembleFv(), assembleFv(), assembleMomentum(), peclet::amr::AmrCutCell< Bits >::assembleOperator(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::b(), peclet::amr::DistributedMultigridView< Dim, Bits >::b(), peclet::amr::MomentumMG< Bits >::b(), peclet::amr::Multigrid< Dim, Bits >::b(), peclet::amr::VelocityMG< Bits >::b(), peclet::amr::DistributedOctree< Dim, Bits >::balance(), peclet::amr::BlockOctree< Dim, Bits >::balance2to1(), peclet::amr::FvFaceEmit< Dim, Bits >::bcDiag(), peclet::amr::AmrFlow< Bits >::beginAdapt(), peclet::amr::AmrCutCell< Bits >::beta(), peclet::amr::AmrFlow< Bits >::betaPerAxis(), peclet::amr::pybind::bindOctreeCommon(), peclet::amr::BlockOctree< Dim, Bits >::bits(), peclet::amr::MgLadderPrediction< Dim >::bottomName(), peclet::amr::AmrPoisson< Dim, Bits >::boundaryDiag(), peclet::amr::BlockOctree< Dim, Bits >::bounds(), peclet::amr::DistributedStage< Dim, Bits >::build(), peclet::amr::ReplicatedTailStage< Dim, Bits >::build(), peclet::amr::GradedDistributedMultigrid< Dim, Bits >::build(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::build(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::build(), peclet::amr::GradedDistributedMultigrid< Dim, Bits >::build(), peclet::amr::DistributedMultigrid< Dim, Bits >::build(), peclet::amr::DistributedMultigridView< Dim, Bits >::build(), peclet::amr::MomentumMG< Bits >::build(), peclet::amr::VelocityMG< Bits >::build(), peclet::amr::Multigrid< Dim, Bits >::build(), peclet::amr::AmrMultigrid< Dim, Bits >::build(), peclet::amr::Multigrid< Dim, Bits >::build(), peclet::amr::Multigrid< Dim, Bits >::build(), peclet::amr::VelocityMG< Bits >::build(), peclet::amr::Multigrid< Dim, Bits >::build(), peclet::amr::AmrMultigrid< Dim, Bits >::build(), peclet::amr::AmgBottom< Dim, Bits >::build(), peclet::amr::BarnesHut< Dim, Bits >::build(), peclet::amr::AmrCutCell< Bits >::build(), peclet::amr::AmrCutCell< Bits >::build(), peclet::amr::AmrCutCell< Bits >::buildAdvectionFou(), buildCfDivDelta(), buildCfGradDelta(), buildCfLapDelta(), buildCfUfDelta(), peclet::amr::AmrCutCell< Bits >::buildCutStencil(), buildFaceCsr(), peclet::amr::oracle::AmrFlow< Bits >::buildFaceField(), buildFaceField(), peclet::amr::DistributedOctree< Dim, Bits >::buildFaceGatherPlan(), buildFaceGeom(), buildFluidMask(), buildFou(), peclet::amr::DistributedOctree< Dim, Bits >::buildGatherHaloTopology(), buildGhostOverlay(), peclet::amr::AmrPoisson< Dim, Bits >::buildOpenness(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::buildRaw(), peclet::amr::Multigrid< Dim, Bits >::buildRaw(), buildSampledGradCsr(), buildSeamRecon(), peclet::amr::AmrMultigrid< Dim, Bits >::canLiftLevel(), peclet::amr::detail::GhostOverlayRef::cell(), peclet::amr::pybind::Octree::cells(), peclet::amr::pybind::DistributedOctree::cells(), peclet::amr::detail::cellsOf(), peclet::amr::AmrGeometry< Dim >::cellVolume(), peclet::amr::FvFaceEmit< Dim, Bits >::cellVolume(), peclet::amr::MomFaceEmit< Bits >::cellVolume(), peclet::amr::AmrPoisson< Dim, Bits >::cellVolume(), peclet::amr::ScalarTransport< Dim, Bits >::cellVolume(), peclet::amr::FvFaceEmit< Dim, Bits >::cellWidth(), peclet::amr::AmrPoisson< Dim, Bits >::cellWidth(), peclet::amr::ScalarTransport< Dim, Bits >::cellWidth(), peclet::amr::FvFaceEmit< Dim, Bits >::cellWidth(), peclet::amr::AmrPoisson< Dim, Bits >::cellWidth(), peclet::amr::ScalarTransport< Dim, Bits >::cellWidth(), peclet::amr::AmrGeometry< Dim >::center(), cfApply(), cfApplyComp(), cfApplyCompHost(), cfApplyHost(), peclet::amr::oracle::AmrFlow< Bits >::cfFluxIdentity(), peclet::amr::BlockOctree< Dim, Bits >::coarsenIf(), peclet::amr::AmrPoisson< Dim, Bits >::coarseStar(), peclet::amr::BlockOctree< Dim, Bits >::code(), peclet::amr::FvFaceEmit< Dim, Bits >::coeff(), peclet::amr::detail::compactCsr(), peclet::amr::AmrFlow< Bits >::copyToHost(), correct(), peclet::amr::FaceGeomEmit< Bits >::count(), countCfCutFaces(), peclet::amr::detail::GhostOverlayRef::coupled(), peclet::amr::DistributedOctree< Dim, Bits >::coverLevels(), peclet::amr::DistributedOctree< Dim, Bits >::coverValues(), peclet::amr::DistributedStage< Dim, Bits >::cycle(), peclet::amr::ReplicatedTailStage< Dim, Bits >::cycle(), peclet::amr::AmrFlow< Bits >::debugSou(), deferredSou(), peclet::amr::MomFaceEmit< Bits >::diag(), distributedAdapt(), peclet::amr::pybind::DistributedOctree::DistributedOctree(), divergence(), peclet::amr::oracle::AmrFlow< Bits >::divergence(), divFaceNorm(), peclet::amr::AmrFlow< Bits >::divNormFace(), peclet::amr::oracle::AmrFlow< Bits >::divNormFace(), peclet::amr::oracle::AmrFlow< Bits >::divNormFaceRegular(), peclet::amr::AmrFlow< Bits >::divNormL2(), peclet::amr::oracle::AmrFlow< Bits >::divNormL2(), peclet::amr::oracle::AmrFlow< Bits >::divNormL2Regular(), dotVol(), peclet::amr::LeafHaloExchange::exchange(), peclet::amr::LeafHaloExchange::exchange3(), peclet::amr::LeafHalo< Dim, Bits >::exchangeHost(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::extendedSize(), peclet::amr::pybind::Octree::extent(), peclet::amr::pybind::DistributedOctree::extent(), peclet::amr::pybind::Flow::face_field(), peclet::amr::pybind::DistributedOctree::face_neighbor_gather(), peclet::amr::pybind::FlowDiagnostics::face_topology(), peclet::amr::DistributedOctree< Dim, Bits >::faceAcross(), peclet::amr::BlockOctree< Dim, Bits >::faceNeighbor(), peclet::amr::BlockOctreeView< Dim, Bits >::faceNeighbor(), peclet::amr::DistributedOctree< Dim, Bits >::faceNeighborGather(), peclet::amr::DistributedOctree< Dim, Bits >::faceNeighborGather(), peclet::amr::AmrPoisson< Dim, Bits >::faceOpenness(), peclet::amr::AmrFlow< Bits >::faceTopology(), peclet::amr::detail::filledVec(), peclet::amr::LeafHalo< Dim, Bits >::finalize(), peclet::amr::BlockOctree< Dim, Bits >::find(), peclet::amr::BlockOctree< Dim, Bits >::find(), peclet::amr::pybind::Octree::find(), peclet::amr::DistributedOctree< Dim, Bits >::findGlobalRoot(), findPocketCells(), peclet::amr::pybind::Flow::finish_adapt(), peclet::amr::AmrFlow< Bits >::finishAdapt(), peclet::amr::oracle::AmrFlow< Bits >::finishAdapt(), peclet::amr::AmrFlow< Bits >::finishProjection(), flagByIndicator(), peclet::amr::pybind::Flow::Flow(), peclet::amr::pybind::Flow::Flow(), peclet::amr::detail::forEachCoveringSlot(), peclet::amr::ScalarTransport< Dim, Bits >::forEachFace(), peclet::amr::FaceGeomEmit< Bits >::forEachFaceFull(), peclet::amr::AmrPoisson< Dim, Bits >::forEachFaceFull(), peclet::amr::AmrPoisson< Dim, Bits >::forEachFaceNeighbor(), peclet::amr::AmrCutCell< Bits >::fouApply(), fvView(), gapFloorTarget(), peclet::amr::SeamView::gather(), peclet::amr::DistributedGatherHalo< Dim, Bits >::gather(), peclet::amr::AmrCutCell< Bits >::gaussSeidel(), peclet::amr::AmrPoisson< Dim, Bits >::gaussSeidel(), peclet::amr::AmrCutCell< Bits >::gaussSeidelGeometric(), ghostApplyDelta(), ghostApplyDeltaHost(), ghostApplyDeltaSampled(), ghostApplyDeltaSampledHost(), ghostDivergDelta(), ghostDivergDeltaHost(), ghostDivergDeltaSampled(), ghostDivergDeltaSampledHost(), peclet::amr::AmrFlow< Bits >::ghostMatvec(), peclet::amr::AmrFlow< Bits >::ghostPrec(), peclet::amr::DistributedOctree< Dim, Bits >::globalCode(), peclet::amr::AmrFlow< Bits >::globalFineExtent(), peclet::amr::DistributedOctree< Dim, Bits >::globalRootOf(), peclet::amr::AmrFlow< Bits >::gpProject(), gpsDirGrad(), peclet::amr::detail::gpsMonomials(), gpsSample(), peclet::amr::detail::gpsSolveDense(), grad3(), peclet::amr::detail::gridCanHalve(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::halo(), peclet::amr::AmrGeometry< Dim >::hMax(), peclet::amr::AmrGeometry< Dim >::hMin(), hoFaceValue(), hoFaceValueSeam(), peclet::amr::AmrPoisson< Dim, Bits >::hostFvOp(), peclet::amr::AmrCutCell< Bits >::hostOp(), peclet::amr::DistributedGatherHalo< Dim, Bits >::init(), peclet::amr::LeafHaloExchange::init(), peclet::amr::ScalarTransport< Dim, Bits >::init(), peclet::amr::AmrPoisson< Dim, Bits >::init(), peclet::amr::AmrPoisson< Dim, Bits >::init(), peclet::amr::DistributedPoissonView< Dim, Bits >::init(), peclet::amr::DistributedFvOperator< Dim, Bits >::init(), peclet::amr::LeafHalo< Dim, Bits >::init(), peclet::amr::DistributedFvOperator< Dim, Bits >::init(), peclet::amr::DistributedOctree< Dim, Bits >::init(), peclet::amr::DistributedOctree< Dim, Bits >::initDecomposed(), peclet::amr::AmrFlow< Bits >::installGhostMeta(), peclet::amr::pybind::Flow::is_fluid(), peclet::amr::BlockOctree< Dim, Bits >::isBalanced(), peclet::amr::AmrCutCell< Bits >::isCut(), peclet::amr::oracle::AmrFlow< Bits >::isCut(), peclet::amr::AmrCutCell< Bits >::isFluid(), peclet::amr::AmrFlow< Bits >::isFluid(), peclet::amr::oracle::AmrFlow< Bits >::isFluid(), peclet::amr::AmrGeometry< Dim >::isotropicAt(), peclet::amr::DistributedFvOperator< Dim, Bits >::jacobi(), peclet::amr::DistributedPoisson< Dim, Bits >::jacobi(), peclet::amr::DistributedPoissonView< Dim, Bits >::jacobi(), jacobiFv(), jacobiSweep(), peclet::amr::AmrCutCell< Bits >::kappa(), korenPsi(), laplacian(), peclet::amr::pybind::leafCenters(), peclet::amr::pybind::leafCodes(), peclet::amr::pybind::leafLevels(), peclet::amr::AmrGeometry< Dim >::leafSize(), peclet::amr::AmrGeometry< Dim >::leafSize(), peclet::amr::pybind::leafSizes(), peclet::amr::BlockOctree< Dim, Bits >::level(), peclet::amr::BlockOctree< Dim, Bits >::liftRoot(), peclet::amr::DistributedOctree< Dim, Bits >::liftRoot(), peclet::amr::DistributedOctree< Dim, Bits >::localGeometry(), peclet::amr::AmrFlow< Bits >::localVector(), peclet::amr::BlockOctreeView< Dim, Bits >::locate(), peclet::amr::pybind::Octree::lohner_indicator(), peclet::amr::pybind::DistributedOctree::lohner_indicator(), lohnerIndicator(), lohnerIndicatorDistributed(), peclet::amr::AmrPoisson< Dim, Bits >::loOf(), peclet::amr::LeafHalo< Dim, Bits >::lookup(), peclet::amr::LeafHalo< Dim, Bits >::lookupGlobal(), peclet::amr::AmrGeometry< Dim >::lowerCorner(), makeBinaryOpenFn(), makeBinaryOpenFn(), peclet::amr::AmrCutCell< Bits >::makeRhs(), makeSeamView(), maskSolid(), peclet::amr::AmrFlow< Bits >::maxAbsDiff(), peclet::amr::detail::maxExtent(), momRhs(), peclet::amr::DistributedStage< Dim, Bits >::moveDown(), peclet::amr::ReplicatedTailStage< Dim, Bits >::moveDown(), peclet::amr::DistributedStage< Dim, Bits >::moveUp(), peclet::amr::ReplicatedTailStage< Dim, Bits >::moveUp(), NB_MODULE(), peclet::amr::AmrCutCell< Bits >::neighborOf(), peclet::amr::SeamReconHost::numDescriptors(), peclet::amr::AmrCutCell< Bits >::numGhosts(), peclet::amr::LeafHalo< Dim, Bits >::numGhosts(), peclet::amr::AmrPoisson< Dim, Bits >::numGhosts(), peclet::amr::BlockOctree< Dim, Bits >::numLeaves(), peclet::amr::DistributedStage< Dim, Bits >::numLeaves(), peclet::amr::ReplicatedTailStage< Dim, Bits >::numLeaves(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::numLeaves(), peclet::amr::GradedDistributedMultigrid< Dim, Bits >::numLeaves(), peclet::amr::DistributedMultigrid< Dim, Bits >::numLeaves(), peclet::amr::DistributedMultigridView< Dim, Bits >::numLeaves(), peclet::amr::MomentumMG< Bits >::numLeaves(), peclet::amr::Multigrid< Dim, Bits >::numLeaves(), peclet::amr::VelocityMG< Bits >::numLeaves(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::numStageLevels(), peclet::amr::pybind::Octree::Octree(), peclet::amr::DistributedMultigrid< Dim, Bits >::octree(), peclet::amr::DistributedMultigridView< Dim, Bits >::octree(), peclet::amr::Multigrid< Dim, Bits >::octreeCode(), peclet::amr::GradedDistributedMultigrid< Dim, Bits >::op(), peclet::amr::DistributedMultigrid< Dim, Bits >::op(), peclet::amr::DistributedMultigridView< Dim, Bits >::op(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::op(), peclet::amr::MomentumMG< Bits >::op(), peclet::amr::Multigrid< Dim, Bits >::op(), peclet::amr::AmrMultigrid< Dim, Bits >::op(), peclet::amr::FvFaceEmit< Dim, Bits >::openness(), peclet::amr::FvFaceEmit< Dim, Bits >::operator()(), peclet::amr::MomFaceEmit< Bits >::operator()(), peclet::amr::CsrFillSink::operator()(), peclet::amr::MomScaleSink< Sink >::operator()(), peclet::amr::MomSumSink::operator()(), peclet::amr::LeafField< T >::operator[](), peclet::amr::LeafField< T >::operator[](), peclet::amr::pybind::DistributedOctree::origin(), peclet::amr::FaceGeomEmit< Bits >::periodicNeighbor(), peclet::amr::AmrPoisson< Dim, Bits >::periodicNeighbor(), peclet::amr::pybind::Poisson::Poisson(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::poisson(), peclet::amr::cc::poly_D(), peclet::amr::cc::poly_D_sandwich(), peclet::amr::cc::poly_N_c_sandwich(), peclet::amr::cc::poly_N_nb(), peclet::amr::cc::poly_Nbc(), peclet::amr::cc::poly_Nbc_mp_sw(), peclet::amr::cc::poly_Nbc_pp_sw(), peclet::amr::cc::poly_Nc(), peclet::amr::AmrFlow< Bits >::prepareDistributed(), peclet::amr::pybind::Flow::pressure(), peclet::amr::AmrFlow< Bits >::pressureMgLevels(), presUpdate(), peclet::amr::AmrFlow< Bits >::probeCfScheme(), peclet::amr::AmrFlow< Bits >::probeCfTangential(), peclet::amr::AmrFlow< Bits >::probeSeamLayer(), peclet::amr::AmrPoisson< Dim, Bits >::probeSlot(), peclet::amr::pybind::Flow::project(), peclet::amr::AmrFlow< Bits >::project(), peclet::amr::oracle::AmrFlow< Bits >::project(), prolongAdd(), prolongAddMasked(), peclet::amr::detail::pushLevel(), quadDelta(), peclet::amr::Multigrid< Dim, Bits >::reassembleOperators(), peclet::amr::pybind::DistributedOctree::rebalance(), peclet::amr::DistributedOctree< Dim, Bits >::rebalance(), peclet::amr::pybind::Flow::rebalance_mpi(), peclet::amr::AmrFlow< Bits >::rebalanceMpi(), rebuildCutStencil(), peclet::amr::pybind::Octree::refine_leaf(), peclet::amr::pybind::Octree::refine_to_gap_floor(), peclet::amr::pybind::Octree::refine_to_sdf(), peclet::amr::pybind::DistributedOctree::refine_to_sdf(), peclet::amr::pybind::Octree::refine_to_sdf_graded(), peclet::amr::pybind::Octree::refine_to_sphere(), peclet::amr::pybind::DistributedOctree::refine_to_sphere(), peclet::amr::BlockOctree< Dim, Bits >::refineIf(), peclet::amr::BlockOctree< Dim, Bits >::refineLeaf(), refineToSdf(), refineToSdfGraded(), peclet::amr::AmrPoisson< Dim, Bits >::removeMean(), removeMeanFv(), removeMeanFvDist(), removeMeanVol(), removeMeanVolReduced(), peclet::amr::AmrFlow< Bits >::requireOperator(), peclet::amr::detail::GhostOverlayRef::rescale(), peclet::amr::AmrCutCell< Bits >::residual(), peclet::amr::DistributedFvOperator< Dim, Bits >::residual(), peclet::amr::AmrPoisson< Dim, Bits >::residual(), peclet::amr::DistributedPoisson< Dim, Bits >::residual(), peclet::amr::pybind::Poisson::residual(), peclet::amr::DistributedPoissonView< Dim, Bits >::residual(), residualFv(), peclet::amr::AmrCutCell< Bits >::residualGeometric(), peclet::amr::DistributedFvOperator< Dim, Bits >::residualNorm(), peclet::amr::DistributedPoisson< Dim, Bits >::residualNorm(), peclet::amr::DistributedPoissonView< Dim, Bits >::residualNorm(), peclet::amr::AmrPoisson< Dim, Bits >::residualQuad(), peclet::amr::LeafHalo< Dim, Bits >::resolve(), peclet::amr::LeafHalo< Dim, Bits >::resolveGlobal(), peclet::amr::LeafHalo< Dim, Bits >::resolveMisses(), peclet::amr::pybind::resolveSpacing(), restrictField(), restrictKappa(), peclet::amr::AmrCutCell< Bits >::rhsScale(), peclet::amr::pybind::rootCellsOf(), peclet::amr::AmrFlow< Bits >::runMgVcycle(), peclet::amr::ScalarTransport< Dim, Bits >::ScalarTransport(), scanOffsets(), peclet::amr::detail::seamFaceLayer(), secondDiffIndicator(), peclet::amr::pybind::Flow::set_advection_scheme(), peclet::amr::pybind::FlowDiagnostics::set_aperture_order(), peclet::amr::pybind::Flow::set_body_force(), peclet::amr::pybind::Flow::set_cf_scheme(), peclet::amr::pybind::Flow::set_dt(), peclet::amr::pybind::Flow::set_ghost_projection(), peclet::amr::pybind::Flow::set_ghost_sampled(), peclet::amr::pybind::Flow::set_momentum_tolerance(), peclet::amr::pybind::Flow::set_outer_iterations(), peclet::amr::pybind::Flow::set_pressure(), peclet::amr::pybind::Flow::set_pressure_bottom(), peclet::amr::pybind::Flow::set_pressure_bottom_extent(), peclet::amr::pybind::Flow::set_pressure_tolerance(), peclet::amr::pybind::Flow::set_solid(), peclet::amr::pybind::Flow::set_solid_spheres(), peclet::amr::pybind::Flow::set_velocity(), peclet::amr::AmrFlow< Bits >::setAdvectionScheme(), peclet::amr::oracle::AmrFlow< Bits >::setAdvectionScheme(), peclet::amr::AmrFlow< Bits >::setApertureOrder(), peclet::amr::oracle::AmrFlow< Bits >::setApertureOrder(), peclet::amr::AmrFlow< Bits >::setBodyForce(), peclet::amr::oracle::AmrFlow< Bits >::setBodyForce(), peclet::amr::AmrFlow< Bits >::setCfScheme(), peclet::amr::oracle::AmrFlow< Bits >::setCfScheme(), peclet::amr::AmrFlow< Bits >::setDensity(), peclet::amr::oracle::AmrFlow< Bits >::setDensity(), peclet::amr::PCG< Dim, Bits >::setDistributed(), peclet::amr::AmrFlow< Bits >::setDt(), peclet::amr::oracle::AmrFlow< Bits >::setDt(), peclet::amr::VelocityMG< Bits >::setFineOp(), peclet::amr::AmrCutCell< Bits >::setFrameShift(), peclet::amr::AmrPoisson< Dim, Bits >::setFrameShift(), peclet::amr::AmrFlow< Bits >::setGhostProjection(), peclet::amr::oracle::AmrFlow< Bits >::setGhostProjection(), peclet::amr::AmrCutCell< Bits >::setGhosts(), peclet::amr::AmrPoisson< Dim, Bits >::setGhosts(), peclet::amr::AmrFlow< Bits >::setGhostSampled(), peclet::amr::Multigrid< Dim, Bits >::setHelmholtz(), peclet::amr::AmrMultigrid< Dim, Bits >::setImmersedWall(), peclet::amr::AmrGeometry< Dim >::setIsotropic(), peclet::amr::AmrFlow< Bits >::setMomentumTol(), peclet::amr::AmrMultigrid< Dim, Bits >::setOpenness(), peclet::amr::AmrPoisson< Dim, Bits >::setOpennessRaw(), peclet::amr::AmrMultigrid< Dim, Bits >::setOpennessRaw(), peclet::amr::AmrPoisson< Dim, Bits >::setOrigin(), peclet::amr::AmrFlow< Bits >::setOuterIterations(), peclet::amr::AmrPoisson< Dim, Bits >::setPeriodic(), peclet::amr::AmrMultigrid< Dim, Bits >::setPeriodic(), peclet::amr::AmrFlow< Bits >::setPressure(), peclet::amr::AmrFlow< Bits >::setPressureBottom(), peclet::amr::AmrFlow< Bits >::setPressureBottomExtent(), peclet::amr::AmrFlow< Bits >::setPressureTol(), peclet::amr::AmrCutCell< Bits >::setResolver(), peclet::amr::AmrPoisson< Dim, Bits >::setResolver(), peclet::amr::PCG< Dim, Bits >::setSingular(), peclet::amr::AmrFlow< Bits >::setSolid(), peclet::amr::oracle::AmrFlow< Bits >::setSolid(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::setStagePolicy(), peclet::amr::PCG< Dim, Bits >::setVcycle(), peclet::amr::AmrFlow< Bits >::setVelocity(), peclet::amr::LeafField< T >::size(), peclet::amr::AmrFlow< Bits >::slotCenters(), peclet::amr::pybind::Poisson::solve(), peclet::amr::PCG< Dim, Bits >::solve(), peclet::amr::AmgBottom< Dim, Bits >::solve(), peclet::amr::AmrFlow< Bits >::solveGhostBiCGStab(), peclet::amr::Multigrid< Dim, Bits >::solveQuad(), peclet::amr::AmrMultigrid< Dim, Bits >::solveQuad(), peclet::amr::pybind::DistributedOctree::spacing(), peclet::amr::pybind::spacingFromExtent(), peclet::amr::pybind::spacingOf(), peclet::amr::pybind::spacingsFromExtent(), peclet::amr::AmrFlow< Bits >::spAdd(), peclet::amr::AmrFlow< Bits >::spEndStep(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::stageLeaves(), peclet::amr::detail::GhostOverlayRef::state(), peclet::amr::ScalarTransport< Dim, Bits >::step(), peclet::amr::pybind::Flow::step(), peclet::amr::AmrFlow< Bits >::step(), peclet::amr::oracle::AmrFlow< Bits >::step(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::sync(), peclet::amr::AmrFlow< Bits >::syncScalar(), peclet::amr::DistributedStage< Dim, Bits >::targetX(), peclet::amr::detail::GhostOverlayRef::th(), peclet::amr::ScalarTransport< Dim, Bits >::totalMass(), transferField(), transferGradients(), peclet::amr::BlockOctreeView< Dim, Bits >::upload(), uploadCfCompCsr(), uploadCfCsr(), uploadGhostGradCsr(), uploadGhostOverlay(), uploadGhostOverlaySampled(), peclet::amr::MomentumMG< Bits >::vcycle(), peclet::amr::VelocityMG< Bits >::vcycle(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle(), peclet::amr::Multigrid< Dim, Bits >::vcycle(), peclet::amr::AmrMultigrid< Dim, Bits >::vcycle(), peclet::amr::DistributedMultigrid< Dim, Bits >::vcycle(), peclet::amr::GradedDistributedMultigrid< Dim, Bits >::vcycle(), peclet::amr::DistributedMultigridView< Dim, Bits >::vcycle(), peclet::amr::pybind::vec1(), peclet::amr::pybind::vec2(), peclet::amr::pybind::vecToArray(), peclet::amr::AmrFlow< Bits >::velocities(), peclet::amr::pybind::Flow::velocities(), peclet::amr::AmrFlow< Bits >::velocity(), peclet::amr::oracle::AmrFlow< Bits >::velocity(), peclet::amr::pybind::Flow::velocity(), peclet::amr::detail::vtkCorners< 2 >(), peclet::amr::detail::vtkCorners< 3 >(), peclet::amr::detail::GhostOverlayRef::w_bc(), peclet::amr::detail::GhostOverlayRef::w_n1(), peclet::amr::detail::GhostOverlayRef::w_n2(), peclet::amr::detail::GhostOverlayRef::wm_n1(), peclet::amr::detail::GhostOverlayRef::wm_n2(), peclet::amr::FvFaceEmit< Dim, Bits >::wrap(), peclet::amr::LeafHalo< Dim, Bits >::wrap(), peclet::amr::pybind::Octree::write_vtu(), peclet::amr::pybind::DistributedOctree::write_vtu(), writeVtu(), writeVtu(), peclet::amr::DistributedFlowMultigrid< Dim, Bits >::x(), peclet::amr::DistributedMultigridView< Dim, Bits >::x(), peclet::amr::MomentumMG< Bits >::x(), peclet::amr::Multigrid< Dim, Bits >::x(), peclet::amr::VelocityMG< Bits >::x(), zeroMasked(), and peclet::amr::AmrFlow< Bits >::zeroSolid().

◆ transferField()

template<int Dim, unsigned Bits>
std::vector< double > peclet::amr::transferField ( const BlockOctree< Dim, Bits > &  oldT,
const std::vector< double > &  oldF,
const BlockOctree< Dim, Bits > &  newT,
bool  linear = true,
const std::type_identity_t< std::vector< std::array< double, Dim > > > *  gradIn = nullptr 
)

Conservative remap of a leaf field from oldT to newT (same domain).

linear selects minmod-limited linear prolongation (more accurate, still conservative and non-overshooting) vs piecewise-constant injection for cells that get finer. gradIn (optional) supplies precomputed prolongation gradients (size numLeaves(oldT)); null = compute them locally (the historical behaviour, bit-identical).

Definition at line 91 of file adapt.hpp.

References peclet::amr::BlockOctree< Dim, Bits >::numLeaves(), and transferFieldGradients().

Referenced by adaptField(), distributedAdapt(), peclet::amr::AmrFlow< Bits >::finishAdapt(), and peclet::amr::oracle::AmrFlow< Bits >::finishAdapt().

◆ flagByIndicator()

template<int Dim, unsigned Bits>
std::vector< int > peclet::amr::flagByIndicator ( const BlockOctree< Dim, Bits > &  t,
const std::vector< double > &  ind,
double  refineThresh,
double  coarsenThresh,
unsigned  finestLevel = 0 
)

Definition at line 202 of file adapt.hpp.

References kCoarsen, kKeep, kRefine, and transferFieldGradients().

Referenced by adapt(), and distributedAdapt().

◆ adaptField()

template<int Dim, unsigned Bits>
AdaptResult< Dim, Bits > peclet::amr::adaptField ( const BlockOctree< Dim, Bits > &  t,
const std::vector< double > &  f,
const std::vector< int > &  flags,
bool  linear = true 
)

Apply adaptation flags (one level of refine/coarsen) to t carrying field f, then 2:1-balance and remap.

A sibling group coarsens only if all its children are flagged kCoarsen; refine flags are honoured per leaf. Flags are looked up by the original leaf's code, so they survive the intermediate index changes.

Definition at line 229 of file adapt.hpp.

References peclet::amr::BlockOctree< Dim, Bits >::coarsenIf(), kCoarsen, kRefine, transferField(), and transferFieldGradients().

Referenced by adapt().

◆ adapt()

template<int Dim, unsigned Bits>
AdaptResult< Dim, Bits > peclet::amr::adapt ( const BlockOctree< Dim, Bits > &  t,
const std::vector< double > &  f,
double  refineThresh,
double  coarsenThresh,
unsigned  finestLevel = 0,
double  eps = 0.01,
bool  linear = true 
)

All-in-one solution-adaptive step: Löhner indicator → flags → adaptField.

Definition at line 257 of file adapt.hpp.

References adaptField(), flagByIndicator(), lohnerIndicator(), and transferFieldGradients().

Referenced by peclet::amr::pybind::Octree::adapt().

◆ korenPsi()

double peclet::amr::korenPsi ( double  r)
inline

psi = max(0, min(2r, (1+2r)/3, 2)) — the Koren limiter, written once for the two reconstructions below (same operations, same order: factoring it out is bit-inert).

Definition at line 25 of file advect_recon.hpp.

References transferFieldGradients().

Referenced by hoFaceValue(), and hoFaceValueSeam().

◆ hoFaceValue()

double peclet::amr::hoFaceValue ( double  upup,
double  up,
double  down,
int  scheme 
)
inline

High-order advected face value from the two upwind cells (upup, up) and the downwind cell (down).

scheme 0 = second-order upwind (SOU = 1.5·up − 0.5·upup); else Koren TVD limiter.

It assumes the three cells are EQUALLY SPACED and their centres tangentially aligned with the face, which is true of every face but the ones a 2:1 octree seam touches — those take hoFaceValueSeam instead, and only those: the two are not bit-identical in the regular-face limit (docs/amr_cf_convective.md §5.1), so routing a plain slot through the seam form would move digits for nothing.

Definition at line 41 of file advect_recon.hpp.

References korenPsi(), and transferFieldGradients().

Referenced by advectedFaceValue().

◆ hoFaceValueSeam()

double peclet::amr::hoFaceValueSeam ( double  upup,
double  up,
double  upStar,
double  downStar,
double  d1,
double  dUU,
double  dD,
int  scheme 
)
inline

The same reconstruction with every distance and every sample made explicit — the rule of docs/amr_cf_convective.md §5.1, for a face whose upwind-side stencil crosses an octree level:

gUp = (up − upup) / dUU              the upwind slope on U's OWN column
SOU   : phi_face = upStar + d1·gUp
Koren : den = downStar − upStar;  r = gUp·dD/den;  phi_face = upStar + (d1/dD)·psi(r)·den

up is the raw upwind value and upStar the same cell SAMPLED at the face's tangential column (they differ only when the upwind cell is the coarse side of a 2:1 sub-face); the slope stays on the raw column, where the two stencil points carry the SAME tangential offset, so the sample correction enters exactly once and with weight one. upup is the upstream probe at its true distance dUU, d1 the upwind cell's half width along the face axis and dD the face's centre-to-centre distance. With d1 = dD/2 and dUU = dD this reduces to hoFaceValue analytically — but NOT bitwise, which is why plain slots never come here.

Definition at line 64 of file advect_recon.hpp.

References korenPsi(), and transferFieldGradients().

Referenced by advectedFaceValue().

◆ assembleFv()

template<int Dim, unsigned Bits>
FvOp peclet::amr::assembleFv ( const AmrPoisson< Dim, Bits > &  ap,
const BlockOctreeView< Dim, Bits > &  ov 
)

◆ amrLocate()

template<class M >
Index peclet::amr::amrLocate ( const typename M::code_type *  codes,
const std::uint8_t *  levels,
Index  n,
typename M::code_type  p 
)
inline

Locate the leaf containing Morton code p in sorted leaf arrays.

codes (ascending, length n) are leaf origin codes; levels[i] the level of leaf i. Returns the leaf index whose cell covers p, or -1 if none does. Device-callable: a hand-rolled binary search (no std::upper_bound) so it compiles in a Kokkos device pass. O(log n).

Definition at line 51 of file block_octree.hpp.

References transferFieldGradients().

◆ buildCfLapDelta()

template<unsigned Bits, class RowFn , class FluidFn >
CfCsr peclet::amr::buildCfLapDelta ( const AmrPoisson< 3, Bits > &  ap,
const BlockOctree< 3, Bits > &  t,
double  factor,
RowFn &&  rowOk,
FluidFn &&  fluidOk,
CfScheme  scheme 
)
inline

(∇²_scheme − ∇²_std) as a scalar CSR, ×factor (pass μ for the momentum deferred-correction RHS, 1 for a pressure-matrix delta): row i gains scale = factor·invV·(αA/d)·(±1) per directed C/F face (+ for a coarser neighbour's substituted value, − for our own value substituted at a finer sub-face) — the same construction as Multigrid's quad CSR.

Rows gated by rowOk (e.g. regular fluid cells for the momentum operator).

Definition at line 311 of file cf_scheme.hpp.

References peclet::amr::AmrPoisson< Dim, Bits >::cellVolume(), peclet::amr::detail::cfAppendStencil(), peclet::amr::detail::compactCsr(), peclet::amr::AmrPoisson< Dim, Bits >::forEachFaceNeighbor(), peclet::amr::AmrPoisson< Dim, Bits >::levelOf(), and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ buildCfDivDelta()

template<unsigned Bits, class RegularFn , class FluidFn >
CfCompCsr peclet::amr::buildCfDivDelta ( const AmrPoisson< 3, Bits > &  ap,
const BlockOctree< 3, Bits > &  t,
RegularFn &&  regularOk,
FluidFn &&  fluidOk,
CfScheme  scheme 
)
inline

(D_scheme − D_std) for the face-average divergence div_i = invV·Σ α·A·dir·(face value).

The standard face value is the pinned ½(u_i+u_j) — at a 2:1 sub-face that average is offset from the face in the NORMAL direction (fine center at h/2, coarse at H/2 — an O(h) value error the tangential fix alone cannot remove). The scheme's face value is the distance-weighted interpolation of the two O(h²)-accurate point values, v = wF·u_fine + wC·u_coarse*, wF = (H/2)/d, wC = (h/2)/d, d = (H+h)/2, with u_coarse* the tangential coarse* substitution. Both incident cells use the identical value (conservative telescoping). Delta emitted per C/F sub-face: Δ = scale·[(wF−½)·u_F + (wC−½)·u_C + wC·(u_C* − u_C)], scale = invV·α·A·dir. Component-tagged: the substituted value is the face-normal velocity component.

Definition at line 350 of file cf_scheme.hpp.

References peclet::amr::AmrPoisson< Dim, Bits >::cellVolume(), peclet::amr::detail::cfAppendFaceValueDelta(), peclet::amr::detail::CompEnt::comp, peclet::amr::detail::compactCsr(), peclet::amr::AmrPoisson< Dim, Bits >::forEachFaceFull(), peclet::amr::AmrPoisson< Dim, Bits >::levelOf(), standard, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ buildCfGradDelta()

template<unsigned Bits, class RegularFn , class FluidFn >
std::array< CfCsr, 3 > peclet::amr::buildCfGradDelta ( const AmrPoisson< 3, Bits > &  ap,
const BlockOctree< 3, Bits > &  t,
RegularFn &&  regularOk,
FluidFn &&  fluidOk,
CfScheme  scheme 
)
inline

(G_scheme − G_std) for the ABC cell gradient gradOf/grad3.

The standard operator averages the two side face-gradients with ½/½: out[a] = ½(Σg⁺/n⁺ + Σg⁻/n⁻), g = ±(f_j−f_i)/dist over α>1e-12 faces. Each face gradient samples ∇f at the MIDPOINT of its two centers (offset s± = ±dist±/2 from the cell center), so at a C/F-adjacent row the ½/½ recombination misses the cell center by O(h). The scheme (a) substitutes the coarse* value in each C/F face gradient (tangentially 2nd-order sample) and (b) recombines the sides with the weights that put the sampled gradient AT the cell center: w⁺ = dist⁻/(dist⁺+dist⁻), w⁻ = dist⁺/(dist⁺+dist⁻) (½/½ when both sides same-level). Delta per row/axis = Σ_side (w±−½)·[std side average] + Σ_side w±/n±·[C/F substitutions]. One scalar CSR per output axis, over rows adjacent to a level boundary.

Definition at line 397 of file cf_scheme.hpp.

References peclet::amr::detail::cfAppendStencil(), peclet::amr::detail::compactCsr(), peclet::amr::AmrPoisson< Dim, Bits >::forEachFaceFull(), peclet::amr::AmrPoisson< Dim, Bits >::levelOf(), standard, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ buildCfUfDelta()

◆ countCfCutFaces()

template<unsigned Bits, class RegularFn , class FluidFn >
Index peclet::amr::countCfCutFaces ( const AmrPoisson< 3, Bits > &  ap,
const BlockOctree< 3, Bits > &  t,
RegularFn &&  regularOk,
FluidFn &&  fluidOk 
)
inline

The C/F CENSUS (docs/amr_cf_flux_gate.md §6.5): how many OWNED forEachFaceFull slots (i, j) are a 2:1 sub-face between two FLUID cells on which the per-face gate WITHHOLDS the quadratic value, i.e.

at least one of the two incident cells is CUT. regularOk must be valid over [0, nExt) (the ghost tail carries the OWNER's flag — §6.4).

It is 0 on every uniform or finest-band mesh (cut cells there have no C/F face), so it is also the observable that says whether §7's O(h) face-value cost applies to a given mesh at all. Each 2:1 sub-face contributes TWO slots (it is enumerated from both incident cells), and under MPI the mirror slot of a seam sub-face is owned by the other rank, so Σ_ranks is exactly the single-rank count — an integer decomposition-invariance gate.

Definition at line 570 of file cf_scheme.hpp.

References peclet::amr::AmrPoisson< Dim, Bits >::forEachFaceFull(), peclet::amr::AmrPoisson< Dim, Bits >::levelOf(), and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ cfApplyHost()

void peclet::amr::cfApplyHost ( const CfCsr &  c,
const std::vector< double > &  f,
std::vector< double > &  out 
)
inline

out(i) += Σ coef·f(slot) (the scalar overlay: momentum ∇² delta, gradient delta per axis).

Definition at line 599 of file cf_scheme.hpp.

References transferFieldGradients().

Referenced by peclet::amr::oracle::AmrFlow< Bits >::step().

◆ cfApplyCompHost()

void peclet::amr::cfApplyCompHost ( const CfCompCsr &  c,
const std::array< std::vector< double >, 3 > &  u,
std::vector< double > &  out 
)
inline

◆ uploadCfCsr()

◆ uploadCfCompCsr()

◆ cfApply()

void peclet::amr::cfApply ( const CfCsrDev &  c,
View< const double >  f,
View< double >  out 
)
inline

◆ cfApplyComp()

void peclet::amr::cfApplyComp ( const CfCompCsrDev &  c,
View< const double >  u0,
View< const double >  u1,
View< const double >  u2,
View< double >  out 
)
inline

◆ scanOffsets()

template<class CountFn >
View< Index > peclet::amr::scanOffsets ( Index  n,
const CountFn &  countFn,
Index &  nTotal 
)

CSR row offsets (size n+1) from a per-cell count functor, via one exclusive prefix scan, with the total written to nTotal.

The standalone scan half of S1 — for assemblers whose per-face payload is richer than (nbr, coef) (e.g. the face-geometry tables), which then run their own own-slice fill over these offsets. CountFn is device-callable: KOKKOS Index operator()(Index i) const.

Definition at line 55 of file csr.hpp.

References transferFieldGradients().

Referenced by assembleFaceGeom().

◆ buildFaceCsr()

template<class Emit >
Csr peclet::amr::buildFaceCsr ( Index  n,
const Emit &  emit 
)

Build a face-CSR on device from a per-cell emit functor.

Emit must be a trivially-copyable, device-callable object with: template <class Sink> KOKKOS_INLINE_FUNCTION void operator()(Index i, Sink& s) const; calling s(neighbourLeaf, coef) once per face of cell i, in a fixed deterministic order.

The count is folded directly into the prefix scan (each cell's traversal runs once in the scan and once in the fill — the same two traversals the host assembler does). Offsets are written by the scan's final pass; the fill writes each cell's own slice with no atomics.

Definition at line 89 of file csr.hpp.

References transferFieldGradients().

Referenced by assembleFv(), and assembleMomentum().

◆ lohnerIndicatorDistributed()

template<int Dim, unsigned Bits>
std::vector< double > peclet::amr::lohnerIndicatorDistributed ( const DistributedOctree< Dim, Bits > &  d,
const std::vector< double > &  u,
double  eps = 0.01 
)

Löhner indicator per local leaf, using the owner-based face-neighbour halo so cross-block neighbours contribute exactly as in a whole-domain solve.

Definition at line 36 of file distributed_adapt.hpp.

References peclet::amr::DistributedOctree< Dim, Bits >::faceNeighborGather(), peclet::amr::DistributedOctree< Dim, Bits >::local(), peclet::amr::BlockOctree< Dim, Bits >::numLeaves(), and transferFieldGradients().

Referenced by distributedAdapt(), and peclet::amr::pybind::DistributedOctree::lohner_indicator().

◆ transferGradients()

template<int Dim, unsigned Bits>
std::vector< std::array< double, Dim > > peclet::amr::transferGradients ( const DistributedOctree< Dim, Bits > &  d,
const std::vector< double > &  f 
)

transferField's minmod prolongation gradients on a DistributedOctree: bit-identical to the block-local transferFieldGradients wherever the stencil is in-block, block-crossing faces completed from the owners (coverValues + coverLevels — the covering leaf across a 2:1 interface is probed at the same corner coordinate faceNeighbor uses), and DOMAIN-crossing probes counted as missing — the single-rank faceNeighbor convention — so np=1 reproduces the local gradients bit-for-bit and the transfer is bit-exact WORLD==SELF.

(The centroid distance along the probe axis is 0.5·(s_i+s_j) fine units on 2:1-aligned faces; small integers and halves are exact in double, so the quotient is bit-identical to the local centroid-difference expression.)

Definition at line 72 of file distributed_adapt.hpp.

References peclet::amr::DistributedOctree< Dim, Bits >::blockBrick(), peclet::amr::DistributedOctree< Dim, Bits >::blockFineOrigin(), peclet::amr::DistributedOctree< Dim, Bits >::coverLevels(), peclet::amr::DistributedOctree< Dim, Bits >::coverValues(), peclet::amr::DistributedOctree< Dim, Bits >::globalFineSize(), peclet::amr::DistributedOctree< Dim, Bits >::local(), peclet::amr::detail::minmod(), peclet::amr::BlockOctree< Dim, Bits >::numLeaves(), peclet::amr::DistributedOctree< Dim, Bits >::rootSpan(), and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::beginAdapt(), and distributedAdapt().

◆ distributedAdapt()

template<int Dim, unsigned Bits>
std::vector< double > peclet::amr::distributedAdapt ( DistributedOctree< Dim, Bits > &  d,
const std::vector< double > &  f,
double  refineThresh,
double  coarsenThresh,
unsigned  finestLevel = 0,
double  eps = 0.01,
bool  linear = true 
)

One distributed solution-adaptive step.

Mutates d's local octree (refine / coarsen one level + cross-block 2:1 balance) and returns the field f remapped onto the new local mesh (conservative). Same ORB ownership as before.

Definition at line 162 of file distributed_adapt.hpp.

References peclet::amr::DistributedOctree< Dim, Bits >::balance(), peclet::amr::BlockOctree< Dim, Bits >::coarsenIf(), flagByIndicator(), kCoarsen, kRefine, peclet::amr::DistributedOctree< Dim, Bits >::local(), lohnerIndicatorDistributed(), peclet::amr::BlockOctree< Dim, Bits >::refineIf(), transferField(), transferFieldGradients(), and transferGradients().

Referenced by peclet::amr::pybind::DistributedOctree::adapt().

◆ removeMeanFvDist()

void peclet::amr::removeMeanFvDist ( const FvOp &  op,
View< double >  u,
MPI_Comm  comm 
)
inline

removeMeanFv with the two mean sums folded across ranks (identical kernels; the Allreduce sits between the reduce and the subtract).

np=1 == removeMeanFv bit-for-bit.

Definition at line 72 of file distributed_flow_mg.hpp.

References peclet::amr::FvOp::bcDiag, peclet::amr::FvOp::faceStart, peclet::amr::FvOp::faceW, peclet::amr::FvOp::invVol, peclet::amr::FvOp::n, and transferFieldGradients().

Referenced by peclet::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle().

◆ makeSeamView()

SeamView peclet::amr::makeSeamView ( const FaceGeom &  g,
bool  on 
)
inline

◆ assembleFaceGeom()

template<unsigned Bits>
FaceGeom peclet::amr::assembleFaceGeom ( const AmrPoisson< 3, Bits > &  ap,
const std::vector< char > &  fluidHost,
const BlockOctreeView< 3, Bits > &  ov 
)

◆ amrEnvFlag()

bool peclet::amr::amrEnvFlag ( const char *  name)
inline

Truthy environment flag (unset / "" / "0" ⇒ false).

Characterisation knobs only — never a production configuration channel (those are the set* methods).

Definition at line 61 of file flow.hpp.

References transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::prepareDistributed(), and peclet::amr::AmrFlow< Bits >::project().

◆ buildFaceGeom()

◆ divergence()

void peclet::amr::divergence ( const FaceGeom &  g,
View< const double >  u0,
View< const double >  u1,
View< const double >  u2,
View< double >  div 
)
inline

Openness-weighted FV divergence: div_i = invVol_i Σ_faces α·area·dir·½(u^axis_i+u^axis_j), on fluid cells (0 elsewhere).

u[0..2] are the three velocity component Views (solid cells must hold 0). Mirrors oracle::AmrFlow::divergence.

Definition at line 126 of file flow.hpp.

References peclet::amr::FaceGeom::alphaArea, peclet::amr::FaceGeom::axis, peclet::amr::FaceGeom::dir, peclet::amr::FaceGeom::fluid, peclet::amr::FaceGeom::invVol, peclet::amr::FaceGeom::n, peclet::amr::FaceGeom::nbr, peclet::amr::FaceGeom::start, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::divNormL2(), and peclet::amr::AmrFlow< Bits >::project().

◆ buildFaceField()

void peclet::amr::buildFaceField ( const FaceGeom &  g,
View< const double >  u0,
View< const double >  u1,
View< const double >  u2,
View< const double >  phi,
View< double >  uf 
)
inline

Build the ABC/Basilisk divergence-free FACE field: uf(k) = ½(u^axis_i+u^axis_j) − (φ₊−φ₋)/dist for face k of cell i (+axis velocity), from u* (call after the pressure solve, before the cell gradient correction).

Because L = D·G_face on the SAME (sub)faces, D(uf) = D u* − Lφ = 0 (to the φ residual). Each (sub)face is written from both incident cells; the +axis-orientation build makes the two copies identical, including across 2:1 interfaces (fine area + (φ_fine−φ_coarse)/dist on each sub-face).

Definition at line 159 of file flow.hpp.

References peclet::amr::FaceGeom::axis, peclet::amr::FaceGeom::dir, peclet::amr::FaceGeom::dist, peclet::amr::FaceGeom::n, peclet::amr::FaceGeom::nbr, peclet::amr::FaceGeom::start, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::finishProjection().

◆ divFaceNorm()

double peclet::amr::divFaceNorm ( const FaceGeom &  g,
View< const double >  uf 
)
inline

L2 norm of the divergence of the FACE field uf (the div-free flux diagnostic / host-parity check).

Definition at line 181 of file flow.hpp.

References peclet::amr::FaceGeom::alphaArea, peclet::amr::FaceGeom::dir, peclet::amr::FaceGeom::fluid, peclet::amr::FaceGeom::invVol, peclet::amr::FaceGeom::n, peclet::amr::FaceGeom::start, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::divNormFace().

◆ grad3()

void peclet::amr::grad3 ( const FaceGeom &  g,
View< const double >  f,
View< double >  gx,
View< double >  gy,
View< double >  gz 
)
inline

ABC cell-gradient of a scalar field f: gx/gy/gz = ½(g⁻+g⁺) of the adjacent face gradients along each axis, a closed face (α≤1e-12) contributing nothing (and not counted).

On fluid cells only. Mirrors oracle::AmrFlow::gradOf for all three components.

Definition at line 206 of file flow.hpp.

References peclet::amr::FaceGeom::alpha, peclet::amr::FaceGeom::axis, peclet::amr::FaceGeom::dir, peclet::amr::FaceGeom::dist, peclet::amr::FaceGeom::fluid, peclet::amr::FaceGeom::n, peclet::amr::FaceGeom::nbr, peclet::amr::FaceGeom::start, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::finishProjection(), and peclet::amr::AmrFlow< Bits >::step().

◆ applyGhostGrad()

void peclet::amr::applyGhostGrad ( const GhostGradOverlay &  ov,
View< const double >  f,
View< double >  gx,
View< double >  gy,
View< double >  gz 
)
inline

◆ momRhs()

void peclet::amr::momRhs ( View< const double >  uc,
View< const double >  gradP,
View< const double >  adv,
View< const double >  rscale,
View< const char >  fluid,
double  idiag,
double  fc,
View< double >  b,
Index  n 
)
inline

Momentum RHS for one component: b_i = fluid ? (idiag·u_i + f_c − gradP_i − adv_i)·rscale_i : 0 (== AmrCutCell::makeRhs of the oracle::AmrFlow predictor source, u_bc = 0).

adv is the explicit deferred-correction advection term ρ(SOU−FOU) (zero for Stokes / fully-implicit at steady).

Definition at line 290 of file flow.hpp.

References transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::step().

◆ buildFou()

void peclet::amr::buildFou ( const FaceGeom &  g,
View< const double >  u0,
View< const double >  u1,
View< const double >  u2,
double  rho,
View< const double >  rscale,
View< double >  advDiag,
View< double >  advCoef,
View< const double >  uf,
bool  useFace 
)
inline

Build the implicit-FOU advection operator from the lagged velocity u0..2 (uⁿ) entirely on device, as the per-cell outflow diagonal advDiag + per-face inflow coefficient advCoef over the face-geometry CSR (g.start/g.nbr).

velOut = dir·½(u^axis_i+u^axis_j); outflow → diagonal, inflow → off-diagonal toward the upstream neighbour; faces into solid carry none. Scaled by the cut-cell row scale rscale (= 1 on regular cells) so the operator advection is consistent with the rscale-scaled RHS — equivalent to AmrCutCell::assembleOperator(scaleAdv= true) added to the static Stokes operator (the AMR reference adds advection after the cut-cell bake, so no K/M/X redistribution). Replaces the per-step HOST rebuild ⇒ no host round-trip.

Definition at line 307 of file flow.hpp.

References peclet::amr::FaceGeom::axis, peclet::amr::FaceGeom::dir, peclet::amr::FaceGeom::fluid, peclet::amr::FaceGeom::invVol, peclet::amr::FaceGeom::n, peclet::amr::FaceGeom::nbr, peclet::amr::FaceGeom::rawArea, peclet::amr::FaceGeom::start, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::step().

◆ advectedFaceValue()

template<class FldFn >
double peclet::amr::advectedFaceValue ( const SeamView &  sv,
Index  k,
bool  upIsI,
double  phiUpUp,
double  phiUp,
double  phiDown,
double  distK,
int  advScheme,
const FldFn &  fld 
)

THE advected face value at one (sub)face slot — written once so deferredSou and advectExplicit cannot drift (docs/amr_cf_convective.md §5.3).

A PLAIN slot (sv.on == false, or no descriptor) takes today's line VERBATIM: hoFaceValue on the raw (upup, up, down) triple. It must, because hoFaceValueSeam is not bit-identical to it even in the regular-face limit (§5.1) — routing a plain slot through the seam form would move digits everywhere for nothing, and gate G0 is what catches it.

A SEAM slot reconstructs from the upwind side with level-aware probes: φ_U* is the upwind cell tangentially sampled at the sub-face's column when it is the coarse side of a 2:1 face, φ_UU* the upstream probe at its true distance (a coarser one as the same tangential sample, a finer one as the mean of the four face-layer children), and — Koren only — φ_D* the downwind cell sampled the same way. Everything comes from prebuilt records (seam_recon.hpp), gathered in record order.

Definition at line 365 of file flow.hpp.

References hoFaceValue(), hoFaceValueSeam(), and transferFieldGradients().

Referenced by advectExplicit(), and deferredSou().

◆ deferredSou()

void peclet::amr::deferredSou ( const FaceGeom &  g,
View< const double >  u0,
View< const double >  u1,
View< const double >  u2,
int  comp,
double  rho,
int  advScheme,
View< double >  defc,
View< const double >  uf,
bool  useFace,
bool  seamOn 
)
inline

Deferred-correction advection term for component comp: defc = ρ·SOU − ρ·FOU (UNSCALED; the predictor RHS applies the cut-cell rscale once).

The explicit part of the implicit-FOU/SOU split, it vanishes at steady state. The advecting velocity is u0..2 (uⁿ) and — for a lagged step — the advected field is the same component. SOU is the second-order-upwind reconstruction 1.5·up−0.5·upup (advScheme 0) or Koren TVD (1), upstream point-probed (upupI/upupJ); the FOU flux is velOut·upwind. The implicit FOU is baked into the momentum operator (AmrCutCell::buildAdvectionFou + assembleOperator) so the two cancel at steady state.

Definition at line 394 of file flow.hpp.

References advectedFaceValue(), peclet::amr::FaceGeom::axis, peclet::amr::FaceGeom::dir, peclet::amr::FaceGeom::dist, peclet::amr::FaceGeom::fluid, peclet::amr::FaceGeom::invVol, makeSeamView(), peclet::amr::FaceGeom::n, peclet::amr::FaceGeom::nbr, peclet::amr::FaceGeom::rawArea, peclet::amr::FaceGeom::start, transferFieldGradients(), peclet::amr::FaceGeom::upupI, and peclet::amr::FaceGeom::upupJ.

Referenced by peclet::amr::AmrFlow< Bits >::step().

◆ advectExplicit()

void peclet::amr::advectExplicit ( const FaceGeom &  g,
View< const double >  u0,
View< const double >  u1,
View< const double >  u2,
int  comp,
double  rho,
int  advScheme,
View< double >  defc,
View< const double >  uf,
bool  useFace,
bool  seamOn 
)
inline

◆ correct()

void peclet::amr::correct ( View< double >  uc,
View< const double >  gphi,
View< const char >  fluid,
Index  n 
)
inline

u_c -= gradPhi_c on fluid cells (the projection velocity correction).

Definition at line 488 of file flow.hpp.

References transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::finishProjection().

◆ presUpdate()

void peclet::amr::presUpdate ( View< double >  p,
View< const double >  phi,
View< const double >  div,
View< const char >  fluid,
double  rho_dt,
double  mu,
Index  n 
)
inline

Rotational incremental pressure update: p += (ρ/dt)φ − μ·div, on fluid cells.

Definition at line 497 of file flow.hpp.

References transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::finishProjection().

◆ laplacian()

template<int Dim, unsigned Bits>
void peclet::amr::laplacian ( BlockOctreeView< Dim, Bits >  dev,
View< double >  x,
View< double >  y,
double  inv 
)

y = inv · Σ_faces (x_nb − x_i) (= ∇² in spacing h0 with inv = 1/h0²), on device.

Definition at line 26 of file fv_op.hpp.

References transferFieldGradients().

◆ jacobiSweep()

template<int Dim, unsigned Bits>
void peclet::amr::jacobiSweep ( BlockOctreeView< Dim, Bits >  dev,
View< double >  x,
View< const double >  b,
View< double >  lx,
double  inv,
double  omega 
)

One weighted-Jacobi sweep of L u = b with L = ∇² (negative-definite, diagonal −2·Dim·inv), on device.

The update u_i += ω (L u_i − b_i)/diag, diag = 2·Dim·inv (= −L_ii), has the right sign for the negative-definite L. lx is scratch (L x).

Definition at line 45 of file fv_op.hpp.

References transferFieldGradients().

◆ fvView()

FvCsrOpT< View< const double >, View< const Index > > peclet::amr::fvView ( const FvOp &  op)
inline

View the assembled FV operator through the shared backend-agnostic FvCsrOpT, so the device kernels and the host AmrPoisson run the same row arithmetic (face_csr.hpp).

Definition at line 97 of file fv_op.hpp.

References peclet::amr::FvOp::bcDiag, peclet::amr::FvOp::c0, peclet::amr::FvOp::cD, peclet::amr::FvOp::faceNbr, peclet::amr::FvOp::faceStart, peclet::amr::FvOp::faceW, peclet::amr::FvOp::invVol, peclet::amr::FvOp::n, and transferFieldGradients().

Referenced by applyFv(), jacobiFv(), and residualFv().

◆ applyFv()

void peclet::amr::applyFv ( const FvOp &  op,
View< const double >  u,
View< double >  Lu 
)
inline

Hu = (c0·I + cD·L) u (consistent conservative FV Laplacian, c0=0/cD=1 ⇒ pure L).

A non-zero bcDiag adds the homogeneous-Dirichlet boundary term −bcDiag·u_i to L.

Definition at line 112 of file fv_op.hpp.

References fvView(), peclet::amr::FvOp::n, and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::ghostMatvec(), peclet::amr::AmrFlow< Bits >::project(), and peclet::amr::PCG< Dim, Bits >::solve().

◆ residualFv()

◆ jacobiFv()

void peclet::amr::jacobiFv ( const FvOp &  op,
View< double >  u,
View< const double >  rhs,
View< double >  tmp,
double  omega 
)
inline

One weighted-Jacobi sweep of H u = rhs (in place).

tmp is scratch (size n). Mirrors the host point solve u_i ← (Σ w u_j − V_i rhs_i)/Σ w with damping ω; pass 1 reads only the previous iterate (into tmp), pass 2 updates — so the sweep is order-independent / bit-reproducible. The pure-L path (c0=0, cD=1) keeps the exact original expression (bit-exact); the Helmholtz path uses the point solve of (c0·I + cD·L) u = rhs.

Definition at line 133 of file fv_op.hpp.

References fvView(), peclet::amr::FvOp::n, and transferFieldGradients().

Referenced by peclet::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle(), and peclet::amr::Multigrid< Dim, Bits >::vcycle().

◆ removeMeanFv()

void peclet::amr::removeMeanFv ( const FvOp &  op,
View< double >  u 
)
inline

Project u to volume-weighted-mean-zero over the ACTIVE (fluid) cells of the operator — the constant-nullspace removal for the singular periodic (pure-Neumann) operator.

A cell is active when its diagonal (Σw + bc) > 0; fully-closed (solid) cells are excluded. Mirrors flow CutcellMG::removeMean (sum over cells with AC > 1e-30). Applied at every V-cycle level so the multigrid preconditioner does not drift / amplify the nullspace.

Definition at line 149 of file fv_op.hpp.

References peclet::amr::FvOp::bcDiag, peclet::amr::FvOp::faceStart, peclet::amr::FvOp::faceW, peclet::amr::FvOp::invVol, peclet::amr::FvOp::n, and transferFieldGradients().

Referenced by peclet::amr::Multigrid< Dim, Bits >::vcycle().

◆ quadDelta()

void peclet::amr::quadDelta ( View< const Index >  qStart,
View< const Index >  qSlot,
View< const double >  qCoef,
View< const double >  u,
View< double >  dq,
Index  n 
)
inline

dq = (L_quad − L_std) u, the quadratic coarse-fine correction as its own SpMV over a precomputed CSR (built from AmrPoisson::coarseStar).

Used for deferred correction: solve L_std u = rhs − dq with dq lagged ⇒ 2nd-order at 2:1 faces.

Definition at line 189 of file fv_op.hpp.

References transferFieldGradients().

Referenced by peclet::amr::Multigrid< Dim, Bits >::solveQuad().

◆ buildGhostOverlay()

template<unsigned Bits>
GhostOverlay peclet::amr::buildGhostOverlay ( const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
const std::vector< double > &  sdfC,
int  matrixOrder,
int  rhsOrder,
bool *  bandViolation = nullptr 
)
inline

Build the overlay from the octree + the cell-centered SDF samples (AmrCutCell::sdfCRaw — EXTENDED over the ghost slots in a distributed build, where pres carries the LeafHalo resolver seam and the chains may hop through ghosts).

Classification is float, from CELL-CENTERED sdf with face values = mean of the two adjacent centers — identical to flow's buildGpOverlay, so the closures agree with the momentum solid masks. On a band-margin violation (a non-clean row's ±2 reach crosses a 2:1 level boundary): throws when bandViolation is null (the single-rank behaviour — widen the refineToSdf band); with bandViolation set, flags it and skips the row instead — the DISTRIBUTED caller must make the fallback decision COLLECTIVELY (Allreduce the flag; one rank falling back alone deadlocks the MG collectives). Unresolved (negative) chain entries count as violations — they only occur during the discovery fixpoint, whose overlay is discarded.

Definition at line 109 of file ghost_projection.hpp.

References peclet::amr::GhostOverlay::cell, peclet::amr::GhostOverlay::coupled, peclet::amr::GhostOverlay::invh, peclet::amr::GhostOverlay::n, peclet::amr::GhostOverlay::nbr, peclet::amr::GhostOverlay::rescale, peclet::amr::GhostOverlay::state, peclet::amr::GhostOverlay::th, transferFieldGradients(), peclet::amr::GhostOverlay::w_bc, peclet::amr::GhostOverlay::w_n1, peclet::amr::GhostOverlay::w_n2, peclet::amr::GhostOverlay::wm_n1, and peclet::amr::GhostOverlay::wm_n2.

Referenced by peclet::amr::AmrFlow< Bits >::prepareDistributed(), peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ makeBinaryOpenFn() [1/2]

template<class SdfFn >
auto peclet::amr::makeBinaryOpenFn ( SdfFn  sdfFn,
const Vec< 3 > &  h0 
)
inline

Binary openness callable factory for the MG surrogate: a face is open iff both adjacent centers (probed at ±h0/2 along the face normal — the adjacent finest-leaf centers in the cut band; deep fluid elsewhere, where the probe distance is irrelevant) are fluid AND the float face sample (mean of the float center samples — the overlay's classification arithmetic) is fluid.

Feed to Multigrid::build / AmrPoisson::buildOpenness / AmrMultigrid::setOpenness in ghost mode; the openness-MG hierarchy runs on it unchanged (area-averaged coarse alpha). Phase 3: the probe steps half a cell along the FACE'S OWN axis, so it takes h0[axis] (docs/amr_anisotropic.md §5, AM2). Identical to the scalar form on a cubic octree.

Definition at line 205 of file ghost_projection.hpp.

References transferFieldGradients().

Referenced by makeBinaryOpenFn(), peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ makeBinaryOpenFn() [2/2]

template<class SdfFn >
auto peclet::amr::makeBinaryOpenFn ( SdfFn  sdfFn,
double  h0 
)
inline

Cubic-cell overload — the pre-Phase-3 spelling.

Definition at line 218 of file ghost_projection.hpp.

References makeBinaryOpenFn(), and transferFieldGradients().

◆ findPocketCells()

template<unsigned Bits>
std::vector< char > peclet::amr::findPocketCells ( const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
const std::vector< double > &  sdfC 
)
inline

Fragmentation guard (the AMR port of flow's host-BFS pocket guard): the BINARY coupled-face graph (a face couples two cells iff its binary openness is 1) can FRAGMENT on tight-throat / enclosed geometries — each pocket then carries its own constant null vector and BiCGStab breaks down (fields → 1e152, measured in flow on RCP packings).

Returns a per-leaf flag: 1 = fluid cell OUTSIDE the largest connected component (a pocket). Pocket cells are projection-DECOUPLED by the caller (pinned φ=0, excluded from the mean and from the directional gradients). Scope note (deferred, as in flow's first version): closure rows adjacent to a pocket may still use pocket-cell velocities as sliver sources — physical (sealed-pocket u ≈ 0) and local.

Definition at line 232 of file ghost_projection.hpp.

References transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ ghostApplyDeltaHost()

void peclet::amr::ghostApplyDeltaHost ( const GhostOverlay &  ov,
const std::vector< double > &  x,
std::vector< double > &  y 
)
inline

Matrix overlay: y currently holds the BINARY L matvec; overwrite the overlay rows with y = rho·(y + invh²·Delta_grid) (decoupled rows → 0).

See the sign derivation in the header.

Definition at line 283 of file ghost_projection.hpp.

References peclet::amr::GhostOverlay::cell, peclet::amr::GhostOverlay::coupled, peclet::amr::GhostOverlay::invh, peclet::amr::GhostOverlay::n, peclet::amr::GhostOverlay::nbr, peclet::amr::GhostOverlay::rescale, peclet::amr::GhostOverlay::state, transferFieldGradients(), peclet::amr::GhostOverlay::wm_n1, and peclet::amr::GhostOverlay::wm_n2.

◆ ghostDivergDeltaHost()

void peclet::amr::ghostDivergDeltaHost ( const GhostOverlay &  ov,
const std::array< std::vector< double >, 3 > &  u,
std::vector< double > &  d 
)
inline

Divergence overlay: d currently holds the BINARY divergence (physical); overwrite overlay rows with d = rho·(d + invh·delta_div) (decoupled → 0).

u_bc = 0 (stationary walls).

Definition at line 327 of file ghost_projection.hpp.

References peclet::amr::GhostOverlay::cell, peclet::amr::GhostOverlay::coupled, peclet::amr::GhostOverlay::invh, peclet::amr::GhostOverlay::n, peclet::amr::GhostOverlay::nbr, peclet::amr::GhostOverlay::rescale, peclet::amr::GhostOverlay::state, transferFieldGradients(), peclet::amr::GhostOverlay::w_n1, and peclet::amr::GhostOverlay::w_n2.

Referenced by peclet::amr::oracle::AmrFlow< Bits >::project().

◆ uploadGhostOverlay()

◆ ghostApplyDelta()

◆ ghostDivergDelta()

◆ makeBinaryOpenFnMixed()

template<unsigned Bits, class SdfFn >
auto peclet::amr::makeBinaryOpenFnMixed ( const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
SdfFn  sdfFn,
const Vec< 3 > &  h0,
Vec< 3 >  origin,
std::array< long, 3 >  frameShift = {} 
)
inline

The canonical (sub)face openness for mixed-level cut bands: open iff both adjacent ACTUAL leaf centers are fluid AND the float mean of the center samples is >= 0.

Reduces to makeBinaryOpenFn on a uniform finest band (centers at ±h0/2). Level-aware by construction — the adjacent leaves are located through the octree, whatever their levels. origin is the world origin of the octree's fine units (AmrFlow's origin). frameShift is this block's global fine origin (D1): the face centroid fc arrives in GLOBAL world coordinates — buildOpenness evaluates it there so every rank agrees bit for bit — while probeSlot wants block-local coords. Zero single-rank, where the two frames coincide. The adjacent slot is read through pres.loOf/levelOf, not t.bounds, so a GHOST slot answers as well as a local leaf.

Definition at line 261 of file ghost_projection_sampled.hpp.

Referenced by peclet::amr::AmrFlow< Bits >::prepareDistributed(), peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ buildGhostOverlaySampled()

template<unsigned Bits, class SdfFn >
GhostOverlaySampled peclet::amr::buildGhostOverlaySampled ( const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
SdfFn &&  sdf,
int  matrixOrder,
int  rhsOrder,
Vec< 3 >  origin = Vec<3>{},
const std::array< long, 3 > *  globalFine = nullptr,
std::array< long, 3 >  frameShift = {},
bool  discovery = false,
double  rhoFactor = 2.2,
long  maxSamples = 0 
)
inline

Build the sampled overlay.

Rows: fluid-centered leaves that are non-clean under the canonical/virtual classification (see header). Requires pres.init done; does NOT require openness built (the canonical rule is self-computed from the SDF).

DISTRIBUTED (rung D1). Two frames meet in this builder and they only coincide single-rank: geometry is evaluated at GLOBAL world points (so every rank samples the SDF at bit-identical coordinates — AmrPoisson::setFrameShift's contract), while probeSlot takes BLOCK-LOCAL fine coords. frameShift is this block's global fine origin and globalFine the whole domain's fine extent; both default to the single-rank values (zero shift, the block's own extent), which makes every expression below reduce to what it was, bit for bit.

discovery (D3 setup-cost fix; prepareDistributed's fixpoint rounds ONLY, never the real build): probe-only mode. The control flow — every SDF evaluation, every gate, every probe — is IDENTICAL to a real build, so the miss set registered through the resolver seam is a superset of what the real build needs (the descent additionally splits pending regions), but the least-squares work whose results a discovery round discards is skipped: no candidate collection, no sort, no normal matrix, no solve, no second (degree-1) descent of the same box, no pass 2, no census print. If discovery ever under-probed, the real build would hit LeafHalo::resolve: unknown coord after finalize() — a throw, never silent corruption.

< Phase 3: 1/cellWidth per axis

Definition at line 309 of file ghost_projection_sampled.hpp.

Referenced by peclet::amr::AmrFlow< Bits >::prepareDistributed(), peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ gpsSample()

double peclet::amr::gpsSample ( const GhostOverlaySampled &  ov,
Index  r,
int  a,
int  q,
const std::vector< double > &  x 
)
inline

◆ ghostApplyDeltaSampledHost()

void peclet::amr::ghostApplyDeltaSampledHost ( const GhostOverlaySampled &  ov,
const std::vector< double > &  x,
std::vector< double > &  y 
)
inline

◆ ghostDivergDeltaSampledHost()

◆ buildMomSeamDelta()

template<unsigned Bits, class Mom , class SdfFn >
CfCsr peclet::amr::buildMomSeamDelta ( const GhostOverlaySampled &  ov,
const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
const Mom &  mom,
SdfFn &&  sdf,
Vec< 3 >  origin,
double  idiag,
double  mu,
long *  nSkipped = nullptr,
std::array< long, 3 >  frameShift = {} 
)
inline

Momentum ξ-overlay seam correction (plan §6.2, rung 1): at overlay rows with a different-level ±1 neighbour, the raw AmrCutCell row is wrong twice over — it classifies and anchors the wall from the COVERING neighbour's center sample (position-inconsistent), and its ξ branch was built with the GLOBAL β = μ/h0² (dimensionally off by 4^ΔL at a coarser row).

The corrected target row is the row-local ξ stencil (buildCutStencil with β = μ/h_row², AC0 = idiag + 6β) evaluated on the overlay's VIRTUAL ±1 sample functionals — i.e. exactly the uniform-band momentum closure on virtual samples (D1) — or, when the row is virtually clean, the level-aware conservative regular row. Delivered as a lagged deferred-correction CSR on the momentum source (the cfMom_ pattern): at the fixed point the steady operator carries the corrected row exactly. Assumes u_bc = 0 (stationary walls — the inhomogeneous ξ term is not corrected). Rows that are raw-regular AND virtually clean, or raw-regular with a virtually-ghost face (rare marginal), are skipped and counted.

Application (oracle step): src += cfApplyHost(csr, u^n) BEFORE makeRhs — the coefficients fold in 1/rscale so makeRhs's rscale multiply lands the correction at unit row scale. frameShift (D2) is this block's global fine origin: the row's centre and its virtual +-1 probe positions are WORLD coordinates, so on a rank whose block does not start at the origin they must carry the shift, or the whole stencil is built from the geometry of the wrong place. Zero single-rank.

Definition at line 955 of file ghost_projection_sampled.hpp.

Referenced by peclet::amr::AmrFlow< Bits >::setSolid(), and peclet::amr::oracle::AmrFlow< Bits >::setSolid().

◆ gpsDirGrad()

double peclet::amr::gpsDirGrad ( const GhostOverlaySampled &  ov,
Index  r,
const std::vector< double > &  fld,
int  c,
double  invh 
)
inline

Directional ghost cell-gradient on a sampled row (the mixed-level gradOfDir): the same cascade — central where both axis virtual neighbours are fluid, 2nd-order one-sided toward the fluid else (2-point fallback), 0 sandwiched — on the row's sample functionals, so the gradient reads virtual uniform-position values across a seam instead of degrading.

Pairing: the SAME functionals feed the constraint and the gradient.

Definition at line 1059 of file ghost_projection_sampled.hpp.

References gpsSample(), peclet::amr::GhostOverlaySampled::sampFluid, and transferFieldGradients().

◆ buildSampledGradCsr()

◆ uploadGhostOverlaySampled()

◆ ghostApplyDeltaSampled()

◆ ghostDivergDeltaSampled()

◆ uploadGhostGradCsr()

◆ applyGhostGradCsr()

◆ lohnerIndicator()

template<int Dim, unsigned Bits>
std::vector< double > peclet::amr::lohnerIndicator ( const BlockOctree< Dim, Bits > &  t,
const std::vector< double > &  u,
double  eps = 0.01 
)

Löhner normalized second-difference indicator E_i ∈ [0,1], per leaf, for scalar u (indexed by leaf slot).

Along each axis with both neighbours present: Δ² = u₊ − 2u_i + u₋ norm = |u₊ − u_i| + |u_i − u₋| + ε(|u₊| + 2|u_i| + |u₋|) and E_i = sqrt( Σ_axis Δ²² / Σ_axis norm² ). The ε term (filter) suppresses refinement on ripples whose amplitude is at the noise level (typical ε≈0.01). Refine where E_i exceeds a threshold (~0.2–0.5); coarsen where it is small.

Definition at line 38 of file indicators.hpp.

References transferFieldGradients().

Referenced by adapt(), and peclet::amr::pybind::Octree::lohner_indicator().

◆ secondDiffIndicator()

template<int Dim, unsigned Bits>
std::vector< double > peclet::amr::secondDiffIndicator ( const BlockOctree< Dim, Bits > &  t,
const std::vector< double > &  u 
)

Raw second-derivative magnitude indicator, per leaf: the L2 norm over axes of the undivided second difference |u₊ − 2u_i + u₋| (so ∝ |∂²u|·h²).

Un-normalized — the threshold is problem-dependent; prefer lohnerIndicator unless a dimensional curvature is specifically wanted.

Definition at line 68 of file indicators.hpp.

References transferFieldGradients().

◆ amrStageLiftable()

template<int Dim>
bool peclet::amr::amrStageLiftable ( const core::decomp::BlockDecomposer< Dim > &  dec)

amr's lift rule (docs/amr_mg_depth.md §6.2) as core's stage predicate: the level grid halves into a cube level with at least two cells per axis, and every block is even in origin and size on EVERY axis.

Pure; replicated whenever dec is.

Definition at line 64 of file mg_predict.hpp.

References transferFieldGradients().

◆ toString() [1/2]

const char * peclet::amr::toString ( MgLevelKind  k)
inline

Definition at line 91 of file mg_predict.hpp.

References Lifted, Octree, Repartition, Sibling, and Tail.

Referenced by peclet::amr::MgLadderPrediction< Dim >::bottomName(), and NB_MODULE().

◆ toString() [2/2]

const char * peclet::amr::toString ( MgBottomKind  k)
inline

Definition at line 106 of file mg_predict.hpp.

References Jacobi.

◆ predictPressureLadder()

template<int Dim>
MgLadderPrediction< Dim > peclet::amr::predictPressureLadder ( IVec< Dim >  G,
unsigned  lmax,
int  numRanks,
Index  bottomExtent = 4,
const PressureStagePolicy &  policy = {} 
)

Predict the pressure-multigrid ladder for a global ROOT grid G (in root cells, i.e.

the globalRootSize DistributedOctree::init takes — the finest grid divided by 2^lmax), a tree depth lmax, and numRanks ranks.

lmax is taken to be the number of octree coarsenings the mesh supports, which is the tree's lmax for a mesh that is refined to level 0 somewhere (every graded mesh, and the uniform mesh of Octree(cells, lmax=0)). An UNREFINED Octree(cells, lmax=k>0) is the same mesh as Octree(cells / 2^k, lmax=0) and must be predicted as such — its leaves are all root cells, so its octree ladder is one level, not k + 1.

LOCAL and pure: no MPI, no Kokkos, no mesh; any numRanks may be asked for on one process. numRanks < 1 is treated as 1. The ORB is BlockDecomposer<Dim>(numRanks, G), the partition DistributedOctree::init builds without weights; a weighted (rebalanced) partition may nest less deeply than predicted. bottomExtent is AmrFlow::pressureBottomExtent() (default 4).

Precondition
every G[d] >= 1 and bottomExtent >= 1 (the Python binding checks both). Does not throw.

Definition at line 214 of file mg_predict.hpp.

◆ rebuildCutStencil()

template<unsigned Bits>
void peclet::amr::rebuildCutStencil ( Index  n,
const double  betaIn[3],
double  idiag,
const View< double > &  sdfC,
const View< Index > &  nbr6,
const View< char > &  fluid,
const View< std::uint8_t > &  levels,
View< double >  AC,
View< double >  off,
View< char >  cut,
View< double >  rscale 
)

The per-cell ξ-overlay rebuild (build() Pass 2) on device: from the staged cell SDF + neighbour indices + fluid flag, recompute AC/off/cut/rscale exactly as the host build does.

The expensive part of a moving-boundary re-assembly, now device-resident; bit-exact vs the host AC_/off_/cut_/rscale_.

Definition at line 125 of file momentum_assembly.hpp.

References peclet::amr::AmrCutCell< Bits >::buildCutStencil(), and transferFieldGradients().

◆ assembleMomentum()

template<unsigned Bits>
MomentumOp peclet::amr::assembleMomentum ( const AmrCutCell< Bits > &  ccop,
const BlockOctreeView< 3, Bits > &  ov,
bool  scaleAdvByRscale = false 
)

Assemble the MomentumOp entirely on the device from a built host AmrCutCell + a device octree view.

The SDF samples / neighbour indices / fluid flags / advection CSR are staged to the device (the SDF sampling stays host, like D2's openness); the stencil rebuild + operator merge run on device. The advection is folded into the single CSR (op.hasAdv = false), matching host assembleOperator + hostOp.

Definition at line 176 of file momentum_assembly.hpp.

References buildFaceCsr(), peclet::amr::FvFaceEmit< Dim, Bits >::fineExt, peclet::amr::MomFaceEmit< Bits >::geom, peclet::amr::FvFaceEmit< Dim, Bits >::h0, peclet::amr::FvFaceEmit< Dim, Bits >::hasOpen, peclet::amr::BlockOctreeView< Dim, Bits >::levels, peclet::amr::BlockOctreeView< Dim, Bits >::numLeaves(), peclet::amr::FvFaceEmit< Dim, Bits >::ov, peclet::amr::FvFaceEmit< Dim, Bits >::periodic, and transferFieldGradients().

◆ restrictField()

void peclet::amr::restrictField ( View< const Index >  childStart,
View< const Index >  childIdx,
View< const double >  fine,
View< double >  coarse,
Index  nCoarse 
)
inline

◆ restrictKappa()

void peclet::amr::restrictKappa ( View< const Index >  childStart,
View< const Index >  childIdx,
View< const double >  fine,
View< const double >  kappa,
View< double >  coarse,
Index  nCoarse 
)
inline

Restrict, κ-weighted: coarse(p) = Σ_child κ_c·fine_c / Σ_child κ_c, with κ the fine cell's fluid-fraction weight (mean face aperture).

Downweights nearly-solid children at thin cut features. Reduces to restrictField when all κ are equal (openness-free). (Experimental — opt-in via Multigrid::setKappaRestrict; see the comparison test. NOTE: unlike the plain volume-average, this is not exactly conservative, so the restricted residual of a mean-zero RHS need not stay mean-zero.)

Definition at line 64 of file multigrid.hpp.

References transferFieldGradients().

Referenced by peclet::amr::Multigrid< Dim, Bits >::vcycle().

◆ prolongAdd()

void peclet::amr::prolongAdd ( View< const Index >  c2p,
View< const double >  coarse,
View< double >  fine,
Index  nFine 
)
inline

◆ prolongAddMasked()

void peclet::amr::prolongAddMasked ( View< const Index >  c2p,
View< const double >  coarse,
View< const char >  excl,
View< double >  fine,
Index  nFine 
)
inline

Masked piecewise-constant prolong + correct: fine(i) += coarse(c2p(i)) only on non-excluded fine cells (mirrors flow VelocityMG::prolongMasked — no correction into a cut/solid cell).

Generic.

Definition at line 94 of file multigrid.hpp.

References transferFieldGradients().

Referenced by peclet::amr::VelocityMG< Bits >::vcycle().

◆ zeroMasked()

void peclet::amr::zeroMasked ( View< double >  v,
View< const char >  excl,
Index  n 
)
inline

Zero v at excluded cells (excl != 0).

Mirrors flow's mg_mul_mask: applied to the fine residual before restriction so the inconsistent cut-cell + solid residuals never reach the coarse grid (the clean-fluid exclude). Generic.

Definition at line 109 of file multigrid.hpp.

References transferFieldGradients().

Referenced by peclet::amr::VelocityMG< Bits >::vcycle().

◆ dotVol()

double peclet::amr::dotVol ( View< const double >  u,
View< const double >  v,
View< const double >  invVol,
Index  n 
)
inline

Volume-weighted dot <u,v>_D = Σ_i V_i u_i v_i, V_i = 1/invVol_i.

Definition at line 43 of file pcg.hpp.

References transferFieldGradients().

Referenced by peclet::amr::PCG< Dim, Bits >::solve().

◆ buildFluidMask()

void peclet::amr::buildFluidMask ( const FvOp &  op,
View< double >  mask,
Index  n 
)
inline

Build the fluid mask: mask(i)=1 where the operator diagonal Σ_f w_f (+ bcDiag) is non-trivial, 0 for a solid cell (every face closed by the cut-cell openness ⇒ Σ w_f = 0).

These solid cells carry their own (per connected solid region) constant null modes; left in the Krylov space CG amplifies them (the cut-cell-openness near-nullspace blow-up). We project them out — same role as flow's mg_mask_solid_k. Geometry-fixed, so it is rebuilt once per solve.

Definition at line 57 of file pcg.hpp.

References peclet::amr::FvOp::bcDiag, peclet::amr::FvOp::faceStart, peclet::amr::FvOp::faceW, and transferFieldGradients().

Referenced by peclet::amr::PCG< Dim, Bits >::solve().

◆ maskSolid()

void peclet::amr::maskSolid ( View< double >  u,
View< const double >  mask,
Index  n 
)
inline

Zero the solid cells (project out the solid null modes).

Definition at line 71 of file pcg.hpp.

References transferFieldGradients().

Referenced by peclet::amr::PCG< Dim, Bits >::solve().

◆ removeMeanVolReduced()

void peclet::amr::removeMeanVolReduced ( View< double >  u,
View< const double >  invVol,
View< const double >  mask,
Index  n,
const std::function< double(double)> &  reduce 
)
inline

Project u onto the FLUID range: zero solid cells, then subtract the volume-weighted mean over the fluid cells only (the constant null mode of the connected fluid region).

The mean must exclude the pinned solid cells — including them dilutes it and lets the solid drift. reduce folds each local mean sum into the global one (identity single-rank; an MPI_Allreduce lambda distributed — the mean is over the GLOBAL fluid region).

Definition at line 80 of file pcg.hpp.

References transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::gpProject(), removeMeanVol(), and peclet::amr::PCG< Dim, Bits >::solve().

◆ removeMeanVol()

void peclet::amr::removeMeanVol ( View< double >  u,
View< const double >  invVol,
View< const double >  mask,
Index  n 
)
inline

Definition at line 99 of file pcg.hpp.

References removeMeanVolReduced(), and transferFieldGradients().

◆ refineToSdf()

template<int Dim, unsigned Bits, class SdfFn >
Index peclet::amr::refineToSdf ( BlockOctree< Dim, Bits > &  t,
const AmrGeometry< Dim > &  geo,
SdfFn &&  sdf,
unsigned  targetLevel,
Real  band = 1.0,
bool  balance = true 
)

Refine leaves near an SDF interface down to targetLevel.

A leaf is refined while its level exceeds targetLevel and the surface lies within the cell or a band around it: |phi(center)| <= halfDiagonal + band*h0, where halfDiagonal = 0.5*sqrt(Dim)*cellWidth. Iterated until no eligible leaf remains; returns the number of refinements performed. sdf is any callable Real(const Vec<Dim>&) (e.g. a lambda over a peclet::core::geom shape). Optionally restore 2:1 balance afterwards.

Definition at line 34 of file refine.hpp.

References transferFieldGradients().

Referenced by peclet::amr::pybind::Octree::refine_to_sdf(), peclet::amr::pybind::DistributedOctree::refine_to_sdf(), peclet::amr::pybind::Octree::refine_to_sphere(), and peclet::amr::pybind::DistributedOctree::refine_to_sphere().

◆ refineToSdfGraded()

template<int Dim, unsigned Bits, class SdfFn , class TargetFn >
Index peclet::amr::refineToSdfGraded ( BlockOctree< Dim, Bits > &  t,
const AmrGeometry< Dim > &  geo,
SdfFn &&  sdf,
TargetFn &&  targetFn,
Real  band = 2.0,
bool  balance = true 
)

Graded variant of refineToSdf: a per-point TARGET LEVEL function instead of one global targetLevel — the mesh-generator side of the mixed-level cut band (docs/amr_mixed_level_cut_band_plan.md §7).

Cut cells then live at several levels: fine in narrow throats / near contacts, coarse on smooth wide caps.

targetFn is any callable unsigned(const Vec<Dim>&) giving the coarsest acceptable level at a world point (0 = finest). A leaf at level L is refined while L > targetFn(center) and the surface lies within halfDiagonal + band*h(L-1) of the center — the band margin is measured in cells of the level being CREATED (not in h0 as in refineToSdf), which is what keeps the margin meaningful where the target level is coarse. Iterated to a fixpoint; optionally 2:1-balanced afterwards. Returns the number of refinements performed.

Requires the sampled ghost overlay (AmrFlow::setGhostSampled(true)) on the solver side: the classic overlay contracts a uniform finest band and throws on the level jumps this produces.

Definition at line 85 of file refine.hpp.

References transferFieldGradients().

Referenced by peclet::amr::pybind::Octree::refine_to_gap_floor(), and peclet::amr::pybind::Octree::refine_to_sdf_graded().

◆ gapFloorTarget()

template<int Dim, class GapFn >
auto peclet::amr::gapFloorTarget ( GapFn &&  gapFn,
Real  h0,
unsigned  coarsestLevel,
Real  n = 4.0 
)

The plan's §7 criterion 1 as a ready-made targetFn for refineToSdfGraded: the GAP-WIDTH FLOOR.

A cell at level L may be cut only where the local fluid gap satisfies gap >= n * h_L (n = 4 per the M1/M2 measurements) — so the target level at a point is the COARSEST level still clearing the floor, clamped to [0, coarsestLevel]. This is the AMReX multi-valued-cell rule inverted: coarsening may never merge or disconnect fluid (plan D3).

gapFn(x) is the local gap proxy — for a sphere packing the two-closest-surfaces sum d1 + d2 (distance to the nearest surface plus the second-nearest), which is the pore/throat width along the line joining them; a medial-axis or peclet.pnm throat-radius field can be substituted verbatim. Phase 3: pass geo.hMax() as h0 on an anisotropic octree — the gap must clear n cells on EVERY axis, so the coarsest one decides (docs/amr_anisotropic.md §6).

Definition at line 140 of file refine.hpp.

References transferFieldGradients().

◆ buildSeamRecon()

template<unsigned Bits, class RegularFn , class FluidFn >
SeamReconHost peclet::amr::buildSeamRecon ( const AmrPoisson< 3, Bits > &  ap,
RegularFn &&  regularOk,
FluidFn &&  fluidOk,
CfScheme  scheme 
)

Build the seam-reconstruction tables over the LOCAL rows of ap (docs/amr_cf_convective.md §5.2).

regularOk is the ghost-visible fluid && !cut flag the C/F overlays are gated on and fluidOk the plain fluid predicate cfAppendStencil drops a tangential side on; scheme selects the tangential sample (CfScheme::quadratic — §5.1 Q-A: ONE tangential-sample operator suite-wide). Every probe it issues is registered by the distributed discovery fixpoint (AmrFlow::probeCfScheme + AmrFlow::probeSeamLayer), so a ghost cell resolves rather than throwing.

LOCAL: no communication; each rank walks its own rows, reading ghost slots through ap's resolver. Deterministic (see the file header), which is what makes np = 1 bitwise identical to the single-rank build.

Precondition
ap is fully built on the final mesh (operator, level-aware probes and — distributed — a FINALIZED resolver whose registry holds every probe above). An unregistered out-of-block probe reaches the frozen LeafHalo resolver, which throws std::runtime_error.
regularOk / fluidOk accept every slot ap can return, ghost slots included.
Returns
the tables; the two record counts are Flow.diagnostics.num_seam_sample_records / num_seam_layer_records.

Definition at line 129 of file seam_recon.hpp.

References peclet::amr::AmrPoisson< Dim, Bits >::cellWidth(), peclet::amr::detail::cfAppendStencil(), peclet::amr::BlockOctree< Dim, Bits >::numLeaves(), peclet::amr::AmrPoisson< Dim, Bits >::octree(), peclet::amr::detail::seamFaceLayer(), and transferFieldGradients().

Referenced by peclet::amr::AmrFlow< Bits >::setSolid().

◆ writeVtu() [1/2]

template<int Dim, unsigned Bits>
void peclet::amr::writeVtu ( const std::string &  path,
const BlockOctree< Dim, Bits > &  t,
const AmrGeometry< Dim > &  geo,
const std::string &  name,
const std::vector< double > &  cellData 
)

Write a BlockOctree (+ world geometry + a per-leaf scalar) as a VTK UnstructuredGrid (.vtu), ASCII, one cell per leaf.

Definition at line 47 of file vtu_io.hpp.

References transferFieldGradients().

Referenced by peclet::amr::pybind::Octree::write_vtu(), peclet::amr::pybind::DistributedOctree::write_vtu(), and writeVtu().

◆ writeVtu() [2/2]

template<int Dim, unsigned Bits>
void peclet::amr::writeVtu ( const std::string &  path,
const BlockOctree< Dim, Bits > &  t,
const AmrGeometry< Dim > &  geo,
const std::string &  name,
const LeafField< double > &  field 
)

Convenience overload taking a LeafField<double>.

Definition at line 113 of file vtu_io.hpp.

References transferFieldGradients(), peclet::amr::LeafField< T >::values, and writeVtu().