31#ifndef PECLET_AMR_FLOW_ORACLE_HPP
32#define PECLET_AMR_FLOW_ORACLE_HPP
52#include "peclet/core/common/types.hpp"
59template <
unsigned Bits = 21u>
65 init(
t, detail::filledVec<3>(h0), origin);
111 ghostProjReq_ = on ? 1 : 0;
136 template <
class SdfFn>
138 mom_.init(*t_, h0_, origin_);
140 for (
int d = 0; d < 3; ++d)
141 betaA[d] = mu_ / (h0_[d] * h0_[d]);
143 pres_.
init(*t_, h0_);
145 presMG_.build(*t_, h0_);
149 ghostProj_ = (ghostProjReq_ != 0);
150 ghostSampled_ = ghostProj_ && (ghostSampledReq_ == 1);
151 if (ghostProj_ && !ghostSampled_) {
155 if (ghostProjReq_ == 1)
156 throw std::runtime_error(
157 "amr ghost projection: an overlay row's ±2 closure reach crosses a 2:1 level "
158 "boundary — widen the refineToSdf band margin");
161 "peclet::core AmrFlow(oracle): AUTO scheme fell back to the aperture projection "
162 "(the finest band is too thin for the ghost overlay).\n");
174 "[peclet.amr] mom seam delta: %ld raw-regular/virtually-ghost rows "
175 "skipped (rung-1 scope)\n",
189 presMG_.setOpenness(
binFn);
193 presMG_.setOpenness(
binFn);
198 maskC_.assign(
static_cast<std::size_t
>(t_->
numLeaves()), 0.0);
200 maskC_[
static_cast<std::size_t
>(
i)] =
201 (mom_.isFluid(
i) && !(!gpPocket_.empty() && gpPocket_[
static_cast<std::size_t
>(
i)]))
206 if (!
rows.coupled[
static_cast<std::size_t
>(
r)])
207 maskC_[
static_cast<std::size_t
>(
rows.cell[
static_cast<std::size_t
>(
r)])] = 0.0;
211 presMG_.setOpenness([&](
const Vec<3>&
fc,
int axis) {
return faceFrac(
sdfFn,
fc, axis); });
223 cfRegular_.assign(
static_cast<std::size_t
>(
nl), 0);
225 cfRegular_[
static_cast<std::size_t
>(
i)] = (mom_.isFluid(
i) && !mom_.isCut(
i)) ? 1 : 0;
229 throw std::logic_error(
"peclet::amr oracle: C/F regular flag queried outside [0, n)");
230 return cfRegular_[
static_cast<std::size_t
>(
s)] != 0;
247 for (
int c = 0;
c < 3; ++
c)
248 u_[
c].assign(
static_cast<std::size_t
>(n), 0.0);
249 phi_.assign(
static_cast<std::size_t
>(n), 0.0);
250 p_.assign(
static_cast<std::size_t
>(n), 0.0);
253 faceStart_.assign(
static_cast<std::size_t
>(n) + 1, 0);
257 faceStart_[
static_cast<std::size_t
>(
i) + 1] = faceStart_[
static_cast<std::size_t
>(
i)] +
cnt;
259 uf_.assign(
static_cast<std::size_t
>(faceStart_[
static_cast<std::size_t
>(n)]), 0.0);
260 faceFieldBuilt_ =
false;
263 const std::vector<double>&
velocity(
int c)
const {
return u_[
c]; }
272 adaptOldT_ = std::make_unique<Octree>(*t_);
276 template <
class SdfFn>
279 throw std::runtime_error(
"oracle::AmrFlow::finishAdapt called without beginAdapt");
280 std::array<std::vector<double>, 3>
nu;
281 for (
int c = 0;
c < 3; ++
c)
282 nu[
static_cast<std::size_t
>(
c)] =
283 transferField(*adaptOldT_, adaptU_[
static_cast<std::size_t
>(
c)], *t_,
true);
284 std::vector<double>
np =
transferField(*adaptOldT_, adaptP_, *t_,
true);
287 const bool fl = mom_.isFluid(
i);
288 for (
int c = 0;
c < 3; ++
c)
289 u_[
static_cast<std::size_t
>(
c)][
static_cast<std::size_t
>(
i)] =
290 fl ?
nu[
static_cast<std::size_t
>(
c)][
static_cast<std::size_t
>(
i)] : 0.0;
291 p_[
static_cast<std::size_t
>(
i)] =
fl ?
np[
static_cast<std::size_t
>(
i)] : 0.0;
304 std::array<std::vector<double>, 3>
adv;
307 mom_.buildAdvectionFou(u_, rho_, uf_, faceStart_,
309 for (
int c = 0;
c < 3; ++
c) {
310 adv[
c].assign(
static_cast<std::size_t
>(n), 0.0);
312 if (mom_.isFluid(
i)) {
313 double term = rho_ * advectHO(
c,
i);
315 term -= mom_.fouApply(
i, u_[
c]);
316 adv[
c][
static_cast<std::size_t
>(
i)] =
term;
322 for (
int c = 0;
c < 3; ++
c) {
325 std::vector<double>
cfm;
327 cfm.assign(
static_cast<std::size_t
>(n), 0.0);
332 if (ghostSampled_ && !gpsMomDelta_.
start.empty()) {
334 cfm.assign(
static_cast<std::size_t
>(n), 0.0);
337 std::vector<double>
src(
static_cast<std::size_t
>(n), 0.0);
339 if (mom_.isFluid(
i)) {
341 double s = (rho_ / dt_) * u_[
c][
static_cast<std::size_t
>(
i)] + f_[
c] - gradP(p_,
i,
c);
343 s -=
adv[
c][
static_cast<std::size_t
>(
i)];
345 s +=
cfm[
static_cast<std::size_t
>(
i)];
346 src[
static_cast<std::size_t
>(
i)] =
s;
348 std::vector<double> b = mom_.makeRhs(
src, 0.0);
358 std::vector<double>
div(
static_cast<std::size_t
>(n), 0.0);
371 std::fill(phi_.begin(), phi_.end(), 0.0);
383 presMG_.vcycle(0, phi_,
div);
389 for (
int c = 0;
c < 3; ++
c)
392 u_[
c][
static_cast<std::size_t
>(
i)] -= gradP(phi_,
i,
c);
399 p_[
static_cast<std::size_t
>(
i)] += (rho_ / dt_) * phi_[
static_cast<std::size_t
>(
i)] -
400 mu_ *
div[
static_cast<std::size_t
>(
i)];
409 double ui = vel[axis][
static_cast<std::size_t
>(
i)];
410 double uj = vel[axis][
static_cast<std::size_t
>(
j)];
411 d += alpha *
area * dir * 0.5 * (
ui +
uj);
416 double divNormL2(
const std::array<std::vector<double>, 3>& vel)
const {
420 if (mom_.isFluid(
i)) {
433 if (mom_.isFluid(
i) && !mom_.isCut(
i)) {
452 Index s = faceStart_[
static_cast<std::size_t
>(
i)];
453 if (!mom_.isFluid(
i) || mom_.isCut(
i)) {
459 d += alpha *
area * dir * uf_[
static_cast<std::size_t
>(
s++)];
464 return std::sqrt(
tot);
478 std::vector<double>
dcell(
static_cast<std::size_t
>(n), 0.0);
480 const std::size_t
nSlots =
484 double err = 0.0, ref = 0.0;
487 Index s = faceStart_[
static_cast<std::size_t
>(
i)];
489 if (
static_cast<std::size_t
>(
s) <
nSlots)
490 d += alpha *
area * dir *
duf[
static_cast<std::size_t
>(
s)];
494 const double r = d -
dcell[
static_cast<std::size_t
>(
i)];
496 ref +=
dcell[
static_cast<std::size_t
>(
i)] *
dcell[
static_cast<std::size_t
>(
i)];
498 return {std::sqrt(
err), std::sqrt(ref)};
512 Index s = faceStart_[
static_cast<std::size_t
>(
i)];
515 0.5 * (u_[axis][
static_cast<std::size_t
>(
i)] + u_[axis][
static_cast<std::size_t
>(
j)]);
519 ? (phi_[
static_cast<std::size_t
>(
j)] - phi_[
static_cast<std::size_t
>(
i)]) / dist
520 : (phi_[
static_cast<std::size_t
>(
i)] - phi_[
static_cast<std::size_t
>(
j)]) / dist;
521 uf_[
static_cast<std::size_t
>(
s++)] =
uface -
gphi;
532 faceFieldBuilt_ =
true;
542 if (!mom_.isFluid(
i))
544 Index s = faceStart_[
static_cast<std::size_t
>(
i)];
547 d += alpha *
area * dir * uf_[
static_cast<std::size_t
>(
s++)];
552 return std::sqrt(
tot);
557 const std::vector<double>&
faceField()
const {
return uf_; }
558 const std::vector<Index>&
faceStart()
const {
return faceStart_; }
562 static double koren(
double up_m1,
double up,
double down,
double vel) {
564 double r = (std::fabs(
den) < 1
e-10) ? 0.0 :
num /
den;
565 double psi = std::fmax(0.0, std::fmin(2.0 *
r, std::fmin((1.0 + 2.0 *
r) / 3.0, 2.0)));
568 static double tvd(
double LL,
double L,
double R,
double RR,
double vel) {
569 return (vel > 0.0) ? koren(
LL,
L,
R, vel) : koren(
RR,
R,
L, vel);
572 double hoFace(
double upup,
double up,
double down)
const {
583 double advectHO(
int comp,
Index i)
const {
585 Index s = faceFieldBuilt_ ? faceStart_[
static_cast<std::size_t
>(
i)] : 0;
592 const double uface = faceFieldBuilt_ ? uf_[
static_cast<std::size_t
>(
s)]
596 if (!mom_.isFluid(
j))
602 double phiUp = u_[comp][
static_cast<std::size_t
>(
up)];
604 (
upup >= 0 && mom_.isFluid(
upup)) ? u_[comp][
static_cast<std::size_t
>(
upup)] :
phiUp;
614 void gpProject(std::vector<double>&
v)
const {
616 double su = 0.0,
sv = 0.0;
618 const std::size_t
s =
static_cast<std::size_t
>(
i);
620 if (maskC_[
s] > 0.0) {
626 const double m = (
sv > 0.0) ?
su /
sv : 0.0;
628 v[
static_cast<std::size_t
>(
i)] -= maskC_[
static_cast<std::size_t
>(
i)] * m;
636 void solveGhostBiCGStab(std::vector<double>& x,
const std::vector<double>& b,
int maxIters,
637 double tol = 1
e-10) {
639 const std::size_t
ns =
static_cast<std::size_t
>(n);
640 auto applyA = [&](
const std::vector<double>&
v, std::vector<double>&
y) {
648 auto prec = [&](
const std::vector<double>&
r, std::vector<double>&
z) {
649 std::fill(
z.begin(),
z.end(), 0.0);
650 presMG_.vcycle(0,
z,
r);
651 presMG_.vcycle(0,
z,
r);
654 auto dot = [&](
const std::vector<double>&
a,
const std::vector<double>&
c) {
656 for (std::size_t
i = 0;
i <
ns; ++
i)
662 for (std::size_t
i = 0;
i <
ns; ++
i)
666 const double res0 = std::sqrt(dot(
r,
r));
676 for (std::size_t
i = 0;
i <
ns; ++
i)
684 for (std::size_t
i = 0;
i <
ns; ++
i)
685 s[
i] =
r[
i] - alpha *
v[
i];
686 double snorm = std::sqrt(dot(
s,
s));
688 for (std::size_t
i = 0;
i <
ns; ++
i)
694 const double tt = dot(
t,
t);
696 for (std::size_t
i = 0;
i <
ns; ++
i) {
700 const double rnorm = std::sqrt(dot(
r,
r));
720 double gradP(
const std::vector<double>&
fld,
Index i,
int c)
const {
721 if (ghostGrad_ && mom_.isCut(
i)) {
726 const Index r = gpOvS_.
rowOf[
static_cast<std::size_t
>(
i)];
730 return gradOfDir(
fld,
i,
c);
732 double g = gradOf(
fld,
i,
c);
734 if (cfScheme_ !=
CfScheme::standard && !cfGrad_[
static_cast<std::size_t
>(
c)].start.empty()) {
735 const CfCsr&
cs = cfGrad_[
static_cast<std::size_t
>(
c)];
736 for (
Index k =
cs.start[
static_cast<std::size_t
>(
i)];
737 k <
cs.start[
static_cast<std::size_t
>(
i) + 1]; ++k)
738 g +=
cs.coef[
static_cast<std::size_t
>(k)] *
739 fld[
static_cast<std::size_t
>(
cs.slot[
static_cast<std::size_t
>(k)])];
750 double gradOfDir(
const std::vector<double>&
fld,
Index i,
int c)
const {
752 auto F = [&](
Index j) {
return fld[
static_cast<std::size_t
>(
j)]; };
755 return j >= 0 && mom_.isFluid(
j) && t_->
level(
j) == t_->
level(
i) &&
756 !(!gpPocket_.empty() && gpPocket_[
static_cast<std::size_t
>(
j)]);
762 return (
F(
jp) -
F(
jm)) / (2.0 *
h);
781 double gradOf(
const std::vector<double>&
fld,
Index i,
int c)
const {
782 const double pi =
fld[
static_cast<std::size_t
>(
i)];
783 double gp = 0,
gm = 0;
788 if (axis !=
c || alpha <= 1
e-12)
790 double g = (dir > 0) ? (
fld[
static_cast<std::size_t
>(
j)] -
pi) / dist
811 static double triFrac(
double a,
double b,
double c) {
812 const bool pa =
a >= 0.0,
pb = b >= 0.0,
pc =
c >= 0.0;
813 const int np = (
pa ? 1 : 0) + (
pb ? 1 : 0) + (
pc ? 1 : 0);
833 const double den = (x -
y) * (x -
z);
834 return den > 1
e-300 ? (x * x) /
den : 1.0;
849 const double den = (x -
y) * (x -
z);
850 return 1.0 - (
den > 1
e-300 ? (x * x) /
den : 1.0);
852 template <
class SdfFn>
854 if (apertureOrder_ >= 2) {
857 const int t1 = (axis + 1) % 3,
t2 = (axis + 2) % 3;
858 const double e1 = 0.5 * h0_[
t1],
e2 = 0.5 * h0_[
t2];
859 auto at = [&](
double d1,
double d2) {
875 for (
int d = 0; d < 3; ++d) {
881 double gmag = std::sqrt(g[0] * g[0] + g[1] * g[1] + g[2] * g[2]);
884 int t1 = (axis + 1) % 3,
t2 = (axis + 2) % 3;
892 const Octree* t_ =
nullptr;
893 Vec<3> h0_ = detail::filledVec<3>(1.0);
895 double rho_ = 1.0, mu_ = 1.0, dt_ = 1
e6;
896 bool advect_ =
false;
897 bool ghostGrad_ =
true;
898 bool ghostProj_ =
false;
899 int8_t ghostProjReq_ = -1;
901 int apertureOrder_ = 2;
902 int gpMatrixOrder_ = 2, gpRhsOrder_ = 2;
905 bool ghostSampled_ =
false;
906 int8_t ghostSampledReq_ = 0;
907 GhostOverlaySampled gpOvS_;
909 std::vector<double> maskC_;
910 std::vector<char> gpPocket_;
926 std::vector<char> cfRegular_;
927 Index cfCutFaces_ = 0;
929 std::array<CfCsr, 3> cfGrad_;
931 bool implicitFou_ =
true;
935 AmrPoisson<3, Bits> pres_;
937 std::array<std::vector<double>, 3> u_;
938 std::vector<double> phi_;
939 std::vector<double> p_;
946 std::vector<Index> faceStart_;
947 std::vector<double> uf_;
948 std::unique_ptr<Octree> adaptOldT_;
949 std::array<std::vector<double>, 3> adaptU_;
950 std::vector<double> adaptP_;
951 bool faceFieldBuilt_ =
void buildOpenness(OpenFn &&openFn)
Build face openness from a geometry callable openFn(faceCentreWorld, axis) -> [0,1] (1 = fully fluid,...
Real cellWidth(Index i, int axis) const
Cell width along axis (Phase 3: per axis).
void forEachFaceFull(Index i, Fn &&fn) const
Like forEachFaceNeighbor but exposes geometry for a consistent FV divergence/gradient: fn(neighbour,...
Index periodicNeighbor(Index i, int axis, int dir) const
Periodic face neighbour leaf (covering the cell just across the face).
void setOrigin(const Vec< Dim > &o)
void init(const Octree &t, Real h0)
Cubic-cell overload — the pre-Phase-3 spelling, and exactly the per-axis one with all three spacings ...
void applyLaplacian(const std::vector< double > &u, std::vector< double > &out) const
out = L u (periodic FV Laplacian).
Real cellVolume(Index i) const
Per-block adaptive octree over block-local Morton codes.
unsigned level(Index i) const
void project(int presIters=60, int presSweeps=4)
Pressure projection of the current velocity in place: solve ∇²φ = ∇·u and correct u -= ∇φ.
std::array< std::vector< double >, 3 > & velocityRef()
void setCfScheme(int scheme)
Coarse/fine (2:1) interface scheme (cf_scheme.hpp): 0 = standard two-point flux (default,...
void setAdvection(bool on)
const std::vector< Index > & faceStart() const
void setBodyForce(double fx, double fy, double fz)
double advectTerm(int comp, Index i) const
Conservative Koren-TVD advection term ∇·(u u_comp) at leaf i (physical units; the explicit momentum a...
double divNormFace() const
L2 norm of the divergence of the FACE field uf_ (the div-free flux).
void setGhostProjection(bool on, int matrixOrder=2, int rhsOrder=2)
bool isCut(Index i) const
BlockOctree< 3, Bits > Octree
void setGhostGradient(bool on)
Directional ghost cell-gradient for the −∇pⁿ predictor and the projection's cell correction (the AMR ...
bool isFluid(Index i) const
void setImplicitAdvection(bool on)
Implicit-FOU deferred-correction advection (default ON): the first-order-upwind part is solved implic...
void init(const Octree &t, Real h0, Vec< 3 > origin=Vec< 3 >{})
void setDensity(double rho)
void setGhostSampled(bool on)
SAMPLED ghost projection: the mixed-level cut-band prototype (the D1 machinery of docs/amr_mixed_leve...
void setViscosity(double mu)
double divNormFaceRegular() const
‖D_std(uf)‖₂ over REGULAR fluid rows only.
void setAdvectionScheme(int s)
High-order advection scheme: 0 = second-order upwind (SOU, default), 1 = Koren TVD.
void init(const Octree &t, const Vec< 3 > &h0, Vec< 3 > origin=Vec< 3 >{})
std::pair< double, double > cfFluxIdentity() const
Rule (I) of docs/amr_cf_flux_gate.md §4, measured (§6.6): the advecting face field's C/F delta and th...
void step(int momSweeps=200, int presIters=60, int presSweeps=4)
One Stokes projection step.
const std::vector< double > & velocity(int c) const
void setApertureOrder(int order)
FULL directional ghost-cell projection (the AMR port of flow's collocated set_ghost_projection): the ...
double divNormL2Regular(const std::array< std::vector< double >, 3 > &vel) const
divNormL2 restricted to REGULAR fluid rows (fluid and not cut) — the companion of divNormFaceRegular ...
void finishAdapt(SdfFn &&sdfFn)
void buildFaceField()
Build the ABC/Basilisk divergence-free FACE field from the current cell velocity u* and the projectio...
void setSolid(SdfFn &&sdfFn)
Build the cut-cell operators from an SDF callable sdfFn(worldPoint) (>0 fluid).
double divergence(const std::array< std::vector< double >, 3 > &vel, Index i) const
Openness-weighted FV divergence at leaf i, C/F-consistent: sum over (sub)faces of α·area·(outward fac...
Index numCfCutFaces() const
The C/F census — see AmrFlow::numCfCutFaces (docs/amr_cf_flux_gate.md §6.5).
const std::vector< double > & faceField() const
The divergence-free face field (read-only): uf[faceStart()[i]+s] for cell i's s-th forEachFaceFull fa...
double divNormL2(const std::array< std::vector< double >, 3 > &vel) const
Index countCfCutFaces(const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &®ularOk, FluidFn &&fluidOk)
The C/F CENSUS (docs/amr_cf_flux_gate.md §6.5): how many OWNED forEachFaceFull slots (i,...
auto makeBinaryOpenFnMixed(const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, SdfFn sdfFn, const Vec< 3 > &h0, Vec< 3 > origin, std::array< long, 3 > frameShift={})
The canonical (sub)face openness for mixed-level cut bands: open iff both adjacent ACTUAL leaf center...
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 + i...
GhostOverlaySampled buildGhostOverlaySampled(const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, SdfFn &&sdf, int matrixOrder, int rhsOrder, Vec< 3 > origin=Vec< 3 >{}, const std::array< long, 3 > *globalFine=nullptr, std::array< long, 3 > frameShift={}, bool discovery=false, double rhoFactor=2.2, long maxSamples=0)
Build the sampled overlay.
CfCompCsr buildCfDivDelta(const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &®ularOk, FluidFn &&fluidOk, CfScheme scheme)
(D_scheme − D_std) for the face-average divergence div_i = invV·Σ α·A·dir·(face value).
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).
CfUfDelta buildCfUfDelta(const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &®ularOk, FluidFn &&fluidOk, CfScheme scheme)
std::vector< char > findPocketCells(const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, const std::vector< double > &sdfC)
Fragmentation guard (the AMR port of flow's host-BFS pocket guard): the BINARY coupled-face graph (a ...
std::vector< double > transferField(const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF, const BlockOctree< Dim, Bits > &newT, bool linear=true, const std::type_identity_t< std::vector< std::array< double, Dim > > > *gradIn=nullptr)
Conservative remap of a leaf field from oldT to newT (same domain).
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).
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).
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...
auto makeBinaryOpenFn(SdfFn sdfFn, const Vec< 3 > &h0)
Binary openness callable factory for the MG surrogate: a face is open iff both adjacent centers (prob...
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,...
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).
std::array< CfCsr, 3 > buildCfGradDelta(const AmrPoisson< 3, Bits > &ap, const BlockOctree< 3, Bits > &t, RegularFn &®ularOk, FluidFn &&fluidOk, CfScheme scheme)
(G_scheme − G_std) for the ABC cell gradient gradOf/grad3.
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 — cent...
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,...
CfCsr buildMomSeamDelta(const GhostOverlaySampled &ov, const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, const Mom &mom, SdfFn &&sdf, Vec< 3 > origin, double idiag, double mu, long *nSkipped=nullptr, std::array< long, 3 > frameShift={})
Momentum ξ-overlay seam correction (plan §6.2, rung 1): at overlay rows with a different-level ±1 nei...
CfScheme
Coarse/fine interface scheme for the collocated flow operators.
@ standard
raw coarse value (two-point flux; 1st-order at 2:1 faces)
@ quadratic
Martin–Cartwright tangential quadratic (2nd-order at 2:1 faces)
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 ove...
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·...
Component-tagged CSR overlay (the divergence delta): out(i) += Σ_k coef·u[comp](slot).
std::vector< Index > start
Scalar-input CSR overlay: out(i) += Σ_k coef·f(slot) over rows with C/F faces.
std::vector< Index > start
size n+1
(uf_scheme − uf_std) for the div-free FACE field uf_k = ½(u_i+u_j) − (φ₊−φ₋)/d, one delta row per for...
CfCompCsr vel
reads the velocity components, rows = face slots
std::vector< Index > rowOf
[numLeaves] row index of a leaf, -1 if none
Host ghost-projection overlay: one row per non-clean fluid leaf (== cut cell: some ±1 center sample s...