feat(neutrino): Started framework for neutrino loss

Neutrino loss is essential for neutrino cooling. Started adding
framework to track this. Reaclib reactions use a simple heuristic where
electron capture reactions loss 100% of their energy to neutrinos
whereas beta decay reactions loose 50% of their energy to neutrinos
This commit is contained in:
2025-11-27 14:34:20 -05:00
parent 7b67f3064a
commit 05175ae87c
13 changed files with 259 additions and 119 deletions

View File

@@ -16,4 +16,12 @@ namespace gridfire::reaclib {
*/
const reaction::ReactionSet &get_all_reaclib_reactions();
// Simple heuristic to check if a reaclib reaction is a strong or weak reaction
/* A weak reaction is defined here as one where:
- The number of reactants is equal to the number of products
- There is only one reactant and one product
- The mass number (A) of the reactant is equal to the mass number (A) of the product
*/
bool reaction_is_weak(const reaction::Reaction& reaction);
} // namespace gridfire::reaclib

View File

@@ -27,19 +27,26 @@ namespace gridfire::reaction {
enum class ReactionType {
WEAK,
REACLIB,
REACLIB_WEAK,
LOGICAL_REACLIB,
LOGICAL_REACLIB_WEAK,
};
static std::unordered_map<ReactionType, std::string> ReactionTypeNames = {
{ReactionType::WEAK, "weak"},
{ReactionType::REACLIB, "reaclib"},
{ReactionType::REACLIB_WEAK, "reaclib_weak"},
{ReactionType::LOGICAL_REACLIB, "logical_reaclib"},
{ReactionType::LOGICAL_REACLIB_WEAK, "logical_reaclib_weak"},
};
static std::unordered_map<ReactionType, std::string> ReactionPhysicalTypeNames = {
{ReactionType::WEAK, "Weak"},
{ReactionType::REACLIB, "Strong"},
{ReactionType::LOGICAL_REACLIB, "Strong"},
{ReactionType::REACLIB_WEAK, "Weak"},
{ReactionType::LOGICAL_REACLIB_WEAK, "Weak"},
};
/**
* @struct RateCoefficientSet
@@ -363,7 +370,7 @@ namespace gridfire::reaction {
* @param reactants A vector of reactant species.
* @param products A vector of product species.
* @param qValue The Q-value of the reaction in MeV.
* @param label The source label for the rate data (e.g., "wc12", "st08").
* @param label The sources label for the rate data (e.g., "wc12", "st08").
* @param sets The set of rate coefficients.
* @param reverse True if this is a reverse reaction rate.
*/
@@ -645,6 +652,27 @@ namespace gridfire::reaction {
}
};
class WeakReaclibReaction final : public ReaclibReaction {
public:
using ReaclibReaction::ReaclibReaction;
[[nodiscard]] ReactionType type() const override { return ReactionType::REACLIB_WEAK; }
[[nodiscard]] std::unique_ptr<Reaction> clone() const override {
return std::make_unique<WeakReaclibReaction>(
m_id,
m_peName,
m_chapter,
reactants(),
products(),
m_qValue,
m_sourceLabel,
m_rateCoefficients,
m_reverse
);
}
};
/**
* @class LogicalReaclibReaction
@@ -664,7 +692,7 @@ namespace gridfire::reaction {
* @param reactions A vector of reactions that represent the same logical process.
* @throws std::runtime_error if the provided reactions have inconsistent Q-values.
*/
explicit LogicalReaclibReaction(const std::vector<ReaclibReaction> &reactions);
explicit LogicalReaclibReaction(const std::vector<std::unique_ptr<ReaclibReaction>> &reactions);
/**
* @breif Constructs a LogicalReaction from a vector of `Reaction` objects and allows the user
@@ -673,7 +701,7 @@ namespace gridfire::reaction {
* @param reverse A flag to control if this logical reaction is reverse or not
* @returns std::runtime_error if the provided reactions have inconsistent Q-values.
*/
explicit LogicalReaclibReaction(const std::vector<ReaclibReaction> &reactions, bool reverse);
explicit LogicalReaclibReaction(const std::vector<std::unique_ptr<ReaclibReaction>> &reactions, bool reverse);
/**
* @brief Adds another `Reaction` source to this logical reaction.
@@ -718,7 +746,12 @@ namespace gridfire::reaction {
double Ye, double mue, const fourdst::composition::Composition& comp
) const override;
[[nodiscard]] ReactionType type() const override { return ReactionType::LOGICAL_REACLIB; }
[[nodiscard]] ReactionType type() const override {
if (m_weak) {
return ReactionType::LOGICAL_REACLIB_WEAK;
}
return ReactionType::LOGICAL_REACLIB;
}
[[nodiscard]] std::unique_ptr<Reaction> clone() const override;
@@ -760,6 +793,7 @@ namespace gridfire::reaction {
private:
std::vector<std::string> m_sources; ///< List of source labels.
std::vector<RateCoefficientSet> m_rates; ///< List of rate coefficient sets from each source.
bool m_weak = false;
private:
/**