|
GridFire v0.7.0-alpha
General Purpose Nuclear Network
|
Represents a single nuclear reaction from a specific data source. More...
#include <reaction.h>
Public Member Functions | |
| virtual | ~Reaction ()=default |
| Virtual destructor for correct polymorphic cleanup. | |
| virtual double | calculate_rate (double T9, double rho, double Ye, double mue, const std::vector< double > &Y, const std::unordered_map< size_t, fourdst::atomic::Species > &index_to_species_map) const=0 |
| Compute the temperature- and composition-dependent reaction rate. | |
| virtual CppAD::AD< double > | calculate_rate (CppAD::AD< double > T9, CppAD::AD< double > rho, CppAD::AD< double > Ye, CppAD::AD< double > mue, const std::vector< CppAD::AD< double > > &Y, const std::unordered_map< size_t, fourdst::atomic::Species > &index_to_species_map) const=0 |
| AD-enabled reaction rate for algorithmic differentiation. | |
| virtual std::string_view | id () const=0 |
| A stable, unique identifier for this reaction instance. | |
| virtual const std::vector< fourdst::atomic::Species > & | reactants () const=0 |
| Ordered list of reactant species. | |
| virtual const std::vector< fourdst::atomic::Species > & | products () const=0 |
| Ordered list of product species. | |
| virtual bool | contains (const fourdst::atomic::Species &species) const=0 |
| True if the species appears as a reactant or a product. | |
| virtual bool | contains_reactant (const fourdst::atomic::Species &species) const=0 |
| True if the species appears among the reactants. | |
| virtual bool | contains_product (const fourdst::atomic::Species &species) const=0 |
| True if the species appears among the products. | |
| virtual bool | is_reverse () const=0 |
| Whether this object represents a reverse (backward) rate. | |
| virtual std::unordered_set< fourdst::atomic::Species > | all_species () const=0 |
| Set of all unique species appearing in the reaction. | |
| virtual std::unordered_set< fourdst::atomic::Species > | reactant_species () const=0 |
| Set of unique reactant species. | |
| virtual std::unordered_set< fourdst::atomic::Species > | product_species () const=0 |
| Set of unique product species. | |
| virtual size_t | num_species () const=0 |
| Number of unique species involved in the reaction. | |
| virtual std::unordered_map< fourdst::atomic::Species, int > | stoichiometry () const=0 |
| Full stoichiometry map for this reaction. | |
| virtual int | stoichiometry (const fourdst::atomic::Species &species) const=0 |
| Stoichiometric coefficient for a particular species. | |
| virtual uint64_t | hash (uint64_t seed) const=0 |
| Stable content-based hash for this reaction. | |
| virtual double | qValue () const=0 |
| Q-value of the reaction (typically MeV), positive if exothermic. | |
| virtual double | calculate_energy_generation_rate (const double T9, const double rho, const double Ye, double mue, const std::vector< double > &Y, const std::unordered_map< size_t, fourdst::atomic::Species > &index_to_species_map) const |
| Convenience: energy generation rate from this reaction (double version). | |
| virtual CppAD::AD< double > | calculate_energy_generation_rate (const CppAD::AD< double > &T9, const CppAD::AD< double > &rho, const CppAD::AD< double > &Ye, const CppAD::AD< double > &mue, const std::vector< CppAD::AD< double > > &Y, const std::unordered_map< size_t, fourdst::atomic::Species > &index_to_species_map) const |
| Convenience: AD-enabled energy generation rate (AD version). | |
| virtual double | calculate_log_rate_partial_deriv_wrt_T9 (double T9, double rho, double Ye, double mue, const fourdst::composition::Composition &comp) const=0 |
| Logarithmic partial derivative of the rate with respect to temperature. | |
| virtual ReactionType | type () const=0 |
| Category of this reaction (e.g., REACLIB, WEAK, LOGICAL_REACLIB). | |
| virtual std::unique_ptr< Reaction > | clone () const=0 |
| Polymorphic deep copy. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Reaction &r) |
Represents a single nuclear reaction from a specific data source.
This class encapsulates all properties of a single nuclear reaction as defined in formats like REACLIB, including reactants, products, Q-value, and rate coefficients from a particular evaluation (source).
Example:
|
virtualdefault |
Virtual destructor for correct polymorphic cleanup.
|
nodiscardpure virtual |
Set of all unique species appearing in the reaction.
|
inlinenodiscardvirtual |
Convenience: AD-enabled energy generation rate (AD version).
Default implementation multiplies the AD rate by the reaction Q-value. Electron quantities (Ye, mue) are ignored in this default, so override if they contribute.
| T9 | Temperature in GK as CppAD::AD<double>. |
| rho | Mass density as CppAD::AD<double>. |
| Ye | Electron fraction as CppAD::AD<double> (ignored by default). |
| mue | Electron chemical potential as CppAD::AD<double> (ignored by default). |
| Y | Composition vector as CppAD::AD<double> values. |
| index_to_species_map | Mapping from state-vector index to Species. |
|
inlinenodiscardvirtual |
Convenience: energy generation rate from this reaction (double version).
Default implementation multiplies the scalar rate by the reaction Q-value. Electron quantities (Ye, mue) are ignored in this default, so override in derived classes if needed. Sign convention follows qValue().
| T9 | Temperature in GK (10^9 K). |
| rho | Mass density (g cm^-3). |
| Ye | Electron fraction (ignored by default implementation). |
| mue | Electron chemical potential (ignored by default implementation). |
| Y | Composition vector. |
| index_to_species_map | Mapping from state-vector index to Species. |
|
nodiscardpure virtual |
Logarithmic partial derivative of the rate with respect to temperature.
Implementations return d(ln rate)/d(ln T9) or an equivalent measure (as documented by the concrete class), evaluated at the provided state.
| T9 | Temperature in GK (10^9 K). |
| rho | Mass density (g cm^-3). |
| Ye | Electron fraction. |
| mue | Electron chemical potential. |
| comp | Composition object providing composition in a convenient form. |
|
nodiscardpure virtual |
AD-enabled reaction rate for algorithmic differentiation.
This overload mirrors calculate_rate(double, ...) but operates on CppAD types to enable derivative calculations w.r.t. its inputs.
| T9 | Temperature in GK as CppAD::AD<double>. |
| rho | Mass density as CppAD::AD<double>. |
| Ye | Electron fraction as CppAD::AD<double>. |
| mue | Electron chemical potential as CppAD::AD<double>. |
| Y | Composition vector as CppAD::AD<double> values. |
| index_to_species_map | Mapping from state-vector index to Species, used to interpret Y. |
|
nodiscardpure virtual |
Compute the temperature- and composition-dependent reaction rate.
This is the primary interface used by the network to obtain the rate of a single reaction at the given thermodynamic state and composition. The exact units and normalization are defined by the concrete implementation (e.g., REACLIB typically provides NA<sigma v> with units depending on the reaction order). Implementations may use density/electron properties for weak processes or screening, and the composition vector for multi-body reactions.
| T9 | Temperature in GK (10^9 K). |
| rho | Mass density (g cm^-3). May be unused for some reaction types. |
| Ye | Electron fraction. May be unused depending on the reaction type. |
| mue | Electron chemical potential. May be unused depending on the reaction type. |
| Y | Composition vector (molar abundances or number fractions) indexed consistently with index_to_species_map. |
| index_to_species_map | Mapping from state-vector index to Species, used to interpret Y. |
|
nodiscardpure virtual |
Polymorphic deep copy.
|
nodiscardpure virtual |
True if the species appears as a reactant or a product.
| species | Species to test. |
|
nodiscardpure virtual |
True if the species appears among the products.
| species | Species to test. |
|
nodiscardpure virtual |
True if the species appears among the reactants.
| species | Species to test. |
|
nodiscardpure virtual |
Stable content-based hash for this reaction.
Intended for use in caches, sets, and order-independent hashing of Reaction collections. Implementations should produce the same value across processes for the same content and seed.
| seed | Seed value to initialize/mix into the hash. |
|
nodiscardpure virtual |
A stable, unique identifier for this reaction instance.
|
nodiscardpure virtual |
Whether this object represents a reverse (backward) rate.
Implementations may pair forward/reverse rates for detailed balance. This flag indicates that the parameterization corresponds to the reverse direction.
|
nodiscardpure virtual |
Number of unique species involved in the reaction.
|
nodiscardpure virtual |
Set of unique product species.
|
nodiscardpure virtual |
Ordered list of product species.
Multiplicity is represented by duplicates if applicable.
|
nodiscardpure virtual |
Q-value of the reaction (typically MeV), positive if exothermic.
|
nodiscardpure virtual |
Set of unique reactant species.
|
nodiscardpure virtual |
Ordered list of reactant species.
Multiplicity is represented by duplicates, e.g., (p, p) would list H1 twice.
|
nodiscardpure virtual |
Full stoichiometry map for this reaction.
Coefficients are negative for reactants and positive for products; multiplicity is reflected in the magnitude (e.g., 2H -> He gives H: -2, He: +1).
|
nodiscardpure virtual |
Stoichiometric coefficient for a particular species.
| species | Species for which to query the coefficient. |
|
nodiscardpure virtual |
Category of this reaction (e.g., REACLIB, WEAK, LOGICAL_REACLIB).
|
friend |