Galaxy animation from 2010

I’ve been rewriting a gravity simulator (see my earlier posts on ephemerides and relativity).  This isn’t because I’ve thought of a better design or come upon a better technology for it.  It’s because I lost the first version!  I’ve recovered almost up to the point where I was before, writing essentially the same program (in C, with naive n-body and Barnes-Hut implementations).

The main difference between the two projects is that the first one aimed at simulating galaxies.  By “galaxy” I mean a system with thousands of stars; billions is not computationally feasible with my program and hardware (yet).  This time round, I’ve concentrated on a solar system simulation, with the actual planets of our own system and several of their major moons.  I’ve tried re-exploring galaxies but it’s quite hard to find starting conditions that result in a pleasing shape.  Perhaps the trick is to take data for a real galaxy and scale it down in a consistent manner.

The one artefact of the previous version is this animation of a galaxy.  I do not know the scale, number of stars, or starting conditions.  I recall that the colours are assigned by initial distance from centre, and are there to a) make it look more like a celestial object and less like abstract pixels; and b) indicate whether the initial distance of a star predicts distance once a steady state is reached.  (And, when rerun with a steady state as the initial conditions, whether stars tend to maintain their distance.)

This entry was posted in Science, Simulation and tagged . Bookmark the permalink.

3 Responses to Galaxy animation from 2010

1. Pingback: Dark Energy | EJRH

2. halitus says:

Ed-man you need to check out Carl Sagans cosmos. Episode 10 if you only watch one. He has some impressive galaxy simulations he shows.

I was wondering if for your future simulations it might be useful to instead of tracking thousands of sprites you could instead break the space into many elements and in each of those you could track star density and “flow rates” instead. Im not sure about some of the details but it might be computationally easier.

If you get famous I want some recognition :P

• ejrh says:

Hmm. The thing is that the future state of the galaxy doesn’t depend just on the mass distribution but the inertia distribution too. And particles that are close together might be flying in completely different directions. So each element in space needs to have several components of inertia, in different directions. I guess we could do that by recording the flow rate into each neighbouring element. Every iteration you update the density based on its incoming/outgoing flow rates, and update the flow rates based on the densities of all other elements (according to their distance).

Anyway it sounds a bit like the Particle Mesh method, which seems to use FFT to compute gravity. Gadget might do it, I could have a look at the code to see how.