|
GridFire v0.7.1_rc2
General Purpose Nuclear Network
|
Concrete Reaction representing a single weak process (beta±, e−/e+ capture). More...
#include <weak.h>
Classes | |
| class | AtomicWeakRate |
| CppAD atomic that wraps weak-rate interpolation for AD evaluation. More... | |
| struct | constants |
Public Member Functions | |
| WeakReaction (const fourdst::atomic::Species &species, WeakReactionType type, const WeakRateInterpolator &interpolator) | |
| Construct a WeakReaction for a specific weak channel and parent species. | |
| 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 |
| Scalar weak reaction rate λ(T9, rho, Ye, μe) in 1/s. | |
| 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 |
| AD-enabled weak reaction rate λ(T9, rho, Ye, μe) in 1/s. | |
| std::string_view | id () const override |
| Unique identifier string for the weak channel. | |
| const std::vector< fourdst::atomic::Species > & | reactants () const override |
| Reactants list (parent nuclide only). | |
| const std::vector< fourdst::atomic::Species > & | products () const override |
| Products list (daughter nuclide only). | |
| bool | contains (const fourdst::atomic::Species &species) const override |
| Check if a species participates in this weak reaction. | |
| bool | contains_reactant (const fourdst::atomic::Species &species) const override |
| Check if a species is the reactant (parent). | |
| bool | contains_product (const fourdst::atomic::Species &species) const override |
| Check if a species is the product (daughter). | |
| std::unordered_set< fourdst::atomic::Species > | all_species () const override |
| Set of both parent and daughter species. | |
| std::unordered_set< fourdst::atomic::Species > | reactant_species () const override |
| Singleton set containing only the parent species. | |
| std::unordered_set< fourdst::atomic::Species > | product_species () const override |
| Singleton set containing only the daughter species. | |
| size_t | num_species () const override |
| Number of unique species involved (always 2 for weak reactions). | |
| std::unordered_map< fourdst::atomic::Species, int > | stoichiometry () const override |
| Full stoichiometry map: parent -1, daughter +1. | |
| int | stoichiometry (const fourdst::atomic::Species &species) const override |
| Stoichiometric coefficient for a species: -1 (parent), +1 (daughter), 0 otherwise. | |
| uint64_t | hash (uint64_t seed) const override |
| Content-based 64-bit hash for this reaction. | |
| double | qValue () const override |
| Q-value (MeV) based on nuclear mass differences and channel. | |
| double | calculate_energy_generation_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 |
| Net energy generation rate (MeV/s) for this weak reaction. | |
| 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 override |
| AD-enabled net energy generation rate (MeV/s). | |
| double | calculate_log_rate_partial_deriv_wrt_T9 (double T9, double rho, double Ye, double mue, const fourdst::composition::Composition &composition) const override |
| Logarithmic temperature sensitivity of the rate at the given state. | |
| reaction::ReactionType | type () const override |
| Reaction type tag for runtime dispatch. | |
| std::unique_ptr< Reaction > | clone () const override |
| Polymorphic deep copy. | |
| bool | is_reverse () const override |
| Weak reactions are parameterized in the forward sense (never reverse). | |
| const WeakRateInterpolator & | getWeakRateInterpolator () const |
| Access the underlying rate interpolator used by this reaction. | |
| std::optional< std::vector< reaction::RateCoefficientSet > > | getRateCoefficients () const override |
| size_t | countReactantOccurrences (const fourdst::atomic::Species &species) const override |
| size_t | countProductOccurrences (const fourdst::atomic::Species &species) const override |
Public Member Functions inherited from gridfire::reaction::Reaction | |
| virtual | ~Reaction ()=default |
| Virtual destructor for correct polymorphic cleanup. | |
Private Member Functions | |
| template<IsArithmeticOrAD T> | |
| T | calculate_rate (T T9, T rho, T Ye, T mue, const std::vector< T > &Y, const std::unordered_map< size_t, fourdst::atomic::Species > &index_to_species_map) const |
| Internal unified implementation for scalar/AD rate evaluation. | |
| double | get_log_rate_from_payload (const WeakRatePayload &payload) const |
| Extract the channel-specific log10(rate) from an interpolated payload. Mapping: β−→log_beta_minus, β+→log_beta_plus, e− capture→log_electron_capture, e+ capture→log_positron_capture. | |
| double | get_log_neutrino_loss_from_payload (const WeakRatePayload &payload) const |
| Extract the channel-specific log10(neutrino loss) from a payload. Mapping: β−/e+ capture→log_antineutrino_loss_bd; β+/e− capture→log_neutrino_loss_ec. | |
Private Attributes | |
| const constants | m_constants |
| fourdst::atomic::Species | m_reactant |
| fourdst::atomic::Species | m_product |
| std::vector< fourdst::atomic::Species > | m_reactants |
| std::vector< fourdst::atomic::Species > | m_products |
| size_t | m_reactant_a |
| size_t | m_reactant_z |
| size_t | m_product_a |
| size_t | m_product_z |
| std::string | m_id |
| WeakReactionType | m_type |
| const WeakRateInterpolator & | m_interpolator |
| AtomicWeakRate | m_atomic |
Concrete Reaction representing a single weak process (beta±, e−/e+ capture).
Wraps interpolation logic for tabulated weak rates and provides both scalar and AD interfaces for rate and energy generation. The reactants/products are the parent/daughter nuclei of the weak process.
the product nucleus is resolved from (A,Z) and channel via simple charge-changing rules (β−: Z+1; β+: Z−1; e− capture: Z−1; e+ capture: Z+1). The reaction ID is formatted like "Parent(channel)Product" with ν/ν̄ decorations, and an internal CppAD atomic (AtomicWeakRate) is prepared for AD energy calculations.
|
explicit |
Construct a WeakReaction for a specific weak channel and parent species.
| species | Parent nuclide undergoing the weak process. |
| type | The weak reaction channel (beta−, beta+, e− capture, e+ capture). |
| interpolator | Reference to a WeakRateInterpolator providing tabulated data. |
| std::runtime_error | If the product species cannot be resolved for the channel (product resolution uses the charge-changing rules described above). |
|
overridevirtual |
Set of both parent and daughter species.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
AD-enabled net energy generation rate (MeV/s).
Uses an internal CppAD atomic to compute two outputs at once: the rate λ and the neutrino loss ν_loss at (T9, log10(rho*Ye), μe). Returns λ · (Q − ν_loss). The atomic throws on interpolation failure.
| std::runtime_error | If the atomic rate evaluation fails to interpolate. |
Reimplemented from gridfire::reaction::Reaction.
|
overridevirtual |
Net energy generation rate (MeV/s) for this weak reaction.
Interpolates once to obtain both the log10(rate) and the appropriate log10(neutrino-loss) for the channel, converts to linear values, computes E_deposited = Q − ν_loss, and returns λ · E_deposited. Throws on interpolation failure.
Channel mapping for neutrino-loss column:
| T9 | Temperature in GK. |
| rho | Density in g cm^-3. |
| Ye | Electron fraction. |
| mue | Electron chemical potential (MeV). |
| Y | Composition vector (unused for weak channels). |
| index_to_species_map | Index-to-species map (unused for weak channels). |
| std::runtime_error | On interpolation failure. |
Reimplemented from gridfire::reaction::Reaction.
|
overridevirtual |
Logarithmic temperature sensitivity of the rate at the given state.
Implementation status: requests derivative tables from the interpolator and throws on failure; otherwise the function is not yet implemented and does not return a value. Avoid calling until implemented.
| T9 | Temperature in GK. |
| rho | Density in g cm^-3. |
| Ye | Electron fraction. |
| mue | Electron chemical potential (MeV). |
| composition | Composition context (not used by weak channels presently). |
| std::runtime_error | On interpolation failure. |
Implements gridfire::reaction::Reaction.
|
overridevirtual |
AD-enabled weak reaction rate λ(T9, rho, Ye, μe) in 1/s.
Current implementation returns 0.0. AD support is provided for the energy-generation overload below using an internal CppAD atomic that evaluates both the rate and neutrino loss consistently. A future implementation may mirror that atomic here and return the AD rate.
| T9 | Temperature in GK (AD type). |
| rho | Mass density (g cm^-3, AD type). |
| Ye | Electron fraction (AD type). |
| mue | Electron chemical potential (MeV, AD type). |
| Y | Composition vector (unused for weak channels). |
| index_to_species_map | Index-to-species map (unused for weak channels). |
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Scalar weak reaction rate λ(T9, rho, Ye, μe) in 1/s.
Performs a single interpolation of the weak-rate tables at (T9, log10(rho*Ye), μe). If the selected log10(rate) is ≤ sentinel (-60), returns 0; otherwise returns 10^{log10(rate)}. On interpolation failure, throws with a message including (A,Z) and the state point.
| T9 | Temperature in GK (1e9 K). |
| rho | Mass density (g cm^-3). |
| Ye | Electron fraction. |
| mue | Electron chemical potential (MeV). |
| Y | Composition vector (unused for weak channels). |
| index_to_species_map | Index-to-species map (unused for weak channels). |
| std::runtime_error | On interpolation failure. |
Implements gridfire::reaction::Reaction.
|
private |
Internal unified implementation for scalar/AD rate evaluation.
| T | double or CppAD::AD<double>. |
| T9,rho,Ye,mue | Thermodynamic state. |
| Y | Composition vector (unused for weak channels). |
| index_to_species_map | Index-to-species map (unused for weak channels). |
| std::runtime_error | If interpolation fails (double path) or the atomic fails (AD path). |
|
overridevirtual |
Polymorphic deep copy.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Check if a species participates in this weak reaction.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Check if a species is the product (daughter).
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Check if a species is the reactant (parent).
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Implements gridfire::reaction::Reaction.
|
private |
Extract the channel-specific log10(neutrino loss) from a payload. Mapping: β−/e+ capture→log_antineutrino_loss_bd; β+/e− capture→log_neutrino_loss_ec.
|
private |
Extract the channel-specific log10(rate) from an interpolated payload. Mapping: β−→log_beta_minus, β+→log_beta_plus, e− capture→log_electron_capture, e+ capture→log_positron_capture.
|
inlineoverridevirtual |
Implements gridfire::reaction::Reaction.
| const WeakRateInterpolator & gridfire::rates::weak::WeakReaction::getWeakRateInterpolator | ( | ) | const |
Access the underlying rate interpolator used by this reaction.
|
overridevirtual |
Content-based 64-bit hash for this reaction.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Unique identifier string for the weak channel.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Weak reactions are parameterized in the forward sense (never reverse).
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Number of unique species involved (always 2 for weak reactions).
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Singleton set containing only the daughter species.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Products list (daughter nuclide only).
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Q-value (MeV) based on nuclear mass differences and channel.
Computes Q = (M_parent − M_daughter) c^2 converted to MeV. For β+ decay subtract 2 m_e c^2, for e+ capture add 2 m_e c^2; for β− and e− capture it is just the nuclear mass difference. Neutrino rest mass is ignored.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Singleton set containing only the parent species.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Reactants list (parent nuclide only).
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Full stoichiometry map: parent -1, daughter +1.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Stoichiometric coefficient for a species: -1 (parent), +1 (daughter), 0 otherwise.
Implements gridfire::reaction::Reaction.
|
overridevirtual |
Reaction type tag for runtime dispatch.
Implements gridfire::reaction::Reaction.
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |