Density Wave — Interactive Spiral Galaxy Simulation
A browser simulation of how the spiral arms of a disc galaxy can appear without any fixed structure holding them together. Every star follows its own elliptical orbit; the arms are simply where those orbits crowd.
What you are looking at
Each point is a star on its own slightly rotated elliptical orbit around a common centre, and stars near the core complete an orbit faster than stars further out. Because neighbouring orbits are turned by a small, steadily increasing angle, they bunch together along two or more sweeping curves. Individual stars drift into those crowded regions and out again: the pattern stays, the matter moves through it.
Density waves and the winding problem
A disc galaxy does not turn like a solid wheel — the inner parts orbit far faster than the outer parts. If spiral arms were fixed strings of stars and gas, this differential rotation would wind them into a tight coil within a few galactic rotations, and after billions of years no open spiral would be left. Yet the sky is full of galaxies with wide, open arms. This is the winding problem, recognised by Bertil Lindblad in the 1920s.
Density wave theory, developed by C. C. Lin and Frank Shu in the 1960s, answers it by treating the arms as a wave pattern that rotates at its own steady speed while stars and gas pass through it — closer to a traffic jam than to a wall. Gas compressed at the crest of the wave collapses into new stars, which is why real arms glow with young blue stars and pink hydrogen clouds. Switch on “Material arms” in the panel to watch the winding problem happen.
What this is not
This is a visual approximation, not an N-body or hydrodynamic simulation: the orbits are prescribed rather than computed from gravity. The supernova flashes and the Milky Way-inspired background band are decorative effects, not physical models, and the morphology slider approximates the look of the Sa–Sc sequence rather than classifying anything. The origin, lifetime and exact dynamics of spiral arms remain an active research question.
Controls
- Galaxy — morphology, bar strength, winding, arm count, zoom, time speed and viewing angle, plus one-click presets.
- Visuals — four colour palettes with automatic crossfade, colour and nebula intensity, star count from 3,000 to 30,000, supernova flashes and parallax.
- Sound — a procedural cosmic soundscape generated live by the Web Audio API, with a slider per layer.
- Keys — H hides the interface, F is fullscreen, P saves a PNG, V starts projector mode, M toggles sound.
Scientific basis
Density wave theory is a serious, observationally supported model, but it is one explanation among several and the nature of spiral structure is not a settled question. These are the primary sources behind the simulation:
Lin, C. C. & Shu, F. H. (1964). On the Spiral Structure of Disk Galaxies. The Astrophysical Journal, 140, 646.
Shu, F. H. (2016). Six Decades of Spiral Density Wave Theory. Annual Review of Astronomy and Astrophysics, 54, 667–724.
Dobbs, C. & Baba, J. (2014). Dawes Review 4: Spiral Structures in Disc Galaxies. Publications of the Astronomical Society of Australia, 31, e035.
Open source, MIT licensed — built by laci141. Source and download on GitHub ↗ build 2026-09-26