Help building an n-body simulation incorporating the speed of gravity

In summary, the speaker is looking for introductory level references for building an n-body gravity simulation and plans to incorporate the speed of gravity in the simulation. They have experience with particle-particle simulations and are considering using a discretized domain and mesh n-body simulations. The speaker also mentions wanting to make the simulation accessible to high school students and discusses the potential use of C and netlogo languages. There is also a discussion about the use of special relativity in the simulation and a recommendation for a reference text. Finally, the speaker mentions the challenges of incorporating the speed of gravity in the simulation, using the example of the Milky Way galaxy.
  • #1
nearc
Gold Member
66
6
I would like some introductory level references for building an n-body gravity simulation. I work for the supercomputer challenge [ http://challenge.nm.org/ ] and I build the teaching models each year we use to train teachers in computer modeling and provide as an example model for the students during the year. We have done n-body a few times in the past with all levels of the challenge, however, they were particle-particle but I would like to build a n-body that incorporates the speed of gravity and if possible uses a discretized domain. I started looking at mesh n-body simulations, but I’ve only found high level information thus far. I wonder if this is the best approach and if so how can I find some more introductory level information because eventually I would like to find a way to bring it down to our student’s level [high school]. I would like to get knee deep in the
understanding and building of this type of simulation so I imagine it will
require the use of C for power and parallelization, however, our lower level
students will be using netlogo [ http://ccl.northwestern.edu/netlogo/ ]. I would like to go as far as building a galaxy, but for our high school students a single solar system will be a
good starting point but I do want to make sure the model does account for
the speed of gravity.
 
Space news on Phys.org
  • #2
nearc said:
I would like some introductory level references for building an n-body gravity simulation. I work for the supercomputer challenge [ http://challenge.nm.org/ ] and I build the teaching models each year we use to train teachers in computer modeling and provide as an example model for the students during the year. We have done n-body a few times in the past with all levels of the challenge, however, they were particle-particle but I would like to build a n-body that incorporates the speed of gravity and if possible uses a discretized domain. I started looking at mesh n-body simulations, but I’ve only found high level information thus far. I wonder if this is the best approach and if so how can I find some more introductory level information because eventually I would like to find a way to bring it down to our student’s level [high school]. I would like to get knee deep in the
understanding and building of this type of simulation so I imagine it will
require the use of C for power and parallelization, however, our lower level
students will be using netlogo [ http://ccl.northwestern.edu/netlogo/ ]. I would like to go as far as building a galaxy, but for our high school students a single solar system will be a
good starting point but I do want to make sure the model does account for
the speed of gravity.

According to Newton's theory gravity is instantaneous. It's not true, but it works remarkably well. In order to do what you like you would have to use general relativity. It would make no noticeable difference and would complicate things a great deal. It would make for a very slow simulation. Physicists avoid using general relativity. I say stick with Newton,
 
  • #3
This seems like a really interesting project, as I have been thinking about this (not strictly simulation, but just thinking about the n-body problem with the speed of gravitational propagation built in) for a while.

Further to Hornbein's comment, I wonder whether it would be possible to simulate using Special Relativity (SR) instead of General Relativity as a simplification. I think this would work as long as the gravitational forces and velocities involved between your particles were relatively weak/slow and excluded, for example, anomalies such as black holes or particles moving with speeds a significant fraction of the speed of light or superimposed particles exerting an infinite gravitational force on each other. However, feel free to correct me if I am wrong.

On the basis of a SR model, I guess there would be several questions to ask:

1. Will the simulation be from the reference frame of an external observer (with no mass) or one of the particles?
2. Will it be a simulation with two spatial dimensions but with an inverse square law, or 3D?
3. Will you be simulating what the external observer will be observing (and therefore what he will see once the light reaches his eye) or what is actually happening (based on an assumption of instantaneous events in SR from the reference frame of the observer)?

An excellent reference text I would recommend is the first few chapters of "Understanding Einstein's Relativity". I shall look up the author and let you know. This should be understandable by undergraduate students with a knowledge of basic calculus, and motivated high school students.
 
  • #4
Hornbein said:
According to Newton's theory gravity is instantaneous. It's not true, but it works remarkably well.

And with a limited speed for gravity the results are remarkably wrong. Such a simulation is a waste of time (I know what I'm talking about).
 
  • #5
Hornbein said:
According to Newton's theory gravity is instantaneous. It's not true, but it works remarkably well. In order to do what you like you would have to use general relativity. It would make no noticeable difference and would complicate things a great deal. It would make for a very slow simulation. Physicists avoid using general relativity. I say stick with Newton,

while it may turn out to be a hideous or impossible task to bring this down to the high school level [heck it might be too hard to get down to my level ] i would like to try. as a reference point, the milky way is 100000 yr across, so the gravitation of a star on one side will take 100000 years to affect a star on the other side. meanwhile, the galaxy is rotating at ~225 km/s so the Newton calculations would be off by [ 225 * 100000 * 60 * 60 * 24 * 365 ] 7.0956e+14 km. not mention other movements [i.e. small group, great attractor, etc...]. granted objects that far away from each other have greatly reduced influence on one another
 
Last edited:
  • #6
DrStupid said:
And with a limited speed for gravity the results are remarkably wrong. Such a simulation is a waste of time (I know what I'm talking about).
Then you did it wrong.

It's easy to get this wrong. The results are going to be remarkably wrong if all one does is tack on a finite transmission speed to Newtonian gravity.

Getting it right isn't easy. A full-blown relativistic simulation that uses Einstein's field equation is going to be very difficult to construct. A parametrized post-Newtonian formalism can make the problem tractable. This means smallish masses, largish distances, and smallish velocities. Small velocities: 100 km/s is small, perhaps even 1000 km/s. A sizable fraction of the speed of light is not small. Smallish masses: The Sun's mass is "small". The supermassive black hole at the center if the galaxy is not small. Largish distances: Mercury orbits the Sun at about 200 million Scharzchild radii. That's large. The stars that come very close to the Milky Way's supermassive central black hole: Those distances are not large.

Each of the three lead groups in modeling the solar system (JPL, the Institute of Applied Astronomy at the Russian Academy of Sciences, and the Paris Observatory) use a PPN formalism in their equations of motion. Basically, pretend the universe is still Newtonian with general relativity adding small perturbations.

For detail, see http://iau-comm4.jpl.nasa.gov/XSChap8.pdf [Broken], particularly equation 8-1.
 
Last edited by a moderator:
  • #7
nearc said:
We have done n-body a few times in the past with all levels of the challenge, however, they were particle-particle but I would like to build a n-body that incorporates the speed of gravity and if possible uses a discretized domain.

Regarding spatial discretization I believe that some n-body simulation of galaxies and similar uses sparse octree decomposition called Barnes-Hut [1] that allow O(n*log(n)) time complexity instead of O(n2) per step. However, I have no idea whether or not such a simulation can be combined with a post-Newtonian or relativistic gravity model.

[1] http://en.wikipedia.org/wiki/Barnes–Hut_simulation
 
  • #8
D H said:
Then you did it wrong.

It is well known, that Newtons law of gravity with non-instantaneous interactions (and that's what I was talking about) give wrong results - even if you do it right. Newton himself was already aware of that.
 
  • #9
It's really quite difficult to do this right. The problem boils down to how aberration works, which makes gravity act as if it were instantaneous up to the second derivative in objects' speeds. Steve Carlip did a good write-up of how the speed of gravity works here:
http://arxiv.org/abs/gr-qc/9909087

I'm not sure that will help you to produce a real simulation, but at least it should provide some understanding of why it isn't very easy.
 
  • #10
Further to my previous comment, I have thought a bit more, and realized that Special Relativity might not be required for a simulation with relatively small masses and low speeds, something I think that DH has also indicated in his comment above. This will result in neglible time and space dilation and other relativistic effects. Obviously, for small masses and low speeds, you will need long time horizons in the simulation to allow time for the objects to interact.

(The book I had mentioned is actually called 'Introducing Einstein's Relativity' by (Prof.) Ray d'Inverno, incidentally, although obviously a simulation not involving relativity will make this redundant.)

I was not aware of the aberration mentioned by Chalnoth, and I had assumed that we could simply assume that gravity propagates at the speed of light.

For a simulation with gravity propagating at the speed of light, even if you are not involving Special or General relativity, I think you will still need to treat gravity as a field. Therefore, each object will have its own gravitational field with a field strength defined at each point in space.

If you are simulating from the frame of reference of an 'external' massless non-interacting observer observing the rest of the "universe" in 2D, which I think will be the simplest version, the gravitational field of a point particle which is static in relation to the observer can be portrayed as a series of concentric circles based on Newton's inverse square law. The gravitational field of a particle in relative motion will be a series of changing non-concentric circles (which cannot overlap), although I guess for low speeds, this will approximate to a series of concentric circles, which may render the simulation meaningless. The net effect on another particle will be the sum of the gravitational fields of all the other particles at the location of the other particle at a particular point in time.

I'd be interested to learn whether a simulation of this nature will come up with anything interesting, such as a precession of an elliptical orbit, for example.
 
  • #11
Vaskor said:
Further to my previous comment, I have thought a bit more, and realized that Special Relativity might not be required for a simulation with relatively small masses and low speeds, something I think that DH has also indicated in his comment above.
That is not what I wrote. What I wrote was that "a parametrized post-Newtonian formalism can make the problem tractable. This means smallish masses, largish distances, and smallish velocities." I wrote that assuming you want to go beyond a Newtonian simulation. A PPN / linearized gravity is one way to go beyond Newton. It won't work for modeling the merger of two black holes, but it does work quite nicely for modeling solar systems, galactic clusters, and even galaxies (but what happens in the galactic core is going to be problematic).

Look at my reference again. http://iau-comm4.jpl.nasa.gov/XSChap8.pdf [Broken]. That big mess of an equation near the bottom of page 3, equation 8-1, is what JPL uses to formulate their planetary ephemerides. The Newtonian version of that equation: $$\ddot{\vec r}_i = \sum_{j\ne i} \frac {\mu_j (\vec r_j - \vec r_i)}{r_{ij}^3}$$

For a simulation with gravity propagating at the speed of light, even if you are not involving Special or General relativity, I think you will still need to treat gravity as a field. Therefore, each object will have its own gravitational field with a field strength defined at each point in space.
You don't want to go there. It will be wrong. Simply adding a lag to Newtonian gravity gives notoriously bad results.

Simplifying things perhaps too much, some of those non-Newtonian term in that weak field PPN formalism (that equation 8-1) are lag terms, others are lead terms. For small velocities and large distances, those lag and lead terms nearly cancel. In the limit, they do cancel, leaving only the Newtonian gravity terms.You haven't indicated how big your system is -- What is the value of "N" in your N-body simulation?
 
Last edited by a moderator:
  • #12
I think he was trying to say something slightly different, D H, that it seemed unlikely that you could deal with a finite propagation speed without modeling how the field actually propagates.

And it does turn out that there have been simulations developed precisely for modeling the gravitational field for General Relativity in great detail. I'm having a hard time finding the actual work from a cursory search, but this is a light overview:
http://worldsciencefestival.com/videos/when_black_holes_collide [Broken]

This won't help the OP, though, because I'm sure the computational requirements are just way out of bounds for more complicated systems.
 
Last edited by a moderator:
  • #13
i would like to start with a simplified spiral galaxy. starting with a random distribution and ending with a stable spinning spiral. the number of bodies can be small, just large enough to show the intended behavior of the system not to recreate an existing galaxy.
 

1. How is the speed of gravity incorporated into an n-body simulation?

The speed of gravity is incorporated into an n-body simulation by using the gravitational force equation, which takes into account the distance between two objects and the speed of gravity. This equation is then applied to each pair of objects in the simulation to calculate the force of gravity between them.

2. What is the advantage of incorporating the speed of gravity into an n-body simulation?

Incorporating the speed of gravity into an n-body simulation allows for more accurate and realistic simulations. Without considering the speed of gravity, the simulation would only reflect the instantaneous force between objects, which may not accurately represent the actual movement of objects in space.

3. How is the speed of gravity determined in an n-body simulation?

The speed of gravity is determined by the gravitational constant and the distance between two objects. This speed is used to calculate the force of gravity between the objects in the simulation.

4. Can the speed of gravity be adjusted in an n-body simulation?

Yes, the speed of gravity can be adjusted in an n-body simulation by changing the value of the gravitational constant. However, this may affect the overall accuracy of the simulation as the gravitational constant is a fundamental physical constant.

5. Are there any limitations to incorporating the speed of gravity into an n-body simulation?

One limitation is that the speed of gravity is assumed to be constant in most n-body simulations, which may not be the case in certain scenarios. Additionally, incorporating the speed of gravity may also require more computational power and time to run the simulation, making it more complex and resource-intensive.

Similar threads

  • Classical Physics
Replies
2
Views
1K
  • STEM Academic Advising
Replies
3
Views
757
  • Programming and Computer Science
Replies
19
Views
2K
Replies
12
Views
2K
  • Classical Physics
Replies
7
Views
750
Replies
6
Views
657
  • Special and General Relativity
Replies
4
Views
1K
Replies
25
Views
2K
Replies
2
Views
1K
  • Classical Physics
Replies
15
Views
2K
Back
Top