SpECTRE  v2026.06.30
Loading...
Searching...
No Matches
io Namespace Reference

Functions and classes for reading external data formats and other I/O helpers. More...

Classes

class  ComposeTable
 Reader for the CompOSE (https://compose.obspm.fr/home) ASCII tabulated equations of state. More...

Typedefs

template<FukaIdType IdType>
using fuka_tags = typename detail::FukaTags<IdType>::type
 List of tags supplied by FUKA initial data.

Enumerations

enum class  FukaIdType {
  Bh , Bbh , Ns , Bns ,
  Bhns
}
 Type of FUKA initial data.

Functions

DataVector compute_zeta_from_free_energy_derivatives (const DataVector &d2f_dt2, const DataVector &d2f_dt_dnb, const DataVector &d2f_dt_dye, const DataVector &d2f_dnb_dye, const DataVector &df_dye, const std::vector< double > &number_density_grid, const std::vector< double > &temperature_grid, size_t number_density_points, size_t temperature_points, size_t electron_fraction_points)
 Compute \(\zeta\) analytically from the tabulated free-energy derivatives of a CompOSE 3D EoS.
template<FukaIdType IdType>
tuples::tagged_tuple_from_typelist< fuka_tags< IdType > > interpolate_from_fuka (gsl::not_null< std::mutex * > fuka_lock, const std::string &info_filename, const tnsr::I< DataVector, 3, Frame::Inertial > &x, double interpolation_offset=0., int interp_order=8, double delta_r_rel=0.3)
 Interpolate numerical FUKA initial data to arbitrary points.
template<typename Tags, typename DataType, typename CoordFrame>
tuples::tagged_tuple_from_typelist< Tags > interpolate_from_spec (const gsl::not_null< spec::Exporter * > spec_exporter, const tnsr::I< DataType, 3, CoordFrame > &x, const size_t which_interpolator)
 Interpolate numerical SpEC initial data to arbitrary points.

Detailed Description

Functions and classes for reading external data formats and other I/O helpers.

Function Documentation

◆ compute_zeta_from_free_energy_derivatives()

DataVector io::compute_zeta_from_free_energy_derivatives ( const DataVector & d2f_dt2,
const DataVector & d2f_dt_dnb,
const DataVector & d2f_dt_dye,
const DataVector & d2f_dnb_dye,
const DataVector & df_dye,
const std::vector< double > & number_density_grid,
const std::vector< double > & temperature_grid,
size_t number_density_points,
size_t temperature_points,
size_t electron_fraction_points )

Compute \(\zeta\) analytically from the tabulated free-energy derivatives of a CompOSE 3D EoS.

Computes

\[\zeta = \left.\frac{\partial p}{\partial Y_e}\right|_{\rho,\epsilon} = \left.\frac{\partial(p,\epsilon) / \partial(T,Y_e)} {\partial(Y_e,\epsilon) / \partial(T,Y_e)}\right|_{n_b} = p_{Y_e} - p_T\,\frac{\epsilon_{Y_e}}{\epsilon_T} \]

at fixed baryon density ( \(\rho \propto n_b\)), where every partial derivative is evaluated analytically from the free energy per baryon \(\mathcal{F}\). With \(p = n_b^2 \mathcal{F}_{n_b}\) and \(\epsilon = \mathcal{F} - T\mathcal{F}_T\) this gives

\begin{align}p_{Y_e} &= n_b^2\,\mathcal{F}_{n_b Y_e}, & p_T &= n_b^2\,\mathcal{F}_{n_b T}, \\ \epsilon_{Y_e} &= \mathcal{F}_{Y_e} - T\,\mathcal{F}_{T Y_e}, & \epsilon_T &= -T\,\mathcal{F}_{T T}. \end{align}

The neutron-mass scaling and rest-mass offset between CompOSE's stored \(\epsilon\) and \(\mathcal{F} - T\mathcal{F}_T\) cancel because only the ratio \(\epsilon_{Y_e}/\epsilon_T\) enters, so the result is in units of MeV/fm \(^3\) per unit \(Y_e\) (matching the tabulated pressure).

The arguments d2f_dt2, d2f_dt_dnb, d2f_dt_dye, d2f_dnb_dye, and df_dye are the CompOSE free-energy derivatives \(\mathcal{F}_{TT}\), \(\mathcal{F}_{T n_b}\), \(\mathcal{F}_{T Y_e}\), \(\mathcal{F}_{n_b Y_e}\), and \(\mathcal{F}_{Y_e}\) (Table 7.3 derivative indices 3, 4, 5, 8, and 9). The number_density_grid and temperature_grid hold the per-node \(n_b\) (in fm \(^{-3}\)) and \(T\) (in MeV).

The CompOSE table is flattened in file order, with \(Y_e\) varying fastest, then \(n_b\), then \(T\): idx = (iT * nN + in) * nYe + iYe.

◆ interpolate_from_fuka()

template<FukaIdType IdType>
tuples::tagged_tuple_from_typelist< fuka_tags< IdType > > io::interpolate_from_fuka ( gsl::not_null< std::mutex * > fuka_lock,
const std::string & info_filename,
const tnsr::I< DataVector, 3, Frame::Inertial > & x,
double interpolation_offset = 0.,
int interp_order = 8,
double delta_r_rel = 0.3 )

Interpolate numerical FUKA initial data to arbitrary points.

Template Parameters
IdTypeType of FUKA initial data
Parameters
fuka_lockLock for accessing FUKA data. This is needed because FUKA is not thread-safe. Pass in a lock that is shared with other threads that are also calling this function.
info_filenamePath to the FUKA info file to load
xCoordinates of points to interpolate to
interpolation_offsetSee FUKA documentation for export functions
interp_orderSee FUKA documentation for export functions
delta_r_relSee FUKA documentation for export functions

Returns: Data interpolated to the given points

◆ interpolate_from_spec()

template<typename Tags, typename DataType, typename CoordFrame>
tuples::tagged_tuple_from_typelist< Tags > io::interpolate_from_spec ( const gsl::not_null< spec::Exporter * > spec_exporter,
const tnsr::I< DataType, 3, CoordFrame > & x,
const size_t which_interpolator )

Interpolate numerical SpEC initial data to arbitrary points.

Template Parameters
TagsList of tags to load. The tags must correspond exactly to the list of variables that the spec_exporter was configured with. This function does not support interpolating only a subset of the variables. This is a limitation of the spec::Exporter.
DataTypedouble or DataVector.
CoordFrameThe frame of the coordinates x. These coordinates are always assumed to be in SpEC's "grid" frame.
Parameters
spec_exporterHas the numerical data already loaded. It must be configured with the same number of variables that were passed as Tags, and in the same order.
xInterpolate to these coordinates. They are assumed to be in SpEC's "grid" frame.
which_interpolatorIndex of the interpolator. See spec::Exporter documentation for details.