|
core
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
|
#include <multigrid.hpp>
Public Types | |
| using | Octree = BlockOctree< Dim, Bits > |
| using | M = typename Octree::M |
| using | Code = typename Octree::Code |
| using | Poisson = AmrPoisson< Dim, Bits > |
Public Member Functions | |
| void | build (const Octree &finest, double h0) |
| Build + upload the hierarchy from a finest octree (uniform coarsening), openness- free. | |
| template<class OpenFn > | |
| void | build (const Octree &finest, double h0, OpenFn &&openFn, bool periodic=true, bool immersedWall=false) |
Build with cut-cell openness openFn(faceCentreWorld, axis) → [0,1], coarsened to every level by area-averaging (AmrMultigrid::setOpenness — the same coarsenOpenAvg the host uses): each level's face weight is α·A/d with α the coarsened aperture, so the coarse operators stay consistent cut-cell operators. | |
| void | setKappaRestrict (bool on) |
| Opt-in: use κ-weighted (fluid-fraction) restriction instead of the default plain volume-average. | |
| void | setRemoveMean (bool on) |
| Opt-in (default off): project the correction to mean-zero over fluid cells at every V-cycle level — the singular (periodic pure-Neumann) nullspace removal, mirroring flow CutcellMG::vcycle. | |
| void | setHelmholtz (double c0, double cD) |
| Turn every level's operator into the Helmholtz form H = c0·I + cD·L (default c0=0, cD=1 ⇒ the pure Laplacian L). | |
| std::size_t | numLevels () const |
| Index | numLeaves (std::size_t L=0) const |
| Code | octreeCode (std::size_t L, Index i) const |
| View< double > | x (std::size_t L=0) |
| View< double > | b (std::size_t L=0) |
| const FvOp & | op (std::size_t L=0) const |
| View< Index > | quadStart () const |
| View< Index > | quadSlot () const |
| View< double > | quadCoef () const |
| void | vcycle (int pre=2, int post=2, int bottom=40, double omega=0.8, std::size_t L=0) |
One V-cycle on level L (default finest) of the standard (consistent conservative) operator, correction scheme. | |
| double | solveQuad (int outer=20, int cyclesPerOuter=1, int pre=2, int post=2, int bottom=40, double omega=0.8) |
Solve L_quad u = rhs (the 2nd-order graded operator) by deferred correction: each outer step solves L_std u = rhs − (L_quad−L_std)u with the quadratic correction lagged, via cyclesPerOuter standard V-cycles. | |
| void | reassembleOperators () |
| Re-assemble every level's operator ON THE DEVICE from the (host) hierarchy's current geometry — the dynamic-AMR rebuild hook (D5/D6). | |
Definition at line 117 of file multigrid.hpp.
| using peclet::core::amr::Multigrid< Dim, Bits >::Octree = BlockOctree<Dim, Bits> |
Definition at line 119 of file multigrid.hpp.
| using peclet::core::amr::Multigrid< Dim, Bits >::M = typename Octree::M |
Definition at line 120 of file multigrid.hpp.
| using peclet::core::amr::Multigrid< Dim, Bits >::Code = typename Octree::Code |
Definition at line 121 of file multigrid.hpp.
| using peclet::core::amr::Multigrid< Dim, Bits >::Poisson = AmrPoisson<Dim, Bits> |
Definition at line 122 of file multigrid.hpp.
Build + upload the hierarchy from a finest octree (uniform coarsening), openness- free.
h0 is the finest spacing (every level shares it; a coarse leaf's higher level encodes its width).
Definition at line 127 of file multigrid.hpp.
|
inline |
Build with cut-cell openness openFn(faceCentreWorld, axis) → [0,1], coarsened to every level by area-averaging (AmrMultigrid::setOpenness — the same coarsenOpenAvg the host uses): each level's face weight is α·A/d with α the coarsened aperture, so the coarse operators stay consistent cut-cell operators.
Definition at line 138 of file multigrid.hpp.
|
inline |
Opt-in: use κ-weighted (fluid-fraction) restriction instead of the default plain volume-average.
Experimental — validate with the comparison test before relying on it.
Definition at line 150 of file multigrid.hpp.
|
inline |
Opt-in (default off): project the correction to mean-zero over fluid cells at every V-cycle level — the singular (periodic pure-Neumann) nullspace removal, mirroring flow CutcellMG::vcycle.
Needed when the V-cycle is the MG-PCG preconditioner for a singular operator (otherwise the cycle drifts / amplifies a near-nullspace mode and the projection blows up under large transient divergence). The bit-exact-vs-host MG test keeps this OFF.
Definition at line 157 of file multigrid.hpp.
|
inline |
Turn every level's operator into the Helmholtz form H = c0·I + cD·L (default c0=0, cD=1 ⇒ the pure Laplacian L).
With c0=idiag, cD=−μ the hierarchy represents the momentum operator idiag·I − μ∇² and (being non-singular for c0≠0) is an effective V-cycle preconditioner for the momentum BiCGStab. The reaction c0 is held constant on every level (standard for a Helmholtz MG preconditioner); cD scales the coarsened L.
Definition at line 164 of file multigrid.hpp.
|
inline |
Definition at line 171 of file multigrid.hpp.
|
inline |
Definition at line 172 of file multigrid.hpp.
|
inline |
Definition at line 173 of file multigrid.hpp.
|
inline |
Definition at line 174 of file multigrid.hpp.
|
inline |
Definition at line 175 of file multigrid.hpp.
|
inline |
Definition at line 176 of file multigrid.hpp.
|
inline |
Definition at line 177 of file multigrid.hpp.
|
inline |
Definition at line 178 of file multigrid.hpp.
|
inline |
Definition at line 179 of file multigrid.hpp.
|
inline |
One V-cycle on level L (default finest) of the standard (consistent conservative) operator, correction scheme.
Definition at line 183 of file multigrid.hpp.
References peclet::core::amr::jacobiFv(), peclet::core::amr::prolongAdd(), peclet::core::amr::removeMeanFv(), peclet::core::amr::residualFv(), peclet::core::amr::restrictField(), peclet::core::amr::restrictKappa(), and peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
Referenced by peclet::core::amr::Multigrid< Dim, Bits >::solveQuad(), and peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
|
inline |
Solve L_quad u = rhs (the 2nd-order graded operator) by deferred correction: each outer step solves L_std u = rhs − (L_quad−L_std)u with the quadratic correction lagged, via cyclesPerOuter standard V-cycles.
The finest b holds rhs on entry and is restored on return. Returns the final L_quad residual L2 norm.
Definition at line 216 of file multigrid.hpp.
References peclet::core::amr::quadDelta(), peclet::core::amr::residualFv(), and peclet::core::amr::Multigrid< Dim, Bits >::vcycle().
|
inline |
Re-assemble every level's operator ON THE DEVICE from the (host) hierarchy's current geometry — the dynamic-AMR rebuild hook (D5/D6).
After a moving boundary re-samples each level's openness on the host AmrPoisson (hmg_), this rebuilds all per-level FvOps on device with no host CSR walk and no round-trip, preserving each level's Helmholtz c0/cD. Topology (c2p/child maps) is unchanged.
Definition at line 347 of file multigrid.hpp.