Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <vector> 8 : 9 : #include "DataStructures/DataVector.hpp" 10 : 11 : namespace io { 12 : 13 : /*! 14 : * \brief Compute \f$\zeta\f$ analytically from the tabulated free-energy 15 : * derivatives of a CompOSE 3D EoS. 16 : * 17 : * Computes 18 : * \f[ 19 : * \zeta = \left.\frac{\partial p}{\partial Y_e}\right|_{\rho,\epsilon} 20 : * = \left.\frac{\partial(p,\epsilon) / \partial(T,Y_e)} 21 : * {\partial(Y_e,\epsilon) / \partial(T,Y_e)}\right|_{n_b} 22 : * = p_{Y_e} - p_T\,\frac{\epsilon_{Y_e}}{\epsilon_T} 23 : * \f] 24 : * at fixed baryon density (\f$\rho \propto n_b\f$), where every partial 25 : * derivative is evaluated analytically from the free energy per baryon 26 : * \f$\mathcal{F}\f$. With \f$p = n_b^2 \mathcal{F}_{n_b}\f$ and 27 : * \f$\epsilon = \mathcal{F} - T\mathcal{F}_T\f$ this gives 28 : * \f{align}{ 29 : * p_{Y_e} &= n_b^2\,\mathcal{F}_{n_b Y_e}, & 30 : * p_T &= n_b^2\,\mathcal{F}_{n_b T}, \\ 31 : * \epsilon_{Y_e} &= \mathcal{F}_{Y_e} - T\,\mathcal{F}_{T Y_e}, & 32 : * \epsilon_T &= -T\,\mathcal{F}_{T T}. 33 : * \f} 34 : * The neutron-mass scaling and rest-mass offset between CompOSE's stored 35 : * \f$\epsilon\f$ and \f$\mathcal{F} - T\mathcal{F}_T\f$ cancel because only the 36 : * ratio \f$\epsilon_{Y_e}/\epsilon_T\f$ enters, so the result is in units of 37 : * MeV/fm\f$^3\f$ per unit \f$Y_e\f$ (matching the tabulated pressure). 38 : * 39 : * The arguments `d2f_dt2`, `d2f_dt_dnb`, `d2f_dt_dye`, `d2f_dnb_dye`, and 40 : * `df_dye` are the CompOSE free-energy derivatives \f$\mathcal{F}_{TT}\f$, 41 : * \f$\mathcal{F}_{T n_b}\f$, \f$\mathcal{F}_{T Y_e}\f$, 42 : * \f$\mathcal{F}_{n_b Y_e}\f$, and \f$\mathcal{F}_{Y_e}\f$ (Table 7.3 43 : * derivative indices 3, 4, 5, 8, and 9). The `number_density_grid` and 44 : * `temperature_grid` hold the per-node \f$n_b\f$ (in fm\f$^{-3}\f$) and \f$T\f$ 45 : * (in MeV). 46 : * 47 : * The CompOSE table is flattened in file order, with \f$Y_e\f$ varying 48 : * fastest, then \f$n_b\f$, then \f$T\f$: idx = (iT * nN + in) * nYe + iYe. 49 : */ 50 1 : DataVector compute_zeta_from_free_energy_derivatives( 51 : const DataVector& d2f_dt2, const DataVector& d2f_dt_dnb, 52 : const DataVector& d2f_dt_dye, const DataVector& d2f_dnb_dye, 53 : const DataVector& df_dye, const std::vector<double>& number_density_grid, 54 : const std::vector<double>& temperature_grid, size_t number_density_points, 55 : size_t temperature_points, size_t electron_fraction_points); 56 : 57 : } // namespace io