include/pops/numerics/time/amr/reflux/amr_flux_helpers.hpp Source FileΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
amr_flux_helpers.hpp
Go to the documentation of this file.
11#include <pops/numerics/time/integrators/implicit_stepper.hpp> // backward_euler_source (IMEX implicit step)
43// (Shu-Osher, 3 stages, order 3) with per-stage reflux (convex effective flux). The enum is passed
50// at ONE AMR level: R = -div(Fx,Fy) + S(U, aux), evaluated at ONE SAME state. It is the divergence of
70// at the state U). Fused "combine" of mf_advance_faces + mf_apply_source for the SSPRK3 stages (the
73inline void mf_eval_rhs(const Model& m, const MultiFab& U, const MultiFab& aux, const MultiFab& Fx,
109// source (pure scalar transport) this adds dt*0: bit-identical. DIFFUSION, in contrast, is carried
153// -> path (2a) bit-identical to the old call backward_euler_source(m, aux, U, dt). The AMR mono-block
154// (AmrCouplerMP::step) threads them from AmrSystem (wave 3 -> mono-block options wired). The partial
181inline void mf_average_down(const MultiFab& Uf, MultiFab& Uc, int CI0, int CI1, int CJ0, int CJ1) {
194inline void fill_cf_ghost_cell(Array4 f, const ConstArray4& co, const ConstArray4& cn, int i, int j,
200 // (pos_comp, resolved on the host by the caller via positivity_comp<Model>) to >= pos_floor. The
201 // refined-patch C/F interface is the highest-risk site: reconstruct_pp's order-1 fallback brings a
203 // source is a ghost; without this clamp the fallback target itself could be sub-floor (the coarse
205 // velocity m/rho only DROPS at quasi-vacuum (bounded, mirror of the single-block mean fallback).
206 // pos_floor <= 0 short-circuits (bit-identical). Ghost cells are never averaged-down nor summed in
207 // mass, so the clamp is conservation-safe (cf. ADC-259 design: average-down immunity + the reflux
Box2D: the integer index space of a 2D cell-centered Cartesian grid.
BoxArray: the set of boxes tiling a level (disjoint, covering).
const Box2D & grown_box() const
Grown box (valid + ng ghosts) = actual memory footprint.
Definition fab2d.hpp:76
ConstArray4 const_array() const
READ handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
Definition fab2d.hpp:96
Array4 array()
WRITE handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
Definition fab2d.hpp:91
Field distributed over a level: decomposition (BoxArray) + distribution (DistributionMapping) + ncomp...
Definition multifab.hpp:33
Fab2D & fab(int li)
Local fab at index li (0 <= li < local_size()), for writing.
Definition multifab.hpp:67
const Box2D & box(int li) const
VALID box of local fab li.
Definition multifab.hpp:71
int local_size() const
Number of fabs OWNED by this rank (bound on local indices).
Definition multifab.hpp:65
fill_boundary: INTRA-level halo exchange (fills ghosts from neighbors).
for_each_cell and reductions: the parallelism SEAM over the cells of a Box2D; sync_host / sync_device...
Implicit / IMEX block step as a named CONTRACT.
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
Definition amr_hierarchy.hpp:29
void mf_apply_source(const Model &m, MultiFab &U, const MultiFab &aux, Real dt)
Definition amr_flux_helpers.hpp:128
void for_each_cell(const Box2D &b, F f)
Applies f to EACH cell (i, j) of box b (bounds inclusive), via Kokkos::parallel_for (Serial / OpenMP ...
Definition for_each.hpp:138
POPS_HD Aux load_aux(const ConstArray4 &a, int i, int j)
load_aux<NComp>: reads NComp components of the auxiliary from an Array4 at (i,j).
Definition state_access.hpp:141
void backward_euler_source(const Model &model, const MultiFab &aux, MultiFab &U, Real dt, const NewtonOptions &opts, const ImplicitMask< Model::n_vars > &mask={}, NewtonReport *report=nullptr)
Definition implicit_stepper.hpp:486
void mf_fill_fine_ghosts_t(MultiFab &Uf, const MultiFab &Uc_old, const MultiFab &Uc_new, Real frac, Real pos_floor=Real(0), int pos_comp=0)
Definition amr_flux_helpers.hpp:215
void mf_average_down(const MultiFab &Uf, MultiFab &Uc, int CI0, int CI1, int CJ0, int CJ1)
Definition amr_flux_helpers.hpp:181
void fill_cf_ghost_cell(Array4 f, const ConstArray4 &co, const ConstArray4 &cn, int i, int j, int nc, Real frac, Real pos_floor=Real(0), int pos_comp=0)
Definition amr_flux_helpers.hpp:194
void device_fence()
Device barrier: waits for in-flight kernels to finish before a HOST access to unified memory.
Definition kokkos_env.hpp:43
void mf_apply_source_treatment(const Model &m, MultiFab &U, const MultiFab &aux, Real dt, bool imex, const NewtonOptions &nopts={})
Definition amr_flux_helpers.hpp:158
@ kSsprk3
@ kEuler
constexpr int kAmrRefRatio
The native AMR refinement ratio between two consecutive levels.
Definition refinement_ratio.hpp:30
void mf_advance_faces(MultiFab &U, const MultiFab &Fx, const MultiFab &Fy, Real dx, Real dy, Real dt)
Definition amr_flux_helpers.hpp:96
POPS_HD int coarsen_index(int a, int r)
Index of the coarse cell containing the fine cell a (FLOOR division by r, handles a < 0).
Definition refinement.hpp:34
void mf_eval_rhs(const Model &m, const MultiFab &U, const MultiFab &aux, const MultiFab &Fx, const MultiFab &Fy, Real dx, Real dy, MultiFab &R)
Definition amr_flux_helpers.hpp:73
AMR inter-level transfer operators (integer ratio r) + parallel_copy.
Single source of truth for the native AMR refinement ratio.
Cartesian spatial operator: assembles R(U, aux) = -div F + S over the cells of a level.
Device-clean NAMED functor: U <- U - dt div(Fx,Fy) on a valid cell.
Definition amr_flux_helpers.hpp:83
POPS_HD void operator()(int i, int j) const
Definition amr_flux_helpers.hpp:88
Device-clean NAMED functor (template Model, see AmrSspRhsKernel): U <- U + dt S(U,...
Definition amr_flux_helpers.hpp:115
POPS_HD void operator()(int i, int j) const
Definition amr_flux_helpers.hpp:120
Device-clean NAMED functor: 2x2 average fine -> coarse on a coarse cell.
Definition amr_flux_helpers.hpp:169
POPS_HD void operator()(int I, int J) const
Definition amr_flux_helpers.hpp:173
Definition amr_flux_helpers.hpp:56
POPS_HD void operator()(int i, int j) const
Definition amr_flux_helpers.hpp:61
WRITE POD handle (raw pointer + strides) over a Fab2D buffer, indexed by (i, j, c) IN GLOBAL INDICES ...
Definition fab2d.hpp:29
bool contains(int i, int j) const
true if cell (i, j) is inside the box (lo/hi bounds inclusive).
Definition box2d.hpp:61
READ-only handle (const counterpart of Array4): same layout and same contract (POD device-copyable,...
Definition fab2d.hpp:44
Options of the local Newton of the implicit source (backward-Euler).
Definition implicit_stepper.hpp:114
Generated by