Table of Contents
Fetching ...

The cosmological simulation code GADGET-2

Volker Springel

TL;DR

<3-5 sentence high-level summary> The paper presents GADGET-2, a scalable cosmological simulation code that couples a TreeSPH framework with a TreePM gravity solver, enabling efficient and accurate modeling of collisionless dark matter and gas dynamics in an expanding universe. Key innovations include entropy-conserving SPH with adaptive smoothing, a symplectic-like leapfrog time integrator with both global and individual timesteps, and a Peano-Hilbert-based domain decomposition that yields processor-count independent force accuracy. The authors validate the code against a suite of hydrodynamic and cosmological tests, demonstrate performance and scalability on large hardware, and compare results with other codes to establish reliability and precision. GADGET-2 is released publicly, offering a flexible, memory-efficient, and high-throughput tool for exploring structure formation across vast dynamic ranges.

Abstract

We discuss the cosmological simulation code GADGET-2, a new massively parallel TreeSPH code, capable of following a collisionless fluid with the N-body method, and an ideal gas by means of smoothed particle hydrodynamics (SPH). Our implementation of SPH manifestly conserves energy and entropy in regions free of dissipation, while allowing for fully adaptive smoothing lengths. Gravitational forces are computed with a hierarchical multipole expansion, which can optionally be applied in the form of a TreePM algorithm, where only short-range forces are computed with the `tree'-method while long-range forces are determined with Fourier techniques. Time integration is based on a quasi-symplectic scheme where long-range and short-range forces can be integrated with different timesteps. Individual and adaptive short-range timesteps may also be employed. The domain decomposition used in the parallelisation algorithm is based on a space-filling curve, resulting in high flexibility and tree force errors that do not depend on the way the domains are cut. The code is efficient in terms of memory consumption and required communication bandwidth. It has been used to compute the first cosmological N-body simulation with more than 10^10 dark matter particles, reaching a homogeneous spatial dynamic range of 10^5 per dimension in a 3D box. It has also been used to carry out very large cosmological SPH simulations that account for radiative cooling and star formation, reaching total particle numbers of more than 250 million. We present the algorithms used by the code and discuss their accuracy and performance using a number of test problems. GADGET-2 is publicly released to the research community.

The cosmological simulation code GADGET-2

TL;DR

<3-5 sentence high-level summary> The paper presents GADGET-2, a scalable cosmological simulation code that couples a TreeSPH framework with a TreePM gravity solver, enabling efficient and accurate modeling of collisionless dark matter and gas dynamics in an expanding universe. Key innovations include entropy-conserving SPH with adaptive smoothing, a symplectic-like leapfrog time integrator with both global and individual timesteps, and a Peano-Hilbert-based domain decomposition that yields processor-count independent force accuracy. The authors validate the code against a suite of hydrodynamic and cosmological tests, demonstrate performance and scalability on large hardware, and compare results with other codes to establish reliability and precision. GADGET-2 is released publicly, offering a flexible, memory-efficient, and high-throughput tool for exploring structure formation across vast dynamic ranges.

Abstract

We discuss the cosmological simulation code GADGET-2, a new massively parallel TreeSPH code, capable of following a collisionless fluid with the N-body method, and an ideal gas by means of smoothed particle hydrodynamics (SPH). Our implementation of SPH manifestly conserves energy and entropy in regions free of dissipation, while allowing for fully adaptive smoothing lengths. Gravitational forces are computed with a hierarchical multipole expansion, which can optionally be applied in the form of a TreePM algorithm, where only short-range forces are computed with the `tree'-method while long-range forces are determined with Fourier techniques. Time integration is based on a quasi-symplectic scheme where long-range and short-range forces can be integrated with different timesteps. Individual and adaptive short-range timesteps may also be employed. The domain decomposition used in the parallelisation algorithm is based on a space-filling curve, resulting in high flexibility and tree force errors that do not depend on the way the domains are cut. The code is efficient in terms of memory consumption and required communication bandwidth. It has been used to compute the first cosmological N-body simulation with more than 10^10 dark matter particles, reaching a homogeneous spatial dynamic range of 10^5 per dimension in a 3D box. It has also been used to carry out very large cosmological SPH simulations that account for radiative cooling and star formation, reaching total particle numbers of more than 250 million. We present the algorithms used by the code and discuss their accuracy and performance using a number of test problems. GADGET-2 is publicly released to the research community.

Paper Structure

This paper contains 34 sections, 35 equations, 20 figures, 2 tables.

Figures (20)

  • Figure 1: Force-errors of the tree code for an isolated galaxy, consisting of a dark halo and a stellar disk. In the top panel, each line shows the fraction of particles with force errors larger than a given value. The different line-styles are for different cell-opening criteria: the relative criterion is shown as solid lines and the standard BH criterion as dot-dashed lines. Both are shown for different values of the corresponding tolerance parameters, taken from the set $\{0.0005, 0.001, 0.0025, 0.005, 0.01, 0.02\}$ for $\alpha$ in the case of the relative criterion, and from $\{0.3, 0.4, 0.5, 0.6, 0.7, 0.8\}$ in the case of the opening angle $\theta$ used in the BH-criterion. In the lower panel, we compare the computational cost as a function of force accuracy. Solid lines compare the force accuracy of the 99.9% percentile as a function of computational cost for the relative criterion (triangles) and the BH criterion (boxes). At the same computational cost, the relative criterion always delivers somewhat more accurate forces. The dotted lines show the corresponding comparison for the 50% percentile of the force error distribution.
  • Figure 2: Force decomposition and force error of the TreePM scheme. The top panel illustrates the size of the short-range (dot-dashed) and long-range force (solid) as a function of distance in a periodic box. The spatial scale $r_s$ of the split is marked with a vertical dashed line. The bottom panel compares the TreePM force with the exact force expected in a periodic box. For separations of order the mesh scale (marked by a vertical dotted line), maximum force errors of $1-2$ per cent due to the mesh anisotropy arise, but the rms force error is well below 1 per cent even in this range, and the mean force tracks the correct result accurately. If a larger force-split scale is chosen, the residual force anisotropies can be further reduced, if desired.
  • Figure 3: Force decomposition and force error of the TreePM scheme in the case when two meshes are used ('zoom-simulations'). The top panel illustrates the strength of the short-range (dot-dashed), intermediate-range (thick solid), and long-range force (solid) as a function of distance in a periodic box. The spatial scales of the two splits are marked with vertical dashed lines. The bottom panel shows the error distribution of the PM force. The outer matching region exhibits a very similar error characteristic as the inner match of tree- and PM-force. In both cases, for separations of order the fine or coarse mesh scale (dotted lines), respectively, force errors of up to $1-2$ per cent arise, but the rms force error stays well below 1 per cent, and the mean force tracks the correct result accurately.
  • Figure 4: A Kepler problem of high eccentricity evolved with different simple time integration schemes, using an equal timestep in all cases. Even though the leapfrog and the 2nd order Runge-Kutta produce comparable errors in a single step, the long term stability of the integration is very different. Even a computationally much more expensive 4th order Runge-Kutta scheme, with a smaller error per step, performs dramatically worse than the leapfrog in this problem.
  • Figure 5: A Kepler problem of high eccentricity integrated with leapfrog schemes using a variable timestep from step to step, based on the $\Delta t \propto 1/\sqrt{| {\bmath a} |}$ criterion commonly employed in cosmological simulations. As a result of the variable timesteps, the integration is no longer manifestly time reversible, and long term secular errors develop. Interestingly, the error in the KDK variant grows four times slower than in the DKD variant, despite being of equal computational cost.
  • ...and 15 more figures