Two disc galaxies on a bound, grazing encounter
They fall together, pass, draw tidal tails out of one another, separate, return and merge. There is no video file in this repository and there is no need for one. The commands that make it are below, and they make it again.
The timestep is 0.005, a two-hundredth of the time it takes the inner disc to turn once, which is short enough that the bulge, the densest part of either galaxy, is resolved rather than integrated through. The two discs are tilted differently on purpose. An encounter between two discs in the same plane is symmetric and much the least interesting to look at, and the tidal tails are drawn out of whichever disc is closest to coplanar with the orbit, so a pair inclined by different amounts produces one long tail and one stubby one, which is what real interacting pairs look like.
The setting it turns on
The softening of 0.12 sits a little above the disc’s scale height of 0.1, and it is the choice this configuration is most sensitive to. The disc is cold, so it is unstable to its own self-gravity and will fragment on every scale the force law permits. The scale height is the smallest structure the model actually represents; below it the disc is a two-dimensional sheet of point masses rather than a galaxy, and letting that sheet collapse would be resolving the sampling. At 0.12 the fragmentation is confined to scales the model does not resolve anyway, and the spiral structure and the tidal tails are unaffected. At 0.05 the same run ends as a swarm of small dense knots.
Running it
The renderer is off by default, because it fetches GLFW and needs an OpenGL 3.3 driver. A build without it is a complete simulator without a viewer.
That run is deliberately smaller and shorter than the configuration file’s own settings, so that it finishes in two minutes and can be repeated by anyone reading this. It took 122 seconds, 20.4ms a step, and conserved energy to 3.3×10−3. Its virial ratio went from 0.94 at the start to 0.99 at the end, which is the merger virialising: two galaxies each in rough internal balance, plus the orbital energy of the encounter between them, become one object in balance with itself.
What the drawing costs
Measured with the viewer’s own frame counter rather than with the benchmark harness, at 1280 by 720, on the machine the performance report describes. That is the weaker instrument and it is adequate here for a specific reason: each figure is already the mean of several hundred consecutive frames, which is the repetition the harness exists to provide, and no figure is a before-and-after comparison of the same kernel.
| Particles | Drawing alone | Live run |
|---|---|---|
| 20 000 | 5020 | 56 |
| 60 000 | 2590 | 14 |
| 200 000 | 740 | not run |
| 1 000 000 | 126 | not run |
Frames a second, so the headline is two numbers rather than one. The collision runs and draws live at better than thirty frames a second up to about thirty thousand particles, where the limit is the solver and not the renderer: at that count the renderer is drawing three thousand frames a second and waiting. For a picture rather than an interaction, a recorded run plays back at 1 000 000 particles and 126 frames a second.
The run in the browser
The instrument plays the same scenario at 8000 particles rather than sixty thousand, and a frame every hundred steps rather than every forty. Both changes are about the download and not about the physics: a frame is three component arrays, so the particle count is the size of every frame, and at sixty thousand particles the same run would be a gigabyte and a half. It integrates the whole encounter, all 40 000 steps of it.
That took 338 seconds, 8.46ms a step, and conserved energy to 7.1×10−3 across forty thousand steps. Its virial ratio went from 0.942 to 0.934. Those are the figures the rail plots beside the picture, read out of the diagnostics file that run wrote.
Seed
20260812
· configuration examples/collision.orrery
Nothing is claimed here that a command in this repository does not
reproduce.
Next:
what is checked, and against what ·
play this run