Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

The detection of relativistic corrections in cosmological N-body simulations

  • 52 Accesses


Cosmological N-body simulations are done on massively parallel computers. This necessitates the use of simple time integrators and, additionally, of mesh-grid approximations of the potentials. Recently, Adamek et al. (Nat Phys 12:346, 2016), Barrera-Hinojosa and Li (GRAMSES: a new route to general relativistic N-body simulations in cosmology—I. Methodology and code description, 2019) have developed general relativistic N-body simulations to capture relativistic effects mainly for cosmological purposes. We therefore ask whether, with the available technology, relativistic effects like perihelion advance can be detected numerically to a relevant precision. We first study the spurious perihelion shift in the Kepler problem, as a function of the integration method used and then as a function of an additional interpolation of forces on a two-dimensional lattice. This is done for several choices of eccentricities and semi-major axes. Using these results, we can predict which precisions and lattice constants allow for a detection of the relativistic perihelion advance in N-body simulation. We find that there are only small windows of parameters—such as eccentricity, distance from the central object and the Schwarzschild radius—for which the corrections can be detected in the numerics.

This is a preview of subscription content, log in to check access.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7


  1. 1.

    We use “perihelion” even if the central mass is not the Sun.

  2. 2.

    All positions, velocities, and the like are in \({\mathbb R}^2\).

  3. 3.

    In units \(\mathrm{{G m}^3} \cdot M_\text {earth}^{-1} \cdot \mathrm {M}s^{-2}\).

  4. 4.

    Due to the discretization, the angular momentum vector might not be conserved and we might have 3D motion; here, we assume that the force perpendicular to the plane of motion vanishes.

  5. 5.

    Finite elements are of course obtained more easily on triangular lattices, but, because of requirements of large parallel computations, we study the lattice \({\mathbb Z}^2\).

  6. 6.

    We use the standard algorithm “zeroin” of Dekker.

  7. 7.

    For example, after 3 turns, we divide the total angle by 3, and we do not take the difference between the angle for 3 and 2 turns. Of course, errors on these points will average out somewhat.

  8. 8.

    In this section, \(\theta \) is not the angle of the major axis, but just one of the three Euler coordinates.


  1. Adamek, J., Daverio, D., Durrer, R., Kunz, M.: Gevolution: a cosmological n-body code based on general relativity. J. Cosmol. Astropart. Phys. 2016053(7), 1–43 (2016a)

  2. Adamek, J., Daverio, D., Durrer, R., Kunz, M.: General relativity and cosmic structure formation. Nat. Phys. 12, 346 (2016b)

  3. Arnold, D.N.: Differential complexes and numerical stability. In: Tatsien, L. (Ed.) Proceedings of the International Congress of Mathematicians, Vol. I, pp. 137–157. Higher Ed. Press, Beijing (2002)

  4. Back, A.: Runge–Kutta Behavior in the Presence of a Jump Discontinuity. (Preprint) (2005)

  5. Barrera-Hinojosa, C., Li, B.: GRAMSES: a new route to general relativistic N-body simulations in cosmology—I. Methodology and code description. arXiv:1905.08890 [astro-ph.CO]

  6. Butcher, J.C.: Coefficients for the study of Runge-Kutta integration processes. J. Aust. Math. Soc. 3(2), 185–201 (1963)

  7. Hairer, E., Nørsett, S.P., Wanner, G.: Solving ordinary differential equations. I. Nonstiff problems, volume 8 of Springer Series in Computational Mathematics, 2nd edn. Springer, Berlin (1993)

  8. Hairer, E., Lubich, C., Wanner, G.: Geometric numerical integration illustrated by the Störmer-Verlet method. Acta Numer. 12, 399–450 (2003)

  9. Hairer, E., Lubich, C., Wanner, G.: Geometric Numerical Integration, volume 31 of Springer Series in Computational Mathematics. Springer, Heidelberg (2010). Structure-Preserving Algorithms for Ordinary Differential Equations, Reprint of the second edition (2006)

  10. Parsa, M., Eckart, A., Shahzamanian, B., Karas, V., Zajacek, M., Zensus, J., et al.: Investigating the relativistic motion of the stars near the supermassive black hole in the galactic center. Astrophys. J. 419(845), 22 (2017)

  11. Preto, M., Saha, P.: On post-Newtonian orbits and the Galactic-center stars. Astrophys. J. 703, 1743 (2009)

  12. Springel, V.: The cosmological simulation code gadget-2. Mon. Not. R. Astron. Soc. 364(4), 1105–1134 (2005)

  13. Stephani, H.: Relativity: An Introduction to Special and General Relativity. Cambridge University Press (Transl. from German By M. Pollock and J. Stewart) (1982)

  14. Teyssier, R.: Cosmological hydrodynamics with adaptive mesh refinement: a new high resolution code called ramses. Astron. Astrophys. 385, 337–364 (2002)

  15. Yu, H., Emberson, J., Inman, D., et al.: Differential neutrino condensation onto cosmic structure. Nature Astronomy 1(143), (2017)

Download references


We thank Martin Kunz for asking questions leading to this paper, and for helpful discussions. We thank Ruth Durrer and Jacques Rougemont for helpful comments about our manuscript. We thank the referees for their very helpful comments on our paper. JPE acknowledges partial support by an ERC advanced grant “Bridges,” (Grant No. 290843_BRIDGES) and FH acknowledges financial support from the Swiss National Science Foundation (Grant No. 200020_182231).

Author information

Correspondence to Jean-Pierre Eckmann.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.


A Newtonian and relativistic orbits

Here, first we review the equations of motion and properties of the orbits in the mechanics of Newtonian particles, and then we derive the equations for general relativistic motion. In two-dimensional polar coordinates \((r,\varphi )\), the Newton equations take the form

$$\begin{aligned} \ddot{r} - r \dot{\varphi }^2 = -\frac{G M}{r^2}. \end{aligned}$$

Writing the angular momentum per mass l in polar coordinates results in

$$\begin{aligned} l = r^2 \dot{\varphi }. \end{aligned}$$

Changing the variable to \(u (\varphi )= 1/ {r (\varphi )}\) gives

$$\begin{aligned} \frac{\mathrm{d}^2}{\mathrm{d}\varphi ^2}u + u = \frac{G M }{l^2}. \end{aligned}$$

To obtain the relativistic perihelion advance, we repeat, for the convenience of the reader, some parts of Stephani (1982, p. 193). The Schwarzschild metric as a spherically symmetric vacuum solution reads,

$$\begin{aligned} ds^2=-\Big (1- \frac{r_\mathrm{sch} }{r} \ \Big ) c^2\mathrm{d}t^2 + \Big ( {1- \frac{r_\mathrm{sch}}{r} } \Big )^{-1}{dr^2} + r^2 \big ( d \theta ^2 + \sin ^2 \theta \, d \varphi ^2 \big ), \end{aligned}$$

where \(r_\mathrm{sch}\) is the Schwarzschild radius, defined by \(r_\mathrm{sch}= \frac{2 GM}{c^2}\), and t and \(r, \theta , \varphi \) are, respectively, time and spatial spherical coordinates.Footnote 8 To obtain geodesic equations, one starts from the classical action of massive test particle,

$$\begin{aligned} \mathcal {A}=-m_o \int \sqrt{-g_{\mu \nu } \frac{\mathrm{d}x^{\mu }}{d \tau } \frac{\mathrm{d}x^{\nu }}{d \tau } } d \tau , \end{aligned}$$

where \(m_o\) is the mass of the object. Applying Euler–Lagrange equation to the Lagrangian of the test particle gives four equations, in which one sees that the angular momentum is conserved. Therefore, the motion is in a plane. By simple algebra on the equations, one finds the equation of motion as

$$\begin{aligned} \frac{\mathrm{d}^2}{\mathrm{d}\varphi ^2}u + u = \frac{G M }{l^2}+ \frac{3}{2} r_\mathrm{sch} u^2 , \end{aligned}$$

which is like Newton’s equation () plus a term which is coming from relativistic correction. We solve () to obtain the relativistic perihelion advance per period, which is well approximated by

$$\begin{aligned} \Delta \varphi _p \approx \frac{3 \pi r_\mathrm{sch}}{a \big (1- e ^2 \big )}, \end{aligned}$$

where a is semi-major axis and e is the eccentricity of the orbit.

For Mercury, this leads to the well-known perihelion advance of 42.98 arc sec per century, or \(\sim 0.103\) arc sec per period.

B The parameterization of orbits

To see the effect of discretization on different orbits in N-body simulations, we parameterize a general orbit with three parameters \((\Upsilon , \theta , e)\), where e is the eccentricity, \(\Upsilon \) is the relativistic parameter at perihelion, and \(\theta \) is the angle of semi-major axis with the lattice squares. It is important to note that these parameters are enough to explain any closed orbits in N-body simulations. Moreover, having the three parameters one could uniquely construct the mass of central object as well as the initial position and velocity of the particle.

Relativistic parameter   The relativistic parameter \(\Upsilon = \frac{r_\mathrm{sch}}{r_\mathrm{per}}\), for a fixed mass of central object it shows the scale of the orbits and for a fixed size of the orbit it is an indicator of the mass of central object. If we assume that the mass of central object is fixed, by changing the relativistic parameter, different quantities of the orbit would scale as follows:

$$\begin{aligned} M\rightarrow & {} M,\qquad r_\mathrm{per} \rightarrow \frac{r_\mathrm{per}}{\Upsilon },\nonumber \\ T\rightarrow & {} \Upsilon ^{3/2} {T},\qquad v_\mathrm{per} \rightarrow {\sqrt{\Upsilon }} { v_\mathrm{per} }. \end{aligned}$$

\(r_\mathrm{per}\) is the perihelion radius, T is the period of the orbit, and \( v_\mathrm{per} \) is the velocity of the object in the perihelion point. To rescale the orbit for the fixed central body mass and fixed eccentricity, one has to change the initial conditions as follows to obtain the new orbit:

$$\begin{aligned} x_0= & {} \frac{r_\mathrm{per}}{\Upsilon },\qquad y_0=0, \\ v_x= & {} 0,\qquad v_y={\sqrt{\Upsilon }} {v_\mathrm{per}}. \end{aligned}$$

We could of course change the central object mass instead of changing the size of the orbit while having the same relativistic parameter.

Eccentricity    Another parameter which is important in characterizing an orbit is the eccentricity, to change the eccentricity we keep the semi-major axis length fixed and we change the positions and velocities in the perihelion point to recover the desired eccentricity for the orbits

$$\begin{aligned} r_\mathrm{per} \rightarrow r_\mathrm{per} \, {\frac{1-e}{1-e_0}},\qquad v_\mathrm{per} \rightarrow v_\mathrm{per} \sqrt{\frac{1+e}{1+e_0}}, \end{aligned}$$

where e is the new eccentricity and \(e_0\) is the reference eccentricity (in our case mercury). Note that changing eccentricity also results in changing the perihelion distance and relativistic parameter.

Rotation   It appears that the angle between the semi-major axis and the lattice squares is an important parameter specially in the linear force interpolation. To rotate the orbit by angle \(\theta \), we can follow the coordinate transformations and start from the following initial condition to obtain the correct orbit,

$$\begin{aligned} x_0= & {} r_\mathrm{{per}} \cos (\theta ),\qquad y_0 = r_\mathrm{{per}} \sin (\theta ), \\ v_x= & {} -v_\mathrm{{per}} \sin (\theta ),\qquad v_y = v_\mathrm{{per}} \cos (\theta ). \end{aligned}$$

In Fig. 8, we illustrate the orbits with different ellipticities, relativistic parameters, and angles obtained from numerical results.

Fig. 8

Some examples of the parameterization of elliptic orbits, which show the role of \(\beta = \Upsilon /\Upsilon _0\), e, and \(\theta \). The orbits are obtained by solving the differential equations

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Eckmann, J., Hassani, F. The detection of relativistic corrections in cosmological N-body simulations. Celest Mech Dyn Astr 132, 2 (2020). https://doi.org/10.1007/s10569-019-9943-z

Download citation


  • Kepler orbits
  • Numerical precision
  • N-body simulation
  • Relativistic corrections
  • Cosmology