Equation of State Sub-Library: Version 0.910
Data Fields | Protected Member Functions | Protected Attributes
tov_solve Class Reference

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

#include <tov_solve.h>


Detailed Description


Mathematical background:

In units where $ c=1 $, 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 gravitational 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 \]

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) \]

which ensures that $ \phi(r) \rightarrow 0 $ as $ r \rightarrow \infty $ .

The surface gravity is

\[ 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.

The baryonic mass is typically defined by

\[ M_B = \int_0^R 4 \pi r^2 n_B m_B \left(1-\frac{2 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. Then the "binding energy" of the neutron star is defined to be $ M_B - M_G $ . If you can specify the product $ n_B m_B $ in the EOS (analogous to the rest mass energy density), it will compute the associated baryonic mass for you.

In the case of slow rigid rotation with angular velocity $ \Omega $, the moment of inertia is

\[ I = \frac{8 \pi}{3} \int_0^R dr~r^4\left(\varepsilon+P\right) e^{\Phi} \left(\frac{\bar{\omega}}{\Omega}\right) \left(1-\frac{2 G m}{r}\right)^{-1/2} \]

where the function $ \bar{\omega}(r) $ is the solution of

\[ \frac{d}{dr} \left( r^4 j \frac{d \bar{\omega}}{dr}\right) + 4 r^3 \frac{d j}{dr} \bar{\omega} = 0 \]

and the function $ j(r) $ is defined by

\[ j = \left( 1-\frac{2 G m}{r} \right) e^{-\Phi} \]

The boundary conditions for $ \bar{\omega} $ are $ d \bar{\omega}/dr = 0 $ at $ r=0 $ and

\[ \bar{\omega}(R) = \Omega - \left(\frac{R}{3}\right) \left(\frac{d \bar{\omega}}{dr}\right)_{r=R} \, . \]


General usage notes:

The equation of state may be changed at any time, by specifying the appropriate tov_eos object

Screen output:


Output tables:

The functions fixed() and max() produce output tables which represent the profile of the neutron star of the requested mass. The columns are

The function mvsr() produces a different kind of output table corresponding to the mass versus radius curve. Some points on the curve may correspond to unstable branches.


Accuracy:

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^8 $.


Other details and todos:

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:
  • 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
  • Standardize xmev_kg, etc.
  • Use convert_units?
  • Double check that fixed() doesn't give a solution on the unstable branch
  • Ensure that this class copies over the units of the user-specified columns to the table

Definition at line 243 of file tov_solve.h.

Public Member Functions

Basic operation
int set_eos (tov_eos &ter)
 Set the EOS to use.
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.
virtual int mvsr ()
 Calculate the mass vs. radius curve.
virtual int fixed (double d_tmass)
 Calculate the profile of a star with fixed mass.
virtual int max ()
 Calculate the profile of the maximum mass star.
o2_shared_ptr< table_units >::type get_results ()
 Return the results data table.
int solution_check ()
 Check the solution (unfinished)
Control numerical methods
int set_kmax (int s_maxoutsize=400, int s_kmax=80000)
 Set maximum storage for integration.
int set_mroot (mroot< mm_funct<> > &s_mrp)
 Set solver.
int set_minimize (minimize< funct > &s_mp)
 Set minimizer.
int set_stepper (adapt_step< ode_funct<> > &sap)
 Set the adaptive stepper.

Data Fields

gsl_min_brent< functdef_min
 The default minimizer.
gsl_mroot_hybrids< mm_funct<> > def_solver
 The default solver.
gsl_astep< ode_funct<> > def_stepper
 The default adaptive stepper.
bool compute_ang_vel
 If true, compute the angular velocity (default false)
double cap_omega
 The angular velocity.
Basic properties
double mass
 mass
double rad
 radius
double bmass
 baryonic mass
double gpot
 gravitational potential
Solution parameters

These parameters can be changed at any time.

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} $)
double max_begin
 Beginning pressure for maximum mass guess (default 7.0e-5)
double max_end
 Ending pressure for maximum mass guess (default 5.0e-3)
double max_inc
 Increment for pressure for maximum mass guess (default 1.3)

Protected Member Functions

int make_unique_name (std::string &col, std::vector< std::string > &cnames)
 Ensure col does not match strings in cnames.
int ang_vel ()
 Compute the angular velocity.
virtual int derivs (double x, size_t nv, const ovector_base &y, ovector_base &dydx)
 The ODE step function.
virtual int derivs_ang_vel (double x, size_t nv, const ovector_base &y, ovector_base &dydx)
 The ODE step function for the angular velocity.
virtual int profile_out (double xx)
 Construct a stellar profile.
virtual double maxfun (double maxx)
 The minimizer function to compute the maximum mass.
virtual int starfun (size_t ndvar, const ovector_base &ndx, ovector_base &ndy)
 The solver function to compute the stellar profile.

Protected Attributes

double mev_kg
 To convert MeV to kilograms.
double mev_per_fm3_msun_km3
 To convert $ MeV/fm{^3} $ to solar masses per cubic kilometer.
double tmass
 Target mass.
tov_eoste
 The EOS.
bool eos_set
 True if the EOS has been set.
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)
sm_interp smi
 Interpolation object for derivs_ang_vel()
o2_shared_ptr< table_units >::type out_table
 The output table.
mroot< mm_funct<> > * mroot_ptr
 The solver.
minimize< funct > * min_ptr
 The minimizer.
adapt_step< ode_funct<> > * as_ptr
 The adaptive stepper.
double schwarz_km
 The schwarzchild radius in km.
User EOS units
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]
 ODE functions.
ovector rkx
 Radial coordinate (in kilometers)
ovector rkdydx [6]
 The derivatives of the ODE functions.

Member Function Documentation

int tov_solve::make_unique_name ( std::string &  col,
std::vector< std::string > &  cnames 
) [protected]

Underscores are added to col until it matches none of the strings in cnames.

virtual int tov_solve::profile_out ( double  xx) [protected, virtual]

This function constructs a stellar profile in out_table from the information in rkx and rky.

int tov_solve::set_units ( std::string  eunits = "",
std::string  punits = "",
std::string  nunits = "" 
)

Valid entries for the units of energy density and pressure are:

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

Valid entries for the units of baryon density are:

  • "1/m^3"
  • "1/cm^3"
  • "1/fm^3"
int tov_solve::set_kmax ( int  s_maxoutsize = 400,
int  s_kmax = 80000 
)

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.


Field Documentation

double tov_solve::tmass [protected]

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 261 of file tov_solve.h.

double tov_solve::presmin [protected]

This quantity can't be much smaller than -100 since we need to compute numbers near $ e^{-presmin} $

Definition at line 303 of file tov_solve.h.

ovector tov_solve::rky[6] [protected]

The vector rky[0] is the gravitational mass in solar masses, and the vector rky[1] is the natural logarithm of the pressure in solar masses per cubic kilometer. When calcgpot is true, the next vector in this list is the gravitational potential (which is unitless), and when tov_eos::baryon_column is true, the next vector in this list is the baryonic mass in solar masses.

Definition at line 317 of file tov_solve.h.

This guess is used in the function fixed().

Definition at line 427 of file tov_solve.h.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Friends

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.