feat(neutrino): Updated neutrino output

GridFire now reports neutrino loss for reaclib reactions. Note this
currently is only computed if precomputation is enabled.
This commit is contained in:
2025-11-27 15:00:51 -05:00
parent 05175ae87c
commit 39a689ee5d
16 changed files with 97 additions and 62 deletions

View File

@@ -15,13 +15,4 @@ namespace gridfire::reaclib {
* @return A constant reference to the application-wide reaction set.
*/
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

@@ -10,7 +10,6 @@
#include <vector>
#include <unordered_set>
#include "cppad/cppad.hpp"
#include "fourdst/composition/composition.h"
@@ -48,6 +47,7 @@ namespace gridfire::reaction {
{ReactionType::REACLIB_WEAK, "Weak"},
{ReactionType::LOGICAL_REACLIB_WEAK, "Weak"},
};
/**
* @struct RateCoefficientSet
* @brief Holds the seven coefficients for the REACLIB rate equation.
@@ -358,6 +358,15 @@ namespace gridfire::reaction {
[[nodiscard]] virtual std::optional<std::vector<RateCoefficientSet>> getRateCoefficients() const = 0;
};
// 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);
class ReaclibReaction : public Reaction {
public:
~ReaclibReaction() override = default;
@@ -448,7 +457,12 @@ namespace gridfire::reaction {
*/
[[nodiscard]] std::string_view sourceLabel() const { return m_sourceLabel; }
[[nodiscard]] ReactionType type() const override { return ReactionType::REACLIB; }
[[nodiscard]] ReactionType type() const override {
if (reaction::reaction_is_weak(*this)) {
return ReactionType::REACLIB_WEAK;
}
return ReactionType::REACLIB;
}
/**
* @brief Gets the set of rate coefficients.

View File

@@ -40,8 +40,8 @@ namespace gridfire {
double energy; ///< Energy in ergs after evaluation
double dEps_dT; ///< Partial derivative of energy generation rate with respect to temperature
double dEps_dRho; ///< Partial derivative of energy generation rate with respect to density
double neutrino_energy_loss_rate; ///< Neutrino energy loss rate in ergs/g/s
double total_neutrino_flux; ///< Total neutrino flux in neutrinos/g/s
double specific_neutrino_energy_loss; ///< Neutrino energy loss rate in ergs/g/s
double specific_neutrino_flux; ///< Total neutrino flux in neutrinos/g/s
friend std::ostream& operator<<(std::ostream& os, const NetOut& netOut) {
os << "NetOut(composition=" << netOut.composition << ", num_steps=" << netOut.num_steps << ", ε=" << netOut.energy << ", dε/dT=" << netOut.dEps_dT << ", dε/dρ=" << netOut.dEps_dRho << ")";