Earth · Scientific Methods
Universe in a Computer
How the laws of physics, played forward in a supercomputer, build galaxies — and how simulation became the third pillar of astrophysics
Universe in a Computer
How the laws of physics, played forward inside a supercomputer, built a cosmos that looks exactly like the one we see through telescopes — and why simulation became the third pillar of astrophysics, alongside theory and observation.
The Simulation That Built a Universe
In 2005, a supercomputer in Garching, Germany finished a calculation that had run for over a month. It had tracked 10 billion particles of dark matter, each representing roughly a billion solar masses, as gravity pulled them together across 13.8 billion years of cosmic time. The output — 25 terabytes of data — was a virtual universe contained in a cube 2 billion light-years on each side. When the Millennium Simulation finished rendering, it showed a structure that was hauntingly familiar: a vast, filamentary web of dark matter halos, with voids stretching between them — exactly the cosmic web that astronomers had been mapping in the real sky.
The simulation was led by Volker Springel at the Max Planck Institute for Astrophysics. It used a code called GADGET-2 — which Springel had also written — to solve the gravitational N-body problem for an unprecedented number of particles. But the truly remarkable thing was that it worked: the simulated universe, seeded only with the tiny density fluctuations measured in the cosmic microwave background, naturally grew into a structure that matched the real universe in extraordinary detail. It was, in a sense, the ultimate test of the cold dark matter paradigm — and it passed.
How to Simulate a Universe
The fundamental challenge of computational astrophysics is deceptively simple: we know the laws of physics — gravity, hydrodynamics, radiative transfer — but we can't solve them analytically for systems as complex as a galaxy, let alone the entire universe. So we simulate. An N-body simulation represents the universe as a collection of massive particles and asks the computer to calculate the gravitational force between every pair. That's an O(N²) problem — 10 billion particles means 100 quintillion calculations per timestep. Doing it naively would be impossible.
Instead, codes like GADGET-2 use clever algorithms: tree codes group distant particles together and approximate their combined gravitational pull, reducing the complexity to O(N log N). For gas dynamics, Smoothed Particle Hydrodynamics (SPH) models fluids as particles whose properties are smoothed over neighboring regions — a technique first introduced in 1977 that naturally concentrates computational resources where matter is densest. The result is a simulation that can follow the formation of cosmic structure from near-uniform initial conditions to the intricate web of galaxies we observe today.
How It Works
10 billion particles, 13.8 billion years of cosmic history, computed inside a machine — and the result matches what we see through our telescopes.
The Third Pillar
Before simulation, astrophysics had two pillars: theory and observation. Theory gave us equations — Einstein's field equations for gravity, the fluid equations for gas dynamics — but could only solve them in idealized cases. Observation gave us the real sky, but couldn't show us how it got that way. Simulation became the third pillar: a laboratory where you can run the universe forward from any set of initial conditions, tweak the parameters, and see what emerges. It is, in a precise sense, an experiment performed on a theory.
The Millennium Simulation confirmed the ΛCDM cosmological model — cold dark matter plus dark energy — with stunning fidelity. It showed that the large-scale clustering of galaxies depends not only on halo mass but on assembly history, a phenomenon called “assembly bias” that challenged simpler models. It demonstrated that the acoustic oscillations imprinted in the cosmic microwave background — sound waves frozen into the early universe — survive as subtle ripples in the galaxy distribution, detectable in surveys like the Sloan Digital Sky Survey. And it resolved a nagging tension: how could billion-solar-mass black holes power quasars less than a billion years after the Big Bang? The simulation showed that a few rare halos grew massive enough, fast enough, to seed them.
From Lightbulbs to Exascale
The first computational astrophysics experiment was run in 1941 by the Swedish astronomer Erik Holmberg. He couldn't use a digital computer — none existed — so he built an analog one: a grid of lightbulbs whose brightness represented the gravitational force between galaxies, with photocells measuring the inverse-square-law intensity. He used it to simulate the tidal interaction of two passing galaxies, producing spiral-arm patterns that looked remarkably like real galaxies. Holmberg published his results — without a single line of digital code — and computational astrophysics was born.
Today's simulations run on the world's fastest supercomputers. The successor projects to the Millennium Simulation — Illustris, EAGLE, IllustrisTNG — model not just dark matter but the full baryonic physics: star formation, supernova feedback, black hole accretion, and the chemical enrichment of the intergalactic medium. They produce virtual galaxies that look disturbingly real, with spiral arms, bulges, bars, and stellar halos — all emergent properties that were never programmed in, but arose naturally from the underlying physics. The universe, it turns out, really is that simple: gravity plus gas plus time equals galaxies.
What We Couldn't Have Known Otherwise
Without computational astrophysics, the cosmic web is just a pattern in the sky — beautiful but mute. With it, that web becomes a fossil record: the spacing of filaments encodes the sound waves of the early universe, the mass distribution of halos encodes the nature of dark matter, the abundance of galaxies encodes the physics of star formation and feedback. Every simulation that matches observation is a vote of confidence in our understanding of physics. Every mismatch is a clue to something we're missing.
Computational astrophysics taught us that the largest structures in the universe — the filaments and voids of the cosmic web — are the natural outcome of gravity acting on near-uniform initial conditions over billions of years. No design, no special initial arrangement. Just physics. And that, in its own quiet way, is one of the most profound discoveries in the history of science.
Further Reading
- Simulations of the Formation, Evolution and Clustering of Galaxies and Quasars — Springel et al., Nature (2005). The original Millennium Simulation paper.
- The IllustrisTNG Project — tng-project.org. The state of the art in cosmological simulations, with full baryonic physics and publicly available data.
- Computer Simulation Using Particles — R.W. Hockney & J.W. Eastwood. The classic textbook on N-body and particle-mesh methods, still relevant after decades.
- GADGET-4 — Volker Springel's latest cosmology code, open source and used by research groups worldwide. The descendant of the code that ran the Millennium Simulation.