Galaxy collision
This simulation needs WebAssembly, and it could not start in this browser.
The image is a frame from a real run. Check that JavaScript is on, or try another browser.
When two galaxies collide, their stars almost never hit each other: the space between them is far too large. What reshapes the galaxies is the tidal force, the difference in gravitational pull from one side of a disc to the other, which draws stars out into bridges and long tails. In 1972 Alar and Juri Toomre reproduced such tails, including those of the Antennae galaxies (NGC 4038/4039), with models of the same kind as this one.
What you see
Head-on encounter: two disc galaxies fall toward each other almost head-on. Each has a bright white core of mass 500,000 and 280 stars of mass 1 on initially circular orbits 15 to 95 units from the core. Stars of the first galaxy are blue, stars of the second orange.
The code sums gravity directly over all pairs, so every particle pulls on every other. A star, though, weighs two millionths of a core, so in practice each star moves in the field of the two cores alone, as in the Toomres’ restricted model. That captures the tidal shapes but not dynamical friction, the drag that a real galaxy’s stars and dark matter exert on an intruding core. Here nothing takes orbital energy away from the cores, so they pass through each other and swing back out instead of settling into one merged galaxy.
Watch for:
- Tidal bridge: a stream of stars linking the two galaxies during the first passage
- Tidal tails: long streams flung out on the far side of each galaxy
- Repeated passages: the cores are bound to each other and keep falling back together
Governing equation
The softening length keeps the force finite when a star passes through a core.
Parameters
timestep dt: the integration step, 0.0005 to 0.02 (default 0.004). Smaller steps follow the close core passages more accurately but run slower.
softening ε (px): the length above, 5 by default.
restart: starts the encounter again from the beginning with the current settings.