<p>I don't know if there are rules of thumb for initializing resonant orbital simulations.  I might suggest:</p>
<ol>
<li><p>Setting initial state vectors' Z-Components to zero.  Keeping the whole simulation in the X-Y plane can help with debugging and visualization.</p>
</li>
<li><p>Choosing initial state vectors that are equivalent to orbits with non-zero eccentricity. Orbital resonances tend to amplify or dampen eccentricities, but the effects can be multiplicative. So if you choose circular orbits, you may see less of an effect.</p>
</li>
<li><p>Choosing initial state vectors that line up apogees and perigees with closest contacts.</p>
</li>
<li><p>Running multiple simulations with slight perturbations to initial state vectors to test stability.</p>
</li>
<li><p>Some interesting initial experiments might be to see if you could replicate the instability of the L1 and L2 points of an orbit.  Or perhaps put some little masses in the Kirkwood Gaps and see if they get expelled.</p>
</li>
</ol>
<p><strong>Notes:</strong></p>
<ol>
<li><p>I tried writing some of my own numerical simulations to simulate natural planetary flybys. I used an algorithm outlined by <a href="http://spiff.rit.edu/classes/phys443/lectures/lg/nbody/OrbitRungeKutta4.pdf" rel="nofollow noreferrer">Voesenek</a>, but I was getting round-off errors that shot my simulation. Instead of investing more time to fix my simulation, I ended up using <a href="https://en.wikipedia.org/wiki/Universe_Sandbox" rel="nofollow noreferrer">Universe Sandbox 2</a>, that I paid for and downloaded from Steam.</p>
</li>
<li><p>Universe Sandbox probably doesn't have the fidelity you need for resonance stability simulations.  Gallardo wrote a pretty slick long term orbital integration software package called <a href="http://www.astronomia.edu.uy/orbe/" rel="nofollow noreferrer">ORBE</a>, that is free to the public for educational purposes.  I wish I had read Tabaré Gallardo's 2017 <a href="http://www.astronomia.edu.uy/orbe/ExploringTGallardo.pdf" rel="nofollow noreferrer">Exploring the orbital evolution of planetary systems</a> before writing my own simulator, since he uses a neat trick by Encke to account for the Sun's gravity analytically via 2-body problem equations while separately treating the inter-planetary gravitational accelerations numerically. This allows larger time steps and prevents some kinds of round-off error.  Gallardo's software is designed to test long term stellar system stability.  Also, it uses orbital elements rather than state vectors, which are a bit less intuitive to me. Gallardo's used of ORBE to run Kirkwood Gap stability simulations is totally AWESOME!!  Here is a capture of one of the figures from <a href="http://www.astronomia.edu.uy/orbe/ExploringTGallardo.pdf" rel="nofollow noreferrer">Gallardo's 2017</a>:
<a href="https://i.sstatic.net/dv5tE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dv5tE.png" alt="enter image description here" /></a></p>
</li>
</ol>

CC BY-SA 4.0
2021-02-25T23:03:37.227Z
This is very helpful and more than I bargained for, thanks! To the question at hand, is the answer pretty much "Just try a whole bunch of velocities scattered about that for circular because you're going to want some eccentricity to make it interesting."?
uhoh
CC BY-SA 4.0
2021-02-25T23:59:29.540Z
Yes, one would want to try various eccentricities and velocities to test resonance stability.  A lot of the current numerical simulations choose a particular initial orbit and then do a Monte Carlo runs with noise added to the state vectors.
Connor Garcia
CC BY-SA 4.0
2021-03-04T22:56:37.000Z
I've linked to your answer [here](https://space.stackexchange.com/questions/14731/nuances-of-the-terms-mean-osculating-keplerian-orbital-elements#comment164770_50546) and added the title of the paper; the linked source was a link that could break or move over time and without the title and author future readers would have no idea what "this paper" is anymore. ([discussion](https://space.meta.stackexchange.com/q/1356/12102))
uhoh
CC BY-SA 4.0
2021-02-25T17:11:18.333Z
2021-03-04T22:52:03.743Z
2021-03-04T22:52:03.743Z
Connor Garcia
<p><a href="https://astronomy.stackexchange.com/q/41644/7982">How do higher numbers affect orbital resonance?</a> is a really interesting question, and I thought I would try to do a simple numerical simulation of various resonance ratios to see if some are inherently stable or inherently unstable.</p>
<p>I understand that numerical simulation is inexact and so it can introduce its own instabilities so attention will have to be paid to the choice of integrators and results taken with a large grain of salt.</p>
<p>In order to get something to happen within say a hundred or a thousand orbits the masses of the orbiting bodies have to be large enough to have a significant impact on each other<sup>1</sup>, and so the state vectors I choose to initialize the calculation will not necessarily be those of circular orbits each body neglecting the other.</p>
<p>Are there any guidelines or rules of thumbs for initializing resonant orbits?</p>
<hr />
<p><sup>1</sup>I'll assume a central force, i.e. the orbiting bodies will not affect the position of the body they orbit, and so there won't be any indirect coupling through it.</p>
<p>Related:</p>
<ul>
<li><a href="https://astronomy.stackexchange.com/q/23980/7982">Just how &quot;locked&quot; are resonant-chains of exoplanets thought to be? (e.g. K2-138 and TOI-178)</a> (currently unanswered)</li>
<li><a href="https://astronomy.stackexchange.com/q/41049/7982">Why does the exoplanetary system TOI-178 challenges current theories of planet formation?</a></li>
</ul>
<p><div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/-WevvRG9ysY?start=0"></iframe>
            </div></div></p>

<orbital-mechanics><orbital-resonance>
How to choose initial state vectors for a resonant orbit numerical simulation?
uhoh
# How to choose initial state vectors for a resonant orbit numerical simulation?

(Asked by: username_0 on 2021-02-25)

[How do higher numbers affect orbital resonance?](https://astronomy.stackexchange.com/q/41644/7982) is a really interesting question, and I thought I would try to do a simple numerical simulation of various resonance ratios to see if some are inherently stable or inherently unstable.

I understand that numerical simulation is inexact and so it can introduce its own instabilities so attention will have to be paid to the choice of integrators and results taken with a large grain of salt.

In order to get something to happen within say a hundred or a thousand orbits the masses of the orbiting bodies have to be large enough to have a significant impact on each other1, and so the state vectors I choose to initialize the calculation will not necessarily be those of circular orbits each body neglecting the other.

Are there any guidelines or rules of thumbs for initializing resonant orbits?

---

1I'll assume a central force, i.e. the orbiting bodies will not affect the position of the body they orbit, and so there won't be any indirect coupling through it.

Related:

* [Just how "locked" are resonant-chains of exoplanets thought to be? (e.g. K2-138 and TOI-178)](https://astronomy.stackexchange.com/q/23980/7982) (currently unanswered)
* [Why does the exoplanetary system TOI-178 challenges current theories of planet formation?](https://astronomy.stackexchange.com/q/41049/7982)

**Tags:** orbital-mechanics, orbital-resonance


---

## 1 answers

### Answer by username_1 on 2021-02-25. Score: 1 | Accepted answer

I don't know if there are rules of thumb for initializing resonant orbital simulations. I might suggest:

1. Setting initial state vectors' Z-Components to zero. Keeping the whole simulation in the X-Y plane can help with debugging and visualization.
2. Choosing initial state vectors that are equivalent to orbits with non-zero eccentricity. Orbital resonances tend to amplify or dampen eccentricities, but the effects can be multiplicative. So if you choose circular orbits, you may see less of an effect.
3. Choosing initial state vectors that line up apogees and perigees with closest contacts.
4. Running multiple simulations with slight perturbations to initial state vectors to test stability.
5. Some interesting initial experiments might be to see if you could replicate the instability of the L1 and L2 points of an orbit. Or perhaps put some little masses in the Kirkwood Gaps and see if they get expelled.

**Notes:**

1. I tried writing some of my own numerical simulations to simulate natural planetary flybys. I used an algorithm outlined by [Voesenek](http://spiff.rit.edu/classes/phys443/lectures/lg/nbody/OrbitRungeKutta4.pdf), but I was getting round-off errors that shot my simulation. Instead of investing more time to fix my simulation, I ended up using [Universe Sandbox 2](https://en.wikipedia.org/wiki/Universe_Sandbox), that I paid for and downloaded from Steam.
2. Universe Sandbox probably doesn't have the fidelity you need for resonance stability simulations. Gallardo wrote a pretty slick long term orbital integration software package called [ORBE](http://www.astronomia.edu.uy/orbe/), that is free to the public for educational purposes. I wish I had read Tabaré Gallardo's 2017 [Exploring the orbital evolution of planetary systems](http://www.astronomia.edu.uy/orbe/ExploringTGallardo.pdf) before writing my own simulator, since he uses a neat trick by Encke to account for the Sun's gravity analytically via 2-body problem equations while separately treating the inter-planetary gravitational accelerations numerically. This allows larger time steps and prevents some kinds of round-off error. Gallardo's software is designed to test long term stellar system stability. Also, it uses orbital elements rather than state vectors, which are a bit less intuitive to me. Gallardo's used of ORBE to run Kirkwood Gap stability simulations is totally AWESOME!! Here is a capture of one of the figures from [Gallardo's 2017](http://www.astronomia.edu.uy/orbe/ExploringTGallardo.pdf):
   [![enter image description here](https://i.sstatic.net/dv5tE.png)](https://i.sstatic.net/dv5tE.png)

> **Comments:**
> **username_0**: This is very helpful and more than I bargained for, thanks! To the question at hand, is the answer pretty much "Just try a whole bunch of velocities scattered about that for circular because you're going to want some eccentricity to make it interesting."?  
> **username_1**: Yes, one would want to try various eccentricities and velocities to test resonance stability.  A lot of the current numerical simulations choose a particular initial orbit and then do a Monte Carlo runs with noise added to the state vectors.  
> **username_0**: I've linked to your answer [here](https://space.stackexchange.com/questions/14731/nuances-of-the-terms-mean-osculating-keplerian-orbital-elements#comment164770_50546) and added the title of the paper; the linked source was a link that could break or move over time and without the title and author future readers would have no idea what "this paper" is anymore. ([discussion](https://space.meta.stackexchange.com/q/1356/12102))  

---

