Skip to content
Projects

Galaxy collision

Two disk galaxies fly past each other and pull out tidal tails, the classic Barnes-Hut problem.

Each galaxy is a heavy core (its bulge and halo, one softened point mass) with a light disk of stars on circular orbits, all in one plane. The cores fall towards each other on a parabolic orbit, and every body feels every other through the Barnes-Hut walk of FlatQuadtree (kernel="coulomb", the 1/r^2 force of point masses, attractive here), integrated with the kick-drift-kick leapfrog. Toomre and Toomre (1972) showed with this setup that the long tails and bridges of interacting galaxies are tides: a disk turning the same way as the orbit (prograde) stays in resonance with the passing companion and is torn into a bridge and a tail, while a disk turning the other way (retrograde) is barely disturbed. Here galaxy A (red) turns prograde and galaxy B (blue) retrograde. Units G = 1, core masses 1, disk radius 1, disk mass 2% of the core, pericentre 1.5.

Source: examples/galaxy_collision.py. Run it yourself with python examples/galaxy_collision.py [--output examples/output] [--quick] (needs pip install "tree-d-3d[examples]").

the encounter, with the quadtree of every frame: the cells crowd into the cores and stretch out along the tails as the prograde disk is torn apart.the encounter, with the quadtree of every frame: the cells crowd into the cores and stretch out along the tails as the prograde disk is torn apart.Loading figure…

the encounter, with the quadtree of every frame: the cells crowd into the cores and stretch out along the tails as the prograde disk is torn apart.

the separation of the cores against the exact two-body parabola (Barker's equation). The disks' light mass and the stars they lose bend the orbit only slightly.the separation of the cores against the exact two-body parabola (Barker's equation). The disks' light mass and the stars they lose bend the orbit only slightly.Loading figure…

the separation of the cores against the exact two-body parabola (Barker’s equation). The disks’ light mass and the stars they lose bend the orbit only slightly.

the fraction of each disk's stars still within one disk radius of their own core six time units after pericentre, against their starting radius: the prograde disk loses its outer half, the retrograde disk keeps almost all of it.the fraction of each disk's stars still within one disk radius of their own core six time units after pericentre, against their starting radius: the prograde disk loses its outer half, the retrograde disk keeps almost all of it.Loading figure…

the fraction of each disk’s stars still within one disk radius of their own core six time units after pericentre, against their starting radius: the prograde disk loses its outer half, the retrograde disk keeps almost all of it.

the energy error (relative to the kinetic energy at the start) of shorter runs with half the stars at several opening angles, and their cost per step. The total energy of a parabolic encounter is nearly zero, so the error is measured against the kinetic energy. The leapfrog's own error is small: what drifts is the tree's force error. The heavy cores make large `theta` costly: a cell holding a core is taken as one multipole while the core sits far from the cell's centre, so `theta = 0.6` loses a few percent and `theta = 0.3` (the main run) under one percent, while the direct sum is limited by the leapfrog alone.the energy error (relative to the kinetic energy at the start) of shorter runs with half the stars at several opening angles, and their cost per step. The total energy of a parabolic encounter is nearly zero, so the error is measured against the kinetic energy. The leapfrog's own error is small: what drifts is the tree's force error. The heavy cores make large `theta` costly: a cell holding a core is taken as one multipole while the core sits far from the cell's centre, so `theta = 0.6` loses a few percent and `theta = 0.3` (the main run) under one percent, while the direct sum is limited by the leapfrog alone.Loading figure…

the energy error (relative to the kinetic energy at the start) of shorter runs with half the stars at several opening angles, and their cost per step. The total energy of a parabolic encounter is nearly zero, so the error is measured against the kinetic energy. The leapfrog’s own error is small: what drifts is the tree’s force error. The heavy cores make large theta costly: a cell holding a core is taken as one multipole while the core sits far from the cell’s centre, so theta = 0.6 loses a few percent and theta = 0.3 (the main run) under one percent, while the direct sum is limited by the leapfrog alone.

--quick uses fewer stars (well under a minute); --smoke is the tiny configuration the test suite runs. Needs Plotly (pip install 'tree-d-3d[examples]').