---
title: "N-Body Star Cluster Interactive Lab | Sandbox Physics"
description: "What happens after a cold cloud collapses? It does not settle at once."
canonical_url: "https://sandboxphysics.com/labs/star-cluster/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/star-cluster/"
last_modified: "2026-11-04"
---

M078 · Every star pulls every star

# N-Body Star Cluster

[Cluster dynamics](https://sandboxphysics.com/labs/star-cluster/) [Stellar populations and light](https://sandboxphysics.com/labs/star-cluster/?analysis=populations)

**What happens after a cold cloud collapses?** It does not settle at once. The cloud falls inward, rebounds and partly expands again, while total energy and momentum stay fixed. A single moment when the virial ratio, the usual balance test between kinetic and potential energy, sits near one does not show the cluster has reached equilibrium; it may just be passing through.

Release a three-dimensional cloud of particles that all attract one another. Change their initial speeds, the spread of masses and the force softening, then follow the collapse, rebound and expansion while tracking total energy and momentum.

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

Model assumptions

The cluster is small and uses softened Newtonian gravity. It does not simulate stellar evolution or hard binary stars.

Physics tutorial

## N-Body Star Cluster

**Background** In a star cluster every star pulls on every other, so the cloud's own gravity keeps reshaping the cloud.

**Why it matters** Following every particle lets you test which quantities the motion of the whole cluster conserves.

Start with the essentials

- **Focus question**: Does a cold cloud settle, rebound or escape?
- **One-sentence intuition**: A virial ratio measured at one instant cannot show that the cluster is in equilibrium.

### Core mathematical model

#### Softened gravity between each pair

$$
U=-\sum_{i<j}\frac{Gm_im_j}{\sqrt{r_{ij}^2+\epsilon^2}}
$$

Force and potential use the same softening.

#### The virial uses the force moment

$$
W=\sum_i\mathbf r_i\cdot\mathbf F_i,\quad Q=\frac{2K}{|W|}
$$

With softening, this force moment is not equal to the potential energy.

#### How the moment of inertia changes

$$
\frac12\ddot I=2K+W,\quad I=\sum_i m_i r_i^2
$$

When the radius stops shrinking and turns around, that alone does not prove equilibrium.

#### Energy and momentum conservation

$$
E=K+U,\quad\mathbf P=\sum_i m_i\mathbf v_i
$$

Track the numerical drift in these totals separately from how the motion looks.

### Common difficulties

#### What a particle represents

**Typical misconception** Each bright dot is an individual, resolved star.

**Better mental model** The markers show particle mass. Close encounters between stars need a different model.

### Run the experiment

1. 01

   #### Release a cold cloud

   Choose Cold collapse and play.

   **What to observe:** The cloud contracts and then rebounds, driven by gravity alone.

2. 02

   #### Give the stars more speed

   Compare Warm cloud with Fast expansion.

   **What to observe:** Clouds with the same initial shape end up behaving differently.

3. 03

   #### Halve the timestep

   Keep the same cloud seed and turn on Use half timestep.

   **What to observe:** Compare the energy drift of the two runs before reading anything into individual encounters.

Physical conclusion

Compare initial speeds and force resolutions, then check how well the simulation conserves energy and momentum.

## Related experiments and articles

Star cluster colours and populations · Reading path

### Star cluster colours and populations

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

1. [Article **Same birthday, different stars**](https://sandboxphysics.com/stories/cluster-populations/same-birthday-different-stars/)
2. [Article **Draw masses before counting stars**](https://sandboxphysics.com/stories/cluster-populations/draw-masses-before-counting-stars/)
3. [Article **Two stars, one point**](https://sandboxphysics.com/stories/cluster-populations/two-stars-one-point/)
4. [Article **An age comparison needs a model**](https://sandboxphysics.com/stories/cluster-populations/an-age-comparison-needs-a-model/)
5. [Article **A fixed patch of M67**](https://sandboxphysics.com/stories/cluster-populations/a-fixed-patch-of-m67/)
6. [Article **A concentrated core is not a clock**](https://sandboxphysics.com/stories/cluster-populations/a-concentrated-core-is-not-a-clock/)

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)
