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
flow.hpp File Reference
#include <array>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>
#include "peclet/amr/adapt.hpp"
#include "peclet/amr/advect_recon.hpp"
#include "peclet/amr/block_octree.hpp"
#include "peclet/amr/cf_scheme.hpp"
#include "peclet/amr/common.hpp"
#include "peclet/amr/cut_cell.hpp"
#include "peclet/amr/distributed_adapt.hpp"
#include "peclet/amr/distributed_flow_mg.hpp"
#include "peclet/amr/distributed_octree.hpp"
#include "peclet/amr/face_geom.hpp"
#include "peclet/amr/facegeom_assembly.hpp"
#include "peclet/amr/ghost_projection.hpp"
#include "peclet/amr/ghost_projection_sampled.hpp"
#include "peclet/amr/leaf_halo.hpp"
#include "peclet/amr/momentum.hpp"
#include "peclet/amr/momentum_assembly.hpp"
#include "peclet/amr/multigrid.hpp"
#include "peclet/amr/pcg.hpp"
#include "peclet/amr/poisson.hpp"
#include "peclet/amr/seam_recon.hpp"
#include "peclet/amr/velocity_mg.hpp"
#include "peclet/core/common/host_parallel.hpp"
#include "peclet/core/common/types.hpp"
#include "peclet/core/common/view.hpp"

Go to the source code of this file.

Classes

struct  peclet::amr::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...
 
class  peclet::amr::AmrFlow< Bits >
 
struct  peclet::amr::AmrFlow< Bits >::FaceTopologyHost
 The face CSR topology faceField() is indexed by, copied to host: start the per-cell row offsets (size n+1), then per (sub)face the neighbour leaf, the face axis (0/1/2) and the direction (+1/-1, pointing from the owning cell to the neighbour). More...
 

Namespaces

namespace  peclet
 
namespace  peclet::amr
 

Functions

bool peclet::amr::amrEnvFlag (const char *name)
 Truthy environment flag (unset / "" / "0" ⇒ false).
 
template<int Dim, unsigned Bits, class FluidFn >
FaceGeom peclet::amr::buildFaceGeom (const AmrPoisson< Dim, Bits > &ap, FluidFn &&isFluid)
 Build FaceGeom from a built AmrPoisson (openness set) + a fluid predicate.
 
void peclet::amr::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 peclet::amr::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 peclet::amr::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 peclet::amr::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 peclet::amr::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 peclet::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)
 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 peclet::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)
 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).
 
template<class FldFn >
double peclet::amr::advectedFaceValue (const SeamView &sv, Index k, bool upIsI, double phiUpUp, double phiUp, double phiDown, double distK, int advScheme, const FldFn &fld)
 THE advected face value at one (sub)face slot — written once so deferredSou and advectExplicit cannot drift (docs/amr_cf_convective.md §5.3).
 
void peclet::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, bool seamOn)
 Deferred-correction advection term for component comp: defc = ρ·SOU − ρ·FOU (UNSCALED; the predictor RHS applies the cut-cell rscale once).
 
void peclet::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, bool seamOn)
 Fully-explicit high-order advection for component comp: defc = ρ·SOU (no implicit FOU; the setImplicitAdvection(false) fallback).
 
void peclet::amr::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 peclet::amr::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.