Difference between revisions of "A Symplectic Integrator"
(Added articles category.) 
m (minor typo: an>a) 

Line 69:  Line 69:  
And that's about all there is to this this secondorder symplectic integrator. To integrate, one chooses a suitable small stepsize (so that the overall errors are as small as some tolerance that you require for your calculations); one specifies the initial conditions of the object  its position and velocity  and then one repeatedly applies the integration step for as long as you wish.  And that's about all there is to this this secondorder symplectic integrator. To integrate, one chooses a suitable small stepsize (so that the overall errors are as small as some tolerance that you require for your calculations); one specifies the initial conditions of the object  its position and velocity  and then one repeatedly applies the integration step for as long as you wish.  
−  Now, for those interested, it is worthwhile setting up this integrator in, say,  +  Now, for those interested, it is worthwhile setting up this integrator in, say, a spreadsheet and seeing how it performs under various sizes of timesteps. and initial conditions. Of course, if there is more than one gravitating body, then you have additional terms in the force functions, but the basic scheme of the updating rule remains the same. 
As a sequel to this post, I will sketch how you can quickly build fourth and sixth order symplectic integrators from this simple secondorder integrator.  As a sequel to this post, I will sketch how you can quickly build fourth and sixth order symplectic integrators from this simple secondorder integrator. 
Revision as of 17:51, 12 March 2017
Introduction
On Orbiter Forum, orbinaut Keithth G has described some of his results comparing the Orbiter numerical integrator with one of his own. In response to a user question, he provided the following description of the principles underlying a symplectic numeric integrator.
A secondorder symplectic integrator
First, let's focus on a basic secondorder symplectic integrator. It is worthwhile spending a little time on this because, so long as the timestep of the integration is small enough, it actually works pretty well. It is also an integrator from which it is possible to build higherorder syplectic integrators.
A couple of introductory points:
 The integrator is called 'symplectic' because (up to second order at least) it preserves the symplectic character of the physical system. This means that the longrun properties of the integrator tend to be much more stable than other kinds of integrators and, largely because of this, they have become very popular amongst physicists in the last couple of decades.
 The integrator is secondorder because it has been constructed so as to 'kill' error terms up to the secondorder only.
So, what is this integrator? If we just focus on a onedimensional system for a moment, then the integrator maps a pair of points to a new pair of points at a time later. We can think of this as taking a pair of numbers, , that describe the state of some object at some start time and updating this to a new pair of numbers, , that describes the new state of the same object at time .
There are three steps to this updating rule:
OK, so what do all of these symbols mean? Let's start with 'Q' and 'P'. In physics, largely because of a longstanding convention in nomenclature, 'Q' is often used to denote a spatial coordinate of something. Here, in our onedimensional example, you can think of 'Q' as representing the xcoordinate of some object moving in some gravitational field. In the same convention, 'P' is used to denote the momentum of the same object. (Formally, it is the generalised momentum conjugate to 'Q' but that's a nuance that we don't need to worry about here.). Here, we can think of 'P' as representing the xcoordinate of the momentum of a particle. But since momentum is just mass * velocity (in this coordinate system), we can think of 'P' as the xcoordinate of velocity (multiplied by the mass of the object). So, the pair of numbers just represents the position and velocity of the object at some initial time. And this is just the statevector of the object written in cartesian coordinates. In other words, the symplectic integrator is an updating rule that takes an object's state vector at some initial time, and returns a new state vector at some time later. (Now, you can extend this idea to three dimensions but for the time being we'll just stick with onedimension.)
Next, let's focus on the 'F' term. Again by convention, 'F' is used to denote the force acting on an object. Specifically, represents the force on the object being modelled when it is at position . So, to carry out the three steps of the integration updating rule, we need to provide some force function, which allows us to calculate the force on an object at a point in our onedimensional space (i.e., at any 'Q'). For object moving subject to a gravitational force from a single body, we know that:
(provided that )
where is the gravitational constant for the body in question; 'm' is the mass of the object that we are modelling, and is the location of the source of the gravitational field (e.g., the centre of the Sun or the Earth). If we work in Gaussian units where we measure distances in AU (Astronomical Units); velocity in AU/day; and mass in units of the mass of the Sun, then for an object moving in the gravitational potential of the Sun, and . For an object moving in the gravitational field of the Earth, . To convert from AU and days to metres and seconds, one needs to know that 1 AU = 149597870700 metres; and that 1 day = 86400 seconds. Unless the mass of the object that we are modelling is changing, it is convenient to set .
In this onedimensional system, the object moving in a gravitational potential is a bit limited in terms of directional options. It can either go up, or it can go down. Clearly, as the object moves towards the location of the gravitational source, the force acting on the object is going to increase without limit and the integration is going to going haywire, but so long as we are a reasonable distance away from then the integration scheme given above will provide a reasonable description of the object's motion.
In three dimensions
In three dimensions, the integration scheme looks much the same. But now we have to apply it to three spatial coordinates and three velocity components  i.e., the integration scheme becomes one that updates one set of 6 numbers to a new set of six numbers . And the second order integration scheme that does this is as follows:
Each step of the integrator is the same  except now we apply it three times  once for each spatial coordinate.
You should note that we now have three force functions rather than just one. This is because force is really a 'vector' rather than 'scalar' quantity. is the force acting in the xdirection on the object located at position ; is the force acting in the ydirection on the object located at position ; and is the force in the xdirection acting on the object located at position . And if we are in the gravitational field of a single body, then these functions become:
where are the coordinates of the gravitating body (when the object whose motion you are modelling is at )
And that's about all there is to this this secondorder symplectic integrator. To integrate, one chooses a suitable small stepsize (so that the overall errors are as small as some tolerance that you require for your calculations); one specifies the initial conditions of the object  its position and velocity  and then one repeatedly applies the integration step for as long as you wish.
Now, for those interested, it is worthwhile setting up this integrator in, say, a spreadsheet and seeing how it performs under various sizes of timesteps. and initial conditions. Of course, if there is more than one gravitating body, then you have additional terms in the force functions, but the basic scheme of the updating rule remains the same.
As a sequel to this post, I will sketch how you can quickly build fourth and sixth order symplectic integrators from this simple secondorder integrator.
And as a sequel to that I will talk about the distinction between 'implicit' and 'explicit' integrators.
Precis
This article has a precis and appears in the Random addon or Random article section on the Main Page. The precis can be found at A Symplectic Integrator/precis and is displayed below.
A Symplectic Integrator. An explanation of how to set up a certain type of numeric integrator, a key aspect of celestial mechanics calculations, such as those performed by Orbiter Space Flight Simulator. (More...)
