This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

iSyMBA: A Symplectic Massive Bodies Integrator with Planets Interpolation

Fernando Roig,1 David Nesvorný,2 Rogerio Deienno2 and Matias J. Garcia1
1Observatório Nacional, Rua Gal. Jose Cristino 77, Rio de Janeiro, RJ 20921-400, Brazil
2Department of Space Studies, Southwest Research Institute, 1050 Walnut St., Suite 300, Boulder, CO 80302, USA
E-mail: froig@on.br
(Accepted XXX. Received YYY; in original form ZZZ)
Abstract

A planetary instability occurring at time <100<100 My after formation of the giant planets in our solar system can be responsible for some characteristics of the inner solar system. However, the actual influence of the instability on the terrestrial planet formation is not well understood. The simulations of terrestrial planet formation are very CPU-expensive, and this limits the exploration of different instability scenarios. To include the effects of the giant planets instability in the simulations of terrestrial planets formation in a feasible way, we approach the problem in two steps. First, we model and record an evolution of the giant planets that replicates the present outer solar system in the end. Then, we use that orbital record, properly interpolated, as the input for a second step to simulate its effects on the terrestrial planet formation. For this second step, we developed iSyMBA, a symplectic massive bodies algorithm, where “i” stands for interpolation. iSyMBA is a very useful code to accurately evaluate the effects of planetary instabilities on minor body reservoirs, while accounting for close encounters among massive objects. We provide a detailed description of how iSyMBA was developed and implemented to study terrestrial planet formation. Adapting iSyMBA for other problems that demand interpolation from previous simulations can be done following the method described here.

keywords:
methods: numerical – software: development – software: simulations – planets and satellites: formation
pubyear: 2021pagerange: iSyMBA: A Symplectic Massive Bodies Integrator with Planets InterpolationReferences

1 Introduction

Current theories of the early evolution of the solar system invoke a temporary instability of the giant planets, that would have happened sometime after the dissipation of the gas in the protoplanetary nebula (see Nesvorný, 2018, for a review). This instability led to mutual scattering of the giant planets while they were radially migrating due to the interaction with an outer massive disk of remnant planetesimals. The instability is required to explain many dynamical features that are currently observed in the different populations of solar system bodies. These include the angular momentum deficit of the giant planets (e.g. Nesvorný & Morbidelli, 2012; Deienno et al., 2017), the inclinations of asteroids in the main belt (e.g. Roig & Nesvorný, 2015; Deienno et al., 2018), the existence of Jupiter trojans (e.g. Nesvorný et al., 2013), the orbital architecture of the Kuiper belt (e.g. Nesvorný, 2015; Gomes et al., 2018), the excited orbit of Mercury (e.g. Roig et al., 2016), the dynamical characteristics of the satellites of the jovian planets (e.g. Deienno et al., 2014; Nesvorný et al., 2014b, a), among others.

The first instability models (Tsiganis et al., 2005) assumed that the instability may have happened around 600 My after the dissipation of the gas in the protoplanetary nebula, helping to trigger the Lunar Late Heavy Bombardment (LHB; Gomes et al., 2005; Bottke et al., 2012). Recent models, however, propose that the instability may have happened as early as 10\sim 10 My after the dissipation of the gas (Nesvorný, 2018). This means that the instability might have played a relevant role in the accretion of the terrestrial planets (e.g. Clement et al., 2018, 2019; Nesvorný et al., 2021).

Using fully self consistent models to study the effects of the instability in the early evolution of the solar system may be an unfeasible task. In general, such models need to consider at least three ingredients: the giant planets, the disk of massive planetesimals that drives the migration of the giant planets, and the population of bodies affected by the instability. We refer to the latter as the target population, and it may be represented either by test particles or by mutually interacting massive bodies. This requires to explore a large number of model parameters and over a wide range of values, implying the need for hundreds or thousands of computationally expensive numerical simulations that, in most cases, lead to meaningless results.

An alternative to overcome these limitations is to use simplified, yet realistic, models where the amount of free parameters is smaller, and the user have more control over the range of possible evolutions of the system. This involves, for example, to drop off the disk of planetesimals and consider a prescribed evolution of the giant planets. This prescribed evolution might be as simple as an ad hoc evolution, mimicked by using artificial forces, or as complex as a realistic evolution obtained from other previous simulations (e.g. Nesvorný et al., 2017; Deienno et al., 2018).

Here, we develop a numerical integration method that exploits the latter approach. In this method, the evolution of the giant planets is stored in a file at regular intervals, and their positions and velocities for a given time are obtained by interpolation. Our aim is to construct a symplectic NN body integrator for the target population, that has the giant planets interpolation scheme embedded in it.

Symplectic integrators are a particular class of numerical integrators, specifically designed to solve Hamiltonian problems (Yoshida, 1993). Their main property is the conservation of a quantity H¯\overline{H}, referred to as the surrogate Hamiltonian, that is very close to the original Hamiltonian HH of the problem. Our choice for a symplectic algorithm has two motivations: (i) these algorithms have proven to be fast and reliable, allowing for long term simulations of planetary NN-body systems with less computational cost than traditional integration algorithms (e.g. Wisdom & Holman, 1991), and (ii) we intend to use the set of subroutines and packages of the well-tested and publicly available symplectic integrators Swift (Levison & Duncan, 1993) and SyMBA (Duncan et al., 1998), with the necessary modifications, as the basis for our algorithm.

When the target population consists of mass-less particles, the construction of a symplectic integrator with embedded interpolation is relatively straightforward (e.g. Beaugé et al., 2002; Roig & Nesvorný, 2015). On the other hand, when the target populations consist of massive bodies that interact with each other and may develop close encounters, including the giant planets interpolation in a symplectic way requires some specific considerations that turn the development of the algorithm more difficult. One particular problem is related to the fact that the system of giant planets has a centre-of-mass that differs from that of the target population. This requires a specific splitting of the Hamiltonian that is not accounted for in full N-body symplectic integrators.

Here, we focus on the case when the target population is in the inner solar system, and we describe the construction of the algorithm. For its recent applications, we refer the reader to Nesvorný et al. (2021) and DeSouza et al. (2021). The paper is organised as follows. In Sect. 2, we revise the basic concepts, provide the detailed description of the new algorithm, and perform some validation tests. In Sect. 3, we briefly discuss the possible parallelization strategies for the new code. The last section is devoted to the conclusions.

2 Symplectic integration with interpolation

2.1 SyMBA

Refer to caption
Figure 1: The detailed sequence of operations needed for a single integration time step, from tt to t+τt+\tau in the SyMBA code. Primed variables are referred to the centre-of-mass of the system composed by the giant planets, the terrestrial proto-planets, and the terrestrial planetesimals. Heliocentric variables are not primed.

Before proceeding with the description of iSyMBA, we will briefly review the basics of SyMBA (see Duncan et al., 1998, for more details). SyMBA stands for Symplectic Massive Bodies Algorithm, and it is a second order symplectic integrator for the planetary NN body problem, that allows for close encounters between massive bodies.

Let us assume a set of NN bodies of masses mim_{i} orbiting around the Sun (or any central star) of mass MmiM\gg m_{i}, and introduce the Poincaré canonical coordinates 𝐫i,𝐩i\mathbf{r}_{i},\mathbf{p}_{i}^{\prime} such that 𝐫i\mathbf{r}_{i} are heliocentric positions and 𝐩i=mi𝐯i\mathbf{p}_{i}^{\prime}=m_{i}\mathbf{v}_{i}^{\prime} are barycentric momenta (barycentric velocities). Throughout this work, primed variables are referred to the centre-of-mass of the system, and not primed variables are referred to the Sun. The Hamiltonian of the system is then composed of three parts:

H(𝐫,𝐩)=HKep+HInt+HSunH(\mathbf{r},\mathbf{p}^{\prime})=H_{\mathrm{Kep}}+H_{\mathrm{Int}}+H_{\mathrm{Sun}} (1)

where

HKep(𝐫,𝐩)=i=1N(|𝐩i|22miGMmi|𝐫i|)H_{\mathrm{Kep}}(\mathbf{r},\mathbf{p}^{\prime})=\sum_{i=1}^{N}\left(\frac{\left|\mathbf{p}_{i}^{\prime}\right|^{2}}{2m_{i}}-\frac{GMm_{i}}{\left|\mathbf{r}_{i}\right|}\right) (2)

represents the two body motion of the bodies around the Sun,

HInt(𝐫)=i=1N1k=i+1NGmimk|𝐫i𝐫k|H_{\mathrm{Int}}(\mathbf{r})=-\sum_{i=1}^{N-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{\left|\mathbf{r}_{i}-\mathbf{r}_{k}\right|} (3)

is the gravitational interaction potential between the bodies, and

HSun(𝐩)=12M|i=1N𝐩i|2H_{\mathrm{Sun}}(\mathbf{p}^{\prime})=\frac{1}{2M}\left|\sum_{i=1}^{N}\mathbf{p}_{i}^{\prime}\right|^{2} (4)

is the barycentric kinetic energy of the Sun.

Whenever HInt,HSunHKepH_{\mathrm{Int}},H_{\mathrm{Sun}}\ll H_{\mathrm{Kep}}, a second order symplectic integration over a time step τ\tau is obtained through the following sequence of steps:

Step 1. Evolve the system only through HSunH_{\mathrm{Sun}}, over τ/2\tau/2; this applies a linear drift (LD) to the positions 𝐫\mathbf{r}.

Step 2. Evolve the system only through HIntH_{\mathrm{Int}}, over τ/2\tau/2; this applies an impulse or kick (K) to the momenta 𝐩\mathbf{p}^{\prime}.

Step 3. Evolve the system only through HKepH_{\mathrm{Kep}}, over τ\tau; this applies a drift (D) to each body along a Keplerian orbit.

Step 4. Evolve the system only through HIntH_{\mathrm{Int}}, over τ/2\tau/2; this applies again a kick (K) to the momenta 𝐩\mathbf{p}^{\prime}.

Step 5. Evolve the system only through HSunH_{\mathrm{Sun}}, over τ/2\tau/2; this applies again a linear drift (LD) to the positions 𝐫\mathbf{r}.

The integration over a time step τ\tau is then schematised by a sequence LD - K - D - K - LD. The detailed flowchart of the algorithm is shown in Fig. 1.

However, when a close encounter between two bodies arises, the condition HIntHKepH_{\mathrm{Int}}\ll H_{\mathrm{Kep}} is no longer satisfied and the above sequence is no longer valid. In a traditional numerical integrator, the increase of the HIntH_{\mathrm{Int}} term during the close encounter is usually compensated by a decrease of the time step τ\tau, such as to keep the impulse τHInt/𝐫-\tau\,\partial H_{\mathrm{Int}}/\partial\mathbf{r} limited. However, in a symplectic integrator the time step must be kept fixed over the whole integration. This is a well known limitation of symplectic algorithms, since the surrogate Hamiltonian H¯\overline{H}, that is preserved by the algorithm, is such that H¯=H+𝒪(τn)\overline{H}=H+\mathcal{O}(\tau^{n}), being nn the order of the integrator. Thus, any change in the time step would break the conservation of H¯\overline{H}.

The solution proposed by Duncan et al. (1998) and Chambers (1999) to circumvent this limitation consists into split the term HIntH_{\mathrm{Int}} into pieces, weighted by a function that depends on the distance between the different pairs of bodies. Consider, for example, a two-terms splitting, HInt=HInt(0)+HInt(1)H_{\mathrm{Int}}=H_{\mathrm{Int}}^{(0)}+H_{\mathrm{Int}}^{(1)}, where:

HInt(0)\displaystyle H_{\mathrm{Int}}^{(0)} =i=1N1k=i+1NGmimkrik(1w1,ik)\displaystyle=-\sum_{i=1}^{N-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{r_{ik}}\left(1-w_{1,ik}\right)
HInt(1)\displaystyle H_{\mathrm{Int}}^{(1)} =i=1N1k=i+1NGmimkrikw1,ik\displaystyle=-\sum_{i=1}^{N-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{r_{ik}}w_{1,ik} (5)

Here, rik=|𝐫i𝐫k|r_{ik}=\left|\mathbf{r}_{i}-\mathbf{r}_{k}\right|, and wl,ikw_{l,ik} is a sigmoid-like weight function:

wl,ik={1,rikRl,ikϕ(rikRl+1,ikRl,ikRl+1,ik),Rl+1,ikrik<Rl,ik0,rik<Rl+1,ikw_{l,ik}=\left\{\begin{array}[]{ll}1&,\qquad r_{ik}\geq R_{l,ik}\\ \phi\left(\frac{r_{ik}-R_{l+1,ik}}{R_{l,ik}-R_{l+1,ik}}\right)&,\qquad R_{l+1,ik}\leq r_{ik}<R_{l,ik}\\ 0&,\qquad r_{ik}<R_{l+1,ik}\end{array}\right. (6)

where ϕ\phi is a suitable odd degree polynomial, and Rl,ik,Rl+1,ikR_{l,ik},R_{l+1,ik} are defined in terms of the mutual Hill radii. Then, the sequence of steps over a time step τ\tau becomes:

Step 1. Evolve the system only through HSunH_{\mathrm{Sun}}, over τ/2\tau/2

Step 2. Evolve the system only through HInt(1)H_{\mathrm{Int}}^{(1)}, over τ/2\tau/2

Step 3. Repeat from 1 to qq (q>1q>1, integer)

Step 3.1. Evolve the system only through HInt(0)H_{\mathrm{Int}}^{(0)}, over τ/2q\tau/2q

Step 3.2. Evolve the system only through HKepH_{\mathrm{Kep}}, over τ/q\tau/q

Step 3.3. Evolve the system only through HInt(0)H_{\mathrm{Int}}^{(0)}, over τ/2q\tau/2q

Step 4. Evolve the system only through HInt(1)H_{\mathrm{Int}}^{(1)}, over τ/2\tau/2

Step 5. Evolve the system only through HSunH_{\mathrm{Sun}}, over τ/2\tau/2

When rikRl,ikr_{ik}\geq R_{l,ik} (no close encounters), HInt(0)=0H_{\mathrm{Int}}^{(0)}=0 and step 3 reduces to a single evolution of HKepH_{\mathrm{Kep}} over τ\tau. On the other hand, when rik<Rl+1,ikr_{ik}<R_{l+1,ik} (close encounter), HInt(1)=0H_{\mathrm{Int}}^{(1)}=0, and step 3 effectively performs the symplectic integration using a smaller time step τ/q\tau/q. The above sequence can be represented as:

LD - K(1) -(K(0)-D-K(0))qK(1) - LDstep τstep τ/qstep τ\begin{array}[]{ccc}\underbrace{\text{LD - K}^{(1)}}\text{ -}\left(\underbrace{\mathrm{K}^{(0)}\text{-D-K}^{(0)}}\right)^{q}\text{- }\underbrace{\mathrm{K}^{(1)}\text{ - LD}}\\ {\scriptstyle\text{step }\tau}\qquad\qquad{\scriptstyle\text{step }\tau/q}\qquad\qquad{\scriptstyle\text{step }\tau}\end{array}

This strategy can be recursively extended to an arbitrary sequence of weight functions for radii R1,ik>R2,ik>>Rn,ik>Rn+1,ikR_{1,ik}>R_{2,ik}>\ldots>R_{n,ik}>R_{n+1,ik}, associating smaller and smaller time steps to each weight function. In SyMBA, Rn+1,ikR_{n+1,ik} is usually set to be of the order of the planetary radii, and R1,ikR_{1,ik} is of the order of a few Hill radii.

2.2 iSyMBA

In order to apply the above concepts to develop iSyMBA, we consider three different categories of bodies:

  1. 1.

    Giant planets: represented by JJ bodies of masses μj\mu_{j}, j=1,,Jj=1,\ldots,J. The positions 𝝆j\boldsymbol{\rho}_{j} and velocities 𝝊j\boldsymbol{\upsilon}_{j} of these bodies are directly read from a file, where they are stored at regular time intervals, and are interpolated down to the desired time step.111The storing cadence needs to be dense enough for the interpolation to work properly. A cadence of 1 year proved to be good for interpolation to time steps of a few days. In principle, interpolation could be avoided by using a cadence equal to the time step, but this unnecessarily increases the file size and also makes the algorithm too slow due to the amount of I/O operations. The giant planets perturb the other two bodies categories in the simulation, but they do not suffer any perturbation, neither among them, nor from other bodies.

  2. 2.

    Terrestrial protoplanets: represented by TT bodies of masses mimtinym_{i}\geq m_{\mathrm{tiny}}, i=1,,Ti=1,\ldots,T. The positions 𝐫i\mathbf{r}_{i} and velocities 𝐯i\mathbf{v}_{i} of these bodies are advanced through a second order symplectic integrator. They feel their mutual gravitational perturbations, as well as those from the giant planets and from the terrestrial planetesimals. Terrestrial protoplanets may also feel relativistic perturbations, if required.

  3. 3.

    Terrestrial planetesimals: represented by NTN-T bodies of masses mi<mtinym_{i}<m_{\mathrm{tiny}}, i=T+1,,Ni=T+1,\ldots,N. The positions 𝐫i\mathbf{r}_{i} and velocities 𝐯i\mathbf{v}_{i} of these bodies are also advanced through a second order symplectic integrator. They do not feel their mutual gravitational perturbations, but they are perturbed by both the giant planets and the terrestrial protoplanets. They also perturb the terrestrial protoplanets.

As in the original SyMBA code, mtinym_{\mathrm{tiny}} is a constant mass threshold, that we set, for example, to 2MMoon2\,M_{\mathrm{Moon}} in Nesvorný et al. (2021). We refer to the set of terrestrial protoplanets and planetesimals simply as the terrestrial bodies.

In the following, we describe in detail the different parts of the code. The flowchart of the algorithm is presented in Fig. 2.

2.2.1 Giant planets interpolation

The positions and velocities of the giant planets are obtained from a previous, and independent, simulation of the migration of these planets by interaction with a transneptunian disk of planetesimals (e.g. Nesvorný & Morbidelli, 2012; Deienno et al., 2018). The output of this simulation, i.e. heliocentric positions and velocities (or heliocentric orbital elements) of the giant planets, as well as their masses and the Sun mass, are stored in a file at 1-yr intervals. The masses are not necessarily constant during such evolution, since the planets and the Sun may accrete planetesimals while migrating and grow in mass.

Let 𝝆b,𝝊b,μb\boldsymbol{\rho}_{b},\boldsymbol{\upsilon}_{b},\mu_{b} be the position, velocity, and mass of a given giant planet at time tbt_{b}, and 𝝆e,𝝊e,μe\boldsymbol{\rho}_{e},\boldsymbol{\upsilon}_{e},\mu_{e} the corresponding values at a posterior time tet_{e}. Let also MbM_{b} and MeM_{e} the corresponding masses of the Sun. Assume that we want to interpolate this trajectory over a time step τ=(tetb)/n\tau=(t_{e}-t_{b})/n. The interpolation method consists of the following steps

Step 1. Advance 𝝆b,𝝊b\boldsymbol{\rho}_{b},\boldsymbol{\upsilon}_{b} from tbt_{b} to tet_{e} along a Keplerian orbit, considering the central mass Mb+μbM_{b}+\mu_{b}, to obtain the sequence of values 𝝆b(i),𝝊b(i)\boldsymbol{\rho}_{b}^{(i)},\boldsymbol{\upsilon}_{b}^{(i)}, for times ti=tb+iτt_{i}=t_{b}+i\tau, i=0,,ni=0,\ldots,n.

Step 2. Recede 𝝆e,𝝊e\boldsymbol{\rho}_{e},\boldsymbol{\upsilon}_{e} from tet_{e} to tbt_{b} along a Keplerian orbit, considering the central mass Me+μeM_{e}+\mu_{e}, to obtain the sequence of values 𝝆e(j),𝝊e(j)\boldsymbol{\rho}_{e}^{(j)},\boldsymbol{\upsilon}_{e}^{(j)}, for times tj=tejτt_{j}=t_{e}-j\tau, j=0,,nj=0,\ldots,n.

Step 3. Compute the interpolated values at time tbtktet_{b}\leq t_{k}\leq t_{e} through a weighted average:

𝝆k\displaystyle\boldsymbol{\rho}_{k} =(1wk)𝝆b(k)+wk𝝆e(nk)\displaystyle=(1-w_{k})\boldsymbol{\rho}_{b}^{(k)}+w_{k}\boldsymbol{\rho}_{e}^{(n-k)}
𝝊k\displaystyle\boldsymbol{\upsilon}_{k} =(1wk)𝝊b(k)+wk𝝊e(nk)\displaystyle=(1-w_{k})\boldsymbol{\upsilon}_{b}^{(k)}+w_{k}\boldsymbol{\upsilon}_{e}^{(n-k)}
𝝁k\displaystyle\boldsymbol{\mu}_{k} =(1wk)𝝁b+wk𝝁e\displaystyle=(1-w_{k})\boldsymbol{\mu}_{b}+w_{k}\boldsymbol{\mu}_{e}
Mk\displaystyle M_{k} =(1wk)Mb+wkMe\displaystyle=(1-w_{k})M_{b}+w_{k}M_{e} (7)

where wk=k/nw_{k}=k/n, k=0,,nk=0,\ldots,n.

We recall that these interpolated coordinates are heliocentric. A similar interpolation strategy was already implemented in the Swift_RMVS3 integrator to deal with encounters of test particles to massive bodies (Levison & Duncan, 1993), and the corresponding subroutine has been adapted with the necessary modifications to account for mass changes.

The interpolation of a giant planet that disappears from the system, either by escaping or by merging to another giant, can be performed only until the last registry of that planet stored in the file. In such case, since the orbits are stored at 1-yr intervals, we loose only a few months of evolution of the giant that disappears. This is not expected to have any significant influence on the evolution of the target population over million years. Moreover, in the case of a merging between two giant planets, one giant disappears but another has its mass increased. This latter giant will be properly interpolated since the interpolation scheme takes into account any variation of the planet’s mass.

It is worth noting that the symplectic algorithm described in the next sections is independent of the particular interpolation scheme. Other interpolation routines, different that the one presented here, can be applied with the same result.

2.2.2 Terrestrial bodies integration

Refer to caption
Figure 2: The detailed sequence of operations needed for a single time step integration, from tt to t+τt+\tau in the iSyMBA code. Primed variables are referred to the centre-of-mass of the system composed by the giant planets (GP), the terrestrial proto-planets (PP) and planetesimals (PL). Heliocentric variables are not primed.

The key contribution to the development of the algorithm consists in the second order symplectic integrator to advance the orbits of the terrestrial bodies over a time step τ\tau. This is constituted by a specific sequence of Lie series, applied to a non autonomous Hamiltonian of the form:

H(𝐫,𝐩,t)=HKep+HPert+HJov+HSunH(\mathbf{r},\mathbf{p}^{\prime},t)=H_{\mathrm{Kep}}+H_{\mathrm{Pert}}+H_{\mathrm{Jov}}+H_{\mathrm{Sun}} (8)

where, again, 𝐫i,𝐩i\mathbf{r}_{i},\mathbf{p}_{i}^{\prime} are the Poincaré canonical coordinates. The Hamiltonian is time dependent though the heliocentric positions 𝝆j\boldsymbol{\rho}_{j} and the barycentric momenta (velocities) 𝝅j=μj𝝊j\boldsymbol{\pi}_{j}^{\prime}=\mu_{j}\boldsymbol{\upsilon}_{j}^{\prime} of the giant planets, which are computed from the interpolated heliocentric values (Sect. 2.2.1). It is worth noting that the barycentric momenta 𝐩,𝝅\mathbf{p}^{\prime},\boldsymbol{\pi}^{\prime} are referred to the centre-of-mass of the whole system, i.e. considering the terrestrial bodies and the giant planets altogether.

The different terms of the Hamiltonian are:

HKep(𝐫,𝐩)=i=1N(|𝐩i|22miGMmi|𝐫i|)H_{\mathrm{Kep}}(\mathbf{r},\mathbf{p}^{\prime})=\sum_{i=1}^{N}\left(\frac{\left|\mathbf{p}_{i}^{\prime}\right|^{2}}{2m_{i}}-\frac{GMm_{i}}{\left|\mathbf{r}_{i}\right|}\right) (9)

that represents the two body motion of the terrestrial bodies around the Sun, of mass MM,

HPert(𝐫)=i=1T1k=i+1NGmimk|𝐫i𝐫k|H_{\mathrm{Pert}}(\mathbf{r})=-\sum_{i=1}^{T-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{\left|\mathbf{r}_{i}-\mathbf{r}_{k}\right|} (10)

which is the mutual gravitational perturbation among the terrestrial bodies,

HJov(𝐫,t)=i=1Nj=1JGmiμj|𝐫i𝝆j(t)|H_{\mathrm{Jov}}(\mathbf{r},t)=-\sum_{i=1}^{N}\sum_{j=1}^{J}\frac{Gm_{i}\mu_{j}}{\left|\mathbf{r}_{i}-\boldsymbol{\rho}_{j}(t)\right|} (11)

that gives the direct gravitational perturbation of the giant planets on the terrestrial bodies, and

HSun(𝐩,t)=12M|i=1N𝐩i+j=1J𝝅j(t)|2H_{\mathrm{Sun}}(\mathbf{p}^{\prime},t)=\frac{1}{2M}\left|\sum_{i=1}^{N}\mathbf{p}_{i}^{\prime}+\sum_{j=1}^{J}\boldsymbol{\pi}_{j}^{\prime}(t)\right|^{2} (12)

that represents the linear momentum of the Sun around the centre-of-mass of the whole system.

The detailed sequence of operations for a single time step integration, from tt to t+τt+\tau, is as follows:

Step 1. Start with the heliocentric positions and velocities 𝐫,𝐯\mathbf{r},\mathbf{v} of all the terrestrial bodies, obtained from the previous time step, as well as the heliocentric positions and velocities 𝝆,𝝊\boldsymbol{\rho},\boldsymbol{\upsilon} interpolated for the giant planets, at time tt.

Step 2. Calculate the heliocentric acceleration 𝐚R\mathbf{a}_{\mathrm{R}} on the terrestrial protoplanets due to relativistic corrections (Quinn et al., 1991):

𝐚R,i=GMc2|𝐫i|3(4𝐫i𝐯i𝐯i𝐯i𝐯i𝐫i+4M𝐫i|𝐫i|),i=1,,T\mathbf{a}_{\mathrm{R},i}=\frac{GM}{c^{2}\left|\mathbf{r}_{i}\right|^{3}}\left(4\,\mathbf{r}_{i}\cdot\mathbf{v}_{i}\,\mathbf{v}_{i}-\mathbf{v}_{i}\cdot\mathbf{v}_{i}\,\mathbf{r}_{i}+4M\frac{\mathbf{r}_{i}}{\left|\mathbf{r}_{i}\right|}\right),\quad i=1,\ldots,T (13)

Step 3. Apply a kick, over τ/2\tau/2, in the heliocentric velocities 𝐯\mathbf{v} of the terrestrials protoplanets due to the relativistic acceleration correction:

𝐯i𝐯i+τ2𝐚R,i,i=1,,T\mathbf{v}_{i}\longleftarrow\mathbf{v}_{i}+\frac{\tau}{2}\mathbf{a}_{\mathrm{R},i},\qquad i=1,\ldots,T (14)

Step 4. Convert the heliocentric velocities 𝐯,𝝊\mathbf{v},\boldsymbol{\upsilon} of all bodies to barycentric 𝐯,𝝊\mathbf{v}^{\prime},\boldsymbol{\upsilon}^{\prime}, with respect to the centre-of-mass of the whole system:

𝐕\displaystyle\mathbf{V}^{\prime} =i=1Nmi𝐯i+j=1Jμj𝝊jM+i=1Nmi+j=1Jμj\displaystyle=-{\displaystyle\frac{\sum_{i=1}^{N}m_{i}\mathbf{v}_{i}+\sum_{j=1}^{J}\mu_{j}\boldsymbol{\upsilon}_{j}}{M+\sum_{i=1}^{N}m_{i}+\sum_{j=1}^{J}\mu_{j}}}
𝐯i\displaystyle\mathbf{v}_{i}^{\prime} =𝐯i+𝐕,i=1,,N\displaystyle=\mathbf{v}_{i}+\mathbf{V}^{\prime},\qquad\qquad\qquad i=1,\ldots,N
𝝊j\displaystyle\boldsymbol{\upsilon}_{j}^{\prime} =𝝊j+𝐕,j=1,,J\displaystyle=\boldsymbol{\upsilon}_{j}+\mathbf{V}^{\prime},\,\,\,\quad\qquad\qquad j=1,\ldots,J (15)

Step 5. Compute the heliocentric accelerations 𝐚J\mathbf{a}_{\mathrm{J}} on the terrestrial bodies due to the giant planets:

𝐚J,i=j=1JGμj𝐫i𝝆j|𝐫i𝝆j|3,i=1,,N\mathbf{a}_{\mathrm{J},i}=-\sum_{j=1}^{J}G\mu_{j}\frac{\mathbf{r}_{i}-\boldsymbol{\rho}_{j}}{\left|\mathbf{r}_{i}-\boldsymbol{\rho}_{j}\right|^{3}},\qquad i=1,\ldots,N (16)

Step 6. Apply a kick, over τ/2\tau/2, in the barycentric velocities 𝐯\mathbf{v}^{\prime} of the terrestrial bodies due to these accelerations:

𝐯i𝐯i+τ2𝐚J,i,i=1,,N\mathbf{v}_{i}^{\prime}\longleftarrow\mathbf{v}_{i}^{\prime}+\frac{\tau}{2}\mathbf{a}_{\mathrm{J},i},\qquad i=1,\ldots,N (17)

Step 7. Perform a linear drift, over τ/2\tau/2, of the heliocentric positions 𝐫\mathbf{r} of the terrestrial bodies due to the giant planets contribution to the Sun momentum:

𝐫i𝐫i+τ2Mj=1Jμj𝝊j,i=1,,N\mathbf{r}_{i}\longleftarrow\mathbf{r}_{i}+\frac{\tau}{2M}\sum_{j=1}^{J}\mu_{j}\boldsymbol{\upsilon}_{j}^{\prime},\qquad i=1,\ldots,N (18)

Step 8. Perform a linear drift, over τ/2\tau/2, of the heliocentric positions 𝐫\mathbf{r} of the terrestrial bodies due to their own contribution to the Sun momentum:

𝐫i𝐫i+τ2Mk=1Nmk𝐯k,i=1,,N\mathbf{r}_{i}\longleftarrow\mathbf{r}_{i}+\frac{\tau}{2M}\sum_{k=1}^{N}m_{k}\mathbf{v}_{k}^{\prime},\qquad i=1,\ldots,N (19)

Step 9. Compute the heliocentric mutual accelerations 𝐚T\mathbf{a}_{\mathrm{T}} of the terrestrial protoplanets and planetesimals:

𝐚T,i\displaystyle\mathbf{a}_{\mathrm{T},i} =k=i+1NGmk𝐫i𝐫k|𝐫i𝐫k|3,i=1,,T\displaystyle={\displaystyle-\sum_{k=i+1}^{N}Gm_{k}\frac{\mathbf{r}_{i}-\mathbf{r}_{k}}{\left|\mathbf{r}_{i}-\mathbf{r}_{k}\right|^{3}}},\qquad i=1,\ldots,T
𝐚T,k\displaystyle\mathbf{a}_{\mathrm{T},k} =i=1TGmi𝐫k𝐫i|𝐫k𝐫i|3,k=T+1,,N\displaystyle={\displaystyle-\sum_{i=1}^{T}Gm_{i}\frac{\mathbf{r}_{k}-\mathbf{r}_{i}}{\left|\mathbf{r}_{k}-\mathbf{r}_{i}\right|^{3}}},\qquad k=T+1,\ldots,N (20)

Step 10. Apply a kick, over τ/2\tau/2, in the barycentric velocities 𝐯\mathbf{v}^{\prime} of the terrestrial bodies due to these accelerations:

𝐯i𝐯i+τ2𝐚T,i,i=1,,N\mathbf{v}_{i}^{\prime}\longleftarrow\mathbf{v}_{i}^{\prime}+\frac{\tau}{2}\mathbf{a}_{\mathrm{T},i},\qquad i=1,\ldots,N (21)

Step 11. Drift the heliocentric positions 𝐫\mathbf{r} and barycentric velocities 𝐯\mathbf{v}^{\prime} of the terrestrial protoplanets and planetesimals along the Keplerian orbits generated by the Hamiltonian HKepH_{\mathrm{Kep}} (Eq. 9), over a full time step τ\tau

Step 12. Recompute the heliocentric mutual accelerations 𝐚T\mathbf{a}_{\mathrm{T}} of the terrestrial bodies (Eq. 20)

Step 13. Apply a kick, over τ/2\tau/2, in the barycentric velocities 𝐯\mathbf{v}^{\prime} of the terrestrial bodies due to these accelerations (Eq. 21)

Step 14. Perform a linear drift, over τ/2\tau/2, of the heliocentric positions 𝐫\mathbf{r} of the terrestrial bodies due to their own contribution to the Sun momentum (Eq. 19)

Step 15. Convert the heliocentric velocities 𝝊\boldsymbol{\upsilon} of the giant planets at time t+τt+\tau to barycentric 𝝊\boldsymbol{\upsilon}^{\prime}, with respect to the centre-of-mass of the whole system:

𝐕\displaystyle\mathbf{V}^{\prime} =i=1Nmi𝐯i+j=1Jμj𝝊jM+j=1Jμj\displaystyle={\displaystyle-\frac{\sum_{i=1}^{N}m_{i}\mathbf{v}_{i}^{\prime}+\sum_{j=1}^{J}\mu_{j}\boldsymbol{\upsilon}_{j}}{M+\sum_{j=1}^{J}\mu_{j}}}
𝝊j\displaystyle\boldsymbol{\upsilon}_{j}^{\prime} =𝝊j+𝐕,j=1,,J\displaystyle=\boldsymbol{\upsilon}_{j}+\mathbf{V}^{\prime},\qquad\qquad\qquad j=1,\ldots,J (22)

Step 16. Perform a linear drift, over τ/2\tau/2, of the heliocentric positions 𝐫\mathbf{r} of the terrestrial bodies due to the giant planets contribution to the Sun momentum (Eq. 18)

Step 17. Recompute the heliocentric accelerations 𝐚J\mathbf{a}_{\mathrm{J}} on the terrestrial bodies due to the giant planets (Eq. 16)

Step 18. Apply a kick, over τ/2\tau/2, in the barycentric velocities 𝐯\mathbf{v}^{\prime} of the terrestrial bodies due to these accelerations (Eq. 17)

Step 19. Convert back the barycentric velocities 𝐯\mathbf{v}^{\prime} of the terrestrial bodies to heliocentric 𝐯\mathbf{v}:

𝐕\displaystyle\mathbf{V}^{\prime} =i=1Nmi𝐯i+j=1Jμj𝝊jM\displaystyle={\displaystyle-\frac{\sum_{i=1}^{N}m_{i}\mathbf{v}_{i}^{\prime}+\sum_{j=1}^{J}\mu_{j}\boldsymbol{\upsilon}_{j}^{\prime}}{M}}
𝐯i\displaystyle\mathbf{v}_{i} =𝐯i𝐕,i=1,,N\displaystyle=\mathbf{v}_{i}^{\prime}-\mathbf{V}^{\prime},\qquad\qquad\qquad i=1,\ldots,N (23)

Step 20. Recalculate the heliocentric acceleration 𝐚R\mathbf{a}_{\mathrm{R}} on the terrestrial protoplanets due to relativistic corrections (Eq. 13)

Step 21. Apply a kick, over τ/2\tau/2, in the heliocentric velocities 𝐯\mathbf{v} of the terrestrials protoplanets due to the relativistic acceleration correction (Eq. 14)

Step 22. Return to step 2.

At variance with the standard SyMBA code, that uses a LD - K - D - K - LD sequence, iSyMBA uses a KJ - LDJ - LDT - KT - DT - KT - LDT - LDJ - KJ sequence, where the sub-indices J,T refer to jovian and terrestrial, respectively, with an additional outer KR sequence for relativistic corrections, if required. This specific sequence has three advantages over other possible sequences:

  1. 1.

    The giant planets perturbations (Eq. 16) do not need to be recomputed at the beginning of each time step; they can be recovered from the final values of the previous time step.

  2. 2.

    If relativistic corrections are not accounted for, there is no need to recompute the barycentric velocities at the beginning of each time step (Eq. 15); they can be recovered from the final values of the previous time step.

  3. 3.

    The innermost LDT - KT - DT - KT - LDT sequence (steps 8 to 14), that treats the interactions among the terrestrial bodies solely, could be executed by the standard SyMBA algorithm.

2.2.3 Treatment of close encounters among terrestrial bodies

Close encounters among terrestrial protoplanets, or between terrestrial protoplanets and planetesimals, are manipulated by iSyMBA using the same strategy of SyMBA, i.e. by splitting the potential term (Eq. 10) as:

HPert(𝐫)\displaystyle H_{\mathrm{Pert}}(\mathbf{r}) =HPert(0)+s=1nHPert(s)\displaystyle=H_{\mathrm{Pert}}^{(0)}+\sum_{s=1}^{n}H_{\mathrm{Pert}}^{(s)} (24)
HPert(0)\displaystyle H_{\mathrm{Pert}}^{(0)} =i=1T1k=i+1NGmimkrikl=1n(1wl,ik)\displaystyle=-\sum_{i=1}^{T-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{r_{ik}}\prod_{l=1}^{n}\left(1-w_{l,ik}\right) (25)
HPert(s)\displaystyle H_{\mathrm{Pert}}^{(s)} =i=1T1k=i+1NGmimkrikws,ikl=1s1(1wl,ik)\displaystyle=-\sum_{i=1}^{T-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{r_{ik}}w_{s,ik}\prod_{l=1}^{s-1}\left(1-w_{l,ik}\right) (26)

where the wl,ikw_{l,ik} are given by Eq. (6). The propagation of the orbits of any two bodies involved in an encounter during the innermost LDT-KT-DT-KT-LDT sequence (steps 8 to 14), is carried out recursively through the nested application of a KT-DT-KT sequence to the Hamiltonian (((HKep+HPert(0))+HPert(1))+)+HPert(n)\left(\left(\left(H_{\mathrm{Kep}}+H_{\mathrm{Pert}}^{(0)}\right)+H_{\mathrm{Pert}}^{(1)}\right)+\ldots\right)+H_{\mathrm{Pert}}^{(n)}, using smaller and smaller time steps τl=τ/3l\tau_{l}=\tau/3^{l}, l=1,,nl=1,\ldots,n.

For this stage, we use the original SyMBA subroutines, with little modifications. Bodies are always merged whenever they reach the last stage of the recursion and get closer than Rn+1,ikR_{n+1,ik}.

2.2.4 Treatment of close encounters between terrestrial bodies and giant planets

Close encounters with giant planets are not properly manipulated by iSyMBA. The application of a splitting strategy to the term HJovH_{\mathrm{Jov}} (Eq. 11) would demand additional interpolations of the giant planets orbits, down to smaller and smaller time steps. This would also require significant changes to the standard SyMBA recursive subroutines, which turns to be a quite complex task. Therefore, we leave this implementation to a future work

Currently, the way iSyMBA deals with such close encounters is to keep tracking the distances between the protoplanets/planetesimals and the giant planets, and discard the former when they get closer to a giant planet than the sum of their individual Hill radii. This solution proved to be adequate for our purposes, since the disk of terrestrial bodies is interior to Jupiter’s orbit. Thus, we may expect that close encounters of planetesimals with the giant planets will be rare, and they eventually will affect only the outer edge of the disk. In particular, using the results of Nesvorný et al. (2021), we verified that, when the disk extends up to 4 au with a radial surface density profile Σ(r)=r1\Sigma(r)=r^{-1}, less than 30% of the planetesimals experienced close encounters with Jupiter during the simulations.

2.2.5 Treatment of small perihelion passages

The iSyMBA code does not properly treat the HSunH_{\mathrm{Sun}} term increase (Eq. 12) when a terrestrial body experiences a small perihelion passage or get too close to the Sun. This limitation also exists in the standard SyMBA code. In such cases, the code relies only in the setup of a sufficiently small time step to resolve the perihelion passage without loosing too much precision. In Nesvorný et al. (2021), we setup a time step τ=3\tau=3-7 days, which proved to be good enough in that application. Bodies are discarded whenever they reach heliocentric or perihelion distances smaller than a given threshold, set by the user.

2.2.6 Symplecticity and energy conservation

The symplecticity of iSyMBA is guaranteed by the conservation of the corresponding surrogate Hamiltonian:

H¯\displaystyle\overline{H} =HKep+HPert+HJov+HSun\displaystyle=H_{\mathrm{Kep}}+H_{\mathrm{Pert}}+H_{\mathrm{Jov}}+H_{\mathrm{Sun}}
i=0nτi212[[HKep,HPert,i],HKep+12HPert,i+j=i+1nHPert,j]\displaystyle-\sum_{i=0}^{n}\frac{\tau_{i}^{2}}{12}\Big{[}\Big{[}H_{\mathrm{Kep}}\,,\,H_{\mathrm{Pert},i}\Big{]}\,,\,H_{\mathrm{Kep}}+\frac{1}{2}H_{\mathrm{Pert},i}+\sum_{j=i+1}^{n}H_{\mathrm{Pert},j}\Big{]}
τ0212[[HKep,HSun],HKep+12HSun]\displaystyle-\frac{\tau_{0}^{2}}{12}\Big{[}\Big{[}H_{\mathrm{Kep}}\,,\,H_{\mathrm{Sun}}\Big{]}\,,\,H_{\mathrm{Kep}}+\frac{1}{2}H_{\mathrm{Sun}}\Big{]}
τ0212[[HKep,HJov],HKep+12HJov]+𝒪(τ4)\displaystyle-\frac{\tau_{0}^{2}}{12}\Big{[}\Big{[}H_{\mathrm{Kep}}\,,\,H_{\mathrm{Jov}}\Big{]}\,,\,H_{\mathrm{Kep}}+\frac{1}{2}H_{\mathrm{Jov}}\Big{]}+\mathcal{O}(\tau^{4}) (27)

where [,][,] represents the Lagrange brackets. In practice, the total energy can be computed as the sum of the barycentric kinetic and potential energies, taking into account all the three categories of bodies in the system:

E\displaystyle E =12M|𝐕|2+i=1N12mi|𝐯i|2+j=1J12μj|𝝊j|2\displaystyle=\frac{1}{2}M\big{|}\mathbf{V}^{\prime}\big{|}^{2}+\sum_{i=1}^{N}\frac{1}{2}m_{i}\big{|}\mathbf{v}_{i}^{\prime}\big{|}^{2}+\sum_{j=1}^{J}\frac{1}{2}\mu_{j}\big{|}\boldsymbol{\upsilon}_{j}^{\prime}\big{|}^{2}
i=1NGMmi|𝐫i|i=1T1k=i+1NGmimk|𝐫i𝐫k|j=1JGMμj|𝝆j|\displaystyle-\sum_{i=1}^{N}\frac{GMm_{i}}{\big{|}\mathbf{r}_{i}\big{|}}-\sum_{i=1}^{T-1}\sum_{k=i+1}^{N}\frac{Gm_{i}m_{k}}{\big{|}\mathbf{r}_{i}-\mathbf{r}_{k}\big{|}}-\sum_{j=1}^{J}\frac{GM\mu_{j}}{\big{|}\boldsymbol{\rho}_{j}\big{|}}
j=1J1k=j+1JGμjμk|𝝆j𝝆k|i=1Nj=1JGmiμj|𝐫i𝝆j|\displaystyle-\sum_{j=1}^{J-1}\sum_{k=j+1}^{J}\frac{G\mu_{j}\mu_{k}}{\big{|}\boldsymbol{\rho}_{j}-\boldsymbol{\rho}_{k}\big{|}}-\sum_{i=1}^{N}\sum_{j=1}^{J}\frac{Gm_{i}\mu_{j}}{\big{|}\mathbf{r}_{i}-\boldsymbol{\rho}_{j}\big{|}} (28)

It is worth recalling that in iSyMBA, the model Hamiltonian is non autonomous. Therefore, the energy is not expected to be constant, but it should display periodic oscillations with bounded amplitude.

2.3 Validation tests

The iSyMBA algorithm has been validated as follows. We consider a system consisting of JJ giant planets and TT terrestrial planets, and perform a simulation over 1 My using the standard SyMBA, i.e. allowing for all the planets to be mutually perturbed. The output (orbital elements) of this simulation for the giant planets is stored in a file every 1 year, while the output for the terrestrial planets is stored in a separate file every 1 000 years. Then, we repeat the simulation using iSyMBA, with the same initial conditions for the terrestrial planets, and interpolating the giant planets’ orbits from the ones previously stored. The output of this simulation is recorded every 1 000 years, and it is directly compared to the previous output from SyMBA. In all the simulations, we check that the total energy of the system, computed from Eq. (28), is well behaved.

We apply the above validation test to two different systems. The first one is the present solar system, with 4 terrestrial and 4 giant planets. Initial conditions are taken from the JPL Ephemerides. Relativistic perturbations are not taken into account, and there are no close encounters between the planets. We call this the 4G4T model.

The second system is a fictitious system composed of 5 giant planets and 20 terrestrial bodies. The giant planets are Jupiter, Saturn, and 3 ice giants, initially in a mutual resonant and compact orbital configuration (see DeSouza et al., 2021, for example). The 20 terrestrial bodies are represented by planetary embryos with a total mass of 5 MM_{\oplus}. These bodies are uniformly distributed in a very narrow annulus, between 0.95 and 1.05 au, with eccentricities <0.01<0.01 and inclinations <0.001<0.001. The idea of this setup is to force close encounters between the terrestrial bodies, in order to test the behaviour of iSyMBA under such conditions. Relativistic perturbations are not taken into account either. We call this the 5G20T model.

Figure 3 shows a result from the 4G4T model. The panels display the evolution of the orbital elements of Mercury from the iSyMBA simulation (in magenta), and the SyMBA simulation (in black, but not visible due to overlapping). The differences between the two codes are shown in green. The behaviour is similar for the other terrestrial planets. Table 1 summarises the maximum relative differences found in this validation test. The total energy of the system behaves as expected, and the differences between the two codes in no larger than 10510^{-5} over the whole time span.

Table 1: Maximum differences in the orbital elements of the terrestrial planets, over 1 My, for the validation test using the 4G4T model (see text).
δa/a\delta a/a δe/e\delta e/e δI/I\delta I/I δϖ()\delta\varpi\,(^{\circ})
Mercury 1.5×1061.5\times 10^{-6} 9×1059\times 10^{-5} 4×1054\times 10^{-5} 6×1036\times 10^{-3}
Venus 2.5×1052.5\times 10^{-5} 6×1036\times 10^{-3} 2×1032\times 10^{-3} 2×1012\times 10^{-1}
Earth 4×1054\times 10^{-5} 1.5×1021.5\times 10^{-2} 6×1036\times 10^{-3} 5×1015\times 10^{-1}
Mars 3×1053\times 10^{-5} 1.5×1031.5\times 10^{-3} 2×1042\times 10^{-4} 4×1024\times 10^{-2}

In the 5G20T model, reproducing the exact evolution of the system with iSyMBA is not feasible, because the system is chaotic, and the small differences caused by the many collisions/mergers produce quantitatively different results. We verify, however, that the total energy of the system is well behaved, as shown in Fig. 5, with a bounded amplitude for iSyMBA that is only twice than in the 4G4T model without collisions. Although the number of collisions recorded in SyMBA and iSyMBA is not the same, the latter is able to reproduce quite well the first few collisions in the simulation. An example of this is shown in Fig. 6. We note that the merger happens at slightly different times in each case. Such small differences quickly propagate, and in a few tens of years each code starts to produce its own set of collisions, not matching each other anymore.

Refer to caption
Figure 3: Comparison between the output from SyMBA (black) and iSyMBA (over-plotted in magenta) for the orbital elements of planet Mercury, over 1 My of evolution, in the 4G4T model (see text for the simulation details): aa, semi-major axis, ee eccentricity, II inclination, and ϖ\varpi longitude of perihelion. The smaller panels show the relative differences (in green), except for ϖ\varpi that shows the absolute difference.
Refer to caption
Figure 4: Comparison between the total energy of the system from SyMBA (black) and from iSyMBA (magenta), in the 4G4T model (see text). Since the iSyMBA Hamiltonian is non autonomous, the energy displays oscillations with amplitude <105<10^{-5}, with respect to the SyMBA energy.
Refer to caption
Figure 5: Comparison between the total energy of the system from SyMBA (black) and from iSyMBA (magenta), in the 5G20T model (see text). Again, the iSyMBA energy displays oscillations with amplitude <2×105<2\times 10^{-5}, with respect to the SyMBA energy.
Refer to caption
Figure 6: Detail of an encounter/merger between two terrestrial bodies in the 5G20T model. The SyMBA simulation is shown in black, and iSyMBA in magenta. Full and dashed lines identify each of the bodies, respectively.

The above validation tests allow us to conclude that iSyMBA shows the desired behaviour in terms of simulation results.

3 Parallelisation strategy

Refer to caption
Figure 7: The performance of iSyMBA for different multi-threading parallelisation strategies. The solid lines correspond to the parallelisation of the outer loop in double loops, while the dashed lines correspond to the parallelisation of the inner loop. The colours identify the test models with different numbers of proto-planets (m) and planetesimals (n). The execution time has been normalised with respect to the serial execution time (see text for details). The green dotted line represents a linear trend, for reference purposes.

Aiming to improve the performance of iSyMBA, we have implemented multi-threading parallelisation using OpenMP. The following discussion does not intend to be comprehensive, and it is only applicable to the specific test models described below. Our aim is to provide some clues about the possible best strategies to parallelise our code, that eventually can be also taken into account to parallelise SyMBA itself.

There is no unique strategy to parallelise a code, and sometimes the best approach is obtained by first redesigning the original serial code. Here, however, the idea is to adopt a parallelisation strategy that keeps the original serial structure of the SyMBA subroutines with minimum or no changes.

The following discussion is based on two different test models: one considering 100 terrestrial proto-planets and 1 000 planetesimals (e.g. Nesvorný et al., 2021), which we refer to as m100n1000 model, and another considering 10 proto-planets and 10 000 planetesimals, which we called m10n10000 model. In both cases the number of giant planets is 5. In all the tests, we use the same total time span and the same time step. We also keep the amount of I/O operations to the minimum required. We define the normalised execution time as the ratio Tpar/TserT_{\mathrm{par}}/T_{\mathrm{ser}}, where TserT_{\mathrm{ser}} is the total execution time of the serial code, without any parallelisation, and TparT_{\mathrm{par}} is the execution time of the parallelised code. All the tests have been performed in Intel Core i7 processors, using GNU Fortran.

There are basically two types of structures that can be parallelised in iSyMBA using OpenMP:

  1. 1.

    the operations that require double loops over the terrestrial bodies, like the mutual acceleration calculations (Eqs. 13, 16 and 20), the check for close encounters, and the energy computation (Eq. 28), and

  2. 2.

    the calculations that require single loops over the bodies, including the Keplerian drifts, the linear drifts, the kicks, the coordinate changes, the loops to deal with interpolation of the giant planets, etc.

We will discuss each structure separately.

3.1 Single loops

Paralellisation of the single loops within the code has to be carefully evaluated, because it may provide little or no improvement of the execution speed. For example, in the LD - K - D - K - LD integration scheme, the Keplerian drifts are, in theory, the second most CPU-expensive step, after the accelerations calculation. However, in our simulations, the Keplerian drifts take between 5% to 20% of the total run time in a serial run. Therefore, their parallelisation might not contribute significantly to improve performance.

We have verified that, in the m100n1000 simulations, parallelisation of the single loops makes the code only 1.2\sim 1.2 times faster, but in the m10n10000 simulations, it becomes 2.3\sim 2.3 times faster.

We have also verified that parallelisation of any loop within the recursive integration of close encounters (see Sect. 2.2.3) must be avoided, since it may slow down execution speed by a factor of 2. This concerns, in particular, the subroutines symba7_step_recur and symba7_kick. We note, however, that there is no actual need to parallelise any part of the recursion, because it only affects the pair of bodies involved in an encounter, and these are not too frequent per time step.

After several experiments, we conclude that multi-threading parallelisation has to focus on the double loops, as explained below, and on the single loops that performs the most complex calculations, like the Keplerian drifts, the loops to deal with the interpolation of the giant planets, the relativistic corrections, the oblateness potential, and the discard subroutines.

3.2 Double loops

The strategy applied for parallelisation of the double loops influences the execution speed. A double loop to compute the accelerations between proto-planets and planetesimals typically reads:

do i from 1 to m

do j from i+1 to n

a(j) = a(j) + accel_ji

a(i) = a(i) + accel_ij

end do

end do

where m is the number of self gravitating proto-planets, n is the number of planetesimals, and a() is an array of dimension n. In this case, one possible strategy is to parallelise the outer loop over i, and the other possibility is to parallelise the inner loop over j.

Figure 7 shows the normalised execution time for the different models and strategies, as a function of the number of threads. The solid lines correspond to the case in which the outer loops are parallelised, while the dashed lines correspond to the case in which the inner loops are parallelised. We note that, when using few threads, there is no significant difference between one strategy or the other, although parallelisation of the outer loops performs a bit better. On the other hand, when using many threads, each strategy has advantages over the other depending on the values of m and n.

For the simulations of the m100n1000 model, parallelisation of the outer loops provides 1.5\sim 1.5 times faster execution times with respect to the parallelisation of the inner loops. On the other hand, for the simulations of the m10n10000 model, it is the parallelisation of the inner loops that provides 1.3\sim 1.3 times faster execution times than parallelising the outer loops.222These tests have been performed using 8 threads.

This behaviour may be related to the fact that initialisation and execution of a parallel loop involve several tasks, besides the calculations within the loop, that may produce some latency in the execution. When parallelising an inner loop, the parallel threads have to be initialised/allocated for every iteration of the outer loop, and this may cause a lot of latency. If the outer loop is small, as in  m = 10, the latency does not have a big impact. However, if the outer loop is bigger, as in  m = 100, the impact of latency may become significant.

Parallelisation of the outer loops has a couple of additional peculiarities that should be taken into account. The first one refers to the fact that the number of iterations over j, in the inner loop, is smaller for larger i. This means that the amount of work to be done by each iteration over i is different. In such case, the way of scheduling the iterations may be relevant. One possibility is choosing between a cyclic or a block scheduling. A cyclic schedule distributes the loop iterations in a round-robin fashion among the available threads, and should provide better performance in our case. The other possibility is choosing between static or dynamic scheduling. We have verified that using a combination of static and cyclic scheduling provides 1.1\sim 1.1 times faster execution times than either a dynamic or block scheduling.

The second peculiarity in parallelising the outer loops refers to the occurrence of data racing conditions over the accelerations array a(). A racing condition arises when two or more processes running in different threads try to modify or update the same variable at the same time. Fortunately, Fortran OpenMP has the capability of performing array reduction, which allows to properly update a(), avoiding data race.

Although multi-threading parallelisation, in our case, may improve execution speed by a factor of 3 to 6, the improvement is not linear with the number of threads and, as shown in Fig. 7, it tends to stabilise for 10\gtrsim 10 threads.

4 Conclusions

In this work, we described how to implement the necessary modifications to embed an orbit interpolation scheme into the symplectic planetary NN-body integrator SyMBA. Our algorithm, named iSyMBA, allows to study the effects of a prescribed evolution of a set of planets on a target population of massive bodies, that interact with each other through close encounters.

iSyMBA is a very useful code to accurately evaluate the effects of planetary instabilities on the accretion processes in the terrestrial planets region. These include the growth of protoplanetary embryos (Nesvorný et al., 2021), the Moon-forming impact (DeSouza et al., 2021), and the origin of Mercury.

Although iSyMBA has been primarily developed and implemented to study terrestrial planet formation, the method presented here could be easily modified to study the evolution of other populations, that requires orbit interpolation from previously developed simulations, while accounting for close encounters among massive objects.

Acknowledgements

We wish to thank an anonymous referee for helpful comments and suggestions. FR acknowledges support form the Brazilian National Council of Research (CNPq). The simulations have been performed at the SDumont cluster of the Brazilian System of High-Performance Computing (SINAPAD)

Data Availability

iSyMBA is freely available under request to the corresponding author.

References

  • Beaugé et al. (2002) Beaugé C., Roig F., Nesvorný D., 2002, Icarus, 158, 483
  • Bottke et al. (2012) Bottke W. F., Vokrouhlický D., Minton D., Nesvorný D., Morbidelli A., Brasser R., Simonson B., Levison H. F., 2012, Nature, 485, 78
  • Chambers (1999) Chambers J. E., 1999, MNRAS, 304, 793
  • Clement et al. (2018) Clement M. S., Kaib N. A., Raymond S. N., Walsh K. J., 2018, Icarus, 311, 340
  • Clement et al. (2019) Clement M. S., Kaib N. A., Raymond S. N., Chambers J. E., Walsh K. J., 2019, Icarus, 321, 778
  • DeSouza et al. (2021) DeSouza S. R., Roig F., Nesvorný D., 2021, MNRAS, 507, 539
  • Deienno et al. (2014) Deienno R., Nesvorný D., Vokrouhlický D., Yokoyama T., 2014, AJ, 148, 25
  • Deienno et al. (2017) Deienno R., Morbidelli A., Gomes R. S., Nesvorný D., 2017, AJ, 153, 153
  • Deienno et al. (2018) Deienno R., Izidoro A., Morbidelli A., Gomes R. S., Nesvorný D., Raymond S. N., 2018, ApJ, 864, 50
  • Duncan et al. (1998) Duncan M. J., Levison H. F., Lee M. H., 1998, AJ, 116, 2067
  • Gomes et al. (2005) Gomes R., Levison H. F., Tsiganis K., Morbidelli A., 2005, Nature, 435, 466
  • Gomes et al. (2018) Gomes R., Nesvorný D., Morbidelli A., Deienno R., Nogueira E., 2018, Icarus, 306, 319
  • Levison & Duncan (1993) Levison H. F., Duncan M. J., 1993, ApJ, 406, L35
  • Nesvorný (2015) Nesvorný D., 2015, AJ, 150, 68
  • Nesvorný (2018) Nesvorný D., 2018, ARA&A, 56, 137
  • Nesvorný & Morbidelli (2012) Nesvorný D., Morbidelli A., 2012, AJ, 144, 117
  • Nesvorný et al. (2013) Nesvorný D., Vokrouhlický D., Morbidelli A., 2013, ApJ, 768, 45
  • Nesvorný et al. (2014a) Nesvorný D., Vokrouhlický D., Deienno R., Walsh K. J., 2014a, AJ, 148, 52
  • Nesvorný et al. (2014b) Nesvorný D., Vokrouhlický D., Deienno R., 2014b, ApJ, 784, 22
  • Nesvorný et al. (2017) Nesvorný D., Roig F., Bottke W. F., 2017, AJ, 153, 103
  • Nesvorný et al. (2021) Nesvorný D., Roig F. V., Deienno R., 2021, AJ, 161, 50
  • Quinn et al. (1991) Quinn T. R., Tremaine S., Duncan M., 1991, AJ, 101, 2287
  • Roig & Nesvorný (2015) Roig F., Nesvorný D., 2015, AJ, 150, 186
  • Roig et al. (2016) Roig F., Nesvorný D., DeSouza S. R., 2016, ApJ, 820, L30
  • Tsiganis et al. (2005) Tsiganis K., Gomes R., Morbidelli A., Levison H. F., 2005, Nature, 435, 459
  • Wisdom & Holman (1991) Wisdom J., Holman M., 1991, AJ, 102, 1528
  • Yoshida (1993) Yoshida H., 1993, CeMDA, 56, 27