|
core
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
|
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 | 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 | 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 |
| 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 | 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... | |
Functions | |
| template<int Dim, unsigned Bits> | |
| std::vector< double > | transferField (const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF, const BlockOctree< Dim, Bits > &newT, bool linear=true) |
Conservative remap of a leaf field from oldT to newT (same domain). | |
| template<int Dim, unsigned Bits> | |
| std::vector< int > | flagByIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &ind, double refineThresh, double coarsenThresh, unsigned finestLevel=0) |
| template<int Dim, unsigned Bits> | |
| AdaptResult< Dim, Bits > | adaptField (const BlockOctree< Dim, Bits > &t, const std::vector< double > &f, const std::vector< int > &flags, bool linear=true) |
Apply adaptation flags (one level of refine/coarsen) to t carrying field f, then 2:1-balance and remap. | |
| template<int Dim, unsigned Bits> | |
| AdaptResult< Dim, Bits > | adapt (const BlockOctree< Dim, Bits > &t, const std::vector< double > &f, double refineThresh, double coarsenThresh, unsigned finestLevel=0, double eps=0.01, bool linear=true) |
| All-in-one solution-adaptive step: Löhner indicator → flags → adaptField. | |
| 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<class CountFn > | |
| View< Index > | scanOffsets (Index n, const CountFn &countFn, Index &nTotal) |
CSR row offsets (size n+1) from a per-cell count functor, via one exclusive prefix scan, with the total written to nTotal. | |
| template<class Emit > | |
| Csr | buildFaceCsr (Index n, const Emit &emit) |
Build a face-CSR on device from a per-cell emit functor. | |
| template<int Dim, unsigned Bits> | |
| std::vector< double > | lohnerIndicatorDistributed (const DistributedOctree< Dim, Bits > &d, const std::vector< double > &u, double eps=0.01) |
| Löhner indicator per local leaf, using the owner-based face-neighbour halo so cross-block neighbours contribute exactly as in a whole-domain solve. | |
| template<int Dim, unsigned Bits> | |
| std::vector< double > | distributedAdapt (DistributedOctree< Dim, Bits > &d, const std::vector< double > &f, double refineThresh, double coarsenThresh, unsigned finestLevel=0, double eps=0.01, bool linear=true) |
| One distributed solution-adaptive step. | |
| 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. | |
| 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 | 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<int Dim, unsigned Bits> | |
| std::vector< double > | lohnerIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &u, double eps=0.01) |
Löhner normalized second-difference indicator E_i ∈ [0,1], per leaf, for scalar u (indexed by leaf slot). | |
| template<int Dim, unsigned Bits> | |
| std::vector< double > | secondDiffIndicator (const BlockOctree< Dim, Bits > &t, const std::vector< double > &u) |
| Raw second-derivative magnitude indicator, per leaf: the L2 norm over axes of the undivided second difference |u₊ − 2u_i + u₋| (so ∝ |∂²u|·h²). | |
| 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 | removeMeanVol (View< double > u, View< const double > invVol, View< const double > mask, Index n) |
| 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 | 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>. | |
| 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 |
||
| ) |
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.
Definition at line 50 of file adapt.hpp.
References peclet::core::amr::BlockOctree< Dim, Bits >::code(), peclet::core::amr::BlockOctree< Dim, Bits >::faceNeighbor(), peclet::core::amr::BlockOctree< Dim, Bits >::find(), peclet::core::amr::BlockOctree< Dim, Bits >::level(), peclet::core::amr::detail::minmod(), and peclet::core::amr::BlockOctree< Dim, Bits >::numLeaves().
Referenced by adaptField(), and distributedAdapt().
| 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 172 of file adapt.hpp.
References kCoarsen, kKeep, kRefine, peclet::core::amr::BlockOctree< Dim, Bits >::level(), peclet::core::amr::BlockOctree< Dim, Bits >::lmax(), and peclet::core::amr::BlockOctree< Dim, Bits >::numLeaves().
Referenced by adapt(), and distributedAdapt().
| 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 199 of file adapt.hpp.
References peclet::core::amr::BlockOctree< Dim, Bits >::coarsenIf(), peclet::core::amr::BlockOctree< Dim, Bits >::find(), kCoarsen, kRefine, and transferField().
Referenced by adapt().
| 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 227 of file adapt.hpp.
References adaptField(), flagByIndicator(), and lohnerIndicator().
|
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.
Referenced by advectExplicit(), and deferredSou().
| FvOp peclet::core::amr::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.
The openness array is staged to the device once (it is the only host input — the expensive face walk + weight build runs on device). Result equals the host AmrPoisson::assembleFv CSR bit-for-bit on OpenMP.
Definition at line 152 of file assembly.hpp.
References peclet::core::amr::FvFaceEmit< Dim, Bits >::alpha, peclet::core::amr::FvOp::bcDiag, buildFaceCsr(), peclet::core::amr::Csr::coef, peclet::core::amr::FvOp::faceNbr, peclet::core::amr::FvOp::faceStart, peclet::core::amr::FvOp::faceW, peclet::core::amr::AmrPoisson< Dim, Bits >::fineExt(), peclet::core::amr::FvFaceEmit< Dim, Bits >::fineExt, peclet::core::amr::FvFaceEmit< Dim, Bits >::h0, peclet::core::amr::AmrPoisson< Dim, Bits >::h0(), peclet::core::amr::FvFaceEmit< Dim, Bits >::hasOpen, peclet::core::amr::AmrPoisson< Dim, Bits >::hasOpenness(), peclet::core::amr::FvFaceEmit< Dim, Bits >::immersedWall, peclet::core::amr::AmrPoisson< Dim, Bits >::immersedWall(), peclet::core::amr::FvOp::invVol, peclet::core::amr::FvOp::n, peclet::core::amr::Csr::nbr, peclet::core::amr::BlockOctreeView< Dim, Bits >::numLeaves(), peclet::core::amr::AmrPoisson< Dim, Bits >::opennessRaw(), peclet::core::amr::FvFaceEmit< Dim, Bits >::ov, peclet::core::amr::FvFaceEmit< Dim, Bits >::periodic, peclet::core::amr::AmrPoisson< Dim, Bits >::periodic(), peclet::core::amr::Csr::start, and peclet::core::toDevice().
|
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.
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.
Referenced by assembleFaceGeom().
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.
Referenced by assembleFv(), and assembleMomentum().
| 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(), and peclet::core::amr::BlockOctree< Dim, Bits >::numLeaves().
Referenced by distributedAdapt().
| 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 68 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(), and transferField().
(A u)_i — one assembled-operator row.
Definition at line 62 of file face_csr.hpp.
Referenced by applyMom(), peclet::core::amr::AmrCutCell< Bits >::applyOp(), peclet::core::amr::AmrCutCell< Bits >::residual(), and residualMom().
|
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.
Referenced by peclet::core::amr::AmrCutCell< Bits >::gaussSeidel(), jacobiMom(), and multicolorGSMom().
|
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.
Referenced by peclet::core::amr::AmrCutCell< Bits >::gaussSeidel(), and multicolorGSMom().
(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.
Referenced by applyFv(), peclet::core::amr::AmrPoisson< Dim, Bits >::applyFvShared(), and residualFv().
|
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.
Referenced by jacobiFv().
| FaceGeom peclet::core::amr::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.
Equals host buildFaceGeom bit-for-bit on OpenMP.
Definition at line 109 of file facegeom_assembly.hpp.
References peclet::core::amr::FaceGeom::n, peclet::core::amr::FaceGeom::nbr, peclet::core::amr::BlockOctreeView< Dim, Bits >::numLeaves(), scanOffsets(), and peclet::core::toDevice().
| FaceGeom peclet::core::amr::buildFaceGeom | ( | const AmrPoisson< Dim, Bits > & | ap, |
| FluidFn && | isFluid | ||
| ) |
Build FaceGeom from a built AmrPoisson (openness set) + a fluid predicate.
Definition at line 51 of file flow.hpp.
References peclet::core::amr::FaceGeom::alpha, peclet::core::amr::FaceGeom::alphaArea, peclet::core::amr::FaceGeom::axis, peclet::core::amr::FaceGeom::dir, peclet::core::amr::FaceGeom::dist, 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, peclet::core::toDevice(), peclet::core::amr::FaceGeom::upupI, and peclet::core::amr::FaceGeom::upupJ.
|
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 106 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, and peclet::core::amr::FaceGeom::start.
Referenced by peclet::core::amr::AmrFlow< Bits >::divNormL2(), and peclet::core::amr::AmrFlow< Bits >::project().
|
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 139 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, and peclet::core::amr::FaceGeom::start.
Referenced by peclet::core::amr::AmrFlow< Bits >::project().
L2 norm of the divergence of the FACE field uf (the div-free flux diagnostic / host-parity check).
Definition at line 161 of file flow.hpp.
References peclet::core::amr::FaceGeom::alphaArea, peclet::core::amr::FaceGeom::dir, peclet::core::amr::FaceGeom::fluid, peclet::core::amr::FaceGeom::invVol, peclet::core::amr::FaceGeom::n, and peclet::core::amr::FaceGeom::start.
Referenced by peclet::core::amr::AmrFlow< Bits >::divNormFace().
|
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 186 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, and peclet::core::amr::FaceGeom::start.
Referenced by peclet::core::amr::AmrFlow< Bits >::project(), and peclet::core::amr::AmrFlow< Bits >::step().
|
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 233 of file flow.hpp.
Referenced by peclet::core::amr::AmrFlow< Bits >::step().
|
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 250 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, and peclet::core::amr::FaceGeom::start.
Referenced by peclet::core::amr::AmrFlow< Bits >::step().
|
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 300 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, peclet::core::amr::FaceGeom::upupI, and peclet::core::amr::FaceGeom::upupJ.
Referenced by peclet::core::amr::AmrFlow< Bits >::step().
|
inline |
Fully-explicit high-order advection for component comp: defc = ρ·SOU (no implicit FOU; the setImplicitAdvection(false) fallback).
Same SOU/TVD reconstruction as deferredSou.
Definition at line 344 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, peclet::core::amr::FaceGeom::upupI, and peclet::core::amr::FaceGeom::upupJ.
Referenced by peclet::core::amr::AmrFlow< Bits >::debugSou(), and peclet::core::amr::AmrFlow< Bits >::step().
|
inline |
u_c -= gradPhi_c on fluid cells (the projection velocity correction).
Definition at line 386 of file flow.hpp.
Referenced by peclet::core::amr::AmrFlow< Bits >::project().
|
inline |
Rotational incremental pressure update: p += (ρ/dt)φ − μ·div, on fluid cells.
Definition at line 395 of file flow.hpp.
Referenced by peclet::core::amr::AmrFlow< Bits >::project().
|
inline |
View the assembled FV operator through the shared backend-agnostic FvCsrOpT, so the device kernels and the host AmrPoisson run the same row arithmetic (face_csr.hpp).
Definition at line 99 of file fv_op.hpp.
References peclet::core::amr::FvOp::bcDiag, peclet::core::amr::FvOp::c0, peclet::core::amr::FvOp::cD, peclet::core::amr::FvOp::faceNbr, peclet::core::amr::FvOp::faceStart, peclet::core::amr::FvOp::faceW, peclet::core::amr::FvOp::invVol, and peclet::core::amr::FvOp::n.
Referenced by applyFv(), jacobiFv(), and residualFv().
|
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(), and peclet::core::amr::FvOp::n.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
|
inline |
res = rhs − H u.
Definition at line 121 of file fv_op.hpp.
References fvApplyRow(), fvView(), and peclet::core::amr::FvOp::n.
Referenced by peclet::core::amr::Multigrid< Dim, Bits >::solveQuad(), and peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
|
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(), and peclet::core::amr::FvOp::n.
Referenced by peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
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, and peclet::core::amr::FvOp::n.
Referenced by peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
|
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.
Referenced by peclet::core::amr::Multigrid< Dim, Bits >::solveQuad().
| 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.
Referenced by adapt().
| 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.
|
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, and peclet::core::amr::MomentumOp::n.
Referenced by applyMom(), jacobiMom(), multicolorGSMom(), and residualMom().
|
inline |
Au = A u (cut-cell operator + optional implicit-FOU advection).
Definition at line 77 of file momentum.hpp.
References faceCsrApplyRow(), momView(), and peclet::core::amr::MomentumOp::n.
Referenced by peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab().
|
inline |
res = b − A u.
Definition at line 84 of file momentum.hpp.
References faceCsrApplyRow(), momView(), and peclet::core::amr::MomentumOp::n.
Referenced by peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab(), peclet::core::amr::MomentumSolver< Bits >::solveDefectCorrection(), peclet::core::amr::MomentumSolver< Bits >::solveJacobi(), peclet::core::amr::MomentumMG< Bits >::vcycle(), and peclet::core::amr::VelocityMG< Bits >::vcycle().
|
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(), and peclet::core::amr::MomentumOp::n.
Referenced by peclet::core::amr::MomentumSolver< Bits >::solveJacobi().
|
inline |
Plain (unweighted) dot product.
Definition at line 109 of file momentum.hpp.
Referenced by peclet::core::amr::AmrFlow< Bits >::divNormL2(), peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab(), peclet::core::amr::MomentumSolver< Bits >::solveDefectCorrection(), and peclet::core::amr::MomentumSolver< Bits >::solveJacobi().
|
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.
Referenced by peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab().
|
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, and peclet::core::toDevice().
Referenced by peclet::core::amr::VelocityMG< Bits >::build().
|
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(), and peclet::core::amr::Coloring::nColors.
| 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().
| 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::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, and peclet::core::toDevice().
|
inline |
Restrict: coarse(p) = mean over p's children (CSR fixed order ⇒ deterministic).
Definition at line 45 of file multigrid.hpp.
Referenced by peclet::core::amr::MomentumMG< Bits >::vcycle(), peclet::core::amr::VelocityMG< Bits >::vcycle(), peclet::core::amr::Multigrid< Dim, Bits >::vcycle(), and peclet::core::amr::DistributedMultigridView< Dim, Bits >::vcycle().
|
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.
Referenced by peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
|
inline |
Prolong (piecewise-constant) + correct: fine(i) += coarse(c2p(i)).
Definition at line 81 of file multigrid.hpp.
Referenced by peclet::core::amr::MomentumMG< Bits >::vcycle(), peclet::core::amr::Multigrid< Dim, Bits >::vcycle(), and peclet::core::amr::DistributedMultigridView< Dim, Bits >::vcycle().
|
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.
Referenced by peclet::core::amr::VelocityMG< Bits >::vcycle().
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.
Referenced by peclet::core::amr::VelocityMG< Bits >::vcycle().
|
inline |
Volume-weighted dot <u,v>_D = Σ_i V_i u_i v_i, V_i = 1/invVol_i.
Definition at line 43 of file pcg.hpp.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
Build the fluid mask: mask(i)=1 where the operator diagonal Σ_f w_f (+ bcDiag) is non-trivial, 0 for a solid cell (every face closed by the cut-cell openness ⇒ Σ w_f = 0).
These solid cells carry their own (per connected solid region) constant null modes; left in the Krylov space CG amplifies them (the cut-cell-openness near-nullspace blow-up). We project them out — same role as flow's mg_mask_solid_k. Geometry-fixed, so it is rebuilt once per solve.
Definition at line 57 of file pcg.hpp.
References peclet::core::amr::FvOp::bcDiag, peclet::core::amr::FvOp::faceStart, and peclet::core::amr::FvOp::faceW.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
Zero the solid cells (project out the solid null modes).
Definition at line 71 of file pcg.hpp.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
|
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.
Definition at line 78 of file pcg.hpp.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
y += a·x
Definition at line 94 of file pcg.hpp.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve(), peclet::core::amr::MomentumSolver< Bits >::solveBiCGStab(), and peclet::core::amr::MomentumSolver< Bits >::solveDefectCorrection().
p = z + b·p (CG direction update)
Definition at line 99 of file pcg.hpp.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
y = −x (negate in place)
Definition at line 105 of file pcg.hpp.
Referenced by peclet::core::amr::PCG< Dim, Bits >::solve().
| 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.
| 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.
Referenced by writeVtu().
| 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 peclet::core::amr::LeafField< T >::values, and writeVtu().