AmrCouplerMP< Model, Elliptic > Class Template ReferenceΒΆ

adc_cpp: pops::AmrCouplerMP< Model, Elliptic > Class Template Reference
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
pops::AmrCouplerMP< Model, Elliptic > Class Template Reference

Multi-patch E x B AMR coupler. More...

#include <amr_coupler_mp.hpp>

+ Collaboration diagram for pops::AmrCouplerMP< Model, Elliptic >:

Public Member Functions

 AmrCouplerMP (const Model &model, const Geometry &geom, const BoxArray &ba_coarse, const BCRec &bc, std::vector< AmrLevelMP > levels, std::function< bool(Real, Real)> active={}, bool replicated_coarse=true)
 
std::vector< AmrLevelMP > & levels ()
 
MultiFabcoarse ()
 
const MultiFabcoarse () const
 
MultiFabaux0 ()
 
const MultiFabaux0 () const
 
void set_named_aux (int comp, std::vector< Real > field)
 Registers a model-NAMED aux field (ADC-291) at shared-channel component comp (>= kAuxNamedBase), as a coarse base-level field field (n*n row-major, global cell index j*nx+i).
 
void set_named_aux_bc (int comp, AuxHaloPolicy policy)
 Registers a per-field aux HALO policy (ADC-369) for the named component comp.
 
const Box2Ddomain () const
 
int nlev () const
 
std::vector< double > level_state (int k)
 
void set_level_state (int k, const std::vector< double > &s)
 
std::vector< double > level_potential (int k)
 
void set_level_potential (int k, const std::vector< double > &p)
 
std::vector< double > level_state_global (int k)
 
std::vector< double > level_potential_global (int k)
 
void set_hierarchy (const std::vector< Box2D > &fine_boxes)
 
void sync_down ()
 
void set_composite_poisson (bool v)
 OPT-IN: replaces the Option A AMR Poisson (coarse solve + piecewise-constant gradient injection) with a COMPOSITE FAC elliptic solve (the fine patch REFINES the elliptic).
 
bool composite_poisson () const
 
void compute_aux ()
 
void update ()
 Updates the hierarchy before a step: sync_down (fine -> coarse) then compute_aux (coarse Poisson + grad phi + injection to the fine levels).
 
template<class Disc = FirstOrder>
void step (Real dt, bool recon_prim=false, bool imex=false, const NewtonOptions &nopts={}, AmrTimeMethod tmethod=AmrTimeMethod::kEuler, Real pos_floor=Real(0))
 Advances the hierarchy by one step dt: update() then advance_amr (Berger-Oliger subcycling + reflux + conservative average_down).
 
template<class Disc = FirstOrder>
void advance_transport (Real dt, bool recon_prim=false, Real pos_floor=Real(0))
 TRANSPORT-ONLY ADVANCE (hyperbolic), WITHOUT update() or source.
 
template<class Crit >
void regrid (Crit crit, int grow=2, int margin=2)
 
Real mass () const
 
Real max_drift_speed () const
 
Real max_wave_speed ()
 Max wave speed on the coarse level via model.max_wave_speed.
 

Detailed Description

template<class Model, class Elliptic = GeometricMG>
class pops::AmrCouplerMP< Model, Elliptic >

Multi-patch E x B AMR coupler.

Template Parameters
ModelPhysicalModel (flux, source, elliptic_rhs, max_wave_speed).
Ellipticelliptic backend (EllipticSolver concept, default GeometricMG). ORCHESTRATES only: the hierarchy lives in an AmrLevelStack<AmrLevelMP>, the Poisson solve in mg_, the regrid in amr_regrid_finest. Reduces bit for bit to AmrCoupler in mono-box per level.

Constructor & Destructor Documentation

◆ AmrCouplerMP()

template<class Model , class Elliptic = GeometricMG>
pops::AmrCouplerMP< Model, Elliptic >::AmrCouplerMP ( const Model &  model,
const Geometry geom,
const BoxArray ba_coarse,
const BCRec bc,
std::vector< AmrLevelMP levels,
std::function< bool(Real, Real)>  active = {},
bool  replicated_coarse = true 
)
inline

Member Function Documentation

◆ advance_transport()

template<class Model , class Elliptic = GeometricMG>
template<class Disc = FirstOrder>
void pops::AmrCouplerMP< Model, Elliptic >::advance_transport ( Real  dt,
bool  recon_prim = false,
Real  pos_floor = Real(0) 
)
inline

TRANSPORT-ONLY ADVANCE (hyperbolic), WITHOUT update() or source.

Counterpart of step() stripped of its field solve and with imex==false: this is the PURE HYPERBOLIC advance (-div F) of the amr-schur path, where the field is solved separately (update()) and the source is played by the global condensed stage (AmrCondensedSchurSourceStepper), exactly like the uniform path interleaving solve_fields / transport (s.advance) / source stage (run_source_stage). The model must be SOURCE-FREE (NoSource source brick) so that the source is not counted twice (once here in forward Euler, once by the Schur stage): this is the contract of the amr-schur path, mirror of the uniform time=Strang(Explicit, CondensedSchur) where the block is added with its transport only.

◆ aux0() [1/2]

template<class Model , class Elliptic = GeometricMG>
MultiFab & pops::AmrCouplerMP< Model, Elliptic >::aux0 ( )
inline

◆ aux0() [2/2]

template<class Model , class Elliptic = GeometricMG>
const MultiFab & pops::AmrCouplerMP< Model, Elliptic >::aux0 ( ) const
inline

◆ coarse() [1/2]

template<class Model , class Elliptic = GeometricMG>
MultiFab & pops::AmrCouplerMP< Model, Elliptic >::coarse ( )
inline

◆ coarse() [2/2]

template<class Model , class Elliptic = GeometricMG>
const MultiFab & pops::AmrCouplerMP< Model, Elliptic >::coarse ( ) const
inline

◆ composite_poisson()

template<class Model , class Elliptic = GeometricMG>
bool pops::AmrCouplerMP< Model, Elliptic >::composite_poisson ( ) const
inline

◆ compute_aux()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::compute_aux ( )
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ domain()

template<class Model , class Elliptic = GeometricMG>
const Box2D & pops::AmrCouplerMP< Model, Elliptic >::domain ( ) const
inline

◆ level_potential()

template<class Model , class Elliptic = GeometricMG>
std::vector< double > pops::AmrCouplerMP< Model, Elliptic >::level_potential ( int  k)
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ level_potential_global()

template<class Model , class Elliptic = GeometricMG>
std::vector< double > pops::AmrCouplerMP< Model, Elliptic >::level_potential_global ( int  k)
inline
+ Here is the call graph for this function:

◆ level_state()

template<class Model , class Elliptic = GeometricMG>
std::vector< double > pops::AmrCouplerMP< Model, Elliptic >::level_state ( int  k)
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ level_state_global()

template<class Model , class Elliptic = GeometricMG>
std::vector< double > pops::AmrCouplerMP< Model, Elliptic >::level_state_global ( int  k)
inline
+ Here is the call graph for this function:

◆ levels()

template<class Model , class Elliptic = GeometricMG>
std::vector< AmrLevelMP > & pops::AmrCouplerMP< Model, Elliptic >::levels ( )
inline

◆ mass()

template<class Model , class Elliptic = GeometricMG>
Real pops::AmrCouplerMP< Model, Elliptic >::mass ( ) const
inline
+ Here is the call graph for this function:

◆ max_drift_speed()

template<class Model , class Elliptic = GeometricMG>
Real pops::AmrCouplerMP< Model, Elliptic >::max_drift_speed ( ) const
inline
+ Here is the call graph for this function:

◆ max_wave_speed()

template<class Model , class Elliptic = GeometricMG>
Real pops::AmrCouplerMP< Model, Elliptic >::max_wave_speed ( )
inline

Max wave speed on the coarse level via model.max_wave_speed.

Model-generic CFL speed (any PhysicalModel), unlike max_drift_speed which is specific to the E x B drift (model.B0). For a pure E x B transport, it equals the drift speed.

Returns
the max over the coarse cells and the two directions, reduced over the ranks.
Note
update() must have run so that aux(0) carries the current grad phi.
+ Here is the call graph for this function:

◆ nlev()

template<class Model , class Elliptic = GeometricMG>
int pops::AmrCouplerMP< Model, Elliptic >::nlev ( ) const
inline

◆ regrid()

template<class Model , class Elliptic = GeometricMG>
template<class Crit >
void pops::AmrCouplerMP< Model, Elliptic >::regrid ( Crit  crit,
int  grow = 2,
int  margin = 2 
)
inline
+ Here is the call graph for this function:

◆ set_composite_poisson()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::set_composite_poisson ( bool  v)
inline

OPT-IN: replaces the Option A AMR Poisson (coarse solve + piecewise-constant gradient injection) with a COMPOSITE FAC elliptic solve (the fine patch REFINES the elliptic).

Cf. CompositeFacPoisson. Phase 2 scope: 2 levels, ONE interior mono-box fine patch, replicated coarse (single-rank). Outside this scope, compute_aux falls back to Option A (bit-identical).

◆ set_hierarchy()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::set_hierarchy ( const std::vector< Box2D > &  fine_boxes)
inline
+ Here is the call graph for this function:

◆ set_level_potential()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::set_level_potential ( int  k,
const std::vector< double > &  p 
)
inline
+ Here is the call graph for this function:

◆ set_level_state()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::set_level_state ( int  k,
const std::vector< double > &  s 
)
inline
+ Here is the call graph for this function:

◆ set_named_aux()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::set_named_aux ( int  comp,
std::vector< Real field 
)
inline

Registers a model-NAMED aux field (ADC-291) at shared-channel component comp (>= kAuxNamedBase), as a coarse base-level field field (n*n row-major, global cell index j*nx+i).

STATIC user field re-applied by compute_aux every update (so it persists across regrid) and injected coarse->fine. Single-block AMR counterpart of System::set_aux_field_component. The facade validates comp/size and resolves the name. No-op default (no named field -> empty map -> bit-identical).

◆ set_named_aux_bc()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::set_named_aux_bc ( int  comp,
AuxHaloPolicy  policy 
)
inline

Registers a per-field aux HALO policy (ADC-369) for the named component comp.

compute_aux applies it onto the COARSE aux AFTER the shared fill, overriding only that component's physical-face ghosts (periodic faces stay periodic). Single-block AMR counterpart of System::set_aux_field_halo_component. No-op default.

◆ step()

template<class Model , class Elliptic = GeometricMG>
template<class Disc = FirstOrder>
void pops::AmrCouplerMP< Model, Elliptic >::step ( Real  dt,
bool  recon_prim = false,
bool  imex = false,
const NewtonOptions nopts = {},
AmrTimeMethod  tmethod = AmrTimeMethod::kEuler,
Real  pos_floor = Real(0) 
)
inline

Advances the hierarchy by one step dt: update() then advance_amr (Berger-Oliger subcycling + reflux + conservative average_down).

Template Parameters
Discspatial discretization (limiter + flux, default FirstOrder bit-identical to the historical one). recon_prim: primitive reconstruction; imex: stiff source implicit (backward_euler). Defaults (false) -> historical explicit path. nopts: OPTIONS of the IMEX implicit-source Newton (iteration budget, tolerances, fd_eps, damping, fail_policy), threaded down to backward_euler_source by advance_amr -> subcycle_level_mp -> mf_apply_source_treatment. DEFAULT {} = historical constants (2 iters, 1e-7, ...) -> path (2a) BIT-IDENTICAL to the old call. No effect if imex==false. The partial IMEX mask is NOT carried by this mono-block path (full backward-Euler), only the OPTIONS are (the mono-block AmrSystem wires the Newton options but not the mask or the diagnostics). tmethod: time method (kEuler by default = historical forward Euler bit-identical; kSsprk3 = order-3 SSPRK3 + per-stage reflux). kSsprk3 requires imex == false (rejected otherwise).

◆ sync_down()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::sync_down ( )
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

template<class Model , class Elliptic = GeometricMG>
void pops::AmrCouplerMP< Model, Elliptic >::update ( )
inline

Updates the hierarchy before a step: sync_down (fine -> coarse) then compute_aux (coarse Poisson + grad phi + injection to the fine levels).

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: