GridFire v0.7.1_rc2
General Purpose Nuclear Network
Loading...
Searching...
No Matches
gridfire::rates::weak::WeakRateInterpolator Class Reference

3D table interpolator for tabulated weak reaction data by isotope. More...

#include <weak_interpolator.h>

Collaboration diagram for gridfire::rates::weak::WeakRateInterpolator:
[legend]

Public Types

using RowDataTable = std::array< RateDataRow, 77400 >
 Raw weak-rate table type expected by the constructor.
 

Public Member Functions

 WeakRateInterpolator (const RowDataTable &raw_data)
 Construct the interpolator from raw weak-rate rows.
 
std::vector< fourdst::atomic::Species > available_isotopes () const
 List isotopes for which tables are available.
 
std::expected< WeakRatePayload, InterpolationErrorget_rates (uint16_t A, uint8_t Z, double t9, double log_rhoYe) const
 Trilinear interpolation of weak-rate payload at a state.
 
std::expected< WeakRateDerivatives, InterpolationErrorget_rate_derivatives (uint16_t A, uint8_t Z, double t9, double log_rhoYe) const
 Finite-difference partial derivatives of the log10() fields.
 

Private Attributes

quill::Logger * m_logger = fourdst::logging::LogManager::getInstance().getLogger("log")
 
std::unordered_map< uint32_t, IsotopeGridm_rate_table
 Per-isotope grids over (T9, log10(rho*Ye), mu_e) with payloads at lattice nodes.
 

Detailed Description

3D table interpolator for tabulated weak reaction data by isotope.

Builds per-isotope 3D grids over (T9, log10(rho*Ye), mu_e) and provides:

Implementation summary (constructor): rows are grouped by (A,Z), then each group's unique axis values are collected and sorted to form the three axes; the 3D payload array is populated at each lattice point with the 6 log10() fields from the raw table.

Member Typedef Documentation

◆ RowDataTable

Raw weak-rate table type expected by the constructor.

The size must match the number of rows compiled into the weak-rate library.

Constructor & Destructor Documentation

◆ WeakRateInterpolator()

gridfire::rates::weak::WeakRateInterpolator::WeakRateInterpolator ( const RowDataTable raw_data)
explicit

Construct the interpolator from raw weak-rate rows.

Groups rows by isotope (A,Z), extracts unique sorted axes for T9, log10(rho*Ye), and mu_e, and fills an internal regular grid with the log10(rate) and neutrino-loss payloads at each node. No interpolation occurs at construction time.

Member Function Documentation

◆ available_isotopes()

std::vector< fourdst::atomic::Species > gridfire::rates::weak::WeakRateInterpolator::available_isotopes ( ) const

List isotopes for which tables are available.

Returns
Vector of available Species (A,Z) derived from internal tables.
Exceptions
std::runtime_errorIf any packed (A,Z) cannot be converted to Species.
Example
WeakRateInterpolator interp(rows);
auto isotopes = interp.available_isotopes();
3D table interpolator for tabulated weak reaction data by isotope.
Definition weak_interpolator.h:29

◆ get_rate_derivatives()

std::expected< WeakRateDerivatives, InterpolationError > gridfire::rates::weak::WeakRateInterpolator::get_rate_derivatives ( uint16_t  A,
uint8_t  Z,
double  t9,
double  log_rhoYe 
) const

Finite-difference partial derivatives of the log10() fields.

Uses central differences with small fixed (1e-6) perturbations in each variable (T9, log10(rho*Ye), mu_e) and returns arrays of d(log10(field))/d(var) for all fields. If any perturbed state falls outside the table, returns a BOUNDS_ERROR with per-axis bounds; if the isotope is unknown, returns UNKNOWN_SPECIES_ERROR.

Parameters
AMass number of the isotope.
ZProton number of the isotope.
t9Temperature in GK (10^9 K).
log_rhoYeLog10 of rho*Ye (cgs density times electron fraction).
Returns
expected<WeakRateDerivatives, InterpolationError>: derivative payload on success; otherwise an InterpolationError as described above.
Example
if (auto d = interp.get_rate_derivatives(52, 26, 3.0, 6.0, 2.0); d) {
// use d->d_log_beta_minus[0..2], etc.
}

◆ get_rates()

std::expected< WeakRatePayload, InterpolationError > gridfire::rates::weak::WeakRateInterpolator::get_rates ( uint16_t  A,
uint8_t  Z,
double  t9,
double  log_rhoYe 
) const

Trilinear interpolation of weak-rate payload at a state.

Interpolates the 6 log10() fields (rates and neutrino losses) at the given state for the requested isotope. If the isotope is unknown or the state lies outside the tabulated ranges, returns an error via std::expected with detailed bounds info.

Parameters
AMass number of the isotope.
ZProton number of the isotope.
t9Temperature in GK (10^9 K).
log_rhoYeLog10 of rho*Ye (cgs density times electron fraction).
Returns
expected<WeakRatePayload, InterpolationError>: payload on success; InterpolationError::UNKNOWN_SPECIES_ERROR if (A,Z) not present; or InterpolationError::BOUNDS_ERROR if any coordinate is outside the table (with per-axis bounds included).
Example
if (auto res = interp.get_rates(52, 26, 3.0, 6.0, 2.0); res) {
const WeakRatePayload& p = *res;
} else {
// inspect res.error().type and optional bounds info
}
Interpolated weak-rate payload at a single state.
Definition weak_types.h:86

Member Data Documentation

◆ m_logger

quill::Logger* gridfire::rates::weak::WeakRateInterpolator::m_logger = fourdst::logging::LogManager::getInstance().getLogger("log")
private

◆ m_rate_table

std::unordered_map<uint32_t, IsotopeGrid> gridfire::rates::weak::WeakRateInterpolator::m_rate_table
private

Per-isotope grids over (T9, log10(rho*Ye), mu_e) with payloads at lattice nodes.


The documentation for this class was generated from the following files: