4.2
The code Gadget
The simulations we have done were performed using the basic tree-construction (as explained in section 4.1.1) and hydrodynamic SPH solver (as described in section 4.1.2) present in the publicly available, parallel code Gadget2 (Springel, 2005).
In the following we will give its main features and describe the changes implemented to study early structure formation and metal pollution.
4.2 The code Gadget 89
Figure 4.3: Top row: example of space-filling Peano-Hilbert curve. The basic structure in the left panel is
replicated arbitrarily. The central panel and the right panel show the first and second replication level, respectively. Bottom row: a simplified 2D representation of the “U” shaped Peano-Hilbert curve is shown (Springel, 2005).
4.2.1 Overview
Gadget is a tree/SPH code which conserves energy and entropy. It computes all the different quantities using the closest neighbour particles located within the smoothing length h and the spherically symmetric, spline smoothing kernel (Monaghan and Lattanzio, 1985, equations (19) and (21) with the v variable replaced by 2r/h) W(r/h) = 8 πh3 1−6 (r/h)2+ 6 (r/h)3 06r/h <1/2 2 (1−r/h)3 1/26r/h <1 0 r/h>1 (4.18)
where r is the inter-particle distance (r 6 h). We notice that such kernel is correctly normalized over the volume element 4πr2dr (according to 4.16), is continuous and
differentiable, has a maximum in W(0) = 8/πh3, decreases down to W(1/2) = 2/πh3,
where it becomes convex, and reaches its minimum at W(1) = 0.
The peculiarity of the “entropy” formulation of the code is that the smoothing length for each particle, hi, is not fixed, but is computed assuming a constant mass content inside a
90 Numerical simulations of early structure formation
sphere with radiushi. So hi is defined as:
4 3πρih
3
i ≡mNSPH (4.19)
where ρi is the estimated density, m the average particle mass, NSPH the number of
neighbors used and mNSPH the total mass inside the kernel. Such treatment, including
the∇hi term in the fluid equations, conserves by construction energy and entropy4 (Lucy,
1977; Benz and Hills, 1987).
The implementation of dynamics and hydrodynamics follows the distcretization of Newton’s law and fluid laws, respectively.
Time integration is performed by a symplectic leapfrog scheme, via drift and kick operators (Quinn et al., 1997), which advances alternatively space coordinates and velocity coordinates at each half time-step.
The parallelization strategy uses a space-filling, fractal curve, the Peano-Hilbert curve (Mandelbrot, 1982, and references therein), to map 3D space into a 1D space (Warren and Salmon, 1995) – see Figure 4.3 – and to reduce the communication costs. The curve is then chopped off into segments defining the individual domains (see Figure 4.4), particles are allocated on their target processor and density estimation, tree construction and force computation are executed.
Once the initial conditions are fixed, the code follows the gravitational evolution of dark and baryonic matter and the fluid evolution of gas particles only. This is done using a heating recipe for UV background (Haardt and Madau, 1996), H and He radiative cooling, multi-phase “sub-grid” model for star formation based on thermal instability criterion (Field, 1965), and a phenomenological approach for feedback from winds (with typical velocities ∼500 km/s) powered by supernova explosions (Katz et al., 1996).
4.2.2 Star formation
The general structure of the effective “sub-grid” star formation model (Katz et al., 1996; Springel and Hernquist, 2003) is briefly described here. Each particle is assumed to be formed by an ambient hot gas, which might contain a cold phase and stars, when the density is high enough (the hydrogen number density for the onset of star formation is
4SPH implementations neglecting the∇h
4.2 The code Gadget 91
Figure 4.4: The top row relates the space-filling Peano-Hilbert curve (left side) with the simulation tree (right side). The simulation volume is cut into domains by segmenting the curve, so its branches reside entirely on single processors, as shown in the last row (Springel, 2005).
nH,th ≃0.1 cm−3).
Basically, at any given time, the rate of star forming mass, ˙m⋆, of a multi-phase gas
particle with mass m is computed using
˙
m⋆ =
xm t⋆
(4.20)
wherexis the fraction of gas in cold clouds providing the reservoir for star formation and
t⋆ is the star formation time-scale given by
t⋆(ρ) =t0⋆ ρth ρ 1/2 (4.21)
being ρ the mass density of the particle, ρth the star formation mass density threshold
and t0
⋆ a free parameter calibrated on the observed data in order to reproduce the known
behaviour of the disc-averaged star formation rate as a function of the surface gas density (see Schmidt law in Appendix B).
92 Numerical simulations of early structure formation equation (4.20) and (4.21) ˙ ρ= ρ t0 ⋆(ρth/ρ)1/2 . (4.22)
Star particles are spawned, within a time-step ∆t and for gas densities ρ > ρth only,
according to a stochastic approximation with exponential probability (Katz et al., 1996, section 4.2):
p= 1−e−x∆t/t⋆. (4.23)
The number of stars produced per each gas particle is fixed by another free parameter,
N⋆ (generations), so that at each time-step the global amount of stars is pN⋆. Their mass
distribution is known from the assumed IMF, which determines the fraction of stars per mass interval.
4.2.3 Metal enrichment
The primitive underlying star formation sub-grid model is extended including metal enrichment at each time-step (Tornatore et al., 2007a). This process is followed tracing ejecta and yields from SNIa (Thielemann et al., 2003), SNII (Woosley and Weaver, 1995), AGB (van den Hoek and Groenewegen, 1997), according to stellar masses and lifetimes (Padovani and Matteucci, 1993); metallicities are spread on the neighbour particles and weighted by the SPH kernel to derive the corresponding tabulated (Sutherland and Dopita, 1993) cooling term; stellar mass distribution is ruled by the possibility of choosing different initial mass functions, depending or not on the particle metallicity.
Similar works are also discussed, for example, by Raiteri et al. (1996); Gnedin (1998); Mosconi et al. (2001); Lia et al. (2002a,b); Kawata and Gibson (2003); Ricotti and Ostriker (2004); Kobayashi (2004); Scannapieco et al. (2005).