---
title: "Cosmic Web and Shell Crossing Interactive Lab | Sandbox Physics"
description: "Why does nearly uniform matter form a cosmic web? Gravity draws more matter into slightly denser regions."
canonical_url: "https://sandboxphysics.com/labs/cosmic-web-shell-crossing/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/cosmic-web-shell-crossing/"
last_modified: "2026-11-12"
---

Gravity grows a small ripple

# Cosmic Web and Shell Crossing

**Why does nearly uniform matter form a cosmic web?** Gravity draws more matter into slightly denser regions. Compression proceeds at different rates along different directions, forming sheets and filaments around emptier volumes. Collisionless matter can pass through the same place with different velocities, so its motion keeps a folded history in phase space.

Change an initial ripple and watch matter fold into sheets and filaments. Compare a displacement approximation with three-dimensional mesh gravity.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

Model assumptions

This teaching model evolves collisionless matter in a periodic, twenty-megaparsec comoving box in an Einstein–de Sitter universe. Equal-mass particles start on a regular lattice with a few specified waves. Mesh gravity uses sixteen cells along each axis, CIC assignment, a fixed Fourier cutoff and a four-point potential gradient. It resolves large-scale folding; dense nodes are not identified halos. Gas, dark energy, baryonic feedback and galaxy light are absent. The displacement reference continues its initial growth after crossing, whereas mesh gravity follows the changing density. The model saves one hundred and twenty-nine native states without time interpolation. Colours show mesh density. The default snapshot and five presets have independent numerical checks; their initial waves are synthetic and are not an IllustrisTNG sample.

Mesh density Displacement reference One material line

A section through the middle of the mesh

The same density scale colours the box and this section. The highest colours saturate.

How a long wave grows

$P_{100}=L^3\left|\frac1{N_p}\sum_j e^{-2\pi i y_{j,x}}\right|^2$

Both curves use the same initial waves. The dotted curve extrapolates the displacement map through crossing.

Physics tutorial

## Matter can fold without sticking together

**Background** Gravity amplifies a small excess of matter. The fastest compression can squeeze a region into a sheet while matter still extends along the other directions. Further compression builds filaments and dense nodes.

**Why it matters** After different streams reach the same place, position alone no longer describes the motion. Following each particle reveals what a density picture hides.

Start with the essentials

- **Focus question**: What changes when particles first pass through one another?
- **One-sentence intuition**: Several velocities can coexist at one position; density sums their positive mass.

### Core mathematical model

#### A displacement that grows with expansion

$$
\boldsymbol y(\boldsymbol q,a)=\boldsymbol q+a\,\boldsymbol s(\boldsymbol q),\qquad \boldsymbol r=aL\boldsymbol y
$$

The first relation is the Zel’dovich reference in this matter-only universe. The labels identify the same matter. The second relation converts the displayed comoving box into physical position.

#### The first fold

$$
J=\det\!\left(I+a\,\frac{\partial\boldsymbol s}{\partial\boldsymbol q}\right),\qquad \frac{\rho}{\bar\rho}=\frac1J\quad\text{before crossing}
$$

Before crossing, a smaller volume holds the same mass. At the first fold this one-stream formula becomes singular. After crossing, each stream contributes positive mass; a negative determinant marks reversed orientation.

#### Gravity follows the changing density

$$
\nabla_y^2U=\frac32\delta,\qquad\frac{d\boldsymbol y}{da}=a^{-3/2}\boldsymbol u,\qquad\frac{d\boldsymbol u}{da}=a^{-1/2}(-\nabla_yU)
$$

Mesh gravity updates the density and force at every integration step. The dimensionless canonical momentum includes the expansion factor. The finite mesh smooths small structures.

### Common difficulties

#### Crossing does not stop the streams

**Typical misconception** A dense sheet must make all particles stick together.

**Better mental model** The model follows collisionless matter. Streams pass through and continue responding to gravity; gas shocks would require another model.

#### A dense node and a halo

**Typical misconception** Every bright knot already measures a halo mass.

**Better mental model** Colour shows coarse mesh density. Identifying a halo needs a separate definition and adequate force and mass resolution.

### Run the experiment

1. 01

   #### Open the sheet

   Choose A sheet folds, then move the time slider across the collapse.

   **What to observe:** The selected material line folds. Its position–velocity plot separates streams that overlap in position.

2. 02

   #### Change the original ripple

   Drag the gold handle horizontally. Compare the new displacement reference with the completed mesh calculation.

   **What to observe:** A larger initial ripple reaches strong compression earlier. The camera can turn independently.

3. 03

   #### Compare the two evolutions

   Choose An oblique web and enable the displacement reference. Inspect the power curve below the box.

   **What to observe:** Both start from the same waves. Mesh gravity responds to the later density, so their positions and long-wave power separate.

Physical conclusion

The web grows through unequal compression; after crossing, velocity distinguishes the overlapping streams.

## Sources and numerical scope

The displacement map follows Zel’dovich’s 1970 approximation. The cosmological variables, CIC mesh method and time factors follow the cited GADGET-2 methods; this small model uses a fixed low-pass mesh force.

- [Zel’dovich (1970), Gravitational Instability](https://www.giss.nasa.gov/staff/mway/cluster/zeldovich.pdf)
- [Springel (2005), GADGET-2, v1](https://arxiv.org/abs/astro-ph/0505010)
- [IllustrisTNG field units and halo definitions](https://www.tng-project.org/data/docs/specifications/)

Independent checks cover matter-only linear growth, actual half-cell particle response, positive mass deposition, a periodic sheet reference across crossing and a separate adaptive integrator. The finite mesh remains a large-scale teaching model.

## Related experiments and articles

From ripples to the cosmic web · Reading path

### Expansion, crossing and independently tested gravity

Articles on this path that use this experiment, followed by the other experiments they suggest.

1. [Article **How Gravity Builds the Cosmic Web**](https://sandboxphysics.com/stories/cosmic-web/why-matter-forms-a-web/)
2. [Article **Measuring Motion with an Expanding Ruler**](https://sandboxphysics.com/stories/cosmic-web/coordinates-that-expand-with-the-universe/)
3. [Article **Why One Position Can Have Several Velocities**](https://sandboxphysics.com/stories/cosmic-web/when-one-position-has-several-velocities/)
4. [Article **How Mesh Gravity Follows Folding Matter**](https://sandboxphysics.com/stories/cosmic-web/how-mesh-gravity-follows-the-fold/)
5. [Article **What a Power Spectrum Remembers**](https://sandboxphysics.com/stories/cosmic-web/what-a-power-spectrum-remembers/)
6. [Article **Give an Exported Initial State to Another Integrator**](https://sandboxphysics.com/stories/cosmic-web/rerun-an-export-and-measure-growth/)
7. [Article **Choose What You Call a Halo, Then Read Feedback**](https://sandboxphysics.com/stories/cosmic-web/choose-what-you-call-a-halo/)

Motion & dynamics · Starter path

## From a falling ball to an orbit

Start by measuring gravity and splitting motion into components. Then add contact forces and collisions, and follow the same laws all the way to an orbit.

[Start here → **Free Fall & Measuring Gravity** Capture a few drops and fit the camera positions to estimate gravitational acceleration. Then add air damping and watch the fit drift from the truth. Observe · 14 min](https://sandboxphysics.com/labs/free-fall/)

1. [1 Free Fall & Measuring Gravity](https://sandboxphysics.com/labs/free-fall/)
2. [2 Projectile Flight Designer](https://sandboxphysics.com/labs/projectile-flight/)
3. [3 Inclined Plane & Friction](https://sandboxphysics.com/labs/inclined-plane/)
4. [4 One-Dimensional Collision Bench](https://sandboxphysics.com/labs/collision-bench/)
5. [5 Mass–Spring Oscillator](https://sandboxphysics.com/labs/mass-spring/)
6. [6 How Orbits Take Shape](https://sandboxphysics.com/labs/orbit/)

[View the full path →](https://sandboxphysics.com/topics/mechanics/#starter-path)
