# Three Body Orbits

Continuing with the program for calculating orbits, some three-body orbits are now considered.

bodies=[] b=Body() b.mass=10 b.x=-5 bodies.append(b) b=Body() b.x=10 b.vy=0.8 bodies.append(b) b=Body() b.x=11 b.vy=1.8 b.mass=0.001 bodies.append(b)

This sets up a system of three bodies whose motion is qualitatively similar to the Earth, Moon, Sun system. It is not an accurate model of our Solar System, for the ratio of the masses and distances is very wrong. However, it displays similar behaviour, with the moon orbiting the planet in a stable fashion. That the planet's year contains rather more than twelve lunar months is one of the many differences of detail.

bodies=[] b=Body() b.mass=10 b.x=-5 bodies.append(b) b=Body() b.x=10 b.vy=0.5 bodies.append(b) b=Body() b.x=11 b.vy=1.4 b.mass=0.001 bodies.append(b)

The second set of initial conditions above looks very similar. Just two values have been changed: the initial velocity of the planet has been reduced from 0.8 to 0.5, and that of the moon from 1.8 to 1.4. The behaviour is now very different.

The first year is similar, although the moon is significantly influenced by the central body at their closest approach. Then half way through the second year the moon switches to orbiting the more massive body. A year later, all changes again as the moon is rescued in a move which ejects it entirely from the system.

(Should one wish to slow down the simulation, reduce the number 10
in the line `turtle.tracer(10,0)`

. Similarly, to speed it
up, increase it.)

Is this answer correct? Yes, and no. A small satellite can be captured from one body to another like this. It can also be flung out to infinity. Energy conservation is not broken, as a small amount of energy will have been lost by the other two bodies in the process.

But the precise trajectory is very sensitive to the initial
conditions, and to accumulated errors of the integration. Change the
timestep from `dt=0.02`

to `dt=0.01`

and the
capture still happens, but the recapture / ejection no longer
occurs.

What happens with a timestep of 0.01 if the initial velocity of the
third body is set as `vy=1.41`

? And 1.42? And 1.43? What
about reducing it to 1.39? With it set to 1.39, what happens if the
timestep is reduced to 0.001?

There is an obvious flaw in this code. When two bodies are very close, so the force, and hence acceleration, is large, the timestep should be reduced, and then increased again when accelerations are lower. Doing this well is quite complicated. Reducing the timestep to 0.001 with the initial velocity of the third body set to 1.43 shows quite different behaviour again.

A very close approach (try an initial velocity of the third body of 0.9 and a timestep of 0.01) can lead to quite an error in the final total energy when the simulation ends. In this case the drift of the orbits of the two more massive bodies after the near collision is fine. With one body being ejected at very high speed, the other two must drift in the opposite direction in order to conserve momentum.

There are more stable orbits for a third, light, body, and they are to be found closer to the second body. Specifying the third body as

b.x=10.5 b.vy=1.8 b.mass=0.001

appears to be stable.

Whilst the algorithm is this code is far from cutting-edge, it is clear why simulating the Asteroid Belt with any accuracy is quite challenging. We have already seen that not all series are stable, and the three body gravitation problem also has regions of stability, and chaotic regions which are highly sensitive to the starting conditions and to integration errors.

(If one runs these simulations for a long while one will discover that the speed of the turtle graphics decreases the longer the trace being displayed is.)

## The Maths of Gravity Assists

The detail of some of the above simulations is quite wrong. A near miss between a light body and a heavy one interacting via gravity is essentially a lossless collision, conserving energy and momentum. In the zero momentum (of those two bodies) frame, both bodies reverse the sign of their velocities along the "contact" line, and preserve their velocities perpendicular to it.

So one can conclude that the change in the speed of the light particle can be no greater than twice the orbital speed of the heavy one, and may be an increase or a decrease. In some of the above simulations the change in speed is very much greater than this. If the discrete integration routine happens to sample the position when two bodies are very close, it assumes that the high acceleration calculated is good for the whole of the timestep dt. In fact, the large velocities involved when two bodies are close means that their separation is also changing rapidly, and hence also their acceleration. Assuming the high value is a good value to use for the whole timestep is incorrect.

Thus one can conclude that the rather simplistic integration used here is mostly correct for many starting conditions, but quite badly wrong for others. This is always an issue in Physics. If a simple model shows interesting and unexpected behaviour, then there are two possibilities. Either nature is interesting and unexpected, or the model is wrong (or, more politely, being used outside of its area of applicability). Either is possible.

One should also note that these equations of motion obey time reversal, that is, they will run backwards as well as forwards. So if the "sun" can capture a "moon" from the "planet", run the sequence backwards (by starting at the end point, and reversing the final velocities) and the "planet" will capture the "moon" from the "sun". Similarly if a moon can be flung out of the "solar system", so an incoming object can be slowed and captured.

## The Physics of Gravity Assists

Spacecraft embarking on journeys far from the Earth's orbit generally use gravity boosts from other planets or their moons. The reason is as follows.

The gravitational field from a body is given by
GM/r^{2}. Put in suitable values for the Earth
(G=6.7x10^-11 Nm^{2}kg^{-2},
M=6.0x10^24 kg, r=6.3x10^6 m) and the answer is about
10 N/kg at its surface, as expected.

The energy needed for a body at the surface of the Earth to escape its gravitation field is given by GM/r, and the answer is about 6.4x10^7 J/kg. This often expressed as a speed after equating it to kinetic energy, and is 11 km/s.

If one does the same calculations for the Sun (2x10^30 kg) at the radius of the Earth's orbit (1.5x10^11 m) the answers are 0.006 N/kg and 9x10^8 J/kg. So whereas the Sun's gravitational field at the Earth is much weaker than the Earth's, the energy needed to escape fully from it is higher.

Carrying enough fuel to be able to be able to escape from the Sun's gravity would be challenging for a rocket. So gravity assists from other planets and moons are used. The first use of a gravity assist to reach a destination was to solve the reverse problem: Mariner 10 (1974), en route for Mercury, used Venus to lose energy. A few years later the Voyager craft used Jupiter and Saturn to gain energy, and when Galileo set out for Jupiter in 1989 it first headed in the "wrong" direction towards Venus for a gravity assist there, followed by two from the Earth, before heading out to Jupiter.