Hybrid Symplectic Integrators for Planetary Dynamics
Hanno Rein, David M. Hernandez, Daniel Tamayo, Garett Brown, Emily, Eckels, Emma Holmes, Michelle Lau, Rejean Leblanc, Ari Silburt

TL;DR
This paper reevaluates the switching function criteria in hybrid symplectic integrators like MERCURY, proposing simpler alternatives that maintain accuracy in planetary dynamics simulations.
Contribution
It clarifies the criteria for choosing switching functions and introduces a simpler scheme using a Heaviside function without sacrificing accuracy.
Findings
Heaviside switching function performs as well as polynomial functions in short-term accuracy.
Original polynomial switching function choice in MERCURY was based on incorrect motivation.
Simpler switching schemes can be used without loss of performance.
Abstract
Hybrid symplectic integrators such as MERCURY are widely used to simulate complex dynamical phenomena in planetary dynamics that could otherwise not be investigated. A hybrid integrator achieves high accuracy during close encounters by using a high order integration scheme for the duration of the encounter while otherwise using a standard 2nd order Wisdom-Holman scheme, thereby optimizing both speed and accuracy. In this paper we reassess the criteria for choosing the switching function that determines which parts of the Hamiltonian are integrated with the high order integrator. We show that the original motivation for choosing a polynomial switching function in MERCURY is not correct. We explain the nevertheless excellent performance of the MERCURY integrator and then explore a wide range of different switching functions including an infinitely differentiable function and a Heaviside…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Hybrid Symplectic Integrators for Planetary Dynamics
Hanno Rein1,2, David M. Hernandez3,4, Daniel Tamayo5, Garett Brown1,6, Emily Eckels7, Emma Holmes8, Michelle Lau9, Réjean Leblanc1,6, Ari Silburt1,2
1 Department of Physical and Environmental Sciences, University of Toronto at Scarborough, Toronto, Ontario M1C 1A4, Canada
2 Department of Astronomy and Astrophysics, University of Toronto, Toronto, Ontario, M5S 3H4, Canada
3 Harvard–Smithsonian Center for Astrophysics, 60 Garden St., MS 51, Cambridge, MA 02138, USA
4 MIT Kavli Institute for Astrophysics and Space Research, 77 Massachusetts Ave., Cambridge, MA 02139, United States
5 Department of Astrophysical Sciences, Princeton University, Princeton, New Jersey 08544, United States
6 Department of Physics, University of Toronto, Toronto, Ontario, M5S 3H4, Canada
7 Department of Mathematics, Emory University, 201 Dowman Drive, Atlanta, GA 30322, USA
8 Department of Mathematics and Statistics, McMaster University, 1280 Main St. W., Hamilton, Ontario, L8S 4K1, Canada
9 Department of Physics, Imperial College London, London, SW7 2AZ, United Kingdom E-mail: [email protected] Sagan Fellow
(Accepted for publication by MNRAS on 12th March 2019. Submitted on 19th January 2019.)
Abstract
Hybrid symplectic integrators such as MERCURY are widely used to simulate complex dynamical phenomena in planetary dynamics that could otherwise not be investigated. A hybrid integrator achieves high accuracy during close encounters by using a high order integration scheme for the duration of the encounter while otherwise using a standard 2nd order Wisdom-Holman scheme, thereby optimizing both speed and accuracy. In this paper we reassess the criteria for choosing the switching function that determines which parts of the Hamiltonian are integrated with the high order integrator. We show that the original motivation for choosing a polynomial switching function in MERCURY is not correct. We explain the nevertheless excellent performance of the MERCURY integrator and then explore a wide range of different switching functions including an infinitely differentiable function and a Heaviside function. We find that using a Heaviside function leads to a significantly simpler scheme compared to MERCURY, while maintaining the same accuracy in short term simulations.
keywords:
methods: numerical — gravitation — planets and satellites: dynamical evolution and stability
1 Introduction
Since ancient times astronomers have predicted the locations of planets in the night sky. But only the advent of computers has made it possible to calculate the orbital evolution of planetary systems over millions and even billions of years (Laskar & Gastineau, 2009). One major breakthrough was the development of mixed variable symplectic maps for the -body problem which we will refer to as Wisdom-Holman integrators (Wisdom & Holman, 1992). The idea behind the Wisdom-Holman integrator is to split the motion of a planet into two steps: a dominant Keplerian motion around the star (the Kepler step), and the motion due to small interactions between the planets (the interaction step).
The Wisdom-Holman scheme works well as long as the interactions between planets can be considered perturbations to their predominant Keplerian motion around the star. However, if two planets come close to each other, the planet-planet interactions can become the dominant part of the motion. In that case the Wisdom-Holman integrator becomes inaccurate and might require excessively small timesteps to achieve an acceptable solution.
Duncan et al. (1998) and Chambers (1999) provide a solution to this problem in the form of hybrid symplectic integrators. The idea is to move terms from the interaction part to the Keplerian part during close encounters, to ensure that one part always remains a perturbation. Although solving the Keplerian part during a close encounter now becomes more difficult than simply solving Kepler’s equation, it can be done relatively efficiently with a high order integrator such as a Burlish-Stoer or Gauß-Radau scheme. As long as close encounters happen infrequently, the high order integrator is rarely used and has a negligible effect on the runtime. The scheme is therefore almost as fast as a Wisdom-Holman integrator. Furthermore, the scheme is also symplectic, ensuring good long term conservation of energy and angular momentum.
In this paper we look specifically at the MERCURY integrator. MERCURY is freely available online and has become a widely used tool in running many otherwise impossible types of simulations. We discuss inconsistencies in the original paper by Chambers (1999) which describes the MERCURY algorithm111A similar discussion in Duncan et al. (1998) is correct, but it describes a slightly different and more complex scheme.. We note that Wisdom (2017) also looked at these inconsistencies and came independently of us to the same conclusion. Despite these inconsistencies, the resulting scheme has very good characteristics. We provide mathematical and physical explanations for them in this paper. With this new understanding, it is easy to construct new hybrid integrators. We describe one new integrator that is much simpler than MERCURY, but achieves the same accuracy.
2 Hybrid Symplectic Integrators
We begin by introducing the notation and coordinate system we use. We have one star and an additional planetary bodies with Cartesian coordinates and canonical momenta in some inertial frame. We will identify the stellar object with and the planets with . The -body Hamiltonian in these coordinates is
[TABLE]
To evolve this system forward in time we could calculate the equations of motion for this Hamiltonian. However, in general the resulting differential equations cannot be solved analytically and are usually stiff and thus hard to solve numerically.
The hybrid integration schemes discussed in this paper make use of democratic heliocentric coordinates and corresponding canonical momenta (see Appendix A). The advantage of these coordinates is that the Hamiltonian can be written as a sum of four terms:
[TABLE]
where
[TABLE]
In the above splitting, we’ve introduced the arbitrary scalar function which depends only on the distance between pairs of particles. Note that the terms involving cancel out when adding and and thus do not change the evolution of the system.
In this paper, we will use the letter to label switching functions that appear in the Hamiltonian and refer to them as Hamiltonian switching functions. Later, we will also encounter force switching functions that first appear in the equations of motions. To avoid any confusion, we will use the letter to label force switching functions. There is a relation between and which we derive in Sec. 3.
Each of the above terms has a physical interpretation. describes the motion of the centre of mass. The term describes the Keplerian motion of the planets, ignoring planet-planet interactions (while ). This term is separable and can be solved for each planet independently. The term corresponds to the planet-planet interactions. The term is related to the barycentric motion of the star and is referred to as the jump term (it changes the positions of particles instantaneously but keeps the momenta constant).
We can calculate the equations of motion for each of these Hamiltonians. The resulting differential equations for , , and are trivial to solve. Only the equations for require more work, i.e. solving Kepler’s equation (while ). Evolving the system under the influence of a Hamiltonian can be thought of as an operator acting on a state corresponding to the initial conditions. The idea of an operator splitting integration method is to approximate the evolution of the full system by consecutively evolving the system under the partial Hamiltonians. We can construct arbitrarily high order integrators by applying these operators in the right order for different amounts of time (Yoshida, 1990). In particular, a second-order integrator can be constructed from the above splitting by using the following chain of operators
[TABLE]
where an operator corresponds to evolving the system under the Hamiltonian for a time . Note that we recover the standard Wisdom-Holman integrator in democratic heliocentric coordinates if we set .
For any finite timestep , is only approximately equal to . We can analyze the error of this splitting scheme with the help of the Baker-Campbell-Hausdorff (BCH) formula. The splitting scheme error arises because some pairs of operators do not commute. The error consists of an infinite series of commutators between operators. In our case, the action of an operator corresponds to solving the differential equations resulting from its respective Hamiltonian. As a result, the splitting scheme error can be expressed as a series of nested Poisson brackets (see e.g. Hernandez & Dehnen, 2017). One caveat to keep in mind when working with the BCH formula is that it is only a formal asymptotic series and does not necessarily converge everywhere in phase space. We come back to this issue later.
The commutators that appear in the BCH formula can be grouped together by powers of the timestep . The specific splitting scheme in Eq. (7) is time symmetric and therefore only even orders of appear (Yoshida, 1990). Further note that commutes with . Thus, the lowest order non-zero error terms that appear are:
[TABLE]
In this paper, we do not attempt to calculate approximations to these expressions analytically using Poisson brackets, but do so numerically. This allows us to easily extend the calculations to arbitrarily high order (7th order in our case).
There are two way to approach this. Consider a commutator of the form . Starting from a state , we can calculate , and similarly for higher order commutators. If , then the commutators commute. To quantify the statement, we can use any norm on . The measure we are typically interested in is the energy, or more specifically the energy error. Note that calculating the energy of does not make sense. However, we can calculate the energy error by comparing the energy of the state to that of the state . Alternatively, we can calculate the state . Here, is a valid state and we can directly compare the energy of the states and .
In this paper we use the latter approach. Note that it is a simple chain of operators and no additions or subtractions of state vectors are needed. This approach avoids some issues with finite floating point precision compared to the standard approach where one needs to subtract nearly equal numbers multiple times when calculating the energy difference of the states and . As a specific example, consider the first (third order) commutator that appears in the BCH formula of the hybrid symplectic intergators: . The effect of this commutator can be calculated by the following chain of operators:
[TABLE]
The two approaches are not exactly equal, only to within order . Our approach is only an approximation of the commutator appearing in the BCH formula and is accurate to within only. We could apply the Zassenhaus formula (the dual of the BCH formula) to calculate higher order corrections, which are again chains of the same operators. However, the approximations are good enough for our purpose: they will allow us to demonstrate which are the dominant contributions to the error terms in the BCH formula and understand their origins, especially for higher order commutators which are otherwise not easily tractable.
3 The MERCURY Code
The Wisdom-Holman map (setting in the above notation) performs poorly during close encounters because some of the commutators in the error term become large. To construct an integrator that can more accurately resolve close encounters, Chambers (1999) suggests to use a non-constant Hamiltonian splitting function as a basis for the MERCURY scheme.
The idea, as outlined in Chambers (1999), is that the switching function keeps the interaction Hamiltonian small even during close encounters between planets. As a result the switching scheme errors from the BCH formula should remain small as well.
Let us use Hamilton’s equations and derive the equations of motion for the Hamiltonian :
[TABLE]
where we have introduced the democratic heliocentric velocities
[TABLE]
We also used the fact that the gradient of satisfies
[TABLE]
The equations of motion above are not those of Keplerian motion but now also include interaction terms. Nevertheless they can be solved with a high order integrator such as a Bulirsch-Stoer algorithm or a high order Gauß-Radau integrator (Everhart, 1985; Rein & Spiegel, 2015).
Similarly, the equations of motion for can be derived as
[TABLE]
These equations remain trivial to solve even in the case of .
Somewhat surprisingly, the equations of motion derived above are not the equations of motion implemented in the MERCURY code. Specifically, the terms involving are not present in the publicly available version of MERCURY. Therefore, the MERCURY code does also not correspond to the Hamiltonian splitting in Eq. (2).
This then begs the question222 This inconsistency was discussed at the Toronto Meeting on Numerical Integration Methods in Planetary Science in 2017 and an explanation was first published by Wisdom (2017). We independently came to the same conclusion. : What is MERCURY solving? To find the answer to this question, we define a new switching function
[TABLE]
With this definition, we can rewrite the equations of motion in terms of . For example, Eq. (10) becomes
[TABLE]
Note that no derivatives of appear in the equations of motion. We can think of , which is changing between [math] and , as a weight in the inter-particle forces. We therefor refer to it as the force switching function. If we set to the piecewise polynomial function
[TABLE]
with
[TABLE]
then we recover exactly the integration scheme as implemented in the MERCURY code333Note that this is not the function described in the paper which has roughly the same shape but is slightly different from the one implemented in the publicly available version of MERCURY. We here use the function implemented in the MERCURY code.. In the above equation, is some critical switching distance. The value depends on the specific application but it typically a small multiple of the mutual Hill radius of the particles.
To find out what the corresponding Hamiltonians are that this scheme is integrating, we need to solve the differential equation in Eq. (15) to find the Hamiltonian switching function , given the force switching function . The solution is a one parameter family due to a gauge symmetry. We choose the solution that is continuous by matching . We plot the functions and in the top panel of Fig. 1. Note that the function does not reach exactly [math] at . This means that there is a finite contribution to the interaction Hamiltonian for any choice of (see function in the bottom panel of Fig. 1).
This is inconsistent with the discussion of Chambers (1999) which argues that the switching function keeps the interaction Hamiltonian small. That argument would only be correct if the force switching function were used as a Hamiltonian switching function (in the MERCURY code is used as a force switching function). As an illustration, we also plot the function in the bottom panel of Fig. 1. This is a potential which now reaches [math] at . However, whereas using as the Hamiltonian switching function would lead to a valid symplectic switching integrator, it will not perform as well as an integrator using . Looking at the bottom panel of Fig. 1, this is because has a local minima around leading to an unphysical repulsive force between particles in some intermediate regime. One consequence of the force changing sign is that the differential equations corresponding to are stiffer during the close encounter. Note that in both cases, particles will feel no force from the potentials in the interaction Hamiltonian while .
It is worth pointing out that for small the shape of the effective potential is similar to that of potentials used in other -body systems where one simply ignores the close range interactions by having a finite smoothing length (similar to a kernel in smooth particle hydrodynamics).
We would like to stress that despite this inconsistency in the derivation of the equations of motion, the MERCURY algorithm is solving a Hamiltonian system that converges to the original system in the limit of .
For the remainder of this paper, we will refer to the force switching function simply as the switching function. The corresponding Hamiltonian switching function can always be calculated by solving Eq. (15).
4 Switching functions
We now explore different force switching functions and their effects on the accuracy of the integration. Our motivation comes from the fact that the function used by MERCURY has been determined heuristically and, as we have shown above, the original justification is not correct. It is thus not clear if one can improve the integration scheme by simply choosing a better switching function. In this paper, we will present and discuss results for the following four switching functions. These are extreme cases which will allow us to explain the general ideas behind choosing switching functions, which can then be applied to any arbitrary switching function.
(i) We set . The integrator simply becomes the (non-switching) Wisdom-Holman integrator in democratic heliocentric coordinates.
(ii) We set to the discontinuous Heaviside function with a jump at .
(iii) Same as (ii) but the value of is kept constant for the duration of the entire timestep. To do that we approximate the trajectories along straight lines for the duration of the timestep and set if the trajectories come closer than , and otherwise. There are cases where this breaks time reversibility. We could avoid this by doing this procedure iteratively. However, in all tests that we have performed this does not seem to be an issue. Further, note that this procedure formally makes the integrator phase space dependent in a similar way than adaptive timesteps do. We comment on whether this has any real world consequences in Sec. 7.
(iv) We use the switching function given in Eq.(17). Thus the integrator becomes the MERCURY integrator.
(v) Finally, we consider an infinitely differentiable switching function given by
[TABLE]
where is given by Eq. (18) and is
[TABLE]
The shape of the function is very similar to that of (shown in Fig. 1). However the function and all its derivatives are smooth and continuous for all , even at the boundaries. Note however, that just as , is not analytic, i.e. a Taylor series expansion will not converge globally.
5 Test Setup and Mercurius
We now look at one representative test case in which a close encounter occurs between two giant planets. We work in units where and the stellar mass is . Both planets have a mass similar to that of Jupiter, . The inner planet is on an orbit with semi-major axis and eccentricity . The outer planet is on a nearby orbit with and . We use a timestep corresponding to 0.5% of the inner planet’s period. We adjust the phases such that a close encounter occurs at with a close approach distance of approximately .
To run these simulations we use MERCURIUS, our own implementation of the MERCURY integrator444In reference to and appreciation of MERCURY, we call our implementation MERCURIUS (the Latin word for Mercury).. We here only give a short overview of the implementation as we plan to publish a detailed code description paper. The MERCURIUS integrator is freely available as part of the REBOUND integrator package. Internally it uses the Kepler solver of the WHFast integrator (Rein & Tamayo, 2015) and the IAS15 integrator (Rein & Spiegel, 2015) to evolve . Using MERCURIUS allows us to easily experiment with different switching functions. We can also call the individual operators manually which allows us to calculate the commutators numerically as described above. We also ran tests with the original MERCURY code and implemented wrapper functions to make the fortran code callable from python. These functions allow us to call MERCURY’s time-stepping functions directly from python, avoiding any potential issues that may arise due to coordinate transformations, unit conversions, time-stepping logic, or input/output files. This might have been an issue in an earlier study looking at the symplecticity of MERCURY (see Appendix B). Aside from small differences at the floating point precision limit, if we use the same switching function as implemented in MERCURY, we find perfect agreement between MERCURY and MERCURIUS in all our results and therefore only show the results using MERCURIUS.
6 Results
Figure 2 summarizes our results for the test case and switching functions introduced above. The columns correspond to the different switching functions. The horizontal axis of every panel corresponds to time, with the close encounter occurring at . The particles enter the critical distance at and exit at it again at . The top row shows the value of the switching function as a function of time. The second row shows the absolute value of the gravitational force between the planets as calculated during the interaction step. We also show the first four derivatives of the force. The third, fourth, and fifth rows show approximations of the third, fifth, and seventh order commutators, respectively. We colour commutators that only include and (i.e. not ) red, and all other commutators orange. We do not show commutators that are always zero (i.e. those only involving and ). As a measure of the size of the commutators, we use the energy error as described above. Note that the energy error does not account for phase errors. Thus an energy error of zero does not imply a perfect solution. The plots for the commutators also show the actual energy error occurred over one timestep step, as well as the integrated energy error, i.e. the energy error measured relative to the beginning of the simulation.
The first column shows the evolution for the standard WH integrator. The forces, its derivatives, and therefore all commutators get very large during the close encounter. As a result, the integrated energy error goes off the chart. As expected, this integrator cannot accurately resolve the close encounter. Note that the higher order commutators become comparable to the lower order commutators during the close encounter. The physical interpretation for this is that timestep is too large to resolve the characteristic timescale (periastron passage of the close encounter). Also note that the dominant commutators are those involving only and .
The second column shows the evolution of using the Heaviside function as the switching function. Note that the commutators which only involve and vanish when . This happens because becomes the identity operator, i.e. not having any effect, and it thus commutes with any other operator. Commutators involving and do not vanish when and become the dominant contribution to the energy error during that time. However, these are several orders of magnitude smaller and do not diverge during the close encounter unless the planets are very eccentric and close to periastron. Note that there is a spike in most commutators exactly when transitions at . This can be understood by imagining a scenario where the particles start out just outside of . To calculate the commutator , let us initially apply . When calculating the effect of this operator the value of will be . If we then apply to the result, it might take the particles inside of . Thus, if we then apply , the value of will be [math]. Let us finally apply again which might take the particles outside of . This sequence of operators corresponds to the commutator which is one of the nested commutators that appears at all orders in the BCH formula. The above argument makes it clear that the commutator will be particularly large when the switching function changes a lot during a timestep. This is the case for the Heaviside function, but it is important to note that for any other switching function that changes significantly during a timestep this is also the case, no matter if the switching function is smooth or has a discontinuity. The consequence is that the actual energy error (both the single step error and the integrated error) jump up when the particles transition . Despite this undesirable jump, the integrator is at least somewhat better at resolving the close encounter than the standard Wisdom-Holman integrator. A physical argument can be given in terms of timescales again: if the switching function changes a lot during one timestep, we’re effectively introducing a very short timescale that the integrator is unable to resolve.
We can avoid large changes of the switching function during the timestep, by simply calculating the value of once, at the beginning of the timestep, and then keeping it fixed. The results of this modification to the Heaviside switching function are shown in the third column. Several features are identical to the standard way of using the Heaviside switching function (second column). In particular, all commutators that only involve and still vanish when . However, we see that we have successfully removed the spikes in the commutators when changes. The commutators involving and simply go to zero. As a consequence the energy error does not increase when particles pass over the transition, despite the sudden change in the value of the switching function . This can be explained following the same scenario described in the last paragraph. This is a remarkable result: This integration scheme, effectively using a binary switching function, is significantly simpler to implement than those using a continuous switching function. However, as one can see in the figure, it provides equal accuracy for one close encounter, at reduced computational complexity. We further comment on this case below.
The fourth column shows the evolution using the standard MERCURY algorithm and its polynomial switching function. Once again all commutators that only involve and vanish when . However, in contrast to the integrators using the Heaviside function, this only happens for . Although these commutators are finite for they are significantly smaller than in the case of the Wisdom-Holman integrator. Note that the third order commutators are smooth. This is because the specific choice of switching function ensures that the forces and its first two derivatives are continuous. These derivatives appear in the Poisson bracket and therefore in the commutator. However looking at the higher order commutators, one can see the effect of non-continuous higher derivates due to the finite differentiable switching function . Fortunately, these commutators are significantly smaller than the third order commutators and therefore do not contribute much to the total energy error. Remember that the plots only show approximations of the commutators. This becomes apparent in the 7th order commutators where the spikes near the discontinuities of the force derivatives at are somewhat smeared out.
The fifth column shows the evolution using an infinitely differentiable switching function. Here, all derivatives of the force, and therefore all Poisson brackets, are continuous and smooth. Because of the smoothness requirement, the higher order derivatives of the force become highly oscillatory. This is a generic feature of any infinitely differentiable switching function and not specific to the function we chose. The commutators look similar to those of the MERCURY algorithm but one significant difference is that the higher order commutators become larger and more oscillatory. As in the previous case this is because these commutators are directly related to the higher order derivatives of the forces. For moderate timesteps like the one we’ve chosen in this example, the energy error of the simulation is still dominated by the third order commutators. However, for larger timesteps, there can be cases where the higher order commutators will dominate the error. We can think of this in physical terms once again. The highly oscillatory derivatives of the force corresponds to very short timescales. Because we are using a finite and fixed timestep, these timescales can at some point be no longer accurately resolved, leading to larger errors. The appearance of these small timescales is a purely numerical artefact (somewhat related to timestep resonances discussed by Rauch & Holman, 1999). Mathematically speaking, the differential equations corresponding to the higher order commutators become very stiff. Note that in the standard Wisdom-Holman integrator (left panel), the forces get large, but do not oscillate.
7 Conclusions
We revisited the motivation behind hybrid symplectic integrators and the choice of switching functions. We found that the derivation of equations of motion by Chambers (1999) omits derivative terms. As we showed, it turns out that despite this inconsistency the MERCURY integrator is a switching integrator. However, it effectively uses a very different switching function than the one described by Chambers (1999).
Motivated by the somewhat arbitrary choice of switching function in MERCURY, we explored a wide range of different switching functions to see if it is possible to improve the accuracy of this kind of integrators any further. In particular, we presented results of two extreme cases: one infinitely differentiable function, and the Heaviside function. In summary, we found that the smoothness alone is not a good criterion for choosing a switching function.
Our results show that an infinitely differentiable switching function does not perform much better over one close encounter than the polynomial function used by MERCURY. We attribute this to two reasons. First, the beneficial effects of a smoother function only show up in higher order commutators which are several orders of magnitude smaller than the dominant third order commutators. Second, the higher order derivates of an infinitely differentiable switching function necessarily become highly oscillatory. The integrator cannot resolve the associated small timescales and thus behaves no better than an integrator involving finite differentiable functions.
We show that using a Heaviside switching function can have surprisingly good properties if the value of the switching function does not change during the timestep. The resulting scheme is significantly simpler than the MERCURY scheme but achieves the same accuracy in the test case of a single close encounter presented. What still needs to be studied in greater detail is the long term evolution in systems with repeated close encounters. We ran additional tests of 1000 highly collisional planetary systems and found that the integrator using the Heaviside function performs on average as well as MERCURY. We will discuss the implementation of this new integrator, as well as the implementation of the MERCURIUS integrator, in an upcoming code description paper.
In practice one is mostly interested in how accurate an integrator can resolve a close encounter. In any numerical simulation, one can calculate a precise answer to this question using any arbitrary metric one thinks is approriate. A mathematical (or maybe even somehwat philosophical) question is whether these integrators we discussed in this paper are symplectic or not. The authors of this paper were not able to agree on the answer to this question. We will therefore leave the final answer up to the reader, but comment on a few aspects of this question.
First, it is important to keep in mind that we very quickly reach the limits of finite floating point precision in systems with close encounters555Imagine a scenario where two planets on orbits with have a close encounter with a minimal encounter distance of one Earth radius, . Using double floating point precision, we only have decimal digits to work with when representing the planets’ positions in heliocentric coordinates. When calculating any derivative, which is required for checking the symplecticity, we further loose roughly half of the significant digits.. One could argue that we should not talk about concepts of differential geometry such as symplecticity at all if we work with floating point numbers because derivatives formally do not even exist. We run simulations on a discrete phase space where only finite differences exist.
Second, note that all switching functions we used are non-analytic. That is not a coincidence but a requirement if we want the integrators to fall back to the Wisdom-Holman integrator whenever particles are far away from each other. As a consequence, the Taylor series of the switching function, and therefore the Poisson Brackets in the BCH formula will not converge to the correct solution globally.
Third, when choosing a switching function, differentiability is not the right criteria to consider. If the mathematical concept of differtiability were an important requirement for a switching function, we could simply come up with a new infinitely differentiable function that is arbitrarily close to the original non-smooth function. We have effectivly done that for by introducing , which did not lead to improvements in any of our tests. What matters is how much the switching function changes during a (finite) timestep. If it changes a lot, then the corresponding differential equations become stiff and the errors large. What also matters is that the switching function is continous to ensure the existance and uniquness of a solution666This only matters when calculating the solution of the step. It does not matter for the solution of the step because the switching function is constant. (Hernandez, 2019). Note that integrator with the Heaviside function completely changes the nature of the algorithm and can among other things break time reversibility. This might be important for some long term integrations, but not for simulations where encounters are rare (for example for planetary system which go unstable), or if physical collisions break time reversibility anyway.
Fourth, all integrators will converge to the correct solution in the limit of the timestep going to zero. We thus argue that the simplest and most reliable way to test that a given integrator gives reliable answers is to change the timestep and watch for changes in the results, i.e. a classical convergence test.
Acknowledgments
We thank the referee John Chambers for providing us with helpful comments which allowed us to improve and clarify the manuscript. We thank Scott Tremaine for helpful discussions at various stages of this project. This research has been supported by the NSERC Discovery Grant RGPIN-2014-04553, the 2018 Fields Undergraduate Summer Research Program at the Fields Institute for Research in Mathematical Sciences in Toronto, and the Centre for Planetary Sciences at the University of Toronto Scarborough. Support for this work was also provided by NASA through the NASA Hubble Fellowship grant HST-HF2-51423.001-A awarded by the Space Telescope Science Institute, which is operated by the Association of Universities for Research in Astronomy, Inc., for NASA, under contract NAS5-26555. This research was made possible by the open-source projects Jupyter (Kluyver et al., 2016), iPython (Pérez & Granger, 2007), and matplotlib (Hunter, 2007; Droettboom et al., 2016).
Appendix A Democratic Heliocentric Coordinates
The hybrid integration schemes discussed in this paper make use of democratic heliocentric coordinates (Duncan et al., 1998). Let us assume we have one star and an additional planetary bodies with Cartesian coordinates and canonical momenta in some inertial frame. Then, the democratic heliocentric coordinates are defines as:
[TABLE]
Here, is the total mass of the system. The corresponding canonical momenta are
[TABLE]
Appendix B Symplecticity of Mercury
While working with MERCURY and MERCURIUS we also looked at measuring the symplecticity error. To do that we follow Hernandez (2016) in calculating the Jacobian using a finite difference approach. This is non-trivial because one quickly runs into issues of finite floating point precision. The results of Hernandez (2016) suggest that the MERCURY algorithm might be non-symplectic for their binary planet test case. To investigate this issue, we implemented wrapper functions to directly call the MERCURY subroutines which evolve the state by one timestep, but ignore all the input, output and other bookkeeping login in the MERCURY package. Our results with this method differ from those obtained by Hernandez (2016) and indicate that MERCURY is symplectic (whether we should really call the scheme symplectic or not, becomes a somewhat philosophical rather than practical question, see discussion).
We attribute this discrepancy to some non-symplectic operations that the MERCURY package applies to the state vector before and after the actual integration (e.g. unit conversions and coordinate transformation), and a loss of precision when using ASCII files as input and output files. We also ran tests with our own implementation of the algorithm, MERCURIUS, and confirm the results obtained with MERCURY.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Chambers (1999) Chambers, J. E. 1999, MNRAS, 304, 793
- 2Droettboom et al. (2016) Droettboom, M., Hunter, J., Caswell, T. A., Firing, E., Nielsen, J. H., Elson, P., Root, B., Dale, D., Lee, J.-J., Seppänen, J. K., Mc Dougall, D., Straw, A., May, R., Varoquaux, N., Yu, T. S., Ma, E., Moad, C., Silvester, S., Gohlke, C., Würtz, P., Hisch, T., Ariza, F., Cimarron, Thomas, I., Evans, J., Ivanov, P., Whitaker, J., Hobson, P., mdehoon, & Giuca, M. 2016, matplotlib: matplotlib v 1.5.1
- 3Duncan et al. (1998) Duncan, M. J., Levison, H. F., & Lee, M. H. 1998, AJ, 116, 2067
- 4Everhart (1985) Everhart, E. 1985, in Dynamics of Comets: Their Origin and Evolution, Proceedings of IAU Colloq. 83, held in Rome, Italy, June 11-15, 1984. Edited by Andrea Carusi and Giovanni B. Valsecchi. Dordrecht: Reidel, Astrophysics and Space Science Library. Volume 115, 1985, p.185, ed. A. Carusi & G. B. Valsecchi, 185
- 5Hernandez (2016) Hernandez, D. M. 2016, MNRAS, 458, 4285
- 6Hernandez (2019) —. 2019, ar Xiv e-prints, ar Xiv:1902.03684
- 7Hernandez & Dehnen (2017) Hernandez, D. M. & Dehnen, W. 2017, MNRAS, 468, 2614
- 8Hunter (2007) Hunter, J. D. 2007, Computing In Science & Engineering, 9, 90
