TOVSolver

I. Hawke,
F. Loeffler <loeffler@sissa.it >

December 12, 2024

Abstract

This thorn solves the Tolman-Oppenheimer-Volkov equations of hydrostatic equilibrium for a spherically symmetric static star.

1 Introduction

The Tolman-Oppenheimer-Volkoff solution is a static perfect fluid “star”. It is frequently used as a test of relativistic hydro codes. Here it is intended for use without evolving the matter terms. This provides a compact strong field solution which is static but does not contain singularities.

2 Equations

The equations for a TOV star [123] are usually derived in Schwarzschild coordinates. In these coordinates, the metric can be brought into the form \begin {equation} ds^2 = -e^{2\phi }dt^2 + \left (1-\dfrac {2m}{r}\right )^{-1}dr^2 + r^2 d\Omega ^2 \ . \end {equation}

This thorn is based on the notes of Thomas Baumgarte [4] that have been partially included in this documentation. However the notation for the fluid quantities follows [5]. Here we are assuming that the stress energy tensor is given by \begin {equation} \label {eq:Tmunu} T^{\mu \nu } = (\mu + P)u^{\mu }u^{\nu } + Pg^{\mu \nu }, \end {equation} where \(\mu \) is the total energy, \(P\) the pressure, \(u^{\mu }\) the fluid four velocity, \(\rho \) the rest-mass density, \(\epsilon \) the specific internal energy, and

\begin {eqnarray} \label {eq:fluidquantities} \mu & = & \rho (1 + \epsilon ), \\ P & = & (\Gamma - 1)\rho \epsilon , \\ P & = & K \rho ^{\Gamma }. \end {eqnarray}

This enforces a polytropic equation of state. We note that in Cactus the units are \(c = G = M_{\odot } = 1\).

The equations to give the initial data are solved (as usual) in the Schwarzschild-like coordinates with the areal radius labelled \(r\). The equations of the relativistic hydrostatic equilibrium are

\begin {eqnarray} \label {eq:TOViso} \frac {d P}{d r} & = & -(\mu + P) \frac {m + 4\pi r^3 P}{r(r - 2m)}, \\ \frac {d m}{d r} & = & 4 \pi r^2 \mu , \\ \frac {d \phi }{d r} & = & \frac {m + 4\pi r^3 P}{r(r - 2m)} \ . \\ \end {eqnarray}

Here \(m\) is the gravitational mass inside the sphere radius \(r\), and \(\phi \) the logarithm of the lapse. Once the integration is done for the interior of the star we match to the exterior (see below). In the exterior we have \begin {align} \label {eq:TOVexterior} P & = {\tt TOV\_atmosphere}, \\ m & = M, \\ \phi & = \dfrac {1}{2} \log (1-2M / r). \end {align}

In order to impose initial data in cartesian coordinates, we want to transform this solution to isotropic coordinates, in which the metric takes the form \begin {equation} \label {eq:metr_iso} ds^2 = -e^{2\phi }dt^2+e^{2\Lambda }\left (d\bar {r}^2+\bar {r}^2d\Omega ^2\right ) \ . \end {equation} Here \(\bar {r}\) denotes the isotropic radius. Matching the two metrics, one obviously finds \begin {align} r^2 &= e^{2\Lambda }\bar {r}^2 \ , \\ \left (1-\dfrac {2m}{r}\right )^{-1} dr^2 &= e^{2\Lambda }d\bar {r}^2 \ . \end {align}

As a result, we have an additional differential equation to solve in order to have \(\bar {r}(r)\), that is \begin {equation} \label {eq:rbar} \frac {d (\log (\bar {r} / r))}{\partial r} = \frac {r^{1/2} - (r-2m)^{1/2}}{r(r-2m)^{1/2}} \ . \end {equation} Given such a solution, the missing metric potential is simply given by \begin {equation} e^{\Lambda } = \dfrac {r}{\bar {r}} \ . \end {equation} In the following section we concentrate on solving Eq. (??) in the exterior and in the interior of the star.

Then, given these one-dimensional data we interpolate to get data on the three-dimensional Cactus grid; that is, we interpolate on the three dimensional r given by the x, y, z variables the physical hydro and spacetime quantities that are function of the isotropic radius \(\bar {r}\) computed above. Only linear interpolation is used. This avoids problems at the surface of the star, and does not cause problems if the number of points in the one dimensional array is sufficient (\(1\times 10^5\) is the default, which should be sufficient for medium-sized grids).

2.1 Exterior

In the exterior of the star, \(r>R\), the mass \(M\equiv m(R)\) is constant, and Eq. (??) can be solved analytically up to a constant of integration. Fixing this constant such that \(r\) and \(\bar {r}\) agree at infinity, we find \begin {equation} \bar {r} = \dfrac {1}{2}\left (\sqrt {r^2-2Mr}+r -M\right ) \ , \end {equation} or, solving for \(r\) [cfr. Exercise 31.7 of MTW [3]] \begin {equation} r=\bar {r}\left (1+\dfrac {M}{2\bar {r}}\right )^2 \ . \end {equation} The metric potential as a function of \(\bar {r}\) is obviously \begin {equation} e^{\Lambda } = \left (1+\dfrac {M}{2\bar {r}}\right )^2 \ . \end {equation}

2.2 Interior

In the interior, Eq, (??) can not be integrated analytically, because \(m\) is now a function of \(r\). Instead, we have to integrate \begin {equation} \int _0^{\bar {r}} \dfrac {d\bar {r}}{\bar {r}} = \int _0^r\left (1-\dfrac {2m}{r}\right )^{-1/2}\dfrac {dr}{r} \ . \end {equation} The left hand side can be integrated analytically, and has a singular point at \(\bar {r}=0\). The right hand side cannot be integrated analytically, but will also be singular at \(r=0\), which poses problems when trying to integrate the equation numerically. We therefore rewrite the right hand side by adding and subracting a term \(1/r\), which yields \begin {equation} \int _0^r\dfrac {1}{r(1-2m/r)^{1/2}}dr = \int _0^r\dfrac {1-(1-2m/r)^{1/2}}{r(1-2m/r)^{1/2}}dr+\int _0^r\dfrac {dr}{r} \ . \end {equation} Since \(m\sim r^3\) close to the origin, the first term on the right hand side is now regular and the second one can be integrated analytically. As a result, we find \begin {equation} \int _0^{\bar {r}}d\ln \bar {r}-\int _0^rd\ln r=\int _0^r\dfrac {1-(1-2m/r)^{1/2}}{r(1-2m/r)^{1/2}}dr \ . \end {equation} Replacing the lower limits (\(r=\bar {r}=0\)) temporarily with \(r_0\) and \(\bar {r}_0\), we can integrate the right hand side and find \begin {equation} \ln \left (\dfrac {\bar {r}}{r}\right )-\ln \left (\dfrac {\bar {r}_0}{r_0}\right )=\int _0^r\dfrac {1-(1-2m/r)^{1/2}}{r(1-2m/r)^{1/2}}dr \ , \end {equation} or \begin {equation} \bar {r} = C r \exp \left [\int _0^r\dfrac {1-(1-2m/r)^{1/2}}{r(1-2m/r)^{1/2}}dr\right ] \ . \end {equation} Here the constant of integration \(C\) is related to the ratio \(\bar {r}_0/r_0\) evaluated at the origin (which is perfectly regular). It can be chosen such that the interior solution matches the exterior solution at the surface of the star. This requirement implies \begin {equation} C = \dfrac {1}{2R}\left (\sqrt {R^2-2MR}+R-M\right )\exp \left [-\int _0^R\dfrac {1-(1-2m/r)^{1/2}}{r(1-2m/r)^{1/2}}dr\right ] \ . \end {equation} In this respect, let us recall how we do initial data for the system of equations at \(r=0\). Given a value of the central density \(\rho _c\) (in Cactus units) we pose \(P_0 = K\rho _c^{\Gamma }\), \(m_0=0\), \(\phi _0=0\) and \(\bar {r}_0 = {\tt TOV\_Tiny}\), \(r_0 = {\tt TOV\_Tiny}\). The TOV_Tiny number is hardwired into the code to avoid divide by zero errors; it is \(10^{-20}\). Also the default parameters will give the TOV star used for the long term evolutions in [6]. That is, a nonrotating \(N=1\) (\(\gamma =1+1/N=2\)) polytropic star with gravitational mass \(M=1.4M_{\odot }\), circumferential radius \(R=14.15\)km, central rest-mass density \(\rho _c=1.28 \times 10^{-3}\) and \(K=100\).

3 Use of this thorn

To use this thorn to provide initial data for the ADMBase variables \(\alpha \), \(\beta \), \(g\) and \(K\) just activate the thorn and set ADMBase:initial_data = ‘‘TOV’’.

There are two ways of coupling the matter sources to the thorn that evolves the Einstein equations. One is to use the CalcTmunu interface. This will give the components of the stress energy tensor pointwise across the grid. For an example of this, see thorn ADM in CactusEinstein.

To use the CalcTmunu interface you should

As an alternative you can use the grid functions StressEnergytt, StressEnergytx, etc. directly to have the stress energy tensor over the entire grid. To do this you just need the line friend: ADMCoupling in your interface.ccl. Although this seems much simpler, you will now only get the contributions from the TOVSolver thorn. If you want to use other matter sources, most of the current thorns (CosmologicalConstant, the hydro code, the scalar field code) all use the CalcTmunu interface.

You also have the possibility to use a parameter GRHydrotovsolver::TOV_Separation to obtain a spacetime consisting of one TOV-system for \(x>0\) and a second (similar) for \(x<0\). This parameter sets the separation of the centers of two neutron stars, has to be positive and should be larger than twice the radius of one star.
Be aware that the spacetime obtained by this is no physical spacetime and no solution of Einsteins Equations and therefore an IVP-run has to follow. This parameter was only introduced for testing purposes of the IVP-Solver and should only be considered as such. There would be better (and also easy) ways to obtain initial data for two TOVs than that.

References

[1]   R. C. Tolman, Phys. Rev. 55, 364 (1939).

[2]   J. R. Oppenheimer and G. Volkoff, Physical Review 55, 374 (1939).

[3]   C.W. Misner, K.S. Thorn and J.A. Wheeler, Gravitation (Freeman and co. NY, 1973).

[4]   T. W. Baumgarte. There is a copy of his notes in this directory:
TOVSolver/doc.

[5]   J. A. Font, M. Miller, W. Suen and M. Tobias, Phys. Rev. D61, 044011 (2000).

[6]   J. A. Font, T. Goodale, S. Iyer, M. Miller, L. Rezzolla, E. Seidel, N. Stergioulas, W. Suen and M. Tobias, Phys. Rev. D65, 084024 (2002).

4 Parameters




pert_amplitude
Scope: private REAL



Description: Amplitude of perturbation



Range Default: 0.0
*:*
Anything






perturb
Scope: private BOOLEAN



Description: Add density perturbation (you should solve the IVP if true)



Default: no






tov_clear_initial_data
Scope: private BOOLEAN



Description: Clear initial data (spacetime)? Default is yes.



Default: yes






tov_combine_method
Scope: private KEYWORD



Description: Which combine method should be used.



Range Default: average
maximum
Take the maximum of rho and gxx as clue for the rest as clue.
average
Take the average of all available parts.






tov_conformal_flat_three_metric
Scope: private BOOLEAN



Description: Use conformal factor to get the 3-metric flat. default is no



Default: no






tov_dr
Scope: private REAL



Description: The spacing in the radial direction on the 1d grid



Range Default: 5.e-4
(0.0:*
Greater than 0






tov_enforce_interpolation
Scope: private BOOLEAN



Description: Enforce the interpolation of the data onto the Hydro GFs even without tov as specified initial data



Default: no






tov_fake_evolution
Scope: private INT



Description: Fake evolution by setting ID at every step



Range Default: (none)
*:*
anything, 0 as off (default), everything else as on






tov_fast_interpolation
Scope: private BOOLEAN



Description: Use faster interpolation algorithm? Default is yes.



Default: yes






tov_gamma
Scope: private REAL



Description: The polytropic constant in P = K rhoĜamma



Range Default: 2.0
1.0:
The physical range at high Lorentz factors is [1,2], but otherwise higher values of gamma can also be used






tov_k
Scope: private REAL



Description: The polytropic constant in P = K rhoĜamma



Range Default: 100.0
(0.0:*
Greater than 0






tov_momentum_psi_power
Scope: private INT



Description: Power of Psi to be multiplied with Jî for Mom



Range Default: (none)
*:*
anything, 0 as default






tov_num_radial
Scope: private INT



Description: The number of radial points for the ODE integration



Range Default: 100000
1:*
Greater than 0






tov_num_tovs
Scope: private INT



Description: The number of TOVs



Range Default: 1
1:*
Greater than 0






tov_populate_timelevels
Scope: private INT



Description: Populate that amount of timelevels



Range Default: 1
1:3
1 (default) to 3






tov_position_x
Scope: private REAL



Description: Position of neutron star, x coordinate



Range Default: 0.0
*:*
real






tov_position_y
Scope: private REAL



Description: Position of neutron star, y coordinate



Range Default: 0.0
*:*
real






tov_position_z
Scope: private REAL



Description: Position of neutron star, z coordinate



Range Default: 0.0
*:*
real






tov_properposition
Scope: private BOOLEAN



Description: For use only with two NSs, atm only handles equal mass



Default: no






tov_rho_central
Scope: private REAL



Description: The central density



Range Default: 1e-3
(0.0:*
Must be positive






tov_save_to_datafile
Scope: private STRING



Description: Only save data to file and exit



Range Default: (none)
.*
Any filename, not used if empty






tov_solve_for_tovs
Scope: private INT



Description: Solve for TOVs even if no TOV initial data was requested?



Range Default: 3
0:3
”depreciated in favour of TOVSolver::TOV_Enfor ce_Interpolation”






tov_use_old_initial_data
Scope: private BOOLEAN



Description: Take old initial data into account (spacetime)? Default is no.



Default: no






tov_use_old_matter_initial_data
Scope: private BOOLEAN



Description: Use also old matter initial data? Default is no.



Default: no






tov_velocity_x
Scope: private REAL



Description: (fixed) Velocity of neutron star, x coordinate (caution!)



Range Default: 0.0
*:*
real






tov_velocity_y
Scope: private REAL



Description: (fixed) Velocity of neutron star, y coordinate (caution!)



Range Default: 0.0
*:*
real






tov_velocity_z
Scope: private REAL



Description: (fixed) Velocity of neutron star, z coordinate (caution!)



Range Default: 0.0
*:*
real






conformal_storage
Scope: shared from STATICCONFORMALKEYWORD



5 Interfaces

General

Implements:

tovsolver

Inherits:

admbase

hydrobase

constants

staticconformal

Uses header:

constants.h

Provides:

Set_Rho_ADM to

Set_Momentum_Source to

Set_Initial_Guess_for_u to

Rescale_Sources to

6 Schedule

This section lists all the variables which are assigned storage by thorn EinsteinInitialData/TOVSolver. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.

Storage

NONE

Scheduled Functions

CCTK_PARAMCHECK

  tov_c_paramcheck

  check parameters

 

  Language: c
  Options: global
  Type: function

CCTK_WRAGH

  tov_c_allocatememory

  allocate memory for tovsolver_c

 

  Language: c
  Options: global
  Type: function

CCTK_POSTPOSTINITIAL (conditional)

  tov_c_freememory

  free memory from tovsolver_c

 

  Language: c
  Options: global
  Type: function

HydroBase_Initial (conditional)

  tov_initial_data

  group for the tov initial data

 

  Sync: admbase::metric
    admbase::curv
    admbase::lapse
    admbase::shift
    rho
    press
    eps
    vel
    w_lorentz
  Type: group

TOV_Initial_Data (conditional)

  tov_c_integrate_rhs

  integrate the 1d equations for the tov star

 

  Language: c
  Options: global
  Type: function
  Writes: staticconformal::conformal_state(everywhere)

TOV_Initial_Data (conditional)

  tov_write_1d_datafile

  save data to file and exit

 

  After: tov_c_integrate_rhs
  Before: tov_c_exact
  Language: c
  Options: global
  Type: function

TOV_Initial_Data (conditional)

  tov_set_properpositions

  steer ns position parameters according to proper distance

 

  After: tov_c_integrate_rhs
  Before: tov_c_exact
  Language: c
  Options: global
  Type: function

TOV_Initial_Data (conditional)

  tov_c_exact

  set up the 3d quantities for the tov star

 

  After: tov_c_integrate_rhs
  Language: c
  Reads: staticconformal::conformal_state
    admbase::shift_state
    grid::coordinates
  Type: function
  Writes: admbase::alp(everywhere)
    admbase::curv(everywhere)
    admbase::metric_p_p(everywhere)
    admbase::metric_p(everywhere)
    admbase::metric(everywhere)
    admbase::shift(everywhere)
    hydrobase::eps_p_p(everywhere)
    hydrobase::rho_p_p(everywhere)
    hydrobase::vel_p_p(everywhere)
    hydrobase::w_lorentz_p_p(everywhere)
    hydrobase::eps_p(everywhere)
    hydrobase::rho_p(everywhere)
    hydrobase::vel_p(everywhere)
    hydrobase::w_lorentz_p(everywhere)
    hydrobase::eps(everywhere)
    hydrobase::rho(everywhere)
    hydrobase::vel(everywhere)
    hydrobase::w_lorentz(everywhere)
    hydrobase::press(everywhere)
    staticconformal::psi(everywhere)
    staticconformal::confac_1derivs(everywhere)
    staticconformal::confac_2derivs(everywhere)

(conditional)

  tov_prepare_fake_evolution

  prepare for fake evolution

 

  After: tov_c_exact
  Language: c
  Type: function

MoL_PostStep (conditional)

  tov_c_exact

  use fake evolution

 

  After: hydrobase_poststep
  Language: c
  Reads: staticconformal::conformal_state
    admbase::shift_state
  Type: function
  Writes: admbase::alp(everywhere)
    admbase::curv(everywhere)
    admbase::metric(everywhere)
    admbase::shift(everywhere)
    hydrobase::eps(everywhere)
    hydrobase::press(everywhere)
    hydrobase::rho(everywhere)
    hydrobase::w_lorentz(everywhere)
    hydrobase::vel(everywhere)
    staticconformal::psi(everywhere)
    staticconformal::confac_1derivs(everywhere)
    staticconformal::confac_2derivs(everywhere)