#include <tov_solve.h>
Integrate Tolman-Oppenheimer-Volkov (TOV) equations
The present code, as demonstrated in the tests, gives the correct central pressure and energy density of the analytical solution by Buchdahl to within less than 1 part in .
The TOV equations (i.e. Einstein's equations for a static spherically symmetric object) are
where is the radial coordinate,
is the mass enclosed within a radius
, and
and
are the energy density and pressure at
, and
is the gravitational constant. The boundary conditions are
the condition
for some fixed radius
. These boundary conditions give a series of solutions to the TOV equations as a function of the radius, although they do not necessarily have a solution for all radii.
The gravitational mass is given by
while the baryonic mass is given by
where is the baryon number density at radius
and
is the mass of one baryon.
The gravitational potential, can be determined from
The proper boundary condition for the gravitational potential is
The equation of state may be changed at any time.
Note that the pressure in the low-density eos is not strictly increasing! (see at P=4.3e-10)
The surface gravity is computed as
which is given in inverse kilometers and the redshift is
which is unitless.
Screen output
verbose=0
- Nothing (even if an error occurs).verbose=1
- Some basic information and any errors or warnings.verbose=2
- For each profile computation, information at every kilometer.verbose=3
- Profile information every 20 grid points. A keypress is required after each profile.
gsl_efailed
without calling the error handler in the case that the solver can recover gracefully from, for example, a negative pressure.Definition at line 146 of file tov_solve.h.
Public Member Functions | |
int | solution_check () |
Check the solution (unfinished). | |
int | set_units (double s_efactor=1.0, double s_pfactor=1.0, double s_nbfactor=1.0) |
Set units. | |
int | set_units (std::string eunits="", std::string punits="", std::string nunits="") |
Set units. | |
int | set_kmax (int s_maxoutsize=400, int s_kmax=40000) |
Set maximum storage for integration. | |
int | set_eos (tov_eos &ter) |
Set the EOS to use. | |
int | set_mroot (mroot< int, mm_funct< int > > &s_mrp) |
Set solver. | |
int | set_minimize (minimize< int, funct< int > > &s_mp) |
Set minimizer. | |
int | set_stepper (adapt_step< int, ode_funct< int > > &sap) |
Set the adaptive stepper. | |
Results | |
table_units & | get_results () |
Return the results data table. | |
Actual solution of equations | |
int | mvsr () |
Calculate the mass vs. radius curve. | |
int | fixed (double d_tmass) |
Calculate the profile of a star with fixed mass. | |
int | max () |
Calculate the profile of the maximum mass star. | |
Data Fields | |
gsl_min_brent< int, funct< int > > | def_min |
The default minimizer. | |
gsl_mroot_hybrids< int, mm_funct< int > > | def_solver |
The default solver. | |
gsl_astep< int, ode_funct< int > > | def_stepper |
The default adaptive stepper. | |
bool | compute_ang_vel |
If true, compute the angular velocity (default false). | |
double | cap_omega |
The angular velocity. | |
double | schwarz_km |
The schwarzchild radius in km. | |
Basic properties | |
double | mass |
mass | |
double | rad |
radius | |
double | bmass |
baryonic mass | |
double | gpot |
gravitational potential | |
Solution parameters | |
bool | generel |
Use general relativistic version (default true). | |
bool | calcgpot |
calculate the gravitational potential and the enclosed baryon mass (default false) | |
double | hmin |
smallest allowed radial stepsize (default 1.0e-4) | |
double | hmax |
largest allowed radial stepsize (default 0.05) | |
double | hstart |
initial radial stepsize (default 4.0e-3) | |
int | verbose |
control for output (default 1) | |
double | maxradius |
maximum radius for integration in km (default 60) | |
Mass versus radius parameters | |
double | prbegin |
Beginning pressure (default 7.0e-7). | |
double | prend |
Ending pressure (default 8.0e-3). | |
double | princ |
Increment for pressure (default 1.1). | |
bool | logmode |
Use 'princ' as a multiplier, not an additive increment (default true). | |
double | prguess |
Guess for central pressure in solar masses per km3 (default ![]() | |
Fixed mass parameters | |
double | tmass |
Target mass. | |
Protected Member Functions | |
int | make_unique_name (std::string &col, std::vector< std::string > &cnames) |
Ensure col does not match strings in cnames . | |
virtual int | derivs (double x, size_t nv, const ovector_base &y, ovector_base &dydx, int &pa) |
The ODE step function. | |
virtual int | derivs_ang_vel (double x, size_t nv, const ovector_base &y, ovector_base &dydx, int &pa) |
The ODE step function for the angular velocity. | |
virtual int | profile_out (double xx) |
Output a stellar profile. | |
virtual double | maxfun (double maxx, int &pa) |
The minimizer function to compute the maximum mass. | |
virtual int | starfun (size_t ndvar, const ovector_base &ndx, ovector_base &ndy, int &pa) |
The solver function to compute the stellar profile. | |
int | ang_vel () |
Compute the angular velocity. | |
Protected Attributes | |
tov_eos * | te |
The EOS. | |
bool | eos_set |
True if the EOS has been set. | |
base_ioc | bio |
Define some necessary I/O objects. | |
int | kmax |
maximum storage size (default 40000) | |
int | maxoutsize |
maximum size of output file (default 400) | |
double | presmin |
Smallest allowed pressure for integration (default: -100). | |
table_units | out_table |
The output table. | |
mroot< int, mm_funct< int > > * | mroot_ptr |
The solver. | |
minimize< int, funct< int > > * | min_ptr |
The minimizer. | |
adapt_step< int, ode_funct < int > > * | as_ptr |
The default adaptive stepper. | |
smart_interp | smi |
Interpolation object for derivs_ang_vel(). | |
User EOS | |
std::string | eunits |
Units for energy density. | |
std::string | punits |
Units for pressure. | |
std::string | nunits |
Units for baryon density. | |
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) | |
Integration storage | |
ovector | rky [6] |
ovector | rkx |
ovector | rkdydx [6] |
int set_kmax | ( | int | s_maxoutsize = 400 , |
|
int | s_kmax = 40000 | |||
) |
Set maximum storage for integration.
The variable s_kmax
is the maximum number of radial integration stepsk while s_maxoutsize
is the maximum number of points that will be output for any profile.
If s_kmax
is less than zero, there is no limit on the number of radial steps.
int set_units | ( | std::string | eunits = "" , |
|
std::string | punits = "" , |
|||
std::string | nunits = "" | |||
) |
Set units.
Valid entries for the units of energy density and pressure are:
Valid entries for the units of baryon density are:
Define some necessary I/O objects.
Definition at line 343 of file tov_solve.h.
bool generel |
Use general relativistic version (default true).
These parameters can be changed at any time.
Definition at line 167 of file tov_solve.h.
double presmin [protected] |
Smallest allowed pressure for integration (default: -100).
This can't be much smaller since we need to compute numbers near exp(-presmin)
Definition at line 372 of file tov_solve.h.
double prguess |
Guess for central pressure in solar masses per km3 (default ).
This guess is used in the function fixed().
Definition at line 200 of file tov_solve.h.
double tmass |
Target mass.
Use negative values to indicate a mass measured relative to the maximum mass. For example, if the EOS has a maximum mass of 2.0, then -0.15 will give the profile of a 1.85 solar mass star.
Definition at line 213 of file tov_solve.h.
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page