We have developed the KETJU code, which is an extension of the widely used GADGET galaxy simulation code. KETJU adds a small region around each supermassive black hole (SMBH) where the dynamics of the SMBHs and stellar particles are integrated using an algorithmically regularised integrator. This allows simulating the dynamics of supermassive black holes (SMBHs) at spatial scales that are below the conventional resolution limit set by the gravitational softening.

The KETJU project is funded by the European Research Council via ERC Consolidator Grant no. 818930 and the Academy of Finland via grant no. 339127.

EU flag and ERC logo

AoF logo


Supermassive black holes or SMBHs are found in the centres of all massive galaxies. Our home galaxy, the Milky Way, has an SMBH that is about four million times more massive than the Sun, while more massive galaxies can host SMBHs that are billions of solar masses. For example, M87, the central galaxy in the Virgo galaxy cluster hosts an SMBH with a mass of 6.5 billion solar masses.

SMBHs play an important role in the formation and evolution of galaxies. For instance, when SMBHs accrete gas, some fraction of the gas can be launched in powerful outflows that regulate the formation of new stars in the galaxy. When galaxies merge, their SMBHs end up orbiting each other in the centre of the merged galaxy. This binary SMBH system interacts with the surrounding stars, ejecting some of them out of the galaxy, while the orbit of the binary in turn shrinks. In massive elliptical galaxies the effects of this process can in some cases be observed as core regions where the density of stars has been significantly reduced.

When the orbit of the SMBH binary has been reduced to a size of about a few parsecs, the emission of gravitational waves (GWs) begins to become important. This GW emission eventually drives the binary to merge into a single larger SMBH, and the GWs emitted during this process are expected to be detectable in the near future with instruments such as the ground-based Pulsar Timing Arrays and the space-borne LISA to be launched in the 2030s.

While the basic picture of how SMBHs merge during galactic mergers is relatively well understood, detailed understanding of the merger process of SMBHs remains challenging due to the wide range of spatial scales involved. KETJU aims to improve our understanding of SMBH mergers by making it possible to simulate the full process from large intergalactic scales down to the last few orbits before the SMBHs merge.

The Code

There are two versions of the KETJU code: a publicly available version based on GADGET-4, and a private version based on GADGET-3. Both versions include the same small-scale gravitational dynamics for SMBHs and the surrounding stellar systems.

Key features:

  • SMBHs are resolved as point particles without gravitational softening.
  • Dynamical friction and hardening of SMBH binaries from interactions with stellar particles are directly captured.
  • Post-Newtonian dynamics of SMBH binaries, such as orbital decay from GW emission and precession of the orbit.

The Public GADGET-4 based version

Get the KETJU edition of GADGET-4 Get the KETJU integrator

The public release of KETJU consists of two components: a modified version of GADGET-4, and a regularised integrator based on the MSTAR integrator.

The integrator contains the main new functionality of KETJU, while the modifications to GADGET-4 mainly consist of code for managing how particle data is passed to and from the integrator. This architecture should make it relatively straightforward to implement the functionality of KETJU also in other galaxy simulation codes, as the integrator can be called from any code.

For more technical details, see the code paper.

The Private GADGET-3 based version

Our private version of KETJU mainly differs from the public version in the various additional physics models that are implemented in GADGET-3. These include various models for gas cooling, star formation, stellar feedback and the feedback from SMBHs.
This version also includes additional physical processes, such as the seeding of SMBHs, required for cosmological simulations of galaxy formation. In addition, we have implemented a model for SMBH binary specific feedback and accretion into this version of the code. The original version of the collisionless version of KETJU was presented in Rantala et al., 2017, ApJ, 840, 53.

This version of the code is not publicly available, however we are open to collaboration on joint projects.

Science Applications

SMBH Dynamics in Cosmological Zoom-in Simulations

A group of galaxies in a cosmological zoom-in simulation run with KETJU. The main panel shows an early state, while the bottom right panel shows the end of the simulation when many of the galaxies have merged. The top right panel shows the merger tree of the SMBHs hosted in these galaxies, with one SMBH being ejected due to a gravitational wave recoil kick. From Mannerkoski et al., 2022, ApJ, 929, 167.

We have used KETJU to study how the SMBHs in a group of cosmologically formed galaxies interact and merge. These simulations have included complex interactions between multiple SMBHs in the same system, including hierarchical triplet systems which can result in accelerated SMBH mergers and even in the ejection of individual SMBHs.

Thus far we have been able to simulate a system with around ~20 SMBHs, and in the future, we plan to push this approach to even larger systems in order to produce statistically meaningful samples of resolved SMBH mergers.

Published Articles

  1. Signatures of the Many Supermassive Black Hole Mergers in a Cosmologically Forming Massive Early-type Galaxy
  2. Resolving the Complex Evolution of a Supermassive Black Hole Triplet in a Cosmological Simulation

Supermassive Black Hole Binaries in Isolated Galaxy Merger Simulations

Overview image of a gas-free merger of two elliptical galaxies. The main images show the projected stellar density, while the insets show the stellar particles (blue), SMBHs (black), and sections of their trajectories in the regularised region (gray). From Mannerkoski et al., 2019, ApJ, 887, 35.

The first use-case for KETJU was simulating the dynamics of SMBHs and their impact on the surrounding stellar structure in a pair of merging gas-free elliptical galaxies. We are continuing work on simulating these types of systems, with the improved performance of KETJU now allowing us to study the statistical behaviour of large samples of gas-free mergers.

In addition, we are now also simulating the mergers of gas-rich disk galaxies, which has been made possible by implementing new black hole accretion models that account for the binary phase of the SMBHs that can be dynamically resolved with KETJU.

Published Articles

  1. Modelling the accretion and feedback of supermassive black hole binaries in gas-rich galaxy mergers
  2. The two phases of core formation - orbital evolution in the centres of ellipticals with supermassive black hole binaries
  3. The Simultaneous Formation of Cored, Tangentially Biased, and Kinematically Decoupled Centers in Massive Early-type Galaxies
  4. The Formation of Extremely Diffuse Galaxy Cores by Merging Supermassive Black Holes
  5. Post-Newtonian Dynamical Modeling of Supermassive Black Holes in Galactic-scale Simulations

Gravitational Waves from SMBH binaries

PTA signal-to-noise ratio computed for the SMBH mergers in a cosmological zoom-in simulation run with KETJU. From Mannerkoski et al., 2022, ApJ, 929, 167.

As KETJU allows simulating the evolution of SMBH binaries down to the GW emission dominated final phase before their merger, we can use KETJU simulations to calculate the expected GW signals observable from these systems with instruments such as Pulsar Timing Arrays (PTA) or LISA.

Published Articles

  1. Signatures of the Many Supermassive Black Hole Mergers in a Cosmologically Forming Massive Early-type Galaxy
  2. Gravitational Waves from the Inspiral of Supermassive Black Holes in Galactic-scale Simulations