tov_solve Class Reference

Class to solve the Tolman-Oppenheimer-Volkov equations. More...

#include <tov_solve.h>


Detailed Description

Class to solve the Tolman-Oppenheimer-Volkov equations.

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 $ 10^5 $.

The TOV equations (i.e. Einstein's equations for a static spherically symmetric object) are

\[ \frac{d m}{d r} = 4 \pi r^2 \varepsilon \]

\[ \frac{d P}{d r} = - \frac{G \varepsilon m}{r^2} \left( 1+\frac{P}{\varepsilon}\right) \left( 1+\frac{4 \pi P r^3}{m} \right) \left( 1-\frac{2 G m}{r}\right)^{-1} \]

where $r$ is the radial coordinate, $m(r)$ is the mass enclosed within a radius $r$, and $\varepsilon(r)$ and $P(r)$ are the energy density and pressure at $r$, and $G$ is the gravitational constant. The boundary conditions are $m(r=0)=0$ the condition $P(r=R)=0$ for some fixed radius $R$. 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

\[ M_G = \int_0^R 4 \pi r^2 \varepsilon d r \]

while the baryonic mass is given by

\[ M_B = \int_0^R 4 \pi r^2 n_B m_B \left(1-\frac{G m}{r}\right)^{-1/2} d r \]

where $n_B(r)$ is the baryon number density at radius $r$ and $m_B$ is the mass of one baryon.

The gravitational potential, $\Phi(r)$ can be determined from

\[ \frac{d \Phi}{d r} = - \frac{1}{\varepsilon} \frac{ d P}{d r} \left(1+\frac{P}{\varepsilon}\right)^{-1} \]

The proper boundary condition for the gravitational potential is

\[ \Phi(r=R) = \frac{1}{2} \ln \left(1-\frac{2 G M}{R} \right) \]

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

\[ g = \frac{G M }{R^2}\left(1-\frac{2 G M}{R}\right)^{-1/2} \]

which is given in inverse kilometers and the redshift is

\[ z = \left(1-\frac{2 G M}{R}\right)^{-1/2} - 1 \]

which is unitless.

Screen output

Note:
The function star_fun() returns gsl_efailed without calling the error handler in the case that the solver can recover gracefully from, for example, a negative pressure.
Todo:
  • The error handler is called in tov_solve()derivs for pressures less than the minimum even in normal circumstances. This should be fixed, so that errors are more rare
  • baryon mass doesn't work for fixed() (This may be fixed. We should make sure it's tested.)
  • Combine maxoutsize and kmax?
  • Document column naming issues
  • Document surface gravity and redshift
Idea for future:
  • Turn numbers in max() function into variables

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_unitsget_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 $ 5.2 \times 10^{-5} $).
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_eoste
 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]

Member Function Documentation

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:

  • "g/cm^3"
  • "erg/cm^3"
  • "MeV/fm^3"
  • "fm^-4"
  • "Msun/km^3" (i.e. solar masses per cubic kilometer)

Valid entries for the units of baryon density are:

  • "m^-3"
  • "cm^-3"
  • "fm^-3"


Field Documentation

base_ioc bio [protected]

Define some necessary I/O objects.

Idea for future:
Is this really required?

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 $ 5.2 \times 10^{-5} $).

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.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page