include/pops/runtime/builders/factory/model_factory.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
|
model_factory.hpp
Go to the documentation of this file.
3#include <pops/core/foundation/cold.hpp> // POPS_COLD_FN: COLD-factory no-optimize attribute (ADC-337)
4#include <pops/core/state/variables.hpp> // VariableSet/VariableRole/role_from_name/roles_csv (resolve_implicit_components)
6#include <pops/runtime/dynamic/model_registry.hpp> // kTransports/kSources/kElliptics: builtin-brick tag registry (ADC-331)
106 validate_elliptic(m.elliptic); // registry rejection (single source of the valid tags + message)
284 const int idx = cons.index_of(role); // canonical role name OR user-defined role label (ADC-292)
Umbrella for composable GENERIC physics bricks (compat).
POPS_COLD_FN: opt out the COLD host factories from the optimizer (ADC-337, P1-B).
SINGLE registry of builtin MODEL BRICK tags (transport / source / elliptic): the shared source of tru...
Flat specification of a model: chosen bricks plus their parameters.
Definition cluster.hpp:37
void validate_model_spec(const ModelSpec &m)
Completeness contract of a ModelSpec (ADC-290): transport and elliptic MUST be chosen explicitly.
Definition model_factory.hpp:32
POPS_COLD_FN void dispatch_source(const ModelSpec &m, Visitor &&v)
Builds the source brick and calls v(source).
Definition model_factory.hpp:85
POPS_COLD_FN void dispatch_model(const ModelSpec &m, Visitor &&visitor)
Assembles the CompositeModel designated by m and calls visitor(model).
Definition model_factory.hpp:168
POPS_COLD_FN void dispatch_elliptic(const ModelSpec &m, Visitor &&v)
Builds the elliptic right-hand-side brick and calls v(elliptic).
Definition model_factory.hpp:105
POPS_COLD_FN void dispatch_model_for(const ModelSpec &m, TR tr, Visitor &&visitor)
Same as dispatch_model but with the transport brick ALREADY chosen (tr).
Definition model_factory.hpp:196
POPS_COLD_FN std::vector< int > resolve_implicit_components(const std::string &block, const VariableSet &cons, const std::vector< std::string > &names, const std::vector< std::string > &roles)
Resolves the IMPLICIT MASK of a block (add_block: implicit_vars / implicit_roles) into a list of cons...
Definition model_factory.hpp:213
POPS_COLD_FN int resolve_selected_component(const std::string &origin, const std::string &block, const VariableSet &cons, const std::string &name, const std::string &role)
Resolves a SINGLE selector variable of block (the AMR regrid variable, ADC-296) into its conserved-co...
Definition model_factory.hpp:262
POPS_COLD_FN void dispatch_transport(const ModelSpec &m, Visitor &&v)
Non-drift guard (ADC-331): the registry's n_vars column (model_registry.hpp, a LIGHT header with no b...
Definition model_factory.hpp:57
POPS_COLD_FN void bind_variable_roles(Brick &brk, const VariableSet &cons)
AUTOMATIC resolution by ROLES (audit sec.5): fills the component indices of a SOURCE or ELLIPTIC bric...
Definition model_factory.hpp:135
void validate_elliptic(const std::string &tag)
Definition model_registry.hpp:212
constexpr int transport_n_vars_ct(const char *name)
Definition model_registry.hpp:176
std::string roles_csv(const VariableSet &vs)
CSV of a VariableSet's roles (role_name, separator ',').
Definition variables.hpp:172
@ Energy
@ Density
@ MomentumX
@ MomentumY
void validate_transport(const std::string &tag)
Validates a transport / elliptic tag against the builtin registry.
Definition model_registry.hpp:208
Composite physical model: one HYPERBOLIC brick + one source + one elliptic right-hand side.
Definition composite.hpp:30
SUM of two source bricks: S(U, aux) = A.apply(U, aux) + B.apply(U, aux).
Definition source.hpp:136
2D compressible Euler for an ideal gas: HYPERBOLIC brick (HyperbolicModel concept).
Definition euler.hpp:34
Scalar advection by the E x B drift: v = (-d_y phi, d_x phi)/B0 (divergence-free).
Definition hyperbolic.hpp:27
Self-consistent coupling f = sign * 4piG * (rho - rho0).
Definition elliptic.hpp:55
ISOTHERMAL Euler flux (p = cs2 rho), 3 variables (rho, rho u, rho v).
Definition hyperbolic.hpp:127
MAGNETIC Lorentz force q (v x B) on momentum, field B = B_z z_hat out of plane.
Definition source.hpp:104
double qom
PotentialForce / MagneticLorentzForce: q/m (sign included)
Definition model_spec.hpp:41
std::string source
"none" (default, neutral: no force) | "potential" | "gravity"
Definition model_spec.hpp:29
std::string elliptic
REQUIRED (unset): "charge" | "background" | "gravity".
Definition model_spec.hpp:31
std::string transport
REQUIRED (unset): "exb" | "compressible" | "isothermal".
Definition model_spec.hpp:28
double four_pi_G
GravityCoupling: coupling intensity.
Definition model_spec.hpp:46
double vacuum_floor
IsothermalFlux: quasi-vacuum density floor for u=m/max(rho,floor) (ADC-77).
Definition model_spec.hpp:36
double sign
GravityCoupling: +1 gravity, -1 electrostatic.
Definition model_spec.hpp:45
Electrostatic potential force (q/m) rho E on momentum (+ work on energy if 4 variables).
Definition source.hpp:47
A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; ...
Definition variables.hpp:58
int index_of(VariableRole role) const
Index of the component carrying role (first occurrence), -1 if absent.
Definition variables.hpp:67
Descriptor of a model's variables (Vars).
Generated by