|
GridFire v0.7.0-alpha
General Purpose Nuclear Network
|
#include <reaction.h>
Public Member Functions | |
| ~ReaclibReaction () override=default | |
| ReaclibReaction (std::string_view id, std::string_view peName, int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, double qValue, std::string_view label, const RateCoefficientSet &sets, bool reverse=false) | |
| Constructs a Reaction object. | |
| 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 override |
| Calculates the reaction rate for a given temperature. | |
| 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 override |
| Calculates the reaction rate for a given temperature using CppAD types. | |
| double | calculate_log_rate_partial_deriv_wrt_T9 (double T9, double rho, double Ye, double mue, const fourdst::composition::Composition &comp) const override |
| Logarithmic partial derivative of the rate with respect to temperature. | |
| virtual std::string_view | peName () const |
| Gets the reaction name in (projectile, ejectile) notation. | |
| int | chapter () const |
| Gets the REACLIB chapter number. | |
| std::string_view | sourceLabel () const |
| Gets the source label for the rate data. | |
| ReactionType | type () const override |
| Category of this reaction (e.g., REACLIB, WEAK, LOGICAL_REACLIB). | |
| const RateCoefficientSet & | rateCoefficients () const |
| Gets the set of rate coefficients. | |
| std::optional< std::vector< RateCoefficientSet > > | getRateCoefficients () const override |
| bool | contains (const fourdst::atomic::Species &species) const override |
| Checks if the reaction involves a given species as a reactant or product. | |
| bool | contains_reactant (const fourdst::atomic::Species &species) const override |
| Checks if the reaction involves a given species as a reactant. | |
| bool | contains_product (const fourdst::atomic::Species &species) const override |
| Checks if the reaction involves a given species as a product. | |
| std::unordered_set< fourdst::atomic::Species > | all_species () const override |
| Gets a set of all unique species involved in the reaction. | |
| std::unordered_set< fourdst::atomic::Species > | reactant_species () const override |
| Gets a set of all unique reactant species. | |
| std::unordered_set< fourdst::atomic::Species > | product_species () const override |
| Gets a set of all unique product species. | |
| size_t | num_species () const override |
| Gets the number of unique species involved in the reaction. | |
| int | stoichiometry (const fourdst::atomic::Species &species) const override |
| Calculates the stoichiometric coefficient for a given species. | |
| std::unordered_map< fourdst::atomic::Species, int > | stoichiometry () const override |
| Gets a map of all species to their stoichiometric coefficients. | |
| std::string_view | id () const override |
| Gets the unique identifier of the reaction. | |
| double | qValue () const override |
| Gets the Q-value of the reaction. | |
| const std::vector< fourdst::atomic::Species > & | reactants () const override |
| Gets the vector of reactant species. | |
| const std::vector< fourdst::atomic::Species > & | products () const override |
| Gets the vector of product species. | |
| bool | is_reverse () const override |
| Checks if this is a reverse reaction rate. | |
| double | excess_energy () const |
| Calculates the excess energy from the mass difference of reactants and products. | |
| bool | operator== (const ReaclibReaction &other) const |
| Compares this reaction with another for equality based on their IDs. | |
| bool | operator!= (const ReaclibReaction &other) const |
| Compares this reaction with another for inequality. | |
| uint64_t | hash (uint64_t seed) const override |
| Computes a hash for the reaction based on its ID. | |
| std::unique_ptr< Reaction > | clone () const override |
| Polymorphic deep copy. | |
Public Member Functions inherited from gridfire::reaction::Reaction | |
| virtual | ~Reaction ()=default |
| Virtual destructor for correct polymorphic cleanup. | |
| 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). | |
Protected Attributes | |
| quill::Logger * | m_logger = fourdst::logging::LogManager::getInstance().getLogger("log") |
| std::string | m_id |
| Unique identifier for the reaction (e.g., "h1+h1=>h2+e+nu"). | |
| std::string | m_peName |
| Name of the reaction in (projectile, ejectile) notation (e.g. "p(p,g)d"). | |
| int | m_chapter |
| Chapter number from the REACLIB database, defining the reaction structure. | |
| double | m_qValue = 0.0 |
| Q-value of the reaction in MeV. | |
| std::vector< fourdst::atomic::Species > | m_reactants |
| Reactants of the reaction. | |
| std::vector< fourdst::atomic::Species > | m_products |
| Products of the reaction. | |
| std::string | m_sourceLabel |
| Source label for the rate data (e.g., "wc12w", "st08"). | |
| RateCoefficientSet | m_rateCoefficients |
| The seven rate coefficients. | |
| bool | m_reverse = false |
| Flag indicating if this is a reverse reaction rate. | |
Private Member Functions | |
| template<typename T> | |
| T | calculate_rate (const T T9) const |
| Template implementation for calculating the reaction rate. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ReaclibReaction &r) |
|
overridedefault |
| gridfire::reaction::ReaclibReaction::ReaclibReaction | ( | std::string_view | id, |
| std::string_view | peName, | ||
| int | chapter, | ||
| const std::vector< fourdst::atomic::Species > & | reactants, | ||
| const std::vector< fourdst::atomic::Species > & | products, | ||
| double | qValue, | ||
| std::string_view | label, | ||
| const RateCoefficientSet & | sets, | ||
| bool | reverse = false ) |
Constructs a Reaction object.
| id | A unique identifier for the reaction. |
| peName | The name in (projectile, ejectile) notation (e.g., "p(p,g)d"). |
| chapter | The REACLIB chapter number, defining reaction structure. |
| reactants | A vector of reactant species. |
| products | A vector of product species. |
| qValue | The Q-value of the reaction in MeV. |
| label | The source label for the rate data (e.g., "wc12", "st08"). |
| sets | The set of rate coefficients. |
| reverse | True if this is a reverse reaction rate. |
|
nodiscardoverridevirtual |
Gets a set of all unique species involved in the reaction.
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
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. |
Implements gridfire::reaction::Reaction.
|
inlinenodiscardprivate |
Template implementation for calculating the reaction rate.
| T | The numeric type (double or CppAD::AD<double>). |
| T9 | The temperature in units of 10^9 K. |
The rate is calculated using the standard REACLIB formula: rate = exp(a0 + a1/T9 + a2/T9^(1/3) + a3*T9^(1/3) + a4*T9 + a5*T9^(5/3) + a6*ln(T9))
|
nodiscardoverridevirtual |
Calculates the reaction rate for a given temperature using CppAD types.
| T9 | The temperature in units of 10^9 K, as a CppAD::AD<double>. |
| rho | Density, as a CppAD::AD<double> [Not used in this implementation]. |
| Ye | |
| mue | |
| Y | Molar abundances of species, as a vector of CppAD::AD<double> [Not used in this implementation]. |
| index_to_species_map |
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Calculates the reaction rate for a given temperature.
| T9 | The temperature in units of 10^9 K. |
| rho | Density [Not used in this implementation]. |
| Ye | |
| mue | |
| Y | |
| index_to_species_map |
Implements gridfire::reaction::Reaction.
|
inlinenodiscard |
Gets the REACLIB chapter number.
|
nodiscardoverridevirtual |
Polymorphic deep copy.
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Checks if the reaction involves a given species as a reactant or product.
| species | The species to check for. |
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Checks if the reaction involves a given species as a product.
| species | The species to check for. |
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Checks if the reaction involves a given species as a reactant.
| species | The species to check for. |
Implements gridfire::reaction::Reaction.
|
nodiscard |
Calculates the excess energy from the mass difference of reactants and products.
|
nodiscardoverridevirtual |
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Computes a hash for the reaction based on its ID.
| seed | The seed for the hash function. |
Uses the XXHash64 algorithm on the reaction's ID string.
Implements gridfire::reaction::Reaction.
|
inlinenodiscardoverridevirtual |
Gets the unique identifier of the reaction.
Implements gridfire::reaction::Reaction.
|
inlinenodiscardoverridevirtual |
Checks if this is a reverse reaction rate.
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Gets the number of unique species involved in the reaction.
Implements gridfire::reaction::Reaction.
|
inline |
Compares this reaction with another for inequality.
| other | The other Reaction to compare with. |
|
inline |
Compares this reaction with another for equality based on their IDs.
| other | The other Reaction to compare with. |
|
inlinenodiscardvirtual |
Gets the reaction name in (projectile, ejectile) notation.
|
nodiscardoverridevirtual |
Gets a set of all unique product species.
Implements gridfire::reaction::Reaction.
|
inlinenodiscardoverridevirtual |
Gets the vector of product species.
Implements gridfire::reaction::Reaction.
|
inlinenodiscardoverridevirtual |
Gets the Q-value of the reaction.
Implements gridfire::reaction::Reaction.
|
inlinenodiscard |
Gets the set of rate coefficients.
|
nodiscardoverridevirtual |
Gets a set of all unique reactant species.
Implements gridfire::reaction::Reaction.
|
inlinenodiscardoverridevirtual |
Gets the vector of reactant species.
Implements gridfire::reaction::Reaction.
|
inlinenodiscard |
Gets the source label for the rate data.
|
nodiscardoverridevirtual |
Gets a map of all species to their stoichiometric coefficients.
Implements gridfire::reaction::Reaction.
|
nodiscardoverridevirtual |
Calculates the stoichiometric coefficient for a given species.
| species | The species for which to find the coefficient. |
Implements gridfire::reaction::Reaction.
|
inlinenodiscardoverridevirtual |
Category of this reaction (e.g., REACLIB, WEAK, LOGICAL_REACLIB).
Implements gridfire::reaction::Reaction.
|
friend |
|
protected |
Chapter number from the REACLIB database, defining the reaction structure.
|
protected |
Unique identifier for the reaction (e.g., "h1+h1=>h2+e+nu").
|
protected |
|
protected |
Name of the reaction in (projectile, ejectile) notation (e.g. "p(p,g)d").
|
protected |
Products of the reaction.
|
protected |
Q-value of the reaction in MeV.
|
protected |
The seven rate coefficients.
|
protected |
Reactants of the reaction.
|
protected |
Flag indicating if this is a reverse reaction rate.
|
protected |
Source label for the rate data (e.g., "wc12w", "st08").