Home▸Space & Astronomy▸Nebula Formation Dynamics (2D): Jeans Instability & Gravitational Collapse

🌌 Nebula Formation Dynamics (2D): Jeans Instability & Gravitational Collapse

2D companion: a real self-gravitating N-body gas cloud with thermal and turbulent pressure, a live Jeans-mass and virial-parameter readout, and protostar clumps that only form when your sliders push the cloud past its own instability threshold.

Space & Astronomy2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-nebula-formation-dynamics ↗ Open standalone

The 3D version of this page renders a pretty volumetric nebula cloud, but its particles only drift on a fixed sine-wave wobble around static centers — there is no gravity, no pressure and nothing that could ever actually collapse. This 2D companion builds the real mechanic the title promises: every gas parcel attracts every other parcel through softened Newtonian gravity, computed pairwise every frame, while thermal jitter and turbulent kicks push back like real pressure. A side panel exposes temperature, gravity strength, parcel count and turbulence, and a live readout tracks the cloud's actual mass, density, Jeans mass and virial parameter — so raising the temperature slider visibly halts a collapse in progress, and raising density or gravity visibly restarts one, exactly as the Jeans-instability criterion M > M_J predicts. Parcels that touch merge into growing protostars, letting you watch star formation happen from first principles instead of from a canned animation.

⚙ Under the hood

2D self-gravitating N-body gas cloud: pairwise softened Newtonian gravity, thermal and turbulent pressure, particle merging into protostars, and a live Jeans-mass / virial-parameter readout computed directly from the running simulation.

nebula formationjeans instabilitygravitational collapsen-body gravityvirial theoremstar formation

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)