Nonlinear Structure Formation and N-body Simulations
Linear perturbation theory is a triumph of cosmology, but it is a theory of the infinitesimal: it holds only while the density contrast stays far below one. The moment a region grows to that description fails. Fourier modes that evolved independently begin to couple, cold streams of matter cross and fold, and violent relaxation scrambles orbits into a bound object. Everything that makes the Universe interesting to look at — galaxies, clusters, and the filamentary cosmic web threaded between the voids — lives in this nonlinear regime, and for a cold, pressureless, collisionless fluid there is no general analytic solution to reach it. So cosmologists run the experiment numerically. The dark matter is a smooth phase-space distribution obeying the collisionless Boltzmann (Vlasov) equation coupled self-consistently to Poisson's equation. A six-dimensional grid is hopeless, so one Monte-Carlo samples with tracer particles, each coasting along a characteristic of the Vlasov flow — nothing more than Newton's law in an expanding box. Each particle is a parcel of dark matter, not a physical WIMP; its mass fixes the resolution and a softening length tames the short-range force. The whole art is then computing the mutual gravity of bodies fast enough. Direct summation is exact but scales as ; tree codes group distant matter into multipoles for ; particle-mesh methods solve Poisson on an FFT grid; hybrids marry the two. The outputs — halo catalogues, profiles, mass functions — are checked against spherical collapse, Press–Schechter theory, and the NFW profile, and against galaxy surveys, lensing, and the baryon acoustic peak. This is the machinery that turns CDM from a parameter set into a universe.
- Linear theory dies at ; beyond it, mode coupling, shell crossing, and virialization make structure formation intrinsically nonlinear, with no general closed-form solution.
- The governing physics is the Vlasov (collisionless Boltzmann) equation coupled to Poisson; the practical solution samples the phase-space distribution with particles following its characteristics — Newtonian gravity in comoving coordinates.
- Gravity is evaluated by direct summation (), tree codes (), particle-mesh FFT solvers, or TreePM/PM hybrids, and time is advanced by a symplectic leapfrog.
- Spherical collapse supplies the analytic anchors every code is calibrated against: turnaround overdensity , linear threshold , and virial overdensity .
- Halos emerge with a near-universal NFW profile and an abundance described by Press–Schechter and Sheth–Tormen theory, assembled into the cosmic web of sheets, filaments, and knots.
- Key idea: nonlinear collapse is followed by sampling the collisionless phase-space distribution with particles moving along the characteristics of the Vlasov equation in an expanding background, with self-gravity solved by tree, PM, or TreePM algorithms; spherical collapse and Press–Schechter theory are the analytic scaffolding.
Nonlinear collapse is followed by sampling the collisionless phase-space distribution with particles that move along the characteristics of the Vlasov equation in an expanding background, with self-gravity solved via tree/PM/TreePM algorithms; the spherical collapse model and Press–Schechter theory provide the analytic scaffolding.
Where this lives today
Cosmological -body simulation is now an industrial-scale enterprise at the centre of precision cosmology. Flagship dark-matter runs — Millennium, Bolshoi, MultiDark, the exascale AbacusSummit and Uchuu suites following trillions of particles — provide the templates against which surveys are read. When DESI measures the baryon acoustic peak, or Euclid and the Vera Rubin Observatory's LSST map weak-lensing shear across billions of galaxies, the interpretation runs through mock catalogues that predict the nonlinear power spectrum, the halo mass function, and their covariance to percent accuracy. Because a full simulation per trial cosmology is impossibly expensive, the field has turned to emulators — machine-learning surrogates that interpolate observables across parameter space in milliseconds. Meanwhile the small-scale predictions of collisionless CDM are where the model is most sharply tested: the "core–cusp" tension and the "missing satellites" and "too-big-to-fail" problems drive both baryonic-feedback modelling and simulations of warm, fuzzy, and self-interacting dark matter. The largest hydrodynamic runs — IllustrisTNG, EAGLE, SIMBA — fold gas, stars, black holes, and feedback onto the dark-matter skeleton, closing the loop to observed galaxies.
The physical picture
Picture the dark matter as a smooth, cold fluid with no thermal pressure to hold it up. Wherever it is slightly overdense, its extra self-gravity slows the local expansion; the region lags behind the Hubble flow, turns around, and falls back on itself. In linear theory each Fourier mode of grows by the same factor and never notices its neighbours; nonlinearity is the moment the modes begin to talk to each other and a patch detaches to become a self-bound halo. Because the fluid is collisionless it passes straight through itself, so the first structures are not blobs but sheets — matter falls onto a plane, overshoots, and forms a caustic "pancake." Pancakes drain into filaments, filaments into knots, and the knots are the halos where galaxies light up: the cosmic web that galaxy redshift surveys map. The single most important quantitative anchor is the spherical collapse model, and the first figure is its whole story. Treat one overdense sphere as a closed sub-universe: it expands, turns around, and collapses along a cycloid. Real matter never reaches the singular point; it virializes at half the turnaround radius. Following the numbers through gives three constants every simulation is measured against — turnaround overdensity , virial overdensity , and linear collapse threshold .
An -body simulation realizes exactly this collapse for millions of overlapping spheres at once. Lay down particles displaced from a uniform grid by the Zel'dovich approximation, seed the displacements from the linear power spectrum , and integrate Newtonian gravity in an expanding box from to today. The only real obstacle is speed: summing the mutual attraction of every tracer at every timestep by brute force costs operations — ruinous for the to particles of a modern run. The second figure is why the field exists in its present form: hierarchical and mesh algorithms replace with , turning centuries of computing into days.
The core equations
The fundamental object is not a particle but a distribution. Dark matter fills a six-dimensional phase space, and its evolution under gravity alone is governed by the collisionless Boltzmann — or Vlasov — equation, which states that the phase-space density is conserved along every trajectory.
where: — phase-space distribution of the dark matter; — comoving position; — comoving canonical momentum; — scale factor; — particle mass; — peculiar potential. Reading it: is conserved in phase space, only sheared and folded by gravity — the basis for solving it with tracer particles. The potential is sourced by the matter itself through Poisson's equation. In comoving coordinates only departures from the mean gravitate, so the source is the density contrast , not the full density.
where: — peculiar potential; — density contrast; — mean matter density; — matter density parameter; — Hubble parameter. Reading it: a uniform universe produces no peculiar force () — structure gravitates only where matter clumps. Each tracer obeys the characteristic of (1) — Newton's second law dressed for an expanding universe, with a "Hubble drag" term that damps peculiar velocities as the box stretches.
where: — comoving coordinate; — Hubble drag; — peculiar acceleration. Reading it: with peculiar velocities redshift away as ; with it is ordinary Newtonian dynamics. Evaluating particle-by-particle gives the softened direct-summation force. The softening length flattens the divergence at short range so close-passing tracers do not scatter violently — an artifact of finite , not real physics.
where: — separation between particles and ; — softening length; — tracer masses. Reading it: for this is exact Newtonian gravity; for the force saturates instead of diverging. The sum in (4) is what costs . Barnes–Hut tree codes avoid it by lumping a distant clump into one multipole, opening a cell only when it subtends too large an angle.
where: — node (cell) size; — distance from the node's centre of mass to the target; — opening angle, typically to . Reading it: a small, faraway cell () is replaced by one multipole, so each particle sees only nodes — the scaling of the second figure. Spherical collapse supplies the calibration constants. The first is the linear collapse threshold: extrapolate the linear growth of a perturbation to the moment its exact nonlinear counterpart collapses, and in an Einstein–de Sitter universe it has reached this universal value.
where: — linearly extrapolated overdensity at collapse. Reading it: a bookkeeping number, not a real density — the barrier a linear field must cross for the true field to have collapsed, feeding the mass function below. The second constant is the actual mean overdensity of the settled halo relative to the background — the number that defines a halo's edge.
where: — mean halo overdensity relative to background at virialization. Reading it: halos are defined as spheres enclosing (often rounded to ) times the mean or critical density, giving and . Inside those halos, simulations find a near-universal shape — the Navarro–Frenk–White profile — independent of mass and cosmology, with a cusp at the centre and a falloff outside the scale radius.
where: — characteristic density; — scale radius; concentration . Reading it: two numbers — or equivalently mass and concentration — fix the entire density run of a relaxed halo. Halo abundance versus mass is captured by the Press–Schechter mass function, the statistical bridge from the initial Gaussian field to the collapsed-object count.
where: — comoving halo number density; — halo mass; — rms fluctuation smoothed on scale ; . Reading it: the exponential cutoff makes cluster abundance exquisitely sensitive to — the lever that turns halo counts into a cosmological measurement. The motion is advanced by the symplectic leapfrog integrator in kick–drift–kick form (, then , then a second half-kick). Because it conserves phase-space volume and is time-reversible, it shows no secular energy drift over the billions of steps of a run — which is why it beats a high-order Runge–Kutta scheme.
The goal is to derive, from Newton's law alone, the three constants that calibrate every cosmological simulation: the turnaround overdensity , the virial overdensity , and the linear collapse threshold . The trick is that a uniform overdense sphere in an Einstein–de Sitter background is itself a closed Friedmann universe, so its exact evolution is the familiar cycloid — and comparing that cycloid to the background at matched times converts a one-line orbit into the numbers cosmologists quote.
Step 1. Take a uniform sphere of mass and radius . By Newton's shell theorem the boundary obeys ; first-integrating gives , and for an overdensity , so the orbit is bound and must turn around. Why: stronger self-gravity than the background makes the sphere bound — collapse is guaranteed.
Step 2. The bound solution is the cycloid , with . The angle runs from at the Big Bang to at turnaround () and on to where . Why: the same parametric solution as a closed Friedmann universe, so the sphere re-collapses like a mini big crunch.
Step 3. Compare densities at turnaround. The sphere has ; the EdS background at has . Substituting , gives . Why: the region is already five times the mean density when it stops expanding — the first hard number.
Step 4. A collisionless sphere cannot reach ; it virializes. The virial theorem with energy conservation (all potential at turnaround, where ) forces , raising the density by . Why: orbits phase-mix and settle at half the turnaround radius — this is where a real halo lives.
Step 5. The background keeps diluting between turnaround () and formal collapse (), a factor . Multiplying: . Why: the halo is measured against a thinned-out background, boosting the contrast to the canonical .
Step 6. Separately, expand to lowest order in for the linear growth , and evaluate at : . Why: the value linear theory reports at collapse — the Press–Schechter threshold, cleanly separated from the true overdensity . *The exact EdS values are , , and . In CDM the values shift slightly: and relative to critical density.*
Go deeper · Derivation B · 1 minThe Press–Schechter halo mass function
The goal is to predict how many collapsed halos of each mass exist, starting only from a Gaussian initial density field and the threshold derived above. Press and Schechter's idea sidesteps the intractable nonlinear dynamics entirely: smooth the linear field on a mass scale , declare any region above collapsed into a halo of at least that mass, and count. It works better than it has any right to, and repairing its one embarrassing factor of two runs from a 1974 fudge to modern excursion-set theory.
Step 1. Smooth the linear density field with a filter enclosing mass ; because the field is Gaussian with variance , the fraction of space above the collapse barrier is . Why: identifying "collapsed on scale " with "linear field exceeds when smoothed on " converts a dynamics problem into a Gaussian tail integral.
Step 2. As (no smoothing) this fraction tends to , not — half of all mass appears never to collapse, which is absurd. Press and Schechter multiply by , arguing underdense material is swept into larger collapsed structures. Why: the "cloud-in-cloud" problem; the factor of two, a 1974 heuristic, was later justified by the excursion-set formalism.
Step 3. Differentiate the corrected fraction with respect to mass and multiply by to get a number density per unit mass — equation (9), compactly , . Why: the exponential makes massive clusters (large ) exponentially rare and so cosmology-sensitive.
Step 4. Calibrating against simulations, PS overpredicts low-mass and underpredicts high-mass halos; Sheth and Tormen fix this with ellipsoidal collapse, a moving barrier with , . Why: real peaks collapse along their shortest axis first, so the effective threshold depends on scale — the correction that makes the mass function percent-accurate. *The form reduces to standard PS with , and by construction , so all mass is accounted for.*
Go deeper · Derivation C · 1 minFrom the Vlasov equation to N bodies
The goal is to justify the central sleight of hand of the whole field: that throwing down point particles and integrating Newtonian gravity actually solves the continuous Vlasov–Poisson system (1) and (2). It is not obvious — a smooth six-dimensional distribution is replaced by a cloud of discrete points — and the justification rests on the method of characteristics, which turns the PDE for into ordinary differential equations for trajectories.
Step 1. The Vlasov equation (1) says : the convective derivative vanishes, so phase-space density is conserved following a fluid element — Liouville's theorem for a collisionless system. Why: with no collisions to scatter particles between cells, the fluid density is frozen along its streamlines.
Step 2. Those streamlines — the characteristics — are exactly Hamilton's equations , , the single-particle equations of motion (3). Why: solving the PDE reduces to following trajectories that are just the orbit of one particle in the mean field.
Step 3. Sample the initial with points, advance each along its characteristic with leapfrog, and recompute from their density via Poisson (2) each step. The evolving cloud is a Monte-Carlo estimate of . Why: because is conserved along characteristics, the tracer density tracks the true — the -body method, whose error falls as sampling improves.
Step 4. The loop closes: particles source the potential, the potential accelerates the particles. The only unphysical ingredient is discreteness, controlled by softening and by using large enough that the relaxation time exceeds the age of the universe. Why: exact as , ; finite- noise is the price of tractability and must be quantified. *The characteristics of (1) reproduce the equations of motion (3), and the collisionless limit is recovered as .*
Limiting cases
Nonlinear structure formation is bracketed by regimes that are individually well understood; a correct simulation must reproduce each in its corner of parameter space.
| Case | Result | Meaning |
|---|---|---|
| Linear regime | Every mode grows by the same factor , independently — a code must reproduce this before nonlinearity sets in, the primary validation test. | |
| Quasi-linear (Zel'dovich) | First-order Lagrangian theory: particles stream along their initial displacement field until trajectories cross and form caustic pancakes. Used to seed initial conditions. | |
| Fully nonlinear | Virialized halos, tractable only numerically. The overdensity threshold defines the halo boundary () and enclosed mass. | |
| Collisionless limit () | The physical target: dark matter never two-body relaxes, retaining its phase-space structure (streams, caustics) indefinitely. | |
| Discrete artifact (finite ) | Finite injects spurious relaxation and heating; kept negligible by large and softening . |
Worked examples
1 · Why a billion-body run needs a tree (fully worked)
A simulation follows particles. Compare the cost per timestep of direct summation against a TreePM solver, and translate the difference into wall-clock time on a petascale machine sustaining floating-point operations per second.
Step 1. Direct summation touches every pair: operations per force evaluation. On a flop/s machine one step takes s, about 17 minutes — for a single timestep, of thousands.
Step 2. A tree/TreePM solver scales as . With , that is operations — tens of microseconds of raw arithmetic per step (real codes are slower from memory traffic, but the scaling is the point).
Step 3. The ratio is : the tree does the same physics with thirty million times fewer operations. Over steps, direct summation would burn operations (months of supercomputer time) while the tree finishes in seconds. This ~3×10⁷ factor is why cosmological N-body simulation is an O(N log N) discipline, not O(N²).
2 · Is a simulated halo collisionless? (fully worked)
A dark-matter halo is resolved with particles and has a crossing time Gyr. Estimate its two-body relaxation time and compare to the age of the universe, yr.
Step 1. The standard estimate is . With , , so the prefactor is .
Step 2. Multiply by the crossing time: .
Step 3. Compare: . The halo relaxes times more slowly than the universe is old, so two-body relaxation is negligible and the halo faithfully samples a collisionless system. The scaling matters: going to pushes up by roughly , buying deeper collisionless fidelity. Large N is not vanity; it is what keeps the numerics collisionless.
Physics of the portrait
Nonlinear structure formation was built by many hands, but no single career embodies its arc — from the first crude simulations to the industrial runs that define CDM — better than Simon White's.
Origins · 1 minSimon White and how this was discovered
Simon White is a British-German cosmologist who, more than almost anyone, made numerical simulation the arbiter of how cosmic structure forms. In 1978, with Martin Rees, he laid out the two-stage picture in which gas cools inside dark-matter halos that grow by hierarchical merging — the skeleton of modern galaxy formation. His defining contribution came in 1985, when Marc Davis, George Efstathiou, Carlos Frenk, and White published the "DEFW" simulations of a cold dark matter universe. Tiny by today's standards, they showed for the first time that CDM plus gravity naturally produces the observed web of filaments and voids, effectively selecting CDM over hot dark matter by direct comparison with galaxy clustering. White then chased the halos' internal structure: with Julio Navarro and Frenk he found, in 1996 and 1997, that relaxed halos of every mass share one universal density profile — the NFW form of equation (8), so robust it became a diagnostic of the dark matter's cold, collisionless nature. As a director of the Max Planck Institute for Astrophysics he oversaw the 2005 Millennium simulation, which followed ten billion particles and seeded a generation of mock catalogues. Threaded through it all is one conviction: a cosmological model is only as good as the nonlinear, observable predictions you can extract from it numerically — the simulation, not the pencil, is where theory meets the sky.
Going further
Texts. Carroll & Ostlie, An Introduction to Modern Astrophysics, 2nd ed., Ch. 30 (structure formation) · Ryden, Introduction to Cosmology, 2nd ed., Ch. 12 (nonlinear collapse) · Dodelson, Modern Cosmology, Ch. 7 and Ch. 9 (nonlinear structure) · Mo, van den Bosch & White, Galaxy Formation and Evolution, Ch. 5 to 7 (spherical collapse, mass functions, halos) · Binney & Tremaine, Galactic Dynamics, 2nd ed., Ch. 4 (collisionless systems). Spherical collapse yields , , and . The Sheth–Tormen parameters are , . The cost ratio for is , and the relaxation-to-crossing-time ratio is at .
Prerequisites. Linear Growth of Structure · Density Perturbations and the Density Contrast · Jeans Instability (Cosmological) · Transfer Function and the Matter Power Spectrum · Cold Dark Matter. Leads to. The ΛCDM Concordance Model · Baryon Acoustic Oscillations · Dark Energy and the Cosmological Constant.
Ask the tutor: Want to walk through how the spherical-collapse cycloid turns into the numbers 1.686 and 178, or how a tree code actually opens cells to hit O(N log N)?
Are the simulation particles real dark-matter particles?
No. A single simulation particle has a mass of to solar masses — it stands in for a parcel of or more actual particles. The bodies are Monte-Carlo samples of a smooth phase-space distribution, chosen to trace its density and velocity field. That is why two can stream through one another: real cold dark matter is collisionless and multi-streaming, not a gas of colliding balls. Any genuine two-body scattering between them is numerical noise, suppressed by softening.
What does the softening length do, and how big should it be?
The softening length replaces the singular force at short range with a smooth, finite one, as in equation (4), preventing artificial large-angle scattering when two tracers pass close — spurious heat that would mimic a collisional system. Too small reintroduces two-body noise and tiny timesteps; too large washes out substructure and flattens halo centres. In practice is a few percent of the mean interparticle spacing — a key convergence parameter to test.
Why do simulations start at high redshift like z ~ 50 rather than at the Big Bang?
At very high redshift is tiny and known analytically — linear theory and the Zel'dovich approximation give the exact displacement field from ; starting earlier only buys noise, as displacements shrink below the grid discreteness. Starting later (say ) is wrong: the largest scales have already gone mildly nonlinear, so linear initial conditions no longer apply. The choice to is the sweet spot where everywhere yet displacements are cleanly resolved.
What is the practical difference between tree, PM, and TreePM force solvers?
A pure tree code (Barnes–Hut) multipoles distant matter — accurate at all scales, , but expensive per particle at short range. A particle-mesh (PM) code deposits mass on a grid and solves Poisson by FFT — very fast, but its resolution is capped at one grid cell, so it cannot resolve halo interiors. TreePM marries them: the FFT mesh handles the smooth long-range force while a local tree supplies the sharp short-range force. Almost every modern large simulation — GADGET, for instance — uses TreePM.
Why does the cosmic web form sheets and filaments rather than just round clumps?
Because gravitational collapse is generically anisotropic. A random overdense region has three unequal tidal axes, so it collapses along its shortest axis first into a two-dimensional sheet (a Zel'dovich pancake), then along the second into a one-dimensional filament, and only where filaments intersect does the third axis collapse into a knot. This ordered sequence — sheet, filament, knot — is what the Zel'dovich approximation predicts and what surveys display as the cosmic web. Spherical collapse is an idealization for thresholds, not a map of where matter ends up.
Do baryons matter, or is a dark-matter-only simulation enough?
For the large-scale skeleton, dark-matter-only runs are excellent: dark matter dominates the mass, so the cosmic web, the mass function, and the BAO scale are set by gravity on the collisionless component. But baryons matter decisively inside halos — gas cools, forms stars, and is blasted out by supernovae and AGN, feedback that can turn a cusp into a core and shift the power spectrum at the percent level next-generation lensing measures. So dark-matter-only is the workhorse for large-scale structure; full hydrodynamic runs (IllustrisTNG, EAGLE, SIMBA) are needed for galaxies themselves.