Class eos_tov_interp (o2scl)¶
-
class eos_tov_interp : public o2scl::eos_tov¶
An EOS for the TOV solver using simple linear interpolation and an optional low-density EOS.
The simplest usage of this class is simply to use read_table() to read a tabulated EOS stored in a table_units object and optionally specify a separate crust (i.e. low-density) EOS.
There are two methods to handle the crust-core interface. The method labeled
smooth_trans
uses the crust below pressure \( P_{\mathrm{lo}} \) (equal to the value of trans_pres divided by trans_width) and the core above pressure \( P_{\mathrm{hi}} \) (the value of trans_pres times trans_width) and then in between uses\[ \varepsilon(P) = [1-\chi(P)] \varepsilon_{\mathrm{crust}}(P) + \chi(P) \varepsilon_{\mathrm{core}}(P) \]where the value \( \chi(P) \) is determined by\[ \chi(P) = (P-P_{\mathrm{lo}})/ (P_{\mathrm{hi}}-P_{\mathrm{lo}}) \, . \]This method is a bit more faithful to the original EOS tables, but the matching can result in pressures which decrease with increasing energy density. Alternatively thematch_line
method uses \( \varepsilon_{\mathrm{lo}}=\varepsilon_{\mathrm{crust}} (P_{\mathrm{lo}}) \) and \( \varepsilon_{\mathrm{hi}}=\varepsilon_{\mathrm{core}} (P_{\mathrm{hi}}) \) and\[ \varepsilon(P) = (\varepsilon_{\mathrm{hi}} - \varepsilon_{\mathrm{lo}}) \chi + \varepsilon_{\mathrm{lo}} \, . \](using the same expression for \( \chi \) ). This method less frequently results in decreasing pressures, but can deviate further from the original tables. For the baryon density, expression similar to those used for \( \varepsilon(P) \) are used for \( n_B(P) \) .By default, no crust EOS is used. If a crust EOS is specified through one of the crust EOS functions, then by default trans_width is 1.0 and
transition_mode
is set equalsmooth_trans
. This creates a discontinuous energy density between the core and crust EOS at the transition pressure. A smoother transition can be chosen by increasing trans_width to a value larger than 1. The crust EOS can be changed after the core EOS is specified.The value of trans_pres is set either by set_transition(), or any of the crust EOS functions.
Internally, energy and pressure are stored in units of \( \mathrm{M}_{\odot}/\mathrm{km}^3 \) and baryon density is stored in units of \( \mathrm{fm}^{-3} \) . The user-specified EOS table is left as is, and unit conversion is performed as needed in ed_nb_from_pr() and other functions from the units specified in the input table_units object.
A faster method is provided in o2scl::eos_tov_vectors where the user can simply specify objects of type
std::vector<double>
which store the energy density, pressure, and baryon density (which should include the crust if necessary).Mode of transitioning between crust and core EOS
-
int transition_mode¶
-
bool err_nonconv¶
If true, call the error handler if the EOS reports a non-finite value (default true)
-
static const int smooth_trans = 0¶
-
static const int match_line = 1¶
Full EOS arrays (in internal units)
-
std::vector<double> full_vece¶
Energy density.
-
std::vector<double> full_vecp¶
Pressure.
-
std::vector<double> full_vecnb¶
Baryon density.
-
void internal_read()¶
Internal function to reinterpolate if if either the core or crust tables are changed.
Crust EOS
-
bool use_crust¶
Set to true if we are using a crust EOS (default false)
-
std::vector<double> crust_vece¶
Energy densities.
-
std::vector<double> crust_vecp¶
Pressures.
-
std::vector<double> crust_vecnb¶
Baryon densities.
Core EOS
-
std::vector<double> core_vece¶
Energy densities.
-
std::vector<double> core_vecp¶
Pressures.
-
std::vector<double> core_vecnb¶
Baryon densities.
Interpolation objects
-
interp_vec<std::vector<double>> pe_int¶
-
interp_vec<std::vector<double>> pnb_int¶
-
interp_vec<std::vector<double>> gen_int¶
Unit conversion factors for core EOS
-
double efactor¶
Unit conversion factor for energy density (default 1.0)
-
double pfactor¶
Unit conversion factor for pressure (default 1.0)
-
double nfactor¶
Unit conversion factor for baryon density (default 1.0)
Properties of transition
-
double trans_pres¶
Transition pressure (in \( M_{\odot}/\mathrm{km}^3 \))
-
double trans_width¶
Transition width (unitless)
Basic EOS functions (all in the internal unit system)
-
virtual double ed_from_pr(double pr)¶
From the pressure, return the energy density.
-
virtual double pr_from_ed(double ed)¶
From the energy density, return the pressure.
-
virtual double nb_from_ed(double ed)¶
From the energy density, return the baryon density.
-
virtual double nb_from_pr(double pr)¶
From the pressure, return the baryon density.
-
virtual double ed_from_nb(double nb)¶
From the baryon density, return the energy density.
-
virtual double pr_from_nb(double nb)¶
From the baryon density, return the pressure.
Basic usage
-
void read_table(table_units<> &eosat, std::string s_cole, std::string s_colp, std::string s_colnb = "")¶
Specify the EOS through a table.
If units are specified for any of the columns, then this function attempts to automatically determine the correct conversion factors using the o2scl::convert_units object returned by o2scl::o2scl_settings . If the units for any of the columns are blank, then they are assumed to be the native units for o2scl::tov_solve .
This function copies the needed information from the table so if it is modified then this function needs to be called again to read a new table.
Note
The input table must have at least 2 rows and the pressure column must be strictly increasing.
Crust EOS functions
-
void default_low_dens_eos()¶
Negele-Vautherin-Baym-Pethick-Sutherland crust.
This crust is taken from [Negele73ns] and [Baym71tg].
-
void rns_C_low_dens_eos()¶
The EOS labeled “C” in Stergioulas’ rotating neutron star code.
This EOS is adapted from [Bethe74].
-
void s12_low_dens_eos(std::string model = "SLy4", bool external = false)¶
Crust EOS from Steiner (2012)
This function uses the neutron star crust models from ref [Steiner12].
The current acceptable values for
model
areAPR
,Gs
,Rs
andSLy4
.
-
void gcp10_low_dens_eos(std::string model = "BSk20", bool external = false)¶
Crust EOS from Goriely, Chamel, and Pearson.
From [Goriely10], [Pearson11], and [Pearson12].
-
void ngl13_low_dens_eos(double L, std::string model = "PNM", bool external = false)¶
Crust EOS from Newton et al. 2013 given L in MeV.
From [Newton13]
Current acceptable values for
model
arePNM
andJ35
.
-
void ngl13_low_dens_eos2(double S, double L, double nt, std::string fname = "")¶
Crust EOS from Newton et al. (2013) given S and L in MeV and a transition density.
Note that this function works only if \( 28 < S < 38 \) MeV, \( 25 < L < 115 \) MeV, \( 0.01 < n_t < 0.15 \), and \( L > 5 S-65~\mathrm{MeV} \) . If
fname
is a string of length 0 (the default), then this function looks for a file namednewton_SL.o2
in the data directory specified by o2scl::lib_settings_class::get_data_dir() .From [Newton13]
-
inline void no_low_dens_eos()¶
Compute with no crust EOS (this is the default)
Functions used by the tov_solve class
-
virtual void ed_nb_from_pr(double pr, double &ed, double &nb)¶
Given the pressure, produce the energy and number densities.
The arguments
pr
anded
should always be in \( M_{\odot}/\mathrm{km}^3 \) . The argument fornb
should be in \( \mathrm{fm}^{-3} \) . This requirement allows the TOV solver to be faster, assuming that it is not required to do any unit conversions while solving the TOV equations.If the baryon density is not specified, it should be set to zero or baryon_column should be set to false
Other functions
-
virtual void get_eden_user(double pres, double &ed, double &nb)¶
Get the energy density from the pressure in the user-specified unit system.
-
void get_transition(double &ptrans, double &pwidth)¶
Get the transition pressure (in the user-specified unit system) and width.
-
void set_transition(double ptrans, double pw)¶
Set the transition pressure and “width”.
Sets the transition pressure and the width (specified as a number greater than unity in
pw
) of the transition between the two EOSs. The transition should be in the same units of the user-specified EOS. The transition is done smoothly using linear interpolation between \( P=\mathrm{ptrans}/pmathrm{pw} \) and \( P=\mathrm{ptrans} \times pmathrm{pw} \).
-
int transition_mode¶