This program simulates the gravitational collapse of a random cloud of particles (in 2D). This produces effects somewhat like the simulations of the early universe that have been done on supercomputers since the 1980s. Now, thanks to the rapid increase in CPU power over the years, desktop computers can produce similar-looking results. The preferences file allows you to change a few of the simulation parameters: making the "grid size" larger will increase the accuracy of the gravitational forces calculation (you will see cusp-like artefacts if you make it too low), but this makes the computer work harder for each step, reducing the frame-rate. I haven't actually tried playing with the timestep parameter, but it is currently set at a fairly sensible value.
Looking around the web a bit, this is how the professionals do it. Note the phrase "One billion mass elements and 10243 Fourier grid cells". The default for my simulation is 20`000 mass elements (which I call "particles") and 1282 Fourier grid cells. Also note how much CPU power that other simulation needs...
Note that the "try it now" version only uses the default configuration; the full download includes an editable
config.txt file to adjust number of particles etc.
Try it now! - press open/run if the browser prompts you.
- - - [Download] - - -
- - - [Screenshot Sequence] - - -