GridFire 0.6.0 General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
gridfire::rates::weak::WeakRateInterpolator Class Reference

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

`#include <weak_interpolator.h>`

## 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, InterpolationError > | get_rates (uint16_t A, uint8_t Z, double t9, double log_rhoYe, double mu_e) const
| Trilinear interpolation of weak-rate payload at a state.
std::expected< WeakRateDerivatives, InterpolationError > | get_rate_derivatives (uint16_t A, uint8_t Z, double t9, double log_rhoYe, double mu_e) const
| Finite-difference partial derivatives of the log10() fields.

## Static Private Member Functions
static uint32_t | pack_isotope_id (uint16_t A, uint8_t Z)
| Pack (A,Z) into a 32-bit key used for the internal map.

## Private Attributes
std::unordered_map< uint32_t, IsotopeGrid > | m_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:

- Trilinear interpolation of the tabulated log10(rate) and neutrino-loss fields into a WeakRatePayload via get_rates().
- Finite-difference estimates of partial derivatives via get_rate_derivatives().

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

using gridfire::rates::weak::WeakRateInterpolator::RowDataTable = std::array<RateDataRow, 77400>

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
| nodiscard

List isotopes for which tables are available.

Returns
  Vector of available Species (A,Z) derived from internal tables.

Exceptions

  std::runtime_error | If any packed (A,Z) cannot be converted to Species.

Example
  WeakRateInterpolator interp(rows);
  auto isotopes = interp.available_isotopes();
  gridfire::rates::weak::WeakRateInterpolator::WeakRateInterpolator
  WeakRateInterpolator(const RowDataTable &raw_data)
  Construct the interpolator from raw weak-rate rows.
  Definition weak_interpolator.cpp:18

## ◆ 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,
|  | double | mu_e ) const
| nodiscard

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

  A | Mass number of the isotope.
  Z | Proton number of the isotope.
  t9 | Temperature in GK (10^9 K).
  log_rhoYe | Log10 of rho*Ye (cgs density times electron fraction).
  mu_e | Electron chemical potential (MeV).

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,
|  | double | mu_e ) const
| nodiscard

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

  A | Mass number of the isotope.
  Z | Proton number of the isotope.
  t9 | Temperature in GK (10^9 K).
  log_rhoYe | Log10 of rho*Ye (cgs density times electron fraction).
  mu_e | Electron chemical potential (MeV).

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
  }
  gridfire::rates::weak::WeakRatePayload
  Interpolated weak-rate payload at a single state.
  Definition weak_types.h:86

## ◆ pack_isotope_id()

uint32_t gridfire::rates::weak::WeakRateInterpolator::pack_isotope_id | ( | uint16_t | A,
|  | uint8_t | Z )
| static private

Pack (A,Z) into a 32-bit key used for the internal map.

Layout: (A << 8) | Z. To unpack, use (key >> 8) for A and (key & 0xFF) for Z.

## Member Data Documentation

## ◆ 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:

- src/include/gridfire/reaction/weak/weak_interpolator.h
- src/lib/reaction/weak/weak_interpolator.cpp