include/pops/runtime/builders/block/block_builder.hpp File ReferenceΒΆ

adc_cpp: include/pops/runtime/builders/block/block_builder.hpp File 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
block_builder.hpp File Reference

Builds the closures of a block (time advance + residual + Poisson contribution) from a COMPILED model (CompositeModel) and a grid context. More...

+ Include dependency graph for block_builder.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::detail::BlockRhsEval< Limiter, Flux, Model >
 Residual functor -div F + S (fill_ghosts then assemble_rhs), passed TO THE TimeStepper as RhsEval. More...
 
struct  pops::detail::AdvanceExplicit< Limiter, Flux, Model, Stepper >
 EXPLICIT advance: n substeps of the Stepper stepper (SSPRK2 by default, SSPRK3 optional) on the transport+source residual. More...
 
struct  pops::detail::AdvanceImex< Limiter, Flux, Model >
 IMEX advance: per substep, EXPLICIT half-step (source-free transport) + stiff IMPLICIT source. More...
 
struct  pops::detail::AdvanceImexRkArs222< Limiter, Flux, Model >
 IMEX-RK ARS(2,2,2) advance (Ascher, Ruuth, Spiteri 1997; "Implicit-explicit Runge-Kutta methods for time-dependent partial differential equations", Appl. More...
 
struct  pops::detail::HotspotFn< Model >
 Frozen residual (fill_ghosts + assemble_rhs) installed as the block's rhs_into. More...
 
struct  pops::detail::ProjectCellKernel< Model >
 Kernel device de la PROJECTION PONCTUELLE post-pas (ADC-177) : U(i, j) <- m.project(U(i, j), aux(i, j)). More...
 
struct  pops::detail::PointwiseProject< Model >
 Foncteur HOTE de la projection ponctuelle : for_each_cell du kernel sur les cellules VALIDES de chaque fab local. More...
 
struct  pops::detail::RhsInto< Limiter, Flux, Model >
 
struct  pops::detail::SourceOnlyKernel< Model >
 SOURCE-ONLY residual kernel R(i,j) <- m.source(U(i,j), aux(i,j)): the EXACT source term of AssembleRhsKernel (cf. More...
 
struct  pops::detail::SourceInto< Model >
 SOURCE-ONLY residual R <- S(U, aux) installed as the block's source_only closure (ADC-430). More...
 
struct  pops::detail::BlockRhsEvalMasked< Limiter, Flux, Model >
 MASKED transport residual (Staircase mode): fill_ghosts then assemble_rhs_masked on the cell-centered 0/1 mask of the System (read via mask, pointer to Impl::domain_mask_, stable address). More...
 
struct  pops::detail::BlockRhsEvalEb< Limiter, Flux, Model >
 CUT-CELL / EB transport residual (CutCell mode): fill_ghosts then assemble_rhs_eb on the level set of the System embedded boundary (read via eb_domain, pointer to Impl::eb_domain_, stable address). More...
 
struct  pops::detail::AdvanceExplicitMasked< Limiter, Flux, Model, Stepper >
 MASKED EXPLICIT advance: n substeps of the Stepper stepper on the MASKED transport residual. More...
 
struct  pops::detail::AdvanceExplicitEb< Limiter, Flux, Model, Stepper >
 CUT-CELL / EB EXPLICIT advance: n substeps of the Stepper stepper on the EB transport residual. More...
 
struct  pops::detail::AdvanceImexMasked< Limiter, Flux, Model >
 MASKED IMEX advance: MASKED EXPLICIT half-step (source-free transport) + stiff IMPLICIT source. More...
 
struct  pops::detail::AdvanceImexEb< Limiter, Flux, Model >
 CUT-CELL / EB IMEX advance: EB EXPLICIT half-step (source-free transport) + stiff IMPLICIT source. More...
 
struct  pops::detail::MaxSpeed< Model >
 Block max wave speed functor (max_wave_speed_mf, reduction over the seam). More...
 
struct  pops::detail::MaxStabilitySpeed< Model >
 Block max STABILITY speed functor (HasStabilitySpeed trait): replaces MaxSpeed in the CFL when the model declares stability_speed (the Riemann solvers keep max_wave_speed). More...
 
struct  pops::detail::MaxSourceFreq< Model >
 Block max source frequency functor (HasSourceFrequency trait, bound dt <= cfl/mu without h). More...
 
struct  pops::detail::MinStabilityDt< Model >
 Block min admissible step functor (HasStabilityDt trait; 0 = no cell constrains it). More...
 
struct  pops::detail::PoissonRhs< Model >
 Poisson contribution functor: rhs += elliptic_rhs(U) (pure HOST loop, no device kernel). More...
 

Namespaces

namespace  pops
 
namespace  pops::detail
 

Functions

template<int N>
POPS_COLD_FN ImplicitMask< N > pops::make_implicit_mask (const std::vector< int > &implicit_components)
 Builds the device-clean POD implicit mask of an N-variable model from a list of component indices (empty -> INACTIVE mask -> model default, bit-identical).
 
template<class Limiter , class Flux , class Model >
POPS_COLD_FN BlockClosures pops::build_block (const Model &m, const GridContext &ctx, bool imex, bool recon_prim, const std::string &method="ssprk2", const std::vector< int > &implicit_components={}, const NewtonOptions &newton_opts={}, NewtonReport *newton_report=nullptr, Real pos_floor=Real(0), bool wave_speed_cache=false)
 Closures (advance + residual) for a frozen spatial scheme (Limiter x Flux).
 
template<class Model >
POPS_COLD_FN BlockClosures pops::make_block_rusanov (const Model &m, const std::string &lim, const GridContext &ctx, bool imex, bool recon_prim, const std::string &method, const std::vector< int > &implicit_components, const NewtonOptions &newton_opts, NewtonReport *newton_report, Real pos_floor)
 Dispatch of the spatial scheme (limiter x Riemann flux) -> compiled closures.
 
template<class Model >
POPS_COLD_FN BlockClosures pops::make_block_hll (const Model &m, const std::string &lim, const GridContext &ctx, bool imex, bool recon_prim, const std::string &method, const std::vector< int > &implicit_components, const NewtonOptions &newton_opts, NewtonReport *newton_report, Real pos_floor, bool wave_speed_cache)
 
template<class Model >
POPS_COLD_FN BlockClosures pops::make_block_hllc (const Model &m, const std::string &lim, const GridContext &ctx, bool imex, bool recon_prim, const std::string &method, const std::vector< int > &implicit_components, const NewtonOptions &newton_opts, NewtonReport *newton_report, Real pos_floor)
 
template<class Model >
POPS_COLD_FN BlockClosures pops::make_block_roe (const Model &m, const std::string &lim, const GridContext &ctx, bool imex, bool recon_prim, const std::string &method, const std::vector< int > &implicit_components, const NewtonOptions &newton_opts, NewtonReport *newton_report, Real pos_floor)
 
template<class Model >
POPS_COLD_FN BlockClosures pops::make_block (const Model &m, const std::string &lim, const std::string &riem, const GridContext &ctx, bool imex, bool recon_prim, const std::string &method="ssprk2", const std::vector< int > &implicit_components={}, const NewtonOptions &newton_opts={}, NewtonReport *newton_report=nullptr, Real pos_floor=Real(0), bool wave_speed_cache=false)
 
int pops::block_n_ghost (const std::string &lim)
 Number of ghosts required by the spatial scheme lim (single source: Limiter::n_ghost).
 
template<class Model >
std::function< Real(const MultiFab &)> pops::make_max_speed (const Model &m, const GridContext &ctx)
 Closure of the speed used by the block CFL step.
 
template<class Model >
std::function< Real(const MultiFab &)> pops::make_source_frequency (const Model &m, const GridContext &ctx)
 Closure of the block max source frequency (bound dt <= cfl * substeps / (stride * mu)).
 
template<class Model >
std::function< Real(const MultiFab &)> pops::make_stability_dt (const Model &m, const GridContext &ctx)
 Closure of the block min admissible step (bound dt <= stability_dt * substeps / stride, WITHOUT cfl).
 
template<class Model >
std::function< void(const MultiFab &, MultiFab &)> pops::make_poisson_rhs (const Model &m)
 Block contribution to the Poisson right-hand side: rhs += elliptic_rhs(U) (host loop).
 
template<class Model >
std::pair< std::function< void(const double *, double *)>, std::function< void(const double *, double *)> > pops::make_cell_convert (const Model &m)
 PER-CELL (one cell) cons <-> prim conversions of the MODEL, type-erased over arrays of Model::n_vars doubles.
 

Detailed Description

Builds the closures of a block (time advance + residual + Poisson contribution) from a COMPILED model (CompositeModel) and a grid context.

This code used to live in System::Impl; it is extracted into a header so that the SAME template path (assemble_rhs<Limiter, Flux>, inlinable and device-ready) is instantiable from an EXTERNAL TRANSLATION UNIT. It is the brick that lets a DSL-generated model be compiled AOT (ahead-of-time) and then plugged into the System via the PRODUCTION path (HLLC/Roe flux, order 2, GPU), no longer only via the virtual host path of the dynamic block.

The System remains the sole owner of the mesh and the aux; GridContext only carries immutable copies of them (domain, BC, geometry) and a non-owning POINTER to the aux (stable address, lifetime longer than the block).