N-Body Star Cluster Collapse (3D): Direct Summation, Virial Ratio and Energy Ledger

Up to 300 stars pull on each other by direct summation of softened Newtonian gravity. Start from equilibrium or a cold sphere, fly around the cluster and read the virial ratio, Lagrangian shells and energy ledger.

Switch to 2D

Presets

Playback

Parameters

Camera

Layers

Quality

Model check

The science

What is simulated

A cluster of N equal stars of total mass 1, in N-body units with G = 1. Every star pulls on every other star: the acceleration of star i is ai = −Σj mj (ri − rj) / (|ri − rj|2 + ε2)3/2, summed directly over all N−1 partners (N²/2 pairs per step, no tree approximation). The small softening length ε keeps two close stars from producing an infinite kick; it is the main departure from real point-mass gravity.

Integrator

Kick-drift-kick leapfrog with a fixed step h. It is symplectic and time reversible, so it conserves total momentum and angular momentum to rounding error and keeps the energy error bounded (it oscillates instead of growing) as long as h is small compared with the shortest orbital time. Cold collapses pass through very dense states; the "coarse time step" preset shows what happens to the energy ledger when h is too large.

Starting conditions

A Plummer sphere (density ∝ (1 + r²)−5/2) is sampled with the standard rejection recipe, so the velocities are those of a cluster in equilibrium, then all velocities are multiplied by √q. The virial ratio is 2T/|W|: 1 means equilibrium, 0 is a cold start that falls in on itself in about one free-fall time (π/2)√(R³/2GM) ≈ 1.11 for a uniform sphere of radius 1, and values above 1 make the cluster expand. After a collapse the cluster rebounds and settles through violent relaxation, ejecting a few fast stars.

Simplifications

  • The stars are point masses of equal mass: no stellar evolution, no binaries formed by tidal capture, no gas, no external galactic tide.
  • Softened gravity and a fixed step: the energy ledger is an honest measure of how much that costs; it is not a statement about real clusters.
  • Only 50 to 300 stars are used so every pair can be summed 60 times a second. Real clusters have 104 to 106 stars and relax by two-body encounters on a longer timescale than shown here.
  • Time and length are in N-body units; one unit of time is about 0.5 Myr for a 1000 solar-mass cluster of 1 parsec scale.

Checks

Five boxes: relative energy error of an equilibrium cluster over 10 time units, conservation of momentum and angular momentum, the virial theorem for the time-averaged ratio 2T/|W|, the Kepler period of an eccentric two-body orbit, and the collapse time of a cold uniform sphere against the free-fall formula.

Loading model...
Loading Blender model...
Energy error of the cluster (log scale)
Lagrangian radii: 10, 50 and 90 % of the mass
Virial ratio 2T/|W|
Made with 🟠 Blender · Three.js