include/pops/coupling/system/system_coupler.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_coupler.hpp
Go to the documentation of this file.
79 // ignores the component. Without an extra-field block the width stays 3 -> allocation and numerics
308 } else if constexpr (treatment == TimeTreatment::Implicit || treatment == TimeTreatment::IMEX) {
367// (`SystemCoupler sim(...)`) is accepted by GCC but REJECTED by clang -- alias-template argument
368// deduction (P1814) is not implemented the same way, so `SystemCoupler sim(...)` fails to compile
369// under clang ("alias template requires template arguments"). This factory deduces the parameters
370// through the underlying class template (CTAD on SystemDriver, which every compiler supports) and
371// forwards to its constructor. Use `auto sim = make_system_coupler(system, geom, ba, bc, rhs);`.
Helpers shared by the three couplers (single-block Coupler, SystemAssembler, AmrSystemCoupler) for th...
BoxArray: the set of boxes tiling a level (disjoint, covering).
Owning MPI rank of each box, indexed by GLOBAL box index (parallel to a BoxArray).
Definition distribution_mapping.hpp:19
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
ASSEMBLES the fields (system Poisson + shared aux) and a block residual evaluator.
Definition system_coupler.hpp:72
void block_residual(Block &block, MultiFab &state, MultiFab &R, bool recompute_aux)
Residual R = -div F + S of a block at a stage (with field re-solve if recompute_aux).
Definition system_coupler.hpp:119
void solve_fields()
Solves the system RHS (Sum_s q_s n_s), the Poisson, then derives aux = (phi, grad phi).
Definition system_coupler.hpp:109
SystemAssembler(System system, const Geometry &geom, const BoxArray &ba, const BCRec &bcPhi, RhsAssembler rhs_assembler, std::function< bool(Real, Real)> active={}, std::function< Real(Real, Real)> bz={})
Definition system_coupler.hpp:81
ADVANCES the system: carries the schedule (per-species subcycling, adaptive multirate,...
Definition system_coupler.hpp:182
Real step_adaptive(Real cfl, ImplicitAdvance &&implicit_advance)
FULLY ADAPTIVE multirate: macro-step fixed by the fastest species (CFL cfl), stride of each species d...
Definition system_coupler.hpp:217
SystemDriver(System system, const Geometry &geom, const BoxArray &ba, const BCRec &bcPhi, RhsAssembler rhs_assembler, std::function< bool(Real, Real)> active={}, std::function< Real(Real, Real)> bz={})
Builds the driver (which builds the underlying assembler).
Definition system_coupler.hpp:186
SystemAssembler< System, RhsAssembler, Elliptic > & assembler()
Definition system_coupler.hpp:198
void coupled_source_step(CoupledSource &&src, Real dt)
Applies an inter-species COUPLING source (forward-Euler splitting): refreshes phi (aux) then calls sr...
Definition system_coupler.hpp:280
void step(Real dt, ImplicitAdvance &&implicit_advance)
Advances the blocks by a macro-step dt per their TimePolicy: explicit ones via TimeStepper,...
Definition system_coupler.hpp:203
Real step_cfl(Real cfl, ImplicitAdvance &&implicit_advance)
Definition system_coupler.hpp:266
Real cfl_dt(Real cfl)
Macro-step chosen by multi-species CFL: dt = cfl * min(dx, dy) / w_max (w_max = largest wave speed ov...
Definition system_coupler.hpp:260
Coupled multi-species system, composed at runtime from generic bricks.
Definition system.hpp:89
Parallel seam: minimal MPI abstraction (rank/size + collectives) with serial fallback.
Concept: C is a valid coupling source for System if System is a CoupledSystem and if C exposes apply(...
Definition coupled_source.hpp:24
Definition elliptic_solver.hpp:30
CoupledSourceFor / NoCoupledSource: contract of an inter-species COUPLING source.
CoupledSystem: heterogeneous collection of equation blocks (multi-species, multi-scheme).
DistributionMapping: maps each box (by global index) to its owning MPI rank.
DESCRIPTIVE types of the elliptic stage: EllipticProblem (problem definition) and FieldPostProcess (f...
Elliptic (Poisson) RIGHT-HAND-SIDE assemblers: single-model and N-species.
EllipticSolver concept: common contract for elliptic solvers at the MultiFab level (solve D phi = f),...
GeometricMG: in-house geometric multigrid (V-cycle) for the elliptic operator, Gauss-Seidel smoother ...
Geometry: index-space (Box2D) <-> Cartesian physical-space mapping; PolarGeometry: SIBLING for a glob...
Implicit / IMEX block step as a named CONTRACT.
MultiFab arithmetic (saxpy, lincomb, norm_inf, dot) over VALID cells.
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
void fill_bz_box(Fab2D &f, const Box2D &box, const Geometry &g, const Bz &bz)
Writes B_z(x, y) at component kAuxBaseComps on box box of fab f, sampling bz at the cell centers of g...
Definition aux_fill.hpp:42
Definition amr_hierarchy.hpp:29
void advance_subcycled(System &system, Real dt, int macro_step, AdvanceBlock &&advance_block)
Definition scheduler.hpp:45
@ Implicit
@ Prescribed
@ Explicit
void saxpy(MultiFab &y, Real a, const MultiFab &x)
y <- y + a x over ALL components of the valid cells. Identical layouts required.
Definition mf_arith.hpp:102
void field_postprocess(const MultiFab &phi, MultiFab &out, Real cx, Real cy, FieldPostProcess spec)
Definition elliptic_problem.hpp:104
void fill_ghosts(MultiFab &mf, const Box2D &domain, const BCRec &bc)
COMPLETE ghost filling: fill_boundary (interior + periodic, periodicity deduced from bc) THEN fill_ph...
Definition physical_bc.hpp:227
Real max_wave_speed_mf(const Model &model, const MultiFab &U, const MultiFab &aux)
max_wave_speed_mf: global max of the wave speed over the whole MultiFab (CFL).
Definition wave_speed.hpp:66
PHYSICAL boundary conditions at the domain edge (BCType, BCRec, fill_physical_bc, fill_ghosts).
Minimal scheduler for coupled systems: advance_subcycled reads each block's time policy (traits block...
Cartesian spatial operator: assembles R(U, aux) = -div F + S over the cells of a level.
Boundary conditions for the FOUR faces of the domain (type + associated Dirichlet value).
Definition physical_bc.hpp:29
Definition elliptic_problem.hpp:73
Cartesian geometry of a level: index domain + physical bounds [xlo, xhi] x [ylo, yhi].
Definition geometry.hpp:20
POPS_HD Real dy() const
Grid spacing in y (= (yhi - ylo) / domain.ny()). POPS_HD.
Definition geometry.hpp:33
POPS_HD Real dx() const
Grid spacing in x (= (xhi - xlo) / domain.nx()). POPS_HD.
Definition geometry.hpp:31
Definition system_coupler.hpp:47
ScopedBlockState & operator=(ScopedBlockState &&)=delete
ScopedBlockState(const ScopedBlockState &)=delete
ScopedBlockState & operator=(const ScopedBlockState &)=delete
~ScopedBlockState()
Definition system_coupler.hpp:63
ScopedBlockState(Block &b, MultiFab &stage_state)
Definition system_coupler.hpp:51
ScopedBlockState(ScopedBlockState &&)=delete
Time integrators as first-class OBJECTS with a take_step method: TimeStepper concept,...
Base scalar types and the POPS_HD macro (host+device portability).
Generated by