core 0.5.0
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::amr Namespace Reference

Namespaces

namespace  cc
 
namespace  detail
 
namespace  oracle
 

Classes

struct  AdaptResult
 
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 wide in every axis. 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  Coloring
 A graph colouring of a face CSR: cells grouped by colour. 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...
 
struct  FaceCsrOpT
 A backend-agnostic view of an assembled face-CSR operator. 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  FvCsrOpT
 A backend-agnostic view of an assembled FV (weight-CSR) operator. More...
 
struct  FvFaceEmit
 Device-callable reproduction of AmrPoisson's per-cell face walk + geometry. More...
 
struct  FvOp
 
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...
 
class  GradedDistributedMultigrid
 Geometric-multigrid V-cycle on a graded distributed octree, built on DistributedFvOperator. More...
 
struct  HostArr
 A uniform accessor over a raw host array, giving it the operator()(i) that Kokkos::View has, so the row kernels can be written once for both. 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...
 
class  MomentumMG
 
struct  MomentumOp
 Assembled momentum operator on the device: (A u)_i = diag_i u_i + Σ coef·u[nbr], with an optional implicit-FOU advection part (rebuilt each step from the lagged velocity): a per-cell outflow diagonal advDiag + per-face inflow coefficients over a second (face-geometry) CSR. More...
 
class  MomentumSolver
 
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
 
class  ScalarTransport
 
class  VelocityMG
 

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

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< doubletransferField (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< intflagByIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &ind, double refineThresh, double coarsenThresh, unsigned finestLevel=0)
 
template<int Dim, unsigned Bits>
AdaptResult< Dim, BitsadaptField (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, Bitsadapt (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.
 
MORTON_HD 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).
 
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 >
MORTON_HD 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 RowFn , class FluidFn >
CfCompCsr buildCfDivDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RowFn &&rowOk, FluidFn &&fluidOk, CfScheme scheme)
 (D_scheme − D_std) for the face-average divergence div_i = invV·Σ α·A·dir·(face value).
 
template<unsigned Bits, class RowFn , class FluidFn >
std::array< CfCsr, 3 > buildCfGradDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RowFn &&rowOk, FluidFn &&fluidOk, CfScheme scheme)
 (G_scheme − G_std) for the ABC cell gradient gradOf/grad3.
 
template<unsigned Bits, class FluidFn >
CfUfDelta buildCfUfDelta (const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, FluidFn &&fluidOk, CfScheme scheme)
 
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< IndexscanOffsets (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< doublelohnerIndicatorDistributed (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< doubledistributedAdapt (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).
 
template<class Op , class U >
MORTON_HD double faceCsrApplyRow (const Op &op, Index i, const U &u)
 (A u)_i — one assembled-operator row.
 
template<class Op , class U >
MORTON_HD void faceCsrOffDiag (const Op &op, Index i, const U &u, double &off, double &d)
 Off-diagonal sum and the (advection-inclusive) diagonal for the point smoothers: out off = Σ coef·u[nbr] (+ advection inflow), d = diag (+ advection outflow).
 
MORTON_HD double faceCsrPointUpdate (double b_i, double off, double d, double uOld, double omega)
 The damped point update used by both Jacobi and (multicolour) Gauss–Seidel: returns the new u_i given the right-hand side b_i, the off-diagonal sum off, the diagonal d, the old value uOld, and the relaxation omega.
 
template<class Op , class U >
MORTON_HD double fvApplyRow (const Op &op, Index i, const U &u)
 (H u)_i = c0·u_i + cD·( invVol_i·( Σ w·(u_nbr − u_i) − bcDiag_i·u_i ) ).
 
template<class Op , class U >
MORTON_HD double fvPointSolve (const Op &op, Index i, const U &u, double rhs_i, double uOld)
 The point solve of H u = rhs for one row (raw value, before damping), matching the host point solve and device jacobiFv: the pure-L path (c0=0,cD=1) keeps the exact original expression.
 
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).
 
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)
 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)
 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, double 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<unsigned Bits>
std::vector< charfindPocketCells (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, double h0, Vec< 3 > origin)
 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 >{})
 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).
 
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<int Dim, unsigned Bits>
std::vector< doublelohnerIndicator (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< doublesecondDiffIndicator (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²).
 
FaceCsrOpT< View< const double >, View< const Index > > momView (const MomentumOp &op)
 View the assembled momentum operator through the shared, backend-agnostic FaceCsrOpT, so the device kernels and the host serial solver (cut_cell.hpp) run the same row arithmetic (face_csr.hpp) and cannot drift.
 
void applyMom (const MomentumOp &op, View< const double > u, View< double > Au)
 Au = A u (cut-cell operator + optional implicit-FOU advection).
 
void residualMom (const MomentumOp &op, View< const double > u, View< const double > b, View< double > res)
 res = b − A u.
 
void jacobiMom (const MomentumOp &op, View< double > u, View< const double > b, View< double > tmp, double omega)
 One weighted-Jacobi sweep of A u = b (in place).
 
double dotPlain (View< const double > a, View< const double > b, Index n)
 Plain (unweighted) dot product.
 
void bicgPUpdate (View< double > p, View< const double > r, View< const double > v, double beta, double omega, Index n)
 BiCGStab direction update: p = r + β(p − ω v).
 
Coloring greedyColoring (const std::vector< Index > &start, const std::vector< Index > &nbr, Index n)
 Greedy colouring of the face CSR (start/nbr, host): each cell gets the smallest colour not used by any face neighbour, so cells of one colour share no edge (race-free parallel GS sweep).
 
void multicolorGSMom (const MomentumOp &op, View< double > u, View< const double > b, const Coloring &col, double omega)
 One symmetric multicolour Gauss–Seidel sweep of A u = b in place (momentum operator: diag + face CSR + optional implicit-FOU advection): a forward pass over colours 0…C-1 followed by a reverse pass C-1…0.
 
template<unsigned Bits>
void rebuildCutStencil (Index n, double beta, double AC0, const View< double > &sdfC, const View< Index > &nbr6, const View< char > &fluid, 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)
 
void axpy (View< double > y, double a, View< const double > x, Index n)
 y += a·x
 
void zpby (View< double > p, View< const double > z, double b, Index n)
 p = z + b·p (CG direction update)
 
void negate (View< double > x, Index n)
 y = −x (negate in place)
 
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>
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>.
 

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 201 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 55 of file cf_scheme.hpp.

Function Documentation

◆ transferFieldGradients()

template<int Dim, unsigned Bits>
std::vector< std::array< double, Dim > > peclet::core::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 53 of file adapt.hpp.

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

Referenced by peclet::core::amr::BarnesHut< Dim, Bits >::acceleration(), peclet::core::amr::BarnesHut< Dim, Bits >::accelerationDirect(), peclet::core::amr::BarnesHut< Dim, Bits >::accelerations(), adapt(), adaptField(), advectExplicit(), peclet::core::amr::oracle::AmrFlow< Bits >::advectTerm(), peclet::core::amr::AmrFlow< Bits >::allSum(), amrEnvFlag(), amrLocate(), peclet::core::amr::AmrPoisson< Dim, Bits >::AmrPoisson(), peclet::core::amr::DistributedFvOperator< Dim, Bits >::apply(), peclet::core::amr::DistributedPoisson< Dim, Bits >::apply(), peclet::core::amr::DistributedPoissonView< Dim, Bits >::apply(), applyFv(), peclet::core::amr::AmrPoisson< Dim, Bits >::applyFvShared(), applyGhostGrad(), peclet::core::amr::AmrPoisson< Dim, Bits >::applyLaplacian(), peclet::core::amr::AmrPoisson< Dim, Bits >::applyLaplacianQuad(), applyMom(), peclet::core::amr::AmrCutCell< Bits >::applyOp(), peclet::core::amr::AmrCutCell< Bits >::applyOpGeometric(), peclet::core::amr::FvFaceEmit< Dim, Bits >::areaOf(), assembleFaceGeom(), peclet::core::amr::AmrPoisson< Dim, Bits >::assembleFv(), assembleFv(), assembleMomentum(), peclet::core::amr::AmrCutCell< Bits >::assembleOperator(), axpy(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::b(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::b(), peclet::core::amr::MomentumMG< Bits >::b(), peclet::core::amr::Multigrid< Dim, Bits >::b(), peclet::core::amr::VelocityMG< Bits >::b(), peclet::core::amr::DistributedOctree< Dim, Bits >::balance(), peclet::core::amr::BlockOctree< Dim, Bits >::balance2to1(), peclet::core::amr::FvFaceEmit< Dim, Bits >::bcDiag(), peclet::core::amr::AmrFlow< Bits >::beginAdapt(), bicgPUpdate(), peclet::core::amr::BlockOctree< Dim, Bits >::bits(), peclet::core::amr::AmrPoisson< Dim, Bits >::boundaryDiag(), peclet::core::amr::BlockOctree< Dim, Bits >::bounds(), peclet::core::amr::GradedDistributedMultigrid< Dim, Bits >::build(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::build(), peclet::core::amr::GradedDistributedMultigrid< Dim, Bits >::build(), peclet::core::amr::DistributedMultigrid< Dim, Bits >::build(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::build(), peclet::core::amr::MomentumMG< Bits >::build(), peclet::core::amr::Multigrid< Dim, Bits >::build(), peclet::core::amr::VelocityMG< Bits >::build(), peclet::core::amr::Multigrid< Dim, Bits >::build(), peclet::core::amr::AmrMultigrid< Dim, Bits >::build(), peclet::core::amr::BarnesHut< Dim, Bits >::build(), peclet::core::amr::AmrCutCell< Bits >::build(), peclet::core::amr::AmrCutCell< Bits >::buildAdvectionFou(), buildCfDivDelta(), buildCfGradDelta(), buildCfLapDelta(), buildCfUfDelta(), peclet::core::amr::AmrCutCell< Bits >::buildCutStencil(), buildFaceCsr(), peclet::core::amr::oracle::AmrFlow< Bits >::buildFaceField(), buildFaceField(), peclet::core::amr::DistributedOctree< Dim, Bits >::buildFaceGatherPlan(), buildFaceGeom(), buildFluidMask(), buildFou(), peclet::core::amr::DistributedOctree< Dim, Bits >::buildGatherHaloTopology(), buildGhostOverlay(), peclet::core::amr::AmrPoisson< Dim, Bits >::buildOpenness(), peclet::core::amr::detail::GhostOverlayRef::cell(), peclet::core::amr::FvFaceEmit< Dim, Bits >::cellVolume(), peclet::core::amr::MomFaceEmit< Bits >::cellVolume(), peclet::core::amr::AmrPoisson< Dim, Bits >::cellVolume(), peclet::core::amr::ScalarTransport< Dim, Bits >::cellVolume(), peclet::core::amr::FvFaceEmit< Dim, Bits >::cellWidth(), peclet::core::amr::AmrPoisson< Dim, Bits >::cellWidth(), peclet::core::amr::ScalarTransport< Dim, Bits >::cellWidth(), cfApply(), cfApplyComp(), cfApplyCompHost(), cfApplyHost(), peclet::core::amr::BlockOctree< Dim, Bits >::coarsenIf(), peclet::core::amr::AmrPoisson< Dim, Bits >::coarseStar(), peclet::core::amr::BlockOctree< Dim, Bits >::code(), peclet::core::amr::FvFaceEmit< Dim, Bits >::coeff(), peclet::core::amr::detail::compactCsr(), peclet::core::amr::AmrFlow< Bits >::copyToHost(), correct(), peclet::core::amr::FaceGeomEmit< Bits >::count(), peclet::core::amr::detail::GhostOverlayRef::coupled(), peclet::core::amr::DistributedOctree< Dim, Bits >::coverLevels(), peclet::core::amr::DistributedOctree< Dim, Bits >::coverValues(), peclet::core::amr::AmrFlow< Bits >::debugSou(), deferredSou(), peclet::core::amr::MomFaceEmit< Bits >::diag(), distributedAdapt(), divergence(), peclet::core::amr::oracle::AmrFlow< Bits >::divergence(), divFaceNorm(), peclet::core::amr::AmrFlow< Bits >::divNormFace(), peclet::core::amr::oracle::AmrFlow< Bits >::divNormFace(), peclet::core::amr::oracle::AmrFlow< Bits >::divNormL2(), dotPlain(), dotVol(), peclet::core::amr::LeafHaloExchange::exchange(), peclet::core::amr::LeafHaloExchange::exchange3(), peclet::core::amr::LeafHalo< Dim, Bits >::exchangeHost(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::extendedSize(), peclet::core::amr::DistributedOctree< Dim, Bits >::faceAcross(), faceCsrApplyRow(), faceCsrOffDiag(), faceCsrPointUpdate(), peclet::core::amr::BlockOctree< Dim, Bits >::faceNeighbor(), peclet::core::amr::BlockOctreeView< Dim, Bits >::faceNeighbor(), peclet::core::amr::DistributedOctree< Dim, Bits >::faceNeighborGather(), peclet::core::amr::DistributedOctree< Dim, Bits >::faceNeighborGather(), peclet::core::amr::AmrPoisson< Dim, Bits >::faceOpenness(), peclet::core::amr::LeafHalo< Dim, Bits >::finalize(), peclet::core::amr::BlockOctree< Dim, Bits >::find(), peclet::core::amr::BlockOctree< Dim, Bits >::find(), peclet::core::amr::DistributedOctree< Dim, Bits >::findGlobalRoot(), findPocketCells(), peclet::core::amr::AmrFlow< Bits >::finishAdapt(), peclet::core::amr::oracle::AmrFlow< Bits >::finishAdapt(), peclet::core::amr::AmrFlow< Bits >::finishProjection(), flagByIndicator(), peclet::core::amr::ScalarTransport< Dim, Bits >::forEachFace(), peclet::core::amr::FaceGeomEmit< Bits >::forEachFaceFull(), peclet::core::amr::AmrPoisson< Dim, Bits >::forEachFaceFull(), peclet::core::amr::AmrPoisson< Dim, Bits >::forEachFaceNeighbor(), peclet::core::amr::AmrCutCell< Bits >::fouApply(), fvApplyRow(), fvPointSolve(), fvView(), peclet::core::amr::DistributedGatherHalo< Dim, Bits >::gather(), peclet::core::amr::AmrCutCell< Bits >::gaussSeidel(), peclet::core::amr::AmrPoisson< Dim, Bits >::gaussSeidel(), peclet::core::amr::AmrCutCell< Bits >::gaussSeidelGeometric(), ghostApplyDelta(), ghostApplyDeltaHost(), ghostApplyDeltaSampledHost(), ghostDivergDelta(), ghostDivergDeltaHost(), ghostDivergDeltaSampledHost(), peclet::core::amr::AmrFlow< Bits >::ghostMatvec(), peclet::core::amr::AmrFlow< Bits >::ghostPrec(), peclet::core::amr::DistributedOctree< Dim, Bits >::globalCode(), peclet::core::amr::DistributedOctree< Dim, Bits >::globalRootOf(), peclet::core::amr::AmrFlow< Bits >::gpProject(), gpsDirGrad(), peclet::core::amr::detail::gpsMonomials(), gpsSample(), peclet::core::amr::detail::gpsSolveDense(), grad3(), greedyColoring(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::halo(), hoFaceValue(), peclet::core::amr::AmrPoisson< Dim, Bits >::hostFvOp(), peclet::core::amr::AmrCutCell< Bits >::hostOp(), peclet::core::amr::DistributedGatherHalo< Dim, Bits >::init(), peclet::core::amr::LeafHaloExchange::init(), peclet::core::amr::ScalarTransport< Dim, Bits >::init(), peclet::core::amr::AmrPoisson< Dim, Bits >::init(), peclet::core::amr::DistributedPoissonView< Dim, Bits >::init(), peclet::core::amr::LeafHalo< Dim, Bits >::init(), peclet::core::amr::DistributedFvOperator< Dim, Bits >::init(), peclet::core::amr::DistributedOctree< Dim, Bits >::init(), peclet::core::amr::AmrFlow< Bits >::installGhostMeta(), peclet::core::amr::BlockOctree< Dim, Bits >::isBalanced(), peclet::core::amr::AmrCutCell< Bits >::isCut(), peclet::core::amr::AmrCutCell< Bits >::isFluid(), peclet::core::amr::AmrFlow< Bits >::isFluid(), peclet::core::amr::oracle::AmrFlow< Bits >::isFluid(), peclet::core::amr::DistributedFvOperator< Dim, Bits >::jacobi(), peclet::core::amr::DistributedPoisson< Dim, Bits >::jacobi(), peclet::core::amr::DistributedPoissonView< Dim, Bits >::jacobi(), jacobiFv(), jacobiMom(), jacobiSweep(), peclet::core::amr::AmrCutCell< Bits >::kappa(), laplacian(), peclet::core::amr::BlockOctree< Dim, Bits >::level(), peclet::core::amr::AmrFlow< Bits >::localVector(), peclet::core::amr::BlockOctreeView< Dim, Bits >::locate(), lohnerIndicator(), lohnerIndicatorDistributed(), peclet::core::amr::AmrPoisson< Dim, Bits >::loOf(), peclet::core::amr::LeafHalo< Dim, Bits >::lookup(), peclet::core::amr::LeafHalo< Dim, Bits >::lookupGlobal(), peclet::core::amr::AmrGeometry< Dim >::lowerCorner(), makeBinaryOpenFn(), makeBinaryOpenFnMixed(), peclet::core::amr::AmrCutCell< Bits >::makeRhs(), maskSolid(), peclet::core::amr::AmrFlow< Bits >::maxAbsDiff(), momRhs(), momView(), multicolorGSMom(), negate(), peclet::core::amr::AmrCutCell< Bits >::neighborOf(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::numLeaves(), peclet::core::amr::GradedDistributedMultigrid< Dim, Bits >::numLeaves(), peclet::core::amr::DistributedMultigrid< Dim, Bits >::numLeaves(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::numLeaves(), peclet::core::amr::MomentumMG< Bits >::numLeaves(), peclet::core::amr::Multigrid< Dim, Bits >::numLeaves(), peclet::core::amr::VelocityMG< Bits >::numLeaves(), peclet::core::amr::DistributedMultigrid< Dim, Bits >::octree(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::octree(), peclet::core::amr::Multigrid< Dim, Bits >::octreeCode(), peclet::core::amr::GradedDistributedMultigrid< Dim, Bits >::op(), peclet::core::amr::DistributedMultigrid< Dim, Bits >::op(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::op(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::op(), peclet::core::amr::MomentumMG< Bits >::op(), peclet::core::amr::Multigrid< Dim, Bits >::op(), peclet::core::amr::AmrMultigrid< Dim, Bits >::op(), peclet::core::amr::FvFaceEmit< Dim, Bits >::openness(), peclet::core::amr::HostArr< T >::operator()(), peclet::core::amr::FvFaceEmit< Dim, Bits >::operator()(), peclet::core::amr::MomFaceEmit< Bits >::operator()(), peclet::core::amr::CsrFillSink::operator()(), peclet::core::amr::MomScaleSink< Sink >::operator()(), peclet::core::amr::MomSumSink::operator()(), peclet::core::amr::LeafField< T >::operator[](), peclet::core::amr::LeafField< T >::operator[](), peclet::core::amr::FaceGeomEmit< Bits >::periodicNeighbor(), peclet::core::amr::AmrPoisson< Dim, Bits >::periodicNeighbor(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::poisson(), peclet::core::amr::cc::poly_D(), peclet::core::amr::cc::poly_D_sandwich(), peclet::core::amr::cc::poly_N_c_sandwich(), peclet::core::amr::cc::poly_N_nb(), peclet::core::amr::cc::poly_Nbc_mp_sw(), peclet::core::amr::cc::poly_Nbc_pp_sw(), peclet::core::amr::cc::poly_Nc(), peclet::core::amr::AmrFlow< Bits >::prepareDistributed(), presUpdate(), peclet::core::amr::AmrPoisson< Dim, Bits >::probeSlot(), peclet::core::amr::AmrFlow< Bits >::project(), peclet::core::amr::oracle::AmrFlow< Bits >::project(), prolongAdd(), prolongAddMasked(), quadDelta(), peclet::core::amr::Multigrid< Dim, Bits >::reassembleOperators(), peclet::core::amr::DistributedOctree< Dim, Bits >::rebalance(), peclet::core::amr::AmrFlow< Bits >::rebalanceMpi(), rebuildCutStencil(), peclet::core::amr::BlockOctree< Dim, Bits >::refineIf(), peclet::core::amr::BlockOctree< Dim, Bits >::refineLeaf(), refineToSdf(), peclet::core::amr::AmrPoisson< Dim, Bits >::removeMean(), removeMeanFv(), removeMeanFvDist(), removeMeanVol(), removeMeanVolReduced(), peclet::core::amr::detail::GhostOverlayRef::rescale(), peclet::core::amr::AmrCutCell< Bits >::residual(), peclet::core::amr::DistributedFvOperator< Dim, Bits >::residual(), peclet::core::amr::AmrPoisson< Dim, Bits >::residual(), peclet::core::amr::DistributedPoisson< Dim, Bits >::residual(), peclet::core::amr::DistributedPoissonView< Dim, Bits >::residual(), residualFv(), peclet::core::amr::AmrCutCell< Bits >::residualGeometric(), residualMom(), peclet::core::amr::DistributedFvOperator< Dim, Bits >::residualNorm(), peclet::core::amr::DistributedPoisson< Dim, Bits >::residualNorm(), peclet::core::amr::DistributedPoissonView< Dim, Bits >::residualNorm(), peclet::core::amr::AmrPoisson< Dim, Bits >::residualQuad(), peclet::core::amr::LeafHalo< Dim, Bits >::resolve(), peclet::core::amr::LeafHalo< Dim, Bits >::resolveGlobal(), peclet::core::amr::LeafHalo< Dim, Bits >::resolveMisses(), restrictField(), restrictKappa(), peclet::core::amr::AmrCutCell< Bits >::rhsScale(), peclet::core::amr::AmrFlow< Bits >::runMgVcycle(), peclet::core::amr::ScalarTransport< Dim, Bits >::ScalarTransport(), scanOffsets(), secondDiffIndicator(), peclet::core::amr::AmrFlow< Bits >::setAdvection(), peclet::core::amr::oracle::AmrFlow< Bits >::setAdvection(), peclet::core::amr::AmrFlow< Bits >::setAdvectionScheme(), peclet::core::amr::oracle::AmrFlow< Bits >::setAdvectionScheme(), peclet::core::amr::AmrFlow< Bits >::setBodyForce(), peclet::core::amr::oracle::AmrFlow< Bits >::setBodyForce(), peclet::core::amr::AmrFlow< Bits >::setDensity(), peclet::core::amr::oracle::AmrFlow< Bits >::setDensity(), peclet::core::amr::MomentumSolver< Bits >::setDistributed(), peclet::core::amr::PCG< Dim, Bits >::setDistributed(), peclet::core::amr::AmrFlow< Bits >::setDt(), peclet::core::amr::oracle::AmrFlow< Bits >::setDt(), peclet::core::amr::VelocityMG< Bits >::setFineOp(), peclet::core::amr::AmrCutCell< Bits >::setFrameShift(), peclet::core::amr::AmrPoisson< Dim, Bits >::setFrameShift(), peclet::core::amr::MomentumMG< Bits >::setGaussSeidel(), peclet::core::amr::VelocityMG< Bits >::setGaussSeidel(), peclet::core::amr::AmrFlow< Bits >::setGhostGradient(), peclet::core::amr::oracle::AmrFlow< Bits >::setGhostGradient(), peclet::core::amr::AmrFlow< Bits >::setGhostProjection(), peclet::core::amr::oracle::AmrFlow< Bits >::setGhostProjection(), peclet::core::amr::AmrCutCell< Bits >::setGhosts(), peclet::core::amr::AmrPoisson< Dim, Bits >::setGhosts(), peclet::core::amr::oracle::AmrFlow< Bits >::setGhostSampled(), peclet::core::amr::Multigrid< Dim, Bits >::setHelmholtz(), peclet::core::amr::AmrMultigrid< Dim, Bits >::setImmersedWall(), peclet::core::amr::AmrFlow< Bits >::setImplicitAdvection(), peclet::core::amr::oracle::AmrFlow< Bits >::setImplicitAdvection(), peclet::core::amr::MomentumSolver< Bits >::setJacobi(), peclet::core::amr::Multigrid< Dim, Bits >::setKappaRestrict(), peclet::core::amr::AmrFlow< Bits >::setMomentumGS(), peclet::core::amr::AmrFlow< Bits >::setMomentumMG(), peclet::core::amr::AmrFlow< Bits >::setMomentumMGSolver(), peclet::core::amr::AmrFlow< Bits >::setMomentumTol(), peclet::core::amr::AmrMultigrid< Dim, Bits >::setOpenness(), peclet::core::amr::AmrPoisson< Dim, Bits >::setOpennessRaw(), peclet::core::amr::AmrPoisson< Dim, Bits >::setOrigin(), peclet::core::amr::AmrFlow< Bits >::setOuterIterations(), peclet::core::amr::AmrMultigrid< Dim, Bits >::setPeriodic(), peclet::core::amr::MomentumSolver< Bits >::setPreconditioner(), peclet::core::amr::AmrFlow< Bits >::setPressure(), peclet::core::amr::AmrFlow< Bits >::setPressurePCG(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::setRemoveMean(), peclet::core::amr::Multigrid< Dim, Bits >::setRemoveMean(), peclet::core::amr::AmrCutCell< Bits >::setResolver(), peclet::core::amr::AmrPoisson< Dim, Bits >::setResolver(), peclet::core::amr::PCG< Dim, Bits >::setSingular(), peclet::core::amr::AmrFlow< Bits >::setSolid(), peclet::core::amr::oracle::AmrFlow< Bits >::setSolid(), peclet::core::amr::PCG< Dim, Bits >::setVcycle(), peclet::core::amr::AmrFlow< Bits >::setVelocity(), peclet::core::amr::AmrFlow< Bits >::setVelocityMGStaircase(), peclet::core::amr::PCG< Dim, Bits >::solve(), peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab(), peclet::core::amr::MomentumSolver< Bits >::solveDefectCorrection(), peclet::core::amr::AmrFlow< Bits >::solveGhostBiCGStab(), peclet::core::amr::MomentumSolver< Bits >::solveJacobi(), peclet::core::amr::Multigrid< Dim, Bits >::solveQuad(), peclet::core::amr::AmrMultigrid< Dim, Bits >::solveQuad(), peclet::core::amr::detail::GhostOverlayRef::state(), peclet::core::amr::ScalarTransport< Dim, Bits >::step(), peclet::core::amr::AmrFlow< Bits >::step(), peclet::core::amr::oracle::AmrFlow< Bits >::step(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::sync(), peclet::core::amr::AmrFlow< Bits >::syncScalar(), peclet::core::amr::detail::GhostOverlayRef::th(), peclet::core::amr::ScalarTransport< Dim, Bits >::totalMass(), transferField(), transferGradients(), peclet::core::amr::BlockOctreeView< Dim, Bits >::upload(), uploadCfCompCsr(), uploadCfCsr(), uploadGhostOverlay(), peclet::core::amr::MomentumMG< Bits >::vcycle(), peclet::core::amr::VelocityMG< Bits >::vcycle(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::vcycle(), peclet::core::amr::Multigrid< Dim, Bits >::vcycle(), peclet::core::amr::AmrMultigrid< Dim, Bits >::vcycle(), peclet::core::amr::DistributedMultigrid< Dim, Bits >::vcycle(), peclet::core::amr::GradedDistributedMultigrid< Dim, Bits >::vcycle(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::vcycle(), peclet::core::amr::AmrFlow< Bits >::velocities(), peclet::core::amr::AmrFlow< Bits >::velocity(), peclet::core::amr::oracle::AmrFlow< Bits >::velocity(), peclet::core::amr::detail::vtkCorners< 2 >(), peclet::core::amr::detail::vtkCorners< 3 >(), peclet::core::amr::detail::GhostOverlayRef::w_bc(), peclet::core::amr::detail::GhostOverlayRef::w_n1(), peclet::core::amr::detail::GhostOverlayRef::w_n2(), peclet::core::amr::detail::GhostOverlayRef::wm_n1(), peclet::core::amr::detail::GhostOverlayRef::wm_n2(), peclet::core::amr::FvFaceEmit< Dim, Bits >::wrap(), peclet::core::amr::LeafHalo< Dim, Bits >::wrap(), writeVtu(), writeVtu(), peclet::core::amr::DistributedFlowMultigrid< Dim, Bits >::x(), peclet::core::amr::DistributedMultigridView< Dim, Bits >::x(), peclet::core::amr::MomentumMG< Bits >::x(), peclet::core::amr::Multigrid< Dim, Bits >::x(), peclet::core::amr::VelocityMG< Bits >::x(), zeroMasked(), peclet::core::amr::AmrFlow< Bits >::zeroSolid(), and zpby().

◆ transferField()

template<int Dim, unsigned Bits>
std::vector< double > peclet::core::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 93 of file adapt.hpp.

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

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

◆ flagByIndicator()

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

Definition at line 204 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::core::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 231 of file adapt.hpp.

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

Referenced by adapt().

◆ adapt()

template<int Dim, unsigned Bits>
AdaptResult< Dim, Bits > peclet::core::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 259 of file adapt.hpp.

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

◆ hoFaceValue()

MORTON_HD double peclet::core::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.

Definition at line 25 of file advect_recon.hpp.

References transferFieldGradients().

Referenced by advectExplicit(), and deferredSou().

◆ assembleFv()

◆ amrLocate()

template<class M >
MORTON_HD Index peclet::core::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 52 of file block_octree.hpp.

References transferFieldGradients().

◆ buildCfLapDelta()

template<unsigned Bits, class RowFn , class FluidFn >
CfCsr peclet::core::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 217 of file cf_scheme.hpp.

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

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

◆ buildCfDivDelta()

template<unsigned Bits, class RowFn , class FluidFn >
CfCompCsr peclet::core::amr::buildCfDivDelta ( const AmrPoisson< 3, Bits > &  ap,
const BlockOctree< 3, Bits > &  t,
RowFn &&  rowOk,
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 253 of file cf_scheme.hpp.

References peclet::core::amr::detail::CompEnt::cell, peclet::core::amr::AmrPoisson< Dim, Bits >::cellVolume(), peclet::core::amr::AmrPoisson< Dim, Bits >::cellWidth(), peclet::core::amr::detail::cfAppendStencil(), peclet::core::amr::detail::CompEnt::comp, peclet::core::amr::detail::compactCsr(), peclet::core::amr::AmrPoisson< Dim, Bits >::forEachFaceFull(), standard, and transferFieldGradients().

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

◆ buildCfGradDelta()

template<unsigned Bits, class RowFn , class FluidFn >
std::array< CfCsr, 3 > peclet::core::amr::buildCfGradDelta ( const AmrPoisson< 3, Bits > &  ap,
const BlockOctree< 3, Bits > &  t,
RowFn &&  rowOk,
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 309 of file cf_scheme.hpp.

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

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

◆ buildCfUfDelta()

◆ cfApplyHost()

void peclet::core::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 451 of file cf_scheme.hpp.

References transferFieldGradients().

Referenced by peclet::core::amr::oracle::AmrFlow< Bits >::buildFaceField(), and peclet::core::amr::oracle::AmrFlow< Bits >::step().

◆ cfApplyCompHost()

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

out(i) += Σ coef·u[comp](slot) (the divergence overlay).

Definition at line 463 of file cf_scheme.hpp.

References transferFieldGradients().

Referenced by peclet::core::amr::oracle::AmrFlow< Bits >::buildFaceField(), and peclet::core::amr::oracle::AmrFlow< Bits >::project().

◆ uploadCfCsr()

◆ uploadCfCompCsr()

◆ cfApply()

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

◆ cfApplyComp()

void peclet::core::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::core::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::core::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::core::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 38 of file distributed_adapt.hpp.

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

Referenced by distributedAdapt().

◆ transferGradients()

template<int Dim, unsigned Bits>
std::vector< std::array< double, Dim > > peclet::core::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 74 of file distributed_adapt.hpp.

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

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

◆ distributedAdapt()

template<int Dim, unsigned Bits>
std::vector< double > peclet::core::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 165 of file distributed_adapt.hpp.

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

◆ removeMeanFvDist()

void peclet::core::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 59 of file distributed_flow_mg.hpp.

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

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

◆ faceCsrApplyRow()

template<class Op , class U >
MORTON_HD double peclet::core::amr::faceCsrApplyRow ( const Op op,
Index  i,
const U u 
)
inline

(A u)_i — one assembled-operator row.

Definition at line 62 of file face_csr.hpp.

References transferFieldGradients().

Referenced by applyMom(), peclet::core::amr::AmrCutCell< Bits >::applyOp(), peclet::core::amr::AmrCutCell< Bits >::residual(), and residualMom().

◆ faceCsrOffDiag()

template<class Op , class U >
MORTON_HD void peclet::core::amr::faceCsrOffDiag ( const Op op,
Index  i,
const U u,
double off,
double d 
)
inline

Off-diagonal sum and the (advection-inclusive) diagonal for the point smoothers: out off = Σ coef·u[nbr] (+ advection inflow), d = diag (+ advection outflow).

The point update of A u = b is then u_i ← (1−ω)u_i + ω·(b_i − off)/d.

Definition at line 78 of file face_csr.hpp.

References transferFieldGradients().

Referenced by peclet::core::amr::AmrCutCell< Bits >::gaussSeidel(), jacobiMom(), and multicolorGSMom().

◆ faceCsrPointUpdate()

MORTON_HD double peclet::core::amr::faceCsrPointUpdate ( double  b_i,
double  off,
double  d,
double  uOld,
double  omega 
)
inline

The damped point update used by both Jacobi and (multicolour) Gauss–Seidel: returns the new u_i given the right-hand side b_i, the off-diagonal sum off, the diagonal d, the old value uOld, and the relaxation omega.

A zero diagonal (an inactive/identity row) leaves u_i fixed.

Definition at line 93 of file face_csr.hpp.

References transferFieldGradients().

Referenced by peclet::core::amr::AmrCutCell< Bits >::gaussSeidel(), and multicolorGSMom().

◆ fvApplyRow()

template<class Op , class U >
MORTON_HD double peclet::core::amr::fvApplyRow ( const Op op,
Index  i,
const U u 
)
inline

(H u)_i = c0·u_i + cD·( invVol_i·( Σ w·(u_nbr − u_i) − bcDiag_i·u_i ) ).

Definition at line 120 of file face_csr.hpp.

References transferFieldGradients().

Referenced by applyFv(), peclet::core::amr::AmrPoisson< Dim, Bits >::applyFvShared(), and residualFv().

◆ fvPointSolve()

template<class Op , class U >
MORTON_HD double peclet::core::amr::fvPointSolve ( const Op op,
Index  i,
const U u,
double  rhs_i,
double  uOld 
)
inline

The point solve of H u = rhs for one row (raw value, before damping), matching the host point solve and device jacobiFv: the pure-L path (c0=0,cD=1) keeps the exact original expression.

Definition at line 131 of file face_csr.hpp.

References transferFieldGradients().

Referenced by jacobiFv().

◆ assembleFaceGeom()

◆ amrEnvFlag()

bool peclet::core::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 59 of file flow.hpp.

References transferFieldGradients().

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

◆ buildFaceGeom()

◆ divergence()

void peclet::core::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 124 of file flow.hpp.

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

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

◆ buildFaceField()

void peclet::core::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 157 of file flow.hpp.

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

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

◆ divFaceNorm()

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

◆ grad3()

void peclet::core::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 204 of file flow.hpp.

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

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

◆ applyGhostGrad()

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

◆ momRhs()

void peclet::core::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 288 of file flow.hpp.

References transferFieldGradients().

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

◆ buildFou()

void peclet::core::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 305 of file flow.hpp.

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

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

◆ deferredSou()

void peclet::core::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 
)
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 355 of file flow.hpp.

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

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

◆ advectExplicit()

void peclet::core::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 
)
inline

◆ correct()

void peclet::core::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 441 of file flow.hpp.

References transferFieldGradients().

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

◆ presUpdate()

void peclet::core::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 450 of file flow.hpp.

References transferFieldGradients().

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

◆ laplacian()

template<int Dim, unsigned Bits>
void peclet::core::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 28 of file fv_op.hpp.

References transferFieldGradients().

◆ jacobiSweep()

template<int Dim, unsigned Bits>
void peclet::core::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 47 of file fv_op.hpp.

References transferFieldGradients().

◆ fvView()

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

◆ applyFv()

void peclet::core::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 114 of file fv_op.hpp.

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

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

◆ residualFv()

◆ jacobiFv()

void peclet::core::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 135 of file fv_op.hpp.

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

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

◆ removeMeanFv()

void peclet::core::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 151 of file fv_op.hpp.

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

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

◆ quadDelta()

void peclet::core::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 191 of file fv_op.hpp.

References transferFieldGradients().

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

◆ buildGhostOverlay()

template<unsigned Bits>
GhostOverlay peclet::core::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 110 of file ghost_projection.hpp.

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

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

◆ makeBinaryOpenFn()

template<class SdfFn >
auto peclet::core::amr::makeBinaryOpenFn ( SdfFn  sdfFn,
double  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).

Definition at line 205 of file ghost_projection.hpp.

References transferFieldGradients().

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

◆ findPocketCells()

template<unsigned Bits>
std::vector< char > peclet::core::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 226 of file ghost_projection.hpp.

References transferFieldGradients().

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

◆ ghostApplyDeltaHost()

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

◆ ghostDivergDeltaHost()

◆ uploadGhostOverlay()

◆ ghostApplyDelta()

◆ ghostDivergDelta()

◆ makeBinaryOpenFnMixed()

template<unsigned Bits, class SdfFn >
auto peclet::core::amr::makeBinaryOpenFnMixed ( const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
SdfFn  sdfFn,
double  h0,
Vec< 3 >  origin 
)
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).

Definition at line 120 of file ghost_projection_sampled.hpp.

References transferFieldGradients().

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

◆ buildGhostOverlaySampled()

template<unsigned Bits, class SdfFn >
GhostOverlaySampled peclet::core::amr::buildGhostOverlaySampled ( const BlockOctree< 3, Bits > &  t,
const AmrPoisson< 3, Bits > &  pres,
SdfFn &&  sdf,
int  matrixOrder,
int  rhsOrder,
Vec< 3 >  origin = Vec<3>{} 
)
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).

Definition at line 150 of file ghost_projection_sampled.hpp.

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

◆ gpsSample()

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

◆ ghostApplyDeltaSampledHost()

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

◆ ghostDivergDeltaSampledHost()

◆ gpsDirGrad()

double peclet::core::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 512 of file ghost_projection_sampled.hpp.

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

◆ lohnerIndicator()

template<int Dim, unsigned Bits>
std::vector< double > peclet::core::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 40 of file indicators.hpp.

References transferFieldGradients().

Referenced by adapt().

◆ secondDiffIndicator()

template<int Dim, unsigned Bits>
std::vector< double > peclet::core::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 70 of file indicators.hpp.

References transferFieldGradients().

◆ momView()

FaceCsrOpT< View< const double >, View< const Index > > peclet::core::amr::momView ( const MomentumOp op)
inline

View the assembled momentum operator through the shared, backend-agnostic FaceCsrOpT, so the device kernels and the host serial solver (cut_cell.hpp) run the same row arithmetic (face_csr.hpp) and cannot drift.

Non-const Views convert to their const accessor form implicitly; the advection arrays are empty (and untouched) when hasAdv is false.

Definition at line 61 of file momentum.hpp.

References peclet::core::amr::MomentumOp::advCoef, peclet::core::amr::MomentumOp::advDiag, peclet::core::amr::MomentumOp::advNbr, peclet::core::amr::MomentumOp::advStart, peclet::core::amr::MomentumOp::diag, peclet::core::amr::MomentumOp::faceCoef, peclet::core::amr::MomentumOp::faceNbr, peclet::core::amr::MomentumOp::faceStart, peclet::core::amr::MomentumOp::hasAdv, peclet::core::amr::FaceCsrOpT< D, I >::n, peclet::core::amr::MomentumOp::n, and transferFieldGradients().

Referenced by applyMom(), jacobiMom(), multicolorGSMom(), and residualMom().

◆ applyMom()

void peclet::core::amr::applyMom ( const MomentumOp op,
View< const double u,
View< double Au 
)
inline

Au = A u (cut-cell operator + optional implicit-FOU advection).

Definition at line 77 of file momentum.hpp.

References faceCsrApplyRow(), momView(), peclet::core::amr::MomentumOp::n, and transferFieldGradients().

Referenced by peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab().

◆ residualMom()

◆ jacobiMom()

void peclet::core::amr::jacobiMom ( const MomentumOp op,
View< double u,
View< const double b,
View< double tmp,
double  omega 
)
inline

One weighted-Jacobi sweep of A u = b (in place).

tmp is scratch (size n). Pass 1 reads only the previous iterate, pass 2 updates ⇒ order-independent / deterministic.

Definition at line 94 of file momentum.hpp.

References faceCsrOffDiag(), momView(), peclet::core::amr::MomentumOp::n, and transferFieldGradients().

Referenced by peclet::core::amr::MomentumSolver< Bits >::solveJacobi().

◆ dotPlain()

double peclet::core::amr::dotPlain ( View< const double a,
View< const double b,
Index  n 
)
inline

◆ bicgPUpdate()

void peclet::core::amr::bicgPUpdate ( View< double p,
View< const double r,
View< const double v,
double  beta,
double  omega,
Index  n 
)
inline

BiCGStab direction update: p = r + β(p − ω v).

(Free function — an extended host device lambda may not live in a private/protected member function.)

Definition at line 118 of file momentum.hpp.

References transferFieldGradients().

Referenced by peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab(), and peclet::core::amr::AmrFlow< Bits >::solveGhostBiCGStab().

◆ greedyColoring()

Coloring peclet::core::amr::greedyColoring ( const std::vector< Index > &  start,
const std::vector< Index > &  nbr,
Index  n 
)
inline

Greedy colouring of the face CSR (start/nbr, host): each cell gets the smallest colour not used by any face neighbour, so cells of one colour share no edge (race-free parallel GS sweep).

Deterministic from the natural cell order.

The adjacency is symmetrised first (undirected: i conflicts with j if i∈nbr(j) OR j∈nbr(i)). The assembled cut-cell operator's CSR can be structurally asymmetric — the ξ-polynomial Dirichlet overlay adds extrapolation entries a cut cell references but its target doesn't reference back — and colouring only the outgoing edges would then leave two mutually-adjacent cells the same colour, a data race that makes the GS sweep a non-deterministic (inconsistent) operator and silently breaks the BiCGStab it preconditions (false convergence to NaN at scale). Symmetrising is the correctness guard; it costs one O(nnz) host pass at build/adapt time.

Definition at line 155 of file momentum.hpp.

References peclet::core::amr::Coloring::hStart, peclet::core::amr::Coloring::idx, peclet::core::amr::Coloring::nColors, peclet::core::toDevice(), and transferFieldGradients().

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

◆ multicolorGSMom()

void peclet::core::amr::multicolorGSMom ( const MomentumOp op,
View< double u,
View< const double b,
const Coloring col,
double  omega 
)
inline

One symmetric multicolour Gauss–Seidel sweep of A u = b in place (momentum operator: diag + face CSR + optional implicit-FOU advection): a forward pass over colours 0…C-1 followed by a reverse pass C-1…0.

Each colour is a parallel_for over its cells doing the GS point update reading the current (already-updated) neighbours; cells of one colour share no edge ⇒ race-free.

The forward+reverse pairing makes the smoother symmetric, which matters when the MG V-cycle is used as a preconditioner for BiCGStab (the momentum path): a forward-only GS V-cycle is a non-symmetric, non-normal operator that breaks BiCGStab's bi-orthogonal recurrence on the larger non-symmetric 64³ system (false convergence to NaN), whereas the symmetric (SGS) V-cycle keeps it robust — the textbook remedy, and the behaviour flow gets from its RB-GS / MG-as-solver path.

Definition at line 225 of file momentum.hpp.

References faceCsrOffDiag(), faceCsrPointUpdate(), peclet::core::amr::Coloring::hStart, peclet::core::amr::Coloring::idx, momView(), peclet::core::amr::Coloring::nColors, and transferFieldGradients().

◆ rebuildCutStencil()

template<unsigned Bits>
void peclet::core::amr::rebuildCutStencil ( Index  n,
double  beta,
double  AC0,
const View< double > &  sdfC,
const View< Index > &  nbr6,
const View< char > &  fluid,
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 127 of file momentum_assembly.hpp.

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

◆ assembleMomentum()

template<unsigned Bits>
MomentumOp peclet::core::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 169 of file momentum_assembly.hpp.

References buildFaceCsr(), peclet::core::amr::MomentumOp::diag, peclet::core::amr::MomentumOp::faceCoef, peclet::core::amr::MomentumOp::faceNbr, peclet::core::amr::MomentumOp::faceStart, peclet::core::amr::FvFaceEmit< Dim, Bits >::fineExt, peclet::core::amr::MomFaceEmit< Bits >::geom, peclet::core::amr::FvFaceEmit< Dim, Bits >::h0, peclet::core::amr::MomentumOp::hasAdv, peclet::core::amr::FvFaceEmit< Dim, Bits >::hasOpen, peclet::core::amr::MomentumOp::n, peclet::core::amr::BlockOctreeView< Dim, Bits >::numLeaves(), peclet::core::amr::FvFaceEmit< Dim, Bits >::ov, peclet::core::amr::FvFaceEmit< Dim, Bits >::periodic, peclet::core::toDevice(), and transferFieldGradients().

◆ restrictField()

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

◆ restrictKappa()

void peclet::core::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 63 of file multigrid.hpp.

References transferFieldGradients().

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

◆ prolongAdd()

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

◆ prolongAddMasked()

void peclet::core::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 93 of file multigrid.hpp.

References transferFieldGradients().

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

◆ zeroMasked()

void peclet::core::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 108 of file multigrid.hpp.

References transferFieldGradients().

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

◆ dotVol()

double peclet::core::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 44 of file pcg.hpp.

References transferFieldGradients().

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

◆ buildFluidMask()

void peclet::core::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 58 of file pcg.hpp.

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

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

◆ maskSolid()

void peclet::core::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 72 of file pcg.hpp.

References transferFieldGradients().

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

◆ removeMeanVolReduced()

void peclet::core::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 81 of file pcg.hpp.

References transferFieldGradients().

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

◆ removeMeanVol()

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

Definition at line 101 of file pcg.hpp.

References removeMeanVolReduced(), and transferFieldGradients().

◆ axpy()

◆ zpby()

void peclet::core::amr::zpby ( View< double p,
View< const double z,
double  b,
Index  n 
)
inline

p = z + b·p (CG direction update)

Definition at line 112 of file pcg.hpp.

References transferFieldGradients().

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

◆ negate()

void peclet::core::amr::negate ( View< double x,
Index  n 
)
inline

y = −x (negate in place)

Definition at line 118 of file pcg.hpp.

References transferFieldGradients().

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

◆ refineToSdf()

template<int Dim, unsigned Bits, class SdfFn >
Index peclet::core::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 35 of file refine.hpp.

References transferFieldGradients().

◆ writeVtu() [1/2]

template<int Dim, unsigned Bits>
void peclet::core::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 49 of file vtu_io.hpp.

References transferFieldGradients().

Referenced by writeVtu().

◆ writeVtu() [2/2]

template<int Dim, unsigned Bits>
void peclet::core::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 115 of file vtu_io.hpp.

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