- #1

- 4

- 0

**Runge-Kutta for gravitational N-Body simulation - "prediction" of acceleration**

Hey!

I'm Raph, as you can see this is my first post, so, thus I'll start saying that it's nice to be here ;).

I've got the following question:

I'm simulating a system of N gravitationally interacting objects, and I implemented a 4th order Runge-Kutta method for the numerical integration. For example, the first two of the four slopes needed to determine the velocity are something like:

[tex]

k_{v,1} = a (t , r)

[/tex]

[tex]

k_{v,2} = a (t+0.5\Delta t , r + 0.5 \Delta t k_{v,1} )

[/tex]

where "a" denotes the acceleration, "\Delta t" is the step size and "r" the position vector.

Of course I intend "a" to be the total acceleration on the object I'm considering, calculated by summing up all the accelerations due to the other objcets.

Finding

[tex]

a ( r + 0.5 \Delta t k_{v,1} )

[/tex]

would be really easy, as I just would have to move the object with position "r".

But to find

[tex]

a (t+0.5\Delta t , r + 0.5 \Delta t k_{v,1} )

[/tex]

I have to "predict" the positions of the other objects at time "t+0.5\Delta t".

What is the most common way to do so? I could simply do an Euler-Step of 0.5 \Delta t, but then the position of the object in consideration would differ from

[tex]

r + 0.5 \Delta t k_{v,1}

[/tex]

as requested by RK4. What do I do wrong? What didn't I understand right?

(Some more pieces of information: For the restricted three-body-problem that "prediction" was trivial, as the acceleration "a" was an easy function of "t" as the positions of the other objects could be predicted independently from the third object's position.

What is confusing me most is that "he": http://spiff.rit.edu/richmond/nbody/OrbitRungeKutta4.pdf doesn't even write the time-dependence of the acceleration in his equations for the slope-calculation.... )

Would be great to find some help!

Raph