peclet-amr 0.2.0
Block-local-Morton AMR octree + collocated cut-cell Navier–Stokes solver (header-only C++20, Kokkos + MPI)
Loading...
Searching...
No Matches
ghost_projection_sampled.hpp File Reference
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>
#include "peclet/amr/block_octree.hpp"
#include "peclet/amr/cf_scheme.hpp"
#include "peclet/amr/common.hpp"
#include "peclet/amr/ghost_projection.hpp"
#include "peclet/amr/poisson.hpp"
#include "peclet/core/common/host_parallel.hpp"
#include "peclet/core/common/types.hpp"
#include "peclet/core/scheme/ghost_closure.hpp"

Go to the source code of this file.

Classes

struct  peclet::amr::GhostOverlaySampled
 Sampled overlay: the classic per-row fields (weights, states, rescale — base; base.nbr is UNUSED) plus one linear functional per chain slot (r*15 + a*5 + (q+2)) in CSR form. More...
 
struct  peclet::amr::GhostGradCsrHost
 Host CSR form of the SAMPLED directional gradient overlay (variable-length stencils — a seam row's cascade composes with its LS sample functionals, so the fixed 9-entry GhostGradOverlay cannot hold it). More...
 
struct  peclet::amr::GhostOverlaySampledDev
 Device mirror of GhostOverlaySampled (uploaded once per setSolid). More...
 
struct  peclet::amr::GhostGradCsrDev
 Device CSR gradient overlay (sampled mode) + upload + apply (the variable-length analog of GhostGradOverlay / applyGhostGrad; overwrites gx/gy/gz on the overlay cells). More...
 

Namespaces

namespace  peclet
 
namespace  peclet::amr
 
namespace  peclet::amr::detail
 

Functions

bool peclet::amr::detail::gpsSolveDense (int n, double *A, double *b)
 Gaussian elimination with partial pivoting (small dense normal equations).
 
template<unsigned Bits, class WrapFn , class EmitFn >
void peclet::amr::detail::forEachCoveringSlot (const AmrPoisson< 3, Bits > &pres, const long lo[3], const long hi[3], WrapFn &&wrapLocal, EmitFn &&emit, bool descendPending=false)
 DD1 (docs/amr_march_perf_and_distributed_plan.md) — the LS cloud's probe descent.
 
void peclet::amr::detail::gpsMonomials (const double d[3], int deg, double *m, int &nm)
 
template<unsigned Bits, class SdfFn >
auto peclet::amr::makeBinaryOpenFnMixed (const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, SdfFn sdfFn, const Vec< 3 > &h0, Vec< 3 > origin, std::array< long, 3 > frameShift={})
 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 peclet::amr::buildGhostOverlaySampled (const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, SdfFn &&sdf, int matrixOrder, int rhsOrder, Vec< 3 > origin=Vec< 3 >{}, const std::array< long, 3 > *globalFine=nullptr, std::array< long, 3 > frameShift={}, bool discovery=false, double rhoFactor=2.2, long maxSamples=0)
 Build the sampled overlay.
 
double peclet::amr::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 peclet::amr::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 peclet::amr::ghostDivergDeltaSampledHost (const GhostOverlaySampled &ov, const std::array< std::vector< double >, 3 > &u, std::vector< double > &d)
 Divergence overlay (sampled): the sampled analog of ghostDivergDeltaHost (u_bc = 0).
 
template<unsigned Bits, class Mom , class SdfFn >
CfCsr peclet::amr::buildMomSeamDelta (const GhostOverlaySampled &ov, const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, const Mom &mom, SdfFn &&sdf, Vec< 3 > origin, double idiag, double mu, long *nSkipped=nullptr, std::array< long, 3 > frameShift={})
 Momentum ξ-overlay seam correction (plan §6.2, rung 1): at overlay rows with a different-level ±1 neighbour, the raw AmrCutCell row is wrong twice over — it classifies and anchors the wall from the COVERING neighbour's center sample (position-inconsistent), and its ξ branch was built with the GLOBAL β = μ/h0² (dimensionally off by 4^ΔL at a coarser row).
 
double peclet::amr::gpsDirGrad (const GhostOverlaySampled &ov, Index r, const std::vector< double > &fld, int c, double invh)
 Directional ghost cell-gradient on a sampled row (the mixed-level gradOfDir): the same cascade — central where both axis virtual neighbours are fluid, 2nd-order one-sided toward the fluid else (2-point fallback), 0 sandwiched — on the row's sample functionals, so the gradient reads virtual uniform-position values across a seam instead of degrading.
 
template<unsigned Bits, class IsCutFn , class OkFn >
GhostGradCsrHost peclet::amr::buildSampledGradCsr (const GhostOverlaySampled &ov, const BlockOctree< 3, Bits > &t, const AmrPoisson< 3, Bits > &pres, IsCutFn &&isCut, OkFn &&classicOk)
 
GhostOverlaySampledDev peclet::amr::uploadGhostOverlaySampled (const GhostOverlaySampled &h)
 
void peclet::amr::ghostApplyDeltaSampled (const GhostOverlaySampledDev &ov, View< const double > x, View< double > y)
 Device matrix overlay (== ghostApplyDeltaSampledHost). Distinct rows per thread: no atomics.
 
void peclet::amr::ghostDivergDeltaSampled (const GhostOverlaySampledDev &ov, View< const double > u0, View< const double > u1, View< const double > u2, View< double > d)
 Device divergence overlay (== ghostDivergDeltaSampledHost).
 
GhostGradCsrDev peclet::amr::uploadGhostGradCsr (const GhostGradCsrHost &h)
 
void peclet::amr::applyGhostGradCsr (const GhostGradCsrDev &ov, View< const double > f, View< double > gx, View< double > gy, View< double > gz)