---
title: "How Gravity Builds the Cosmic Web"
description: "Follow a patch of matter as unequal compression builds sheets and filaments, then see why crossing streams need both position and velocity."
canonical_url: "https://sandboxphysics.com/stories/cosmic-web/why-matter-forms-a-web/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/cosmic-web/why-matter-forms-a-web/"
last_modified: "2026-11-12"
---

[From ripples to the cosmic web](https://sandboxphysics.com/stories/cosmic-web/)

From ripples to the cosmic web · L1

# How Gravity Builds the Cosmic Web

Sandbox Physics · 2026-11-12

Gravity draws more matter towards a slightly denser region. The attraction differs across its surroundings, so compression proceeds at different rates in different directions. Sheets, filaments and dense nodes emerge between volumes that become emptier.

## Before you begin

Everyday ideas about gravity and motion are enough. The next chapter introduces coordinates and growth equations; begin here with the motion itself.

## A small imbalance can grow

Divide a large volume into many little boxes. Put slightly more matter in a few of them. That excess changes the gravitational pull on their neighbours. Matter flows towards the denser places, increasing the original difference. A local departure from the average density is called a density fluctuation.

All this happens in an expanding universe. Early on, two pieces of matter may still move apart, but more slowly than the average expansion would carry them. As an overdense region grows, gravity can eventually turn it around into actual contraction. An expanding background and local gravitational gathering can coexist.

Attraction alone does not yet explain the shape. We need to know which neighbours approach fastest and which directions keep extending. Those differences determine whether a region becomes flattened or elongated.

Reading: Zel’dovich (1970), Gravitational instability: an approximate theory for large density perturbations

## A patch can flatten along one direction

Draw a box around neighbouring pieces of matter. An extra acceleration shared by every part moves the box as a whole. To change its shape, the pull must differ from one side to the other. This difference is a tidal effect. It can compress one direction while another contracts more slowly or stretches.

Suppose the box first becomes thin from top to bottom, leaving the other two directions extended. Matter gathers near a sheet. Compression along another direction can leave an elongated structure. This is a local account of deformation; it does not impose one construction schedule on the entire universe.

In 1970, Zel’dovich described an approximation in which the initial gravitational pattern sets the displacement directions and a growing factor increases the displacements. It gives a particularly clear picture of unequal compression, including the point at which the map first folds.

![Own three-dimensional sheet, filament and oblique web PM states at the same saved expansion factor](https://sandboxphysics.com/_astro/morphology.BH7cxjwW.svg)

Our accepted $4096$-particle PM states at native frame $116$, $a=1.0904635200240378$. Axes show comoving Mpc in a $20\,\mathrm{Mpc}$ periodic box. Colour samples each state’s CIC density relative to its mean, with one common scale clipped at $40$. These controlled initial conditions illustrate different geometries; they do not show a universal chronological sequence. [Open the full figure](https://sandboxphysics.com/_astro/morphology.BH7cxjwW.svg)

Reading: Zel’dovich (1970), Gravitational instability: an approximate theory for large density perturbations · Original finite-mesh calculations and independent small-wave Python replay

## The network remembers a wider pattern

The web is not assembled by joining independently collapsing boxes at random. Gravity at one place depends on matter distributed over a much wider neighbourhood. The positions of neighbouring dense regions correlate the directions of motion in different patches.

Bond, Kofman and Pogosyan emphasised this connection in their 1996 work. Broad, weak precursors of the later filaments were already present in the initial density and tidal patterns. Nearby peaks with suitably aligned deformations supported stronger connecting bridges; greater separation or misalignment weakened the connection. Nonlinear evolution sharpened the pattern.

A local sheet-like fold therefore tells only part of the story. The arrangement of sheets, filaments and nodes also carries the spatial relationships in the initial fluctuations. Matter flows away from other regions, leaving the web's emptier volumes. These voids still contain matter.

Reading: Bond, Kofman & Pogosyan, How filaments are woven into the cosmic web (1996), astro-ph/9512141v1

## Streams can meet and keep moving

A common approximation treats cold dark matter as collisionless. Direct encounters between particles are negligible, allowing streams to pass through one another. Gravity continues changing their velocities, but there is no gas shock in this description to stop the streams at their meeting place.

Label the original layers of matter. Initially, a location belongs to one stream. Later, different labels can reach the same place. This is shell crossing. The name does not require spherical shells: parallel planes can cross too. Each label still follows its own matter, but working backwards from a location can now give several answers.

A density picture adds those streams together. Adding velocity separates them: one stream can move left as another moves right. The combined description of position and velocity is called phase space. A dense knot in an image can contain matter that is still moving rapidly in several directions.

The displacement approximation can continue drawing a folded map. Following the later gravitational motion also requires the force to respond to the changed density. A particle-mesh calculation repeatedly deposits the matter, solves for gravity and advances the motion. Keeping the velocities lets us follow the overlapping streams into what happens next.

Reading: Zel’dovich (1970), Gravitational instability: an approximate theory for large density perturbations · Springel (2005), The cosmological simulation code GADGET-2, astro-ph/0505010v1

## Exercises and explained answers

1. Would giving every part of a patch exactly the same extra acceleration turn it into a filament?

   Read the explanation

   The common acceleration changes the patch's overall journey. Deformation requires differences in acceleration between neighbouring parts, making them approach or separate.

2. A density image contains a bright knot. What would reveal whether its matter has stopped?

   Read the explanation

   Inspect the velocities. Several streams can overlap at the same position and move in different directions. A phase-space view separates them.

## Try the prediction

### [Follow one material line through a fold](https://sandboxphysics.com/labs/cosmic-web-shell-crossing/)

1. Predict the shapes left by one-direction and two-direction compression, then try A sheet folds and A filament forms.
2. Turn An oblique web to inspect its depth. The gold line keeps connecting the same material labels.

[Next: Measuring Motion with an Expanding Ruler](https://sandboxphysics.com/stories/cosmic-web/coordinates-that-expand-with-the-universe/)

## Sources and calculation scope

1. [Zel’dovich (1970), Gravitational instability: an approximate theory for large density perturbations](https://www.giss.nasa.gov/staff/mway/cluster/zeldovich.pdf)

   All six original pages read. Physical displacement in the original notation is distinguished from modern comoving growth and canonical momentum. We use the pre-crossing map; its discussion of gas shocks is not applied to collisionless matter. The hosted paper remains external.

2. [Bond, Kofman & Pogosyan, How filaments are woven into the cosmic web (1996), astro-ph/9512141v1](https://arxiv.org/abs/astro-ph/9512141v1)

   Main text, captions and original Figure 1 inspected. Initial density/tidal correlations organise a network whose contrast nonlinear evolution sharpens. Local first-caustic flattening does not establish a universal sequence in which an entire network first becomes pancakes. Our figure uses our own PM outputs.

3. [Springel (2005), The cosmological simulation code GADGET-2, astro-ph/0505010v1](https://arxiv.org/abs/astro-ph/0505010v1)

   Focused reading: Section 2.1, equations 1–3; Section 3.2/3.2.1, equations 20–23; Section 4.1, equations 26–31, with original pages 3 and 11 viewed. Supplies cosmological momentum, PM windows and time-integration context. The teaching calculation specifies its own cutoff and finite gradient and adds no short-range tree force.

4. [Original finite-mesh calculations and independent small-wave Python replay](https://sandboxphysics.com/stories/cosmic-web/materials/cosmic-web-replay-v1.zip)

   Original accepted kernel/linear, nonlinear and five-preset F64 calculations support the teaching figures and calibration. This small public ZIP contains only an exact current-state small-wave fixture, an independent NumPy/SciPy trajectory replay and expected output. The fixture was generated through the frozen model and canonical serializer in Node, not downloaded in a browser. Large raw preset archives remain separately retained; no Engine or source paper is included.
