PDA

View Full Version : The gravitational n-body problem - galaxies!

HappyKoala
2016-Feb-05, 11:16 AM
Hey guys,

I'm trying to wrap my head around how to generate a miniature galaxy comprising of no more than 1000 (not in possession of a super computer, unfortunately!!!) stars that orbit a common gravitational center. The Kepler n-body problem, where one mass is vastly greater than the others in the system (our solar system is a prime example of the Kepler problem), is quite easy to simulate but whenever I try to get a thousand bodies of similar mass to orbit a common gravitational center the whole system collapses and you get bodies getting flung left, right, down and up. While this looks pretty cool, my goal is not to send stars careening through space, but rather to have them orbit their galactic center in a docile and serene fashion, so my question is if I'm failing at getting my thousand stars to act like a galaxy either because assuming that every star has the same mass is a bad thing to do (it is!), or because the intial conditions are off (for the solar system you have the NASA JPL ephemeris that gives you orbital state vectors for most known solar system bodies, but there's no galactic equivalent for this tool, unfortunately!!!). I also realize that the challenge I'm facing might be dark matter or gas cloud related (wouldn't surprise me since galaxies, if I have understood Pamela and Fraser correctly, seem to be anchored in wells of dark matter), in which case I'm probably lost, but I figured I would check with you guys to see if anyone around here might be able to give an answer or point me to some material that could be of use in this regard.

Have a nice day!!

Cougar
2016-Feb-05, 01:39 PM
Hey guys,

I'm trying to wrap my head around how to generate a miniature galaxy comprising of no more than 1000 (not in possession of a super computer, unfortunately!!!) stars that orbit a common gravitational center....

What center? In order to move one star to its new location in one time step, aren't you calculating that star's new gravitational acceleration due to each of the other 999 stars according to their mass and distance?

profloater
2016-Feb-05, 02:39 PM
Is this a disc galaxy? I guess not from your description and I guess you do not have a Keplerian supermassive black hole at the centre. Can you get three stars stable?

mkline55
2016-Feb-05, 03:44 PM
Check your starting positions and motion vectors. Are they completely random within a range, or are you starting with some premise, such as everything is in the same plane, and has a starting motion in the same rotational direction? Also, check the average density compared to the overall mass of 1000(s). By "check" it's not that they should be something in particular. It's that those can be critical to how your analog model functions.

ngc3314
2016-Feb-05, 08:45 PM
Simulating galaxies is a huge field with a huge literature, full of arguments about the optimal way to model various aspects. One issue that comes up with this few points is that each of them stands in for a bunch of stars but is numerically in a smaller volume, so there can be close passes with momentum transfer amounts that would never happen in real galaxies (because there are not really individual stars of 10 million solar masses coming that close to each other). One common way of dealing with this adequately is to adopt a softening length. When modeled particles approach each other within the softening length, the modeled gravity between them is reduced (for example by the amount appropriate for a uniform-density sphere).

In addition, getting a realistic initial condition is another whole issue, For a spherical galaxy it might work to start with equal total energy per particle and isotropic motion directions, if the space distribution follows a so-called King profile. (Velocities and positions have to match to start in a near-equilibrium configuration or purely numerical oscillations occur, which I'm pretty sure you know but bystanders might not).

Hornblower
2016-Feb-05, 08:49 PM
Is this a disc galaxy? I guess not from your description and I guess you do not have a Keplerian supermassive black hole at the centre. Can you get three stars stable?
A central black hole does not have an appreciable effect on the patterns of orbital motion except in a small region near the center. The most massive known ones are only a very small fraction of the total masses of their galaxies.

cjameshuff
2016-Feb-05, 10:57 PM
As ngc3314 said, you just don't have enough point masses. Every close encounter is like two supermassive black holes meeting. Sol and the Alpha Centauri stars would be doing some rather exciting things if they all had 1/1000th the mass of the Milky Way (which would make each of them about 232 times the mass of Sagittarius A*, the Milky Way's central supermassive black hole). Your dynamics are going to be more like those of a star cluster than a galaxy, there's just not enough resolution there to get the fluid effects of star motion within a full galaxy without additional measures.

One way to view the "softening length" is to consider each point mass to be a collection of stars with similar motions when it is distant, and a single star when nearby. This would underestimate the frequency of near passes, but give you a more realistic star mass/galaxy mass ratio.

Another sanity check to do is to compute the overall kinetic and potential energy, which should remain practically constant. If your simulation violates conservation of energy, it's not going to be stable.

Cougar
2016-Feb-06, 03:23 AM
....stars that orbit a common gravitational center.

To simplify things considerably, you could have each star orbit a central nucleus with a particular mass (although that central mass should change according to the star's distance from it, since more stars would be interior to the orbit of a star farther out, hence more mass). As ngc3314 mentioned, each star needs a particular initial (lateral) velocity that drops it into a somewhat circular orbit, as it's gravitationally affected at each step by the central mass.

Solfe
2016-Feb-06, 03:25 AM
The artist in me wants to go the other other direction. What if you didn't simulate 1000 stars, but the density of said star formations? I think it is called Density Wave Theory. It seems to work for galaxies and ring systems.

Jeff Root
2016-Feb-06, 11:12 AM
If you are simulating 1000 stars, and they have realistic masses
and are realistic distances apart, then you are simulating a small
globular cluster instead of a galaxy.

How massive are your stars? How far apart are they? What do
they do when they get close together? Do interactions become
exaggerated at small distances? If so, is it because you need
to use smaller timesteps when stars are close together?

-- Jeff, in Minneapolis

cjameshuff
2016-Feb-06, 01:24 PM
To simplify things considerably, you could have each star orbit a central nucleus with a particular mass (although that central mass should change according to the star's distance from it, since more stars would be interior to the orbit of a star farther out, hence more mass). As ngc3314 mentioned, each star needs a particular initial (lateral) velocity that drops it into a somewhat circular orbit, as it's gravitationally affected at each step by the central mass.

This approximation only works for circular orbits within a spherically symmetric mass distribution. For a real galaxy, it simplifies things to the point of being an unrealistic animation rather than a simulation.

The artist in me wants to go the other other direction. What if you didn't simulate 1000 stars, but the density of said star formations? I think it is called Density Wave Theory. It seems to work for galaxies and ring systems.

You could use a CFD simulation to model the galaxy, but it's not going to be computationally cheap or simple to implement. Modeling the star formation that produces the spiral arms in DWT would also be rather tricky, you'd need to handle the changes in composition from gas to stars and back as well as the total amount of matter.

Cougar
2016-Feb-06, 02:04 PM
This approximation only works for circular orbits within a spherically symmetric mass distribution. For a real galaxy, it simplifies things to the point of being an unrealistic animation rather than a simulation.

Yes. HappyKoala has to decide if he wants to program an animation that looks like a galaxy, or one that simulates how galaxies work, which can get very complex, with considerations for gas/dust, dark matter, light travel time..... As ngc3314 said, "Simulating galaxies is a huge field with a huge literature..."