include/pops/runtime/system/system_block_store.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
|
system_block_store.hpp
Go to the documentation of this file.
3#include <pops/core/state/state.hpp> // kAuxBaseComps (default aux channel of the Schur stage: B_z)
7#include <pops/mesh/execution/for_each.hpp> // device_fence (marshaling synchronizes the device before reading the host)
92 // Schur-CONDENSED SOURCE STAGE (OPT-IN, pops.Split(source=CondensedSchur), cf. set_source_stage).
94 // (bit-identical). Non null = after the hyperbolic transport, the step runs the standalone source stage
96 // keeps BlockState MOVABLE (the stepper carries a GeometricMG, neither copyable nor trivially movable).
98 // POLAR counterpart of the condensed source stage (ring (r, theta), Voie A step 2c). Exclusive with
100 // -> schur_polar, Cartesian -> schur). run_source_stage dispatches on whichever is non null. The
108 // GENERIC SOURCE STAGE (optional): a callable (U, dt) that advances IN PLACE the source stage of the
109 // block. nullptr (default) = no generic source stage (BIT-IDENTICAL path). run_source_stage runs it
111 // NOTHING in the production Schur path. Used for generic splitting (pops.Strang on an arbitrary
116 // the stepper advances via `advance` (full Cartesian path, BIT-IDENTICAL). Non empty, they MIMIC
121 // (stable address): the order add_block / set_disc_domain is irrelevant. Trailing + empty default:
126 // dt_hotspot DIAGNOSTIC (ADC-182): (U, w, i, j) -> GLOBAL cell dominating the transport CFL bound
134 // Trailing + empty default: the positional aggregate init of the other members stays unchanged.
140 // appliquee par le stepper a la FIN de chaque macro-pas ENTIER (apres transport + etage source +
144 // FLUX-ONLY residual R <- -div F(U) (NO default/composite source), Poisson frozen (ADC-425). The
145 // SAME transport assembly as rhs_into evaluated on SourceFreeModel<Model> (zero source), so the
151 // Lie/Strang split assembles "flux but no source" (spec criterion 17). EMPTY (default) for paths
152 // that do not build it (the host .so prototype loader); block_neg_div_flux_into fails loud then.
153 // Trailing + empty default: the positional aggregate init of the other members stays unchanged.
155 // NAMED elliptic-field RHS closures (ADC-428): field name -> (+= elliptic_field_rhs(U)). A model
157 // (distinct from add_poisson_rhs, the default Poisson coupling), assembled the same way (host loop,
158 // += per cell). EMPTY (default) -> no named elliptic field: bit-identical to the historical block.
159 // The SystemFieldSolver gathers these per field (sum over blocks) into a SEPARATE elliptic solve
163 // SOURCE-ONLY residual R <- S(U, aux) (the default/composite source, NO flux divergence), Poisson
164 // frozen (ADC-430). The exact MIRROR of rhs_flux_only: together they split rhs_into (-div F + S).
167 // System::block_source_into, which a compiled time Program's source stage calls so a Lie/Strang
168 // split assembles "the default source but no flux" (spec: rhs flux=False is source-only). EMPTY
169 // (default) for paths that do not build it (the host .so prototype loader); block_source_into fails
179 // --- access by NAME (0-based indexing, insertion order) ------------------------------------------
215 // --- state marshaling (host <-> MultiFab copy; device_fence included) ---------------------------
220 // MPI single-box: the box lives on the owner rank (rank 0). A rank without a box (local_size()==0)
Box2D: the integer index space of a 2D cell-centered Cartesian grid.
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
ORDERED registry of the System blocks + state marshaling helpers.
Definition system_block_store.hpp:58
void write_state(MultiFab &mf, int ncomp, const std::vector< double > &in)
Writes the ncomp components into fab(0) from a component-major buffer (same layout as copy_state).
Definition system_block_store.hpp:254
const BlockState & find(const std::string &name) const
Reference to block name (for reading).
Definition system_block_store.hpp:188
std::vector< double > copy_comp0(const MultiFab &mf) const
Copies component 0 of fab(0) (density) in row-major (j slow, i fast).
Definition system_block_store.hpp:218
BlockState & find(const std::string &name)
Reference to block name (for writing).
Definition system_block_store.hpp:181
int index(const std::string &name) const
0-based index of block name (insertion order).
Definition system_block_store.hpp:195
std::vector< BlockState > blocks
ORDERED registry of the blocks (UNIQUE source of truth).
Definition system_block_store.hpp:177
std::vector< double > copy_state(const MultiFab &mf, int ncomp) const
Copies the ncomp components of fab(0) in component-major layout (c slow, then j, then i).
Definition system_block_store.hpp:235
std::vector< std::string > names() const
Block names, in insertion order (UNIQUE source: all add paths appear here).
Definition system_block_store.hpp:205
std::function< void(const double *in, double *out)> CellConvert
Type-erase of the POINTWISE (one cell) cons <-> prim conversion of a block: in/out are arrays of ncom...
Definition system_block_store.hpp:63
int size() const
Number of registered blocks.
Definition system_block_store.hpp:203
for_each_cell and reductions: the parallelism SEAM over the cells of a Box2D; sync_host / sync_device...
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
Definition amr_hierarchy.hpp:29
void device_fence()
Device barrier: waits for in-flight kernels to finish before a HOST access to unified memory.
Definition kokkos_env.hpp:43
Pointwise types of the physics layer: StateVec<N> (conserved state) and Aux (auxiliary fields from th...
WRITE POD handle (raw pointer + strides) over a Fab2D buffer, indexed by (i, j, c) IN GLOBAL INDICES ...
Definition fab2d.hpp:29
POPS_HD int nx() const
Width (direction 0). POPS_HD (called from Geometry::dx() in a device kernel).
Definition box2d.hpp:50
POPS_HD int ny() const
Height (direction 1). POPS_HD (called from Geometry::dy() in a device kernel).
Definition box2d.hpp:52
READ-only handle (const counterpart of Array4): same layout and same contract (POD device-copyable,...
Definition fab2d.hpp:44
Compiled closures frozen at block add time (composite model + spatial scheme + time).
Definition system_block_store.hpp:71
std::function< void(MultiFab &)> project
Definition system_block_store.hpp:143
std::function< Real(const MultiFab &)> source_frequency
Definition system_block_store.hpp:136
CellConvert prim_to_cons
Definition system_block_store.hpp:91
VariableSet cons_vars
Definition system_block_store.hpp:86
std::function< void(MultiFab &, Real)> source_step
Definition system_block_store.hpp:114
double schur_theta
Definition system_block_store.hpp:103
std::function< void(MultiFab &, Real, int)> advance_eb
Definition system_block_store.hpp:125
std::function< Real(const MultiFab &)> stability_dt
Definition system_block_store.hpp:138
std::map< std::string, std::function< void(const MultiFab &, MultiFab &)> > named_poisson_rhs
Definition system_block_store.hpp:162
std::shared_ptr< PolarCondensedSchurSourceStepper > schur_polar
Definition system_block_store.hpp:102
std::function< void(MultiFab &, MultiFab &)> rhs_flux_only
Definition system_block_store.hpp:154
std::function< void(MultiFab &, MultiFab &)> source_only
Definition system_block_store.hpp:172
std::function< void(MultiFab &, Real, int)> advance
Definition system_block_store.hpp:79
VariableSet prim_vars
Definition system_block_store.hpp:86
int schur_bz_comp
Definition system_block_store.hpp:107
std::function< void(MultiFab &, MultiFab &)> rhs_into
Definition system_block_store.hpp:80
std::function< void(MultiFab &, Real, int)> advance_masked
Definition system_block_store.hpp:124
CellConvert cons_to_prim
Definition system_block_store.hpp:91
std::function< void(const MultiFab &, MultiFab &)> add_poisson_rhs
Definition system_block_store.hpp:82
std::shared_ptr< CondensedSchurSourceStepper > schur
Definition system_block_store.hpp:97
std::function< void(const MultiFab &, Real &, int &, int &)> hotspot
Definition system_block_store.hpp:129
std::function< Real(const MultiFab &)> max_speed
Definition system_block_store.hpp:81
A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; ...
Definition variables.hpp:58
Base scalar types and the POPS_HD macro (host+device portability).
Descriptor of a model's variables (Vars).
Generated by