---
title: "Repeat the TOV calculation and check it against NICER and GW170817"
description: "Rerun an independent TOV integrator, inspect the released posterior slices and see why an acausal fit must stop."
canonical_url: "https://sandboxphysics.com/stories/neutron-star-interior/repeat-the-tov-calculation/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/neutron-star-interior/repeat-the-tov-calculation/"
last_modified: "2026-11-22"
---

[Inside a neutron star](https://sandboxphysics.com/stories/neutron-star-interior/)

# Repeat the TOV calculation and check it against NICER and GW170817

Begin with one star whose answer you can check independently. The downloadable program integrates in radius. The Lab integrates in enthalpy, a pressure coordinate that lets the solver land directly at the surface.

## Match two integrations at a known mass

Unzip the materials in a fresh directory and install the listed Python dependencies. The pressure fits are Read’s selected Table III rows with a common SLy-like crust. The JSON contains the exact inputs. The fit uses rest-mass density in grams per cubic centimeter and pressure in dynes per square centimeter. The integrator converts pressure and total energy density into inverse square kilometers.

Run the first command from the extracted directory. The Python solver advances radius with an adaptive high-order step and stops at each pressure boundary. It solves for the metric perturbation and its derivative separately. The browser uses a transformed enthalpy coordinate and integrates the derivative-to-value ratio. Both formulas are regularized near the center.

Look at SLy in the at1p4 block. Its radius is 11.7061 km, its Love number is 0.07617, and its dimensionless deformability is 295.63. The independent radius calculation stops at a geometric pressure of ten to the minus 22 inverse square kilometers. In the browser, the enthalpy reaches zero. A constant-density benchmark instead gives the interior lapses exactly and exposes any errors in the matching to the exterior clock.

$$
h(P)=\int_0^P\frac{\mathrm{d}P'}{\varepsilon(P')+P'},\qquad
\alpha(r)=\sqrt{1-2M/R}\,e^{-h(P(r))}
$$

The lapse is the rate of a stationary clock relative to a distant clock. It is determined up to the normalization at the surface.

```
python -B scripts/astronomy/ac54/replay_reference.py --eos src/scripts/physics-lab/experiments/neutron-star-interior/model/read-eos.json --output rerun.json
```

Read et al. (2009), Phys. Rev. D 79, 124032 · Hinderer (2008), with the 2009 erratum · Typel et al. (2022), CompOSE reference manual

## Extract the two published comparisons

For NICER, the chosen J0030+0451 run uses Riley’s hot spot plus crescent surface model. The equal-weight table has 12,242 rows. Use its second and third columns, gravitational mass and equatorial radius. The radius percentiles at 16, 50 and 84 percent are about 11.52, 12.71 and 13.84 km. These are marginal percentiles. Preserve the paired values when you draw the mass-radius plot.

For GW170817, use the official GWTC-1 v5 HDF5 table named in the source record. Use the detector-frame mass pair and the two component tidal values to compute the mass ratio and combined tide. A common factor in both masses cancels. Of 8,078 draws, 60 are outside the plotted window. Quantiles use every draw. For this fixed low-spin waveform, the 5th and 95th percentiles of the combined tide are 144.6 and 892.2.

The frozen model curve holds the source chirp mass at 1.186 solar masses and varies the mass ratio. Both predicted stars in that curve use one shared EOS. The measured samples keep the published low-spin posterior. Compare the overlap by eye. Assigning probabilities to fits would require a joint inference with specified priors and likelihoods.

```
python -B scripts/astronomy/ac54/extract_posteriors.py --nicer-range --members-output nicer-members --gw-hdf5 GW170817_GWTC-1.hdf5 --output posterior-rerun.json
```

Riley et al., Zenodo 3386449 v1.0.0 · LIGO–Virgo GWTC-1, P1800370 v5

## Find a plausible mass that fails the sound-speed test

Open the APR4 test at $1.80\times10^{15}\,\mathrm{g\,cm^{-3}}$. The mathematical solution here has a mass of 2.183 solar masses. Its central sound speed squared is 1.300 times light speed squared. The model rejects that state, so this mass cannot be reported as a physical maximum of the fit. A new high-density extension would need another assumption and a new calculation.

For a subtler check, compare the n equals one Love number against Hinderer’s corrected table. At compactness 0.20, the integration gives 0.045886 compared with 0.0459. At compactness 0.15, the reference result is 0.078371 versus the listed 0.0776. The replay records both residuals. The analytic weak-gravity check is a separate test of the tidal matching.

Read et al. (2009), Phys. Rev. D 79, 124032 · Hinderer (2008), with the 2009 erratum

## Files to run locally

- [Reproduction ZIP with code, inputs and fixed outputs](https://sandboxphysics.com/stories/neutron-star-interior/materials/neutron-star-reproduction.zip)
- [Independent calculation and its benchmarks](https://sandboxphysics.com/stories/neutron-star-interior/materials/reference-results.json)
- [Frozen aggregate NICER and GW170817 slices](https://sandboxphysics.com/stories/neutron-star-interior/materials/posterior-occupancy.json)
- [GW170817\_GWTC-1.hdf5](https://dcc.ligo.org/public/0157/P1800370/005/GW170817_GWTC-1.hdf5)

## [Compare the stars in the Lab](https://sandboxphysics.com/labs/neutron-star-interior/)

Select APR4 and request the highest central density. Compare the sound-speed limit on the screen with the failed offline trial. Export the selected star and check the requested density against the actual integrated density.

[How to read a hybrid-star phase diagram and joint EOS constraints](https://sandboxphysics.com/stories/neutron-star-interior/read-hybrid-star-branches/) [Return to the mass-limit explanation](https://sandboxphysics.com/stories/neutron-star-interior/why-a-star-has-a-mass-limit/)

## Sources

- [Read et al. (2009), Phys. Rev. D 79, 124032](https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevD.79.124032/fulltext)

  Equations 1–5 and 23, Tables II–III. The tabulated microphysics and the piecewise fits are separate.

- [Typel et al. (2022), CompOSE reference manual](https://doi.org/10.1140/epja/s10050-022-00847-y)

  Section 3.4 on mass, radius and perturbative tidal response.

- [Hinderer (2008), with the 2009 erratum](https://arxiv.org/pdf/0711.2420v4)

  Solves the quadrupolar metric perturbation in the fluid and matches to the exterior using the corrected equation 23.

- [Riley et al., Zenodo 3386449 v1.0.0](https://zenodo.org/records/3386449)

  Equal-weight ST+PST run 1. The associated source defines the column order. CC BY 4.0.

- [LIGO–Virgo GWTC-1, P1800370 v5](https://dcc.ligo.org/LIGO-P1800370-v5/public)

  GW170817 IMRPhenomPv2NRT low-spin posterior samples. The catalogue paper’s Table III supplies the source-frame chirp mass.

## Keep reading

Inside a neutron star · Reading path

### Inside a neutron star

1. [Article **Why a neutron star has a maximum mass**](https://sandboxphysics.com/stories/neutron-star-interior/why-a-star-has-a-mass-limit/)
2. [Article **Degeneracy pressure and the cold nuclear equation of state**](https://sandboxphysics.com/stories/neutron-star-interior/cold-matter-pressure/)
3. [Article **The TOV equations for a static neutron star**](https://sandboxphysics.com/stories/neutron-star-interior/relativistic-hydrostatic-equilibrium/)
4. [Article **From a neutron star’s Love number to a binary tide**](https://sandboxphysics.com/stories/neutron-star-interior/measure-a-static-tide/)
5. [You are here **Repeat the TOV calculation and check it against NICER and GW170817**](https://sandboxphysics.com/stories/neutron-star-interior/repeat-the-tov-calculation/)
6. [Article **How to read a hybrid-star phase diagram and joint EOS constraints**](https://sandboxphysics.com/stories/neutron-star-interior/read-hybrid-star-branches/)
