EDP Sciences
Free Access
Issue
A&A
Volume 513, April 2010
Article Number A36
Number of page(s) 28
Section Numerical methods and codes
DOI https://doi.org/10.1051/0004-6361/200913514
Published online 21 April 2010
A&A 513, A36 (2010)

EvoL: the new Padova Tree-SPH parallel code for cosmological simulations

I. Basic code: gravity and hydrodynamics

E. Merlin - U. Buonomo - T. Grassi - L. Piovan - C. Chiosi

Department of Astronomy, University of Padova, Vicolo dell'Osservatorio 3, 35122 Padova, Italy

Received 20 October 2009 / Accepted 22 December 2009

Abstract
Context. We present the new release of the Padova N-body code for cosmological simulations of galaxy formation and evolution, EVOL. The basic Tree + SPH code is presented and analysed, together with an overview of the software architectures.
Aims. EVOL is a flexible parallel Fortran95 code, specifically designed for simulations of cosmological structure formations on cluster, galactic and sub-galactic scales.
Methods. EVOL is a fully Lagrangian self-adaptive code, based on the classical oct-tree by Barnes & Hut (1986, Nature, 324, 446) and on the smoothed particle hydrodynamics algorithm (SPH, Lucy 1977, AJ, 82, 1013). It includes special features like adaptive softening lengths with correcting extra-terms, and modern formulations of SPH and artificial viscosity. It is designed to be run in parallel on multiple CPUs to optimise the performance and save computational time.
Results. We describe the code in detail, and present the results of a number of standard hydrodynamical tests.

Key words: methods: simulations

1 Introduction

The importance of numerical simulations in modern science is constantly growing, because of the complexity, the multi-scaling properties, and the non-linearity of many physical phenomena. When analytical predictions are not possible, we are forced to compute the evolution of physical systems numerically. Typical examples in an astrophysical context are the problems of structure and galaxy formation and evolution. Over the past two decades, a number of issues concerning the formation of cosmic systems and their evolution along the history of the Universe were clarified, thanks to highly sophisticated cosmological and galaxy-sized numerical simulations. However, an equivalent number of new questions have been raised, so that a complete understanding of how galaxies and clusters formed and evolved along the Hubble time is still out of our reach. This is especially true in the light of many recent observations that often appear at odds with well established theories (see for instance the long debated question of the monolithic versus hierarchical mechanism of galaxy formation and their many variants) and to require new theoretical scenarios able to match the observational data.

For this purpose ever more accurate and detailed numerical simulations are still needed. They are indeed the best tool at our disposal to investigate such complex phenomena as the formation and evolution of galaxies within a consistent cosmological context. A number of astrophysical codes for galaxy-sized and cosmological simulations are freely and publicly available. They display a huge range of options and functions; each of them is best suited for a set of particular problems and experiments, and may suffer one or more drawbacks. Among the best known, we recall FLASH (Fryxell et al. 2000), GADGET (Springel et al. 2001) and its second release GADGET2 (Springel 2005), GASOLINE (Wadsley et al. 2004), ENZO (O'Shea et al. 2004), HYDRA (Couchman et al. 1995),and VINE (Wetzstein et al. 2008).

EVOL is the new release of the Padova N-body code (PD-TSPH, Carraro et al. 1998; Lia et al. 2002; Merlin & Chiosi 2007). It is a flexible, fully Lagrangian, parallel, and self-adaptive N-body code, written in Fortran95 in a straightforward and user-friendly format.

EVOL describes the dynamical evolution of a system of interacting discrete masses (particles) moving under the mutual gravitational forces and/or the gravitational action of external bodies, plus, when appropriate, under mutual hydrodynamical interactions. These particles can represent real discrete bodies or a fluid contained in volume elements of suitable size. A numerical simulation of a physical system follows the temporal evolution of it using small but finite time-steps to approximate the equations of motion to a finite-differences problem. In the Lagrangian description, no reference grid is superposed to the volume under consideration, while the particles move under their mutual (or external) interactions. Each particles carries a mass, a position, a velocity, plus (when necessary) a list of physical features like density, temperature, chemical composition, etc.

To simulate the dynamical evolution of a region of the Universe, one has to properly model the main different material components, namely Dark Matter, gas, and stars), representing them with different species of particles. Moreover, a physically robust model for the fundamental interactions (in addition to gravity) is required at the various scales of interest. Finally, a suitable cosmological framework is necessary, together with a coherent setting of the boundary conditions and with an efficient algorithm to follow the temporal evolution of the system. EVOL is designed to respond to all of these requirements, improving the previous versions of the Padova Tree-SPH code in many aspects[*]. In the following sections, the main features of EVOL are presented in detail, together with a review of some general considerations about the adopted algorithms whenever appropriate.

This paper presents the basic features of the code; namely, the Tree-SPH (i.e. oct-tree plus smoothing particle hydrodynamics) formalism, its implementation in the parallel architecture of the code, and the results of a number of classic hydrodynamic tests. The non-standard algorithms (e.g. radiative cooling functions, chemical evolution, star formation, energy feedback) will be presented in a following companion paper (Merlin et al. 2010, in preparation).

The plan of the paper is as follows. In Sect. 2 we describe the aspects of the code related to the gravitational interaction. In Sect. 3 we deal with the hydrodynamical treatment of fluids and its approximation in the SPH language. Section 4 illustrates some aspects related to the integration technique, like the time steps, the periodic boundary conditions, and the parallelisation of the code. Section 5 contains and discusses numerous tests aimed to assess the performance of the code. Section 6 summarises some concluding remarks. Finally, Appendices A and B contains some technical details related to the N-dimensional spline kernel (Appendix A) and the equations of motion and energy conservation (Appendix B).

2 Description of the code: gravity

Gravity is the leading force behind the formation of cosmic structures, on many scales of interest, from galaxy clusters down to individual stars and planets. Classical gravitation is a well understood interaction. As long as general relativity, particle physics or exotic treatments like modified dynamics are not considered[*], it is described by Newton's law of universal gravitation

$\displaystyle \vec{F}_{ij} = G4{m_i m_j}{\vert\vec{r}_j-\vec{r}_i\vert^3}(\vec{r}_j-\vec{r}_i),$     (1)

where G is the gravitational constant. Given a density field $\rho(\vec{r})$, the gravitational potential $\Phi$ is obtained by the Poisson equation
$\displaystyle \nabla^2 \Phi(\vec{r}) = 4 \pi G \rho(\vec{r}),$     (2)

and $\vec{F}_{ij} = \nabla \Phi(\vec{r})$.

The gravitational force exerted on a given body (i.e., particle) by the whole system of bodies within a simulation can be obtained by the vectorial summation of all the particles' contributions (without considering, for the moment, the action of the infinite region external to the computational volume; this can indeed be taken into account using periodic boundary conditions, see Sect. 4.3). This is simply the straightforward application of Eq. (1). Anyway, in practice this approach is not efficient, and may also lead to artificial divergences, as explained in the following sections.

2.1 Softening of the gravitational force

Close encounters between particles can cause numerical errors, essentially because of the time and mass resolution limits. Moreover, when dealing with continuous fluids rather than with single, isolated objects, one tries to solve Eq. (2) rather than Eq. (1), and must therefore try to model a smooth density field given a distribution of particles with mass. In addition, dense clumps of particles may also steal considerable amounts of computational time. To cope with all these issues, it is common practice to soften the gravitational force between close pairs of bodies: if the distance between two particles becomes smaller than a suitable softening length $\epsilon $, the force exerted on each body is corrected and progressively reduced to zero with decreasing distance.

Different forms of the force softening function can be used. A possible expression is given by the formula

                                            $\displaystyle 4{F(\vec{r},\epsilon)}{G m_i} = m_j 4{\vec{r}}{\vert\vec{r}\vert}$ (3)
    $\displaystyle \hspace*{4mm}\times\left\{ \begin{array}{ll}
1 / \epsilon^2 \left...
... u < 2, \\  [2mm]
1/\vert\vec{r}\vert^2 & {\rm if}~u \geq 2,
\end{array}\right.$  

where $\vec{r}$ is the distance between the particles i and j, and $u \equiv\vert\vec{r}\vert/\epsilon$. This expression for the force softening corresponds (via the Poisson equation) to a density distribution kernel function proposed by Monaghan & Lattanzio (1985) and widely adopted in smoothed particles hydrodynamics algorithms (see Sect. 3)[*]
  $\displaystyle W(r,\epsilon) = 4{1}{\pi h^3} \times
\left\{ \begin{array}{ll}
1 ...
... {{\rm if}~1 \leq u < 2,} \\  [2mm]
0 & {{\rm if}~u \geq 2.}
\end{array}\right.$ (4)

Note that in Eq. (4) the softening length $\epsilon $ is assumed to be the same for the two particles i and j. In the more general situation in which each particle carries its own $\epsilon $, a symmetrisation is needed to ensure energy and momentum conservation: this can be achieved either with $\epsilon =
\bar{\epsilon_{ij}}=(\epsilon_i+\epsilon_j)/2$, or by symmetrising the softened force after computing it with the two different values $\epsilon_i$ and $\epsilon_j$.

The softening lengths can be fixed in space and time, or may be let to vary with local conditions. If the softening length is kept constant, the choice of its numerical value is of primary importance: for too small a softening length it will result in noisy force estimates, while for too high a value it will systematically bias the force in an unphysical manner (Romeo 1998; Price & Monaghan 2007; Merritt 1996; Athanassoula et al. 2000, and see also Sect. 5.9). Unfortunately, the ``optimal'' value for the softening length depends on the particular system being simulated, and is in general not known a priori. A standard solution is to assign a softening length to each particle proportional to its mass, keeping it fixed throughout the whole simulation[*], or letting it vary with time or redshift, if a cosmological background is included. A clear advantage of keeping $\epsilon $ fixed in space is that energy is naturally conserved, but on the other hand the smallest resolvable length scale is fixed at the beginning of the simulation and remains the same in the whole spatial domain independently of the real evolution of the density field. A collapsing or expanding body may quickly reach a size where the flow is dominated by the softening in one region, while in another the flow may become unphysically point-like.

Obviously, the accuracy can be greatly improved if $\epsilon $ is let to vary according to the local particle number density (see e.g. Dehnen 2001). Moreover, in principle, if particles in a simulation are used to sample a continuous fluid (whose physics is determined by the Navier-Stokes or the Boltzmann equations) the properties of these points should always change accordingly to the local properties of the fluid they are sampling, to optimise the self-adaptive nature of Lagrangian methods. On the other hand, if particles represent discrete objects (single stars, or galaxies in a cluster, etc.), their softening lengths might perhaps be considered an intrinsic property of such objects and may be kept constant, depending on their mass and not on the local density of particles. In cosmological and galaxy-sized simulations, gas and Dark Matter particles are point-masses sampling the underlying density field, and stellar particles represent clusters of thousands of stars prone to the gravitational action of the nearby distribution of matter; thus a fully adaptive approach seems to be adequate to describe the evolution of these fluids. However, it can be easily shown that simply letting $\epsilon $ change freely would result in a poor conservation of global energy and momentum, even if in some cases the errors could be small (see e.g. Wetzstein et al. 2008; Price & Monaghan 2007).

To cope with this, EVOL allows for the adaptive evolution of individual softening lengths, but includes in the equations of motion of particles additional self-consistent correcting terms. These terms can be derived (see Price & Monaghan 2007) starting from an analysis of the Lagrangian describing a self-gravitating, softened, collisionless system of N particles, which is given by[*]

$\displaystyle L=\sum_{i=1}^N m_i \left( 4{1}{2}v_i^2 - \Phi_i \right),$     (5)

where $\Phi$ is the gravitational potential of the i-th particle,
$\displaystyle \Phi(\vec{r}_i) = - G \sum_{j=1}^N m_j \phi (\vert\vec{r}_{ij}\vert,\epsilon_i),$     (6)

and $\phi$ is a softening kernel ( $\vec{r}_{ij}=\vec{r}_i-\vec{r}_j$). Assuming a density distribution described by the standard spline kernel Eq. (4), the latter becomes
$\displaystyle \phi(\vec{r},\epsilon) =
\left\{\begin{array}{ll}
1 / \epsilon \l...
...mm]
-1/\vert\vec{r}\vert & \hspace*{4mm}{{\rm if}~u \geq 2,}
\end{array}\right.$     (7)

where again $u \equiv\vert\vec{r}\vert/\epsilon$. Note that the force softening, Eq. (4), is obtained taking the spatial derivative of Eq. (7).

The equations of motion are obtained from the Euler-Lagrange equations,

$\displaystyle 4{{\rm d}}{{\rm d}t} \left(4{\partial L}{\partial \vec{v}_i} \right) - 4{\partial L}{\partial \vec{r}_i} = 0,$   (8)

which give
$\displaystyle m_i 4{{\rm d}\vec{v}_i}{{\rm d}t} = 4{\partial L}{\partial \vec{r}_i}\cdot$   (9)

The gravitational part of the Lagrangian is
                      $\displaystyle L_{\rm grav}$ = $\displaystyle - \sum_{j=1}^N m_j \Phi_j$ (10)
  = $\displaystyle - 4{G}{2}\sum_j\sum_k m_j m_k \phi_{jk}(\epsilon_j)$  

where for the sake of clarity $\phi_{ij}(\epsilon_i) =
\phi(\vert\vec{r}_{ij}\vert,\epsilon_i)$; swapping indices, the partial derivative $\partial L_{\rm grav} / \partial \vec{r}_i$ results
$\displaystyle 4{\partial L_{\rm grav}}{\partial \vec{r}_i} =
-4{G}{2}\sum_j\sum...
...rtial \epsilon_j}\vert _{r} 4{\partial \epsilon_j}{\partial \vec{r}_i} \right],$   (11)

where
$\displaystyle 4{\partial\vert r_{jk}\vert}{\partial \vec{r}_i} =
4{\vec{r}_j-\vec{r}_k}{\vert\vec{r}_j-\vec{r}_k\vert}(\delta_{ji}-\delta_{ki}).$   (12)

To obtain the required terms in the second addend on the right part of Eq. (11), the softening length must be related to the particle coordinates so that $\epsilon=\epsilon(n)$, where n is the number density of particles at particle i location. For this purpose, one can start from the general interpolation rule that any function of coordinates $A(\vec{r})$ can be expressed in terms of its values at a disordered set of points, and the integral interpolating the function $A(\vec{r})$ can be defined by
$\displaystyle A_{\rm int}(\vec{r})=\int{A(\vec{r}')W(\vec{r}-\vec{r}',\epsilon){\rm d}\vec{r'}},$   (13)

where W is the density kernel of Eq. (4). This is the same rule as at the basis of the SPH scheme (see Sect. 3)[*].

Approximating the integral to a summation over particles for practice purposes[*], one obtains

$\displaystyle A_{\rm sum}(\vec{r}_i) = A_i = \sum_j{4{A_j}{n_j} W(\vec{r}_{ij},\epsilon_i)},$     (14)

where i marks the ``active'' particle that lays at the position at which the function is evaluated, and j are its neighbouring particles (or simply neighbours). The error by doing so depends on the disorder of particles and is in general O(h2)(Monaghan 1992). Thus
$\displaystyle n_i = \sum_j W(\vert\vec{r}_{ij}\vert,\epsilon_i),$   (15)

where A = n; so there is no need to know the value of the density of neighbouring particles in advance to compute the density of the active one.

To link $\epsilon $ and n, a safe prescription is to use

$\displaystyle \epsilon_i = \eta \left( 4{1}{n_i} \right)^{1/3},$   (16)

where $\eta$ is a dimensionless parameter. With this law, the weighted number of particles within a softening sphere is tentatively held constant, i.e.
$\displaystyle 4{4}{3}(2 \epsilon_i)^3 n_i = N_{\rm nei,id},$   (17)

with $N_{\rm nei,id} {3} \pi (2 \eta)^3$. Numerical experiments have shown that a safe choice is $1.2 \leq \eta \leq 1.5$, corresponding to $60 \leq N_{\rm nei,id} \leq 110$ (Price & Monaghan 2007).

The term needed in Eq. (11) is

$\displaystyle 4{\partial \epsilon_j}{\partial \vec{r}_i} = 4{\partial
\epsilon_j}{\partial n_j} 4{\partial n_j}{\partial \vec{r}_i}\cdot$   (18)

The first factor is given by the derivative of Eq. (16),

$\displaystyle 4{\partial \epsilon_j}{\partial n_j} = - 4{\epsilon_j}{3 n_j},$   (19)

whereas the second factor is the spatial derivative of Eq. (15), which results:

$\displaystyle 4{\partial n_j}{\partial \vec{r}_i} = 4{1}{\Upsilon_j}\sum_p 4{\partial W_{jp}(\epsilon_j)}{\partial \vec{r}_i} (\delta_{ij}-\delta_{ip}),$   (20)

where
$\displaystyle \Upsilon_i = \left[ 1 - 4{\partial \epsilon_i}{\partial n_i} \sum_j 4{\partial W_{ij}(\epsilon_i)}{\partial \epsilon_i}\right]\cdot$     (21)

Rearranging and putting $G\equiv1$, one finally finds
                          $\displaystyle 4{\partial L_{\rm grav}}{\partial \vec{r}_i}$ = $\displaystyle -m_i \sum_j m_j \left[4{\phi_{ij}'(\epsilon_i)+\phi_{ij}'(\epsilon_j)}{2}\right]4{\vec{r}_i-\vec{r}_j}{\vert\vec{r}_i-\vec{r}_j\vert}$  
    $\displaystyle - m_i \sum_j m_j 4{1}{2} \left[ 4{\xi_i}{\Upsilon_i} 4{\partial W...
...{\xi_j}{\Upsilon_j} 4{\partial W_{ij}(\epsilon_i)}{\partial \vec{r}_j} \right],$ (22)

where
$\displaystyle \xi_i = 4{\partial \epsilon_i}{\partial n_i} \sum_j 4{\partial \phi_{ij}(\epsilon_i)}{\partial \epsilon_i}\cdot$   (23)

The $\partial \phi / \partial \epsilon$ terms used in Eq. (23) can be tabulated together with the other kernel functions

\begin{displaymath}4{\partial \phi}{\partial \epsilon} = \left\{ \begin{array}{l...
...eq u < 2,} \\ [2mm]
0 &{{\rm if}~u \geq 2,}
\end{array}\right.
\end{displaymath} (24)

where, as usual, $u \equiv\vert\vec{r}\vert/\epsilon$. Finally, the $\partial W /\partial \vec{r}$ and $\partial W / \partial \epsilon$terms are easily obtained deriving the explicit expression of $W(\vert\vec{r}\vert,\epsilon)$.

In Eq. (22) (and Eq. (12)), the first term is the classical gravitational interaction, whereas the second term is a new, extra-term which restores energy conservation for varying softening lengths. Since $\xi$ is defined as a negative quantity for positive kernels, this term acts as a negative pressure, increasing the gravitational force. To obtain the $\xi$ and $\Upsilon$ correcting terms, each particle i must perform a loop over the other particles, summing the contributions from those that satisfy the criterion $\vert\vec{r}_{ij}\vert \leq 2 \times
\max(\epsilon_i, \epsilon_j)$[*].

The relation between $\epsilon $ and n defined by Eq. (16) leads to a non-linear equation which can be solved self-consistently for each particle. Price & Monaghan (2007) proposed an iterative method in which beginning from a starting guess for both n and $\epsilon $the solution of the equation

$\displaystyle f(\epsilon) = \vert n_i(\epsilon_i) - n_{{\rm sum},i}(\epsilon_i)\vert = 0,$     (25)

where $n_{{\rm sum},i}(\epsilon_i)$ is the mass density computed via summation over neighbouring particles (Eq. (15)) and $n_i(\epsilon_i)$ is the density obtained from Eq. (16), is searched by means of an iterative procedure that can be solved adopting a classical bisection scheme or more efficient routines such as the Newton-Raphson method. In this case, a loop is iterated until $\vert\epsilon_{i,{\rm new}}-\epsilon_i\vert/\epsilon_{i,{\rm init}} <
\gamma_{\rm TOL}$, where $\gamma_{\rm TOL}$ is a tolerance parameter $\sim$ 10-2-10-3, $\epsilon_{i,{\rm init}}$ is the value of $\epsilon $for the particle i at the beginning of the procedure, $\epsilon_i$is its current value, and $\epsilon_{i,{\rm new}}=\epsilon_i-f(\epsilon_i)/f'(\epsilon_i)$; the derivative of Eq. (25) is given by
$\displaystyle f'(\epsilon_i) = 4{\partial n_i}{\partial \epsilon_i} - \sum_j m_...
...ial W_{ij}(\epsilon_i)}{\partial \epsilon_i} = - 4{3n_i}{\epsilon_i}\Upsilon_i.$     (26)

To increase the efficiency of this process, a predicted value for both $\epsilon $ and n can be obtained at the beginning of each time-step with a discretised formulation of the Lagrangian continuity equation,
$\displaystyle 4{{\rm d}n}{{\rm d}t}= - n(\nabla\cdot\vec{v}).$   (27)

This formulation can be obtained taking the time derivative of Eq. (15), which yields
$\displaystyle 4{{\rm d}n_i}{{\rm d}t} = 4{1}{\Upsilon_i} \sum_j (\vec{v}_i-\vec{v}_j) \cdot \nabla_i W(\vec{r}_{ij},\epsilon),$     (28)

while
$\displaystyle 4{{\rm d}\epsilon_i}{{\rm d}t} = 4{\partial \epsilon_i}{\partial n_i} 4{{\rm d}n_i}{{\rm d}t}\cdot$     (29)

Combining Eqs. (28) with (27), one can also see that the velocity divergence at the i particle location is given by
$\displaystyle \nabla \cdot \vec{v}_i = -4{1}{n_i \Upsilon_i}
\sum_j(\vec{v}_i-\vec{v}_j) \cdot \nabla_i W(\vec{r}_{ij},\epsilon).$     (30)

The adoption of this adaptive softening length formalism with the correcting extra-terms in the equation of motion results in small errors, always comparable in magnitude to the ones found with the ``optimal'' $\epsilon $ (see Price & Monaghan 2007, their Figs. 2-4).

At the beginning of a simulation, the user can select whether he/she prefers to adopt the constant or the adaptive softening lengths formalism, by switching a suitable flag on or off.

2.2 Hierarchical oct-tree structure

A direct summation of the contribution of all particles should in principle be performed for each particle at each time-step to correctly compute the gravitational interaction, which would lead to a computational cost increasing with N2 (N being the number of particles). A convenient alternative to this unpractical approach are the so-called tree structures, in which particles are arranged in a hierarchy of groups or ``cells''. In this way, when the force on a particle is computed, the contribution by distant groups of bodies can be approximated by their lowest multipole moments, reducing the computational cost to evaluate the total force to $O(N \log N)$. In the classical Barnes & Hut (1986) scheme, the computational spatial domain is hierarchically partitioned into a sequence of cubes, where each cube contains eight siblings, each with half the side-length of the parent cube. These cubes form the nodes of an oct-tree structure. The tree is constructed in a way that each node (cube) contains either a desired number of particles (usually one, or one per particles type - Dark Matter, gas, stars), or is the progenitor of further nodes, in which case the node carries the monopole and quadrupole moments of all the particles that lie inside the cube. The force computation then proceeds by walking along the tree and summing up the appropriate force contributions from tree nodes. In the standard tree walk, the global gravitational force exerted by a node of a linear size l on a particle i is considered only if $r > l/\theta$, where r is the distance of the node from the active particle and $\theta$ is an accuracy parameter (usually $\leq$1): if a node fulfills the criterion, the tree walk along this branch can be terminated, otherwise it is ``opened'', and the walk is continued with all its siblings. The contribution from individual particles is thus considered only when they are sufficiently close to the particle i.

To cope with some problems pointed out by Salmon & Warren (1994) about the worst-case behaviour of this standard criterion for commonly employed opening angles, Dubinski (1996) introduced the simple modification

$\displaystyle r > l/\theta + \delta,$ (31)

where the $\delta$ is the distance of the geometric centre of a cell to its centre of mass. This provides protection against pathological cases where the centre of mass lies closely to an edge of a cell.

In practice, this whole scheme only includes the monopole moment of the force exerted by distant groups of particles. Higher orders can be included, and the common practice is to include the quadrupole moment corrections (EVOL indeed includes them). Still higher multipole orders would result in a worst performance without significant gains in computational accuracy (McMillan & Aarseth 1993).

Note that if one has the total mass, the centre of mass and the weighted average softening length of a node of the oct-tree structure, the softened expression of the gravitational force can be straightforwardly computed treating the cell as a single particle if the opening criterion is fulfilled but the cell is still sufficiently near for the force to need to be softened.

As first suggested by Hernquist & Katz (1989), the tree structure can be also used to obtain the individual lists of neighbours for each body. At each time step each (active) particle can build its list of interacting neighbouring particles while walking the tree and opening only sufficiently nearby cells, until nearby bodies are reached and linked.

3 Description of the code: hydrodynamics

Astrophysical gaseous plasmas can generally be reasonably approximated to highly compressible, unviscous fluids, in which a fundamental role anyway is played by violent phenomena like strong shocks, high energy point-like explosions and/or supersonic turbulent motions. EVOL follows the basic gas physics by means of the SPH method (Monaghan 1992; Lucy 1977), in a modern formulation based on the review by Rosswog (2009), to which the reader is referred for details. Anyway, some different features are present in our implementation and we summarise them below, along with a short review of the whole SPH algorithm.

To model fluid hydrodynamics by means of a discrete description of a continuous fluid, in the SPH approach the properties of single particles are smoothed in real space through the kernel function W and are thus weighted by the contributions of neighbouring particles. In this way, the physical properties of each point in real space can be obtained by the summation over particles of their individual, discrete properties. Note that on the contrary to what happens when softening the gravitational force (which is gradually reduced to zero within the softening sphere), in this case the smoothing sphere is the only ``active'' region, and only particles inside this region contribute to the computation of the local properties of the central particle.

Starting again from the interpolation rule described in Sect. 2.1, but replacing the softening length $\epsilon $ by a suitable smoothing length h, the integral interpolating the function $A(\vec{r})$ becomes

$\displaystyle A_i(\vec{r})=\int{A(\vec{r}')W(\vec{r}-\vec{r}',h){\rm d}\vec{r'}},$     (32)

(the kernel function W can be the density kernel Eq. (4)).

The relative discrete approximation becomes

$\displaystyle A_{\rm s}(\vec{r}_i) = \sum_j{4{A_j}{\rho_j} m_j W(\vec{r}_i-\vec{r}_j,h_i)},$     (33)

and the physical density of any SPH particle can be computed as
$\displaystyle \rho_i = \sum{m_j W(\vert\vec{r}\vert,h_i)}$     (34)

(here and throughout this section, it is implied that all summations and computations are extended on SPH particles only).

A differentiable interpolating function can be constructed from its values at the interpolation points, i.e. the particles

$\displaystyle \nabla A(\vec{r}) = \sum_j{4{A_j}{\rho_j} m_j \nabla W(\vec{r}-\vec{r}',h)}.$     (35)

In any case better accuracy is found rewriting the formulae with the density inside operators and with the general rule
$\displaystyle \rho \nabla A = \nabla (\rho A) - A \nabla \rho$     (36)

(e.g., Monaghan 1992). Thus the divergence of velocity is customarily estimated by means of
$\displaystyle \nabla \cdot \vec{v}_i = \sum_j m_j [(\vec{v}_j-\vec{v}_i) \cdot \nabla_i W_{ij}] / \rho_i,$     (37)

where $\nabla_i W_{ij}$ denotes the gradient of $W(\vec{r}-\vec{r}',h)$ with respect to the coordinates of a particle i.

The dynamical evolution of a continuous fluid is governed by the well known laws of conservation: the continuity equation which ensures conservation of mass, the Euler equation which represents the conservation of momentum, and the equation of energy conservation (plus a suitable equation of state to close the system). These equations must be written in discretised form to be used with the SPH formalism, and can be obtained by means of the Lagrangian analysis, following the same strategy used to obtain the gravitational accelerations.

The continuity equation is generally replaced by Eq. (34)[*]. Like in the case of the gravitational softening length $\epsilon $, the smoothing length h may in principle be a constant parameter, but the efficiency and accuracy of the SPH method is greatly improved by adapting the resolution lengths to the local density of particles. A self-consistent method is to adopt the same algorithm described in Sect. 2.1, i.e. obtaining h from

$\displaystyle 4{{\rm d}h}{{\rm d}t} = 4{{\rm d}h}{{\rm d}n}4{{\rm d}n}{{\rm d}t},$   (39)

where of course n is the local number density of SPH particles only, and relating h to n by requiring that a fixed number of kernel-weighted particles is contained within a smoothing sphere, i.e.
$\displaystyle h_i = \eta \left( 4{1}{n_i} \right)^{1/3}\cdot$   (40)

Note that in this case, while still obtaining the mass density by summing Eq. (34), one can compute the number density of particles at particle i's location, i.e.:
$\displaystyle n_i = \sum_j W(\vert\vec{r}_{ij}\vert,h_i),$   (41)

which is clearly formally equivalent to Eq. (15)[*].

It is worth recalling here that in the first versions of SPH with a spatially-varying resolution, the spatial variation of the smoothing length was generally not considered in the the equations of motion, and this resulted in secular errors in the conservation of entropy. The inclusion of extra-correcting terms (the so-called $\nabla h$ terms) is therefore important to ensure the conservation of both energy and entropy. For example, Serna et al. (1996) studied the pressure-driven expansion of a gaseous sphere, finding that while the energy conservation is generally good even without the inclusion of the corrections (and sometimes gets slightly worse if these are included!), errors up to $\sim$$5\%$ can be found in the entropy conservation, while all this does not occur with the inclusion of the extra-terms. Although the effects of entropy violation in SPH codes are not completely clear and need to be analysed in much more detail, especially in simulations where galaxies are formed in a cosmological framework, there are many evidences that the problem must be taken into consideration. Alimi et al. (2003) have analysed this issue for the collapse of isolated objects and have found that if correcting terms are neglected the density peaks associated with central cores or shock fronts are overestimated at a $\simeq$$30\%$ level.

These $\nabla h$ terms were first introduced explicitly (Nelson & Papaloizou 1994), with a double-summation added to the canonical SPH equations. Later an implicit formulation was obtained (Springel & Hernquist 2002; Monaghan 2002), starting from the Lagrangian derivation of the equations of motion and self-consistently obtaining correcting terms which accounts for the variation of h. Obviously these terms are formally similar to those obtained for the locally varying gravitational softening lengths (Sect. 2.1).

Following Monaghan (2002), the Lagrangian for non-relativistic fluid dynamics can be written as

$\displaystyle L=\int \rho \left (4{1}{2}v^2 - u \right) {\rm d}V,$   (42)

(the gravitational part is not included here since SPH does not account for gravity), which in the SPH formalism becomes
$\displaystyle L_{\rm SPH} = \sum_j m_j \left[ 4{1}{2}v_j^2 - u_j \right]\cdot$   (43)

As already done in Eq. (8), the equations of motion of a particle can be obtained from the Euler-Lagrange equations, giving
$\displaystyle 4{{\rm d}\vec{v}_i}{{\rm d}t} = - \sum_j m_j \left( 4{\partial
u}{\partial \rho} \right)4{\partial \rho_j}{\partial \vec{r}_i}\cdot$     (44)

To obtain the term $\partial \rho_j/ \partial \vec{r}_i$, one can note that with the density $\rho$ given by Eq. (34) and letting the smoothing length vary according to Eq. (40) one gets
$\displaystyle 4{\partial \rho_j}{\partial \vec{r}_{i}} =
4{1}{\Omega_j} \sum_k m_k \nabla_i W_{ik}(h_i) \delta_{ij} -
m_i \nabla_j W_{ij}(h_j),$     (45)

where $\delta_{ij}$ is the Kronecker delta function, $\nabla_i W$ is the gradient of the kernel function W taken with respect to the coordinates of particle i keeping h constant, and
$\displaystyle \Omega_j = 1 - 4{\partial h}{\partial \rho} \sum_k m_{\rm c}
4{\partial W_{jk}(h_{j})}{\partial h_j}$     (46)

is an extra-term that accounts for the dependence of the kernel function on the smoothing length. Note that $\Omega$ is formally identical to the $\Upsilon$ term introduced in Sect. 2, replacing $\epsilon $ with h. This is obvious since the underlying mathematics is exactly the same; both terms arise when the motion equations are derived from the Lagrangian formulation.

In case of particles with different mass, the term $\partial \rho_j/ \partial \vec{r}_i$ is

$\displaystyle 4{\partial \rho_j}{\partial \vec{r}_i} = \sum_k m_k \nabla_j
W_{ij}(h_j)\left[ 1+ 4{\zeta_j/m_k}{\Omega_j^*}\right]
(\delta_{ij}-\delta_{ik}),$     (47)

where
$\displaystyle \zeta_i = 4{\partial h_i}{\partial n_i}\sum_j m_j 4{\partial
W_{ij}(h_i)}{\partial h_i}$     (48)

and
$\displaystyle \Omega_i^* = 1 - 4{\partial h_i}{\partial n_i} \sum_j
4{\partial W_{ij}(h_i)}{\partial h_i}\cdot$     (49)

(Price 2009, private communication). These terms can be easily computed for each particle while looping over neighbours to obtain the density from Eq. (34).

The term $\partial u / \partial \rho$ in Eq. (44) can be derived from the first law of thermodynamics, ${\rm d}U = {\rm d}Q - P{\rm d}V$, dropping the dQ term since only adiabatic processes are considered. Rewriting in terms of specific quantities, the volume V becomes volume ``per mass'', i.e. $1/\rho$, and ${\rm d}V = {\rm d}(1/\rho) =
-{\rm d}\rho / \rho^2$. Thus, if no dissipation is present so that the specific entropy is constant,

$\displaystyle {\rm d}u = 4{P}{\rho^2} {\rm d}\rho,$   (50)

and
$\displaystyle \left(4{\partial u}{\partial \rho} \right)_{\rm s} = 4{P}{\rho^2}\cdot$   (51)

Inserting Eqs. (51) and (47) into Eq. (44), the equations of motion finally become
                          $\displaystyle 4{{\rm d}\vec{v}_i}{{\rm d}t}$ = $\displaystyle \sum_j m_j \times \left[ 4{P_i}{\rho_i^2} \left( 1+4{\zeta_i/m_j}
{\Omega_i^*}\right) \nabla_i W_{ij}(h_i) \right.$  
    $\displaystyle +\left. 4{P_j}{\rho_j^2} \left( 1+4{\zeta_j/m_i}
{\Omega_j^*}\right) \nabla_i W_{ij}(h_j) \right].$ (52)

The equation for the thermal energy equation is

\begin{displaymath}4{{\rm d}u_i}{{\rm d}t} =
\sum_j m_j \left[ 4{P_i}{\rho_i^2}...
...ght) (\vec{v}_j-\vec{v}_i) \cdot
\nabla_i W_{ij}(h_i) \right].
\end{displaymath} (53)

It can be shown that if all SPH particles have the same mass, Eqs. (52) and (53) are reduced to the standard Eqs. (2.10) and (2.23) in Monaghan (2002)[*].

Equations (41) (density summation) and (40) form a non-linear system to be solved for h and n, adopting the method described in Sect. 2.1.

A drawback of this scheme can be encountered when a sink of internal energy such as radiative cooling is included. In this case, very dense clumps of cold particles can form and remain stable for long periods of time. Since the contribution of neighbouring particles to the density summation (Eq. (41)) is weighted by their distance from the active particle, if this clump is in the outskirts of the smoothing region, each body will give a very small contribution to the summation, and this will result in an unacceptably long neighbour list. For these cases the adoption of a less accurate but faster method is appropriate. The easiest way to select h is to require that a constant number of neighbouring particles is contained within a sphere of a radius $\eta h$ (perhaps allowing for small deviations). This type of procedure was generally adopted in the first SPH codes, and provided sufficiently accurate results. If the scheme in question is adopted (EVOL may choose between the two algorithms), the terms $\nabla h$ are neglected, because the relation Eq. (40) is no longer strictly valid. Below we will refer to this scheme as to the standard SPH scheme, and to the previous one based on the n-h (or $\rho-h$ relation) as to the Lagrangian SPH scheme.

A test to check the ability of the different algorithms to capture the correct description of an (ideally) homogeneous density field has been performed with particles of different masses mixed together in the domain 0<x<1, 0<y<0.1, 0<z<0.1 to obtain the physical densities $\rho = 1$ if x < 0.5 and $\rho = 0.25$ if $x
\geq 0.5$. For this purpose, a first set of particles were displaced on a regular grid and were given the following masses:

\begin{displaymath}m = 0.9 \times 10^{-6} \mbox{ for } x < 0.5; \\
m = 2.25 \times 10^{-7} \mbox{ for } x \geq 0.5.
\end{displaymath}

Then a second set of particles were displaced on another superposed regular grid, shifted along all three dimensions with respect to the previous one by a factor of $\Delta x = \Delta y =
\Delta z = 5 \times 10^{-3}$. These particles were then assigned the following masses

\begin{displaymath}m = 0.1 \times 10^{-6} \mbox{ for } x < 0.5; \\
m = 0.25 \times 10^{-7} \mbox{ for } x \geq 0.5.
\end{displaymath}

Four different schemes were then used to compute the density of particles:
  • standard SPH, mass density summation;
  • standard SPH, number density summation;
  • Lagrangian SPH, mass density summation;
  • Lagrangian SPH, number density summation;
where the expressions ``mass density'' and ``number density'' refer to the different scheme adopted to compute the density of a particle, i.e. to Eqs. (34) and (41), respectively. Looking at Fig. 1, it is clear that the discrete nature of the regular displacement of particles gives different results depending on the adopted algorithm. The mass density formulation is not able to properly describe the uniform density field: low-mass particles strongly underestimate their density, on both sides of the density discontinuity. The situation is much improved when a number density formulation is adopted. Little differences can be noted between the determinations using the constant neighbours scheme and the density-h relation.

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f01.eps} \end{figure} Figure 1:

Determination of the initial density adopting four different SPH algorithms. Left to right, top to bottom: standard SPH, mass density summation; Lagrangian SPH, mass density summation; standard SPH, number density summation; Lagrangian SPH, number density determination. Blue dots: high mass particles; red crosses: low mass particles.

Open with DEXTER

3.1 Symmetrisation

To ensure the conservation of energy and momenta, a proper symmetrisation of the equations of motion is required. It is worth noticing that while in the first formulations of SPH such symmetrisation had to be imposed ``ad hoc'', in the Lagrangian derivation it is naturally built-in without any further assumption.

Anyway, the symmetrisation is strictly necessary only when pairwise forces act on couples of particles. Thus it is not needed when obtaining the density from Eqs. (41) and (34), or when the internal energy of a particle is evolved according to Eq. (53). Indeed, symmetrisation of the energy equation may lead to unphysical negative temperatures. For example when cold particles are pushed by a strong source of pressure: in this case, the mechanical expansion leads to a loss of internal energy which, if equally subdivided between the cold and hot phase, may exceed the small energy budget of cold bodies (see e.g. Springel & Hernquist 2002).

Since symmetrisation is not needed in the density summation algorithm, the smoothing length of neighbouring particles is not required to compute the density of a particle i. This allows us an exact calculation by simply gathering the positions and masses of neighbours, which are known at the beginning of the time-step. On the other hand, after the density loop each particle has its new smoothing length h, and it is now possible to use these values in the acceleration calculations, where symmetrisation is needed. However, while in the previous case only particles within 2hi were considered neighbours of the particle i, in this latter case the symmetrisation scheme requires a particle j to be considered a neighbour of particle i if $r_{ij} < 2 \times \max(h_i, h_j)$[*].

Note that with this scheme two routines of neighbour searching are necessary: the first one in the density summation, and the second in the force calculation. In practice, when the evaluation of density is being performed, a gather view of SPH is adopted (see Hernquist & Katz 1989); thus, each particle isearches its neighbours using only its own smoothing length hi, until the convergence process is completed. In this way, if a particle finds too high or too low a number of neighbours (and therefore must change its smoothing length to repeat the search) it is not necessary to inform the other particles (including those belonging to other processors) about the change that is being made. This would in principle be necessary if a standard gather/scatter mode is adopted. Thus each particle evaluates its density independently, adjusting its smoothing length on its own, and no further communication among processors is necessary after the initial gathering of particles positions. Moreover, the search is initially performed with an effective searching radius which is slightly larger than the correct value 2hi. In this way, the neighbour list will include slightly more particles than effectively needed. However, if at the end of the loop the smoothing length has to be increased by a small factor, it is not be necessary to repeat the tree-walk to reconstruct the neighbour list. Of course if the adaptive softening length scheme is adopted the tree-walk will be performed to upgrade h and $\rho$for SPH particles only, and $\epsilon $ and $\rho_{tot}$ for all particles.

After evaluating the forces (hydrodynamical forces and, if the adaptive softening length scheme is adopted, gravitational forces too), a new search for neighbours must be made, in which a particle is considered neighbour to another one if the distance between them is less than the maximum between the two searching radii. During this second tree-walk, the gravitational force is evaluated together with the construction of the particle's neighbour list. Finally, correcting terms are computed for the hydrodynamic equations of motion ($\nabla h$ terms) and, if necessary, for gravitational interactions (if softening lengths are adaptive), summing the neighbouring particles' contributions.

3.2 Smoothing and softening lengths for SPH particles

SPH particles under self-gravity have two parameters characterising their physical properties: the softening length $\epsilon $, which tunes their gravitational interactions with nearby particles, and the smoothing length h, used to smooth their hydrodynamical features.

In principle these two quantities need not to be related to one another, because they refer to two distinct actions, and have somehow opposite functions as noted above. However, Bate & Burkert (1997) claimed that a quasi-stable clump of gas could became un-physically stable against collapse if $\epsilon>h$, because in this case pressure forces would dominate over the strongly softened gravity, or on the other hand, if $\epsilon<h$, collapse on scales smaller than the formal resolution of SPH may be induced, causing artificial fragmentation. They recommend that gravitational and hydrodynamical forces should be resolved at the same scale length, imposing $\epsilon = h$ (requiring both of them to fixed, or $\epsilon $ to be adaptive like h, with the introduction of the correcting terms described above). In other studies (e.g. Thacker & Couchman 2000) the softening length is fixed, but the smoothing length is allowed to vary, imposing a lower limit close to the value of the softening length (this is a typical assumption in SPH simulations of galaxy formation).

Be that as it may, Williams et al. (2004) have studied the effects of this procedure, finding that it can cause a number of problems in many hydrodynamical studies. The adoption of high values of h can result in over-smoothed density fields, i.e. a decrease in the computed values of the density $\rho$ and of the density gradients $\nabla
\rho$, which in turn un-physically decreases the computed pressure accelerations in the Euler equation. Problems with angular momentum transfer may also arise. Therefore they suggest to allow h to freely vary. This eventually yields improved accuracy and also, contrary to expectations, a significant saving in computational time (because the number of neighbours is kept fixed instead of steeply increasing as it may happen in dense environments with fixed h). Moreover, they pointed out that in contrast with the claims by Bate & Burkert (1997), the smoothing length should not be kept equal to the softening length, because in many physical situations (shocks for example) hydrodynamical forces dominate over gravity and likely need to be properly resolved on size scales smaller than the softening length.

Finally, a numerical problem arises when one tries to keep $\epsilon = h$in cosmological simulations. The presence of a Dark Matter component makes it impossible to keep the number of both hydrodynamical and gravitational neighbours constant. For example, a collapsed Dark Matter halo could retain few gaseous particles (because of shocks and/or stellar feedback), and these will thus have many gravitational neighbours, but few hydrodynamic neighbours with a unique softening/smoothing length. The opposite problem could arise for very dense clumps of cold gas that may form behind shocks without a corresponding concentration of Dark Matter.

Consequently both $\epsilon $ and h are let free to vary independently in EVOL. Future tests may be done trying to keep the two parameters linked, for example allowing for some variations in both their ratio $\epsilon / h$ (imposing it to be around, but not exactly, 1) and in the number of hydrodynamical and gravitational neighbours.

3.3 Discontinuities

3.3.1 Artificial viscosity

The SPH formalism in its straight form is not able to handle discontinuities. By construction, SPH smooths out local properties on a spatial scale of the order of the smoothing length h. Still, strong shocks are of primary importance in a number of astrophysical systems. Accordingly, to model a real discontinuity in the density and/or pressure field ad hoc dissipational, pressure-like terms must be added to the perfect fluid equations to spread the discontinuities over the numerically resolvable length. This is usually achieved by introducing an artificial viscosity, a numerical artifact that is not meant to mimic physical viscosity, but to reproduce on a large scale the action of smaller, unresolved scale physics with a formulation consistent with the Navier-Stokes terms.

Among the many formulations that have been proposed, the most commonly used is obtained adding a term $\Pi_{ij}$ to Eqs. (52) and (53), so that

                            $\displaystyle 4{{\rm d}\vec{v}_i}{{\rm d}t}$ = $\displaystyle \sum_j m_j \times \left[ 4{P_i}{\rho_i^2} \left( 1+4{\zeta_i/m_j}
{\Omega_i^*}\right) \nabla_i W_{ij}(h_i) \right.$  
    $\displaystyle +\left. 4{P_j}{\rho_j^2}
\left( 1+4{\zeta_j/m_i}{\Omega_j^*}\right) \nabla_i W_{ij}(h_j)
+ \Pi_{ij} \bar{\nabla_i W_{ij}} \right],$ (55)

and
                            $\displaystyle 4{{\rm d}u_i}{{\rm d}t}$ = $\displaystyle \sum_j m_j \left[ 4{P_i}
{\rho_i^2}\left( 1+4{\zeta_i/m_j}{\Omega_i^*}\right)
(\vec{v}_j-\vec{v}_i) \cdot \nabla_i W_{ij}(h_i) \right.$ (56)
    $\displaystyle + \left. 4{1}{2}\Pi_{ij} w_{ij} \vert\bar{\nabla_i W_{ij}}\vert \right].$  

Here $w_{ij} = (\vec{v}_{ij} \cdot
\vec{r}_{ij})/\vert\vec{r}_{ij}\vert$,
    $\displaystyle \Pi_{ij} =
\left\{\begin{array}{ll}
\left( 4{-\alpha\bar{c_{ij}}\...
...\  [2mm]
0 &{{\rm if}~\vec{v}_{ij}\cdot\vec{r}_{ij} \geq 0,}
\end{array}\right.$ (57)


$\displaystyle \mu_{ij} = 4{h\vec{v}_{ij}\cdot\vec{r}_{ij}}{\vec{r_{ij}^2}+\eta^2},$   (58)

and
                     $\displaystyle \bar{\nabla_i W_{ij}}$ = $\displaystyle 4{1}{2} \left[ \nabla_i W_{ij}(h_i) \left(
1+4{\zeta_i/m_j}{\Omega_i^*} \right) \right.$ (59)
    $\displaystyle \left. + \nabla_i W_{ij}(h_j) \left(
1+4{\zeta_j/m_i}{\Omega_j^*} \right) \right]$ (60)

(Monaghan 1988). $\bar{c_{ij}}$ is the average sound speed, which is computed for each particle from a suitable equation of state (EoS), like the ideal monatomic gas EoS $P = (\gamma-1)
\rho u$, using $c_i = \sqrt{\gamma (\gamma -1) u_i}$ ($\gamma$ is the adiabatic index); the parameter $\eta$ is introduced to avoid numerical divergences, and it is usually taken to be $\eta = 0.1 h$. $\alpha$ and $\beta$ are two free parameters, of the order of unity, which account respectively for the shear and bulk viscosity in the Navier-Stokes equation (Watkins et al. 1996), and for the von Neuman-Richtmyer viscosity, which works in high Mach number flows.

A more recent formulation is the so-called ``signal velocity'' viscosity (Monaghan 1997), which works better for small pair separations between particles, being a first-order expression of h/r; it reads

$\displaystyle \Pi_{ij} = 4{-\alpha v_{ij}^{\rm sig}w_{ij}}{\bar{\rho_{ij}}},$   (61)

with the signal velocity defined as
$\displaystyle v_{ij}^{\rm sig}= 2 \bar{c_{ij}} - w_{ij}.$   (62)

One or the other of the two formulations above can be used in EVOL.

In general, artificial dissipation should be applied only where really necessary. However, it has long been recognized that artificial viscosity un-physically boosts the post-shock shear viscosity, suppressing structures in the velocity field on scales well above the nominal resolution limit, and damping the generation of turbulence by fluid instabilities.

To avoid the overestimate of the shear viscosity, Balsara (1995) proposed to multiply the chosen expression of $\Pi_{ij}$ by a function $\bar{f_{ij}}=(f_i+f_j)/2$; the proposed expression for the correcintg term fi for a particle i is

$\displaystyle f_i = 4{\vert\nabla_i\cdot\vec{v}_i\vert}
{\vert\nabla_i\cdot\vec{v}_i\vert+\vert\nabla_i\times\vec{v}_i\vert+\eta c_i/h_i},$   (63)

where $\eta \sim 10^{-4}$ is a factor introduced to avoid numerical divergences. It can be seen that f acts as a limiting switch reducing the efficiency of viscous forces in the presence of rotational flows.

Another possible cure to the problem is the following. The most commonly used values for the parameters $\alpha$ and $\beta$ in Eq. (57) are $\alpha = 1$ and $\beta = 2$. Bulk viscosity is primarily produced by $\alpha$, and this sometimes over-smoothen the post-shock turbulence. To cope with this, Morris & Monaghan (1997) have proposed a modification of Eq. (57), in which the parameter $\alpha$ depends on the particle and changes with time according to

$\displaystyle 4{{\rm d}\alpha_i}{{\rm d}t} = - 4{\alpha_i-\alpha_{\rm min}}{\tau} + G_i,$     (64)

where $\alpha_{\rm min} = 0.01$ is the minimum allowed value, $\tau = 0.1 h_i/v^{\rm sig}$ is an e-folding time scale (with $v^{\rm sig}
= \max_j[v_{ij}^{\rm sig}]$), and Gi is a source term which can be parameterised as $G_i = 0.75 f_i \max[0,-\vert\nabla\cdot\vec{v}_i\vert]$. This formulation embodies some different prescriptions (e.g. in Price 2008; Rosswog & Price 2007). One can then put $\alpha = 4{1}{2}(\alpha_i+\alpha_j)$ in Eq. (61). Dolag et al. (2005) showed that this scheme captures shocks as well as the original formulation of SPH, but in regions away from shocks the numerical viscosity is much smaller. In their high resolution cluster simulations this resulted in higher levels of turbulent gas motions in the ICM, significantly affecting radial gas profiles and bulk cluster properties. Interestingly, this tends to reduce the differences between SPH and adaptive mesh refinement simulations of cluster formation.

Finally, we include the cut-off to the viscous acceleration introduced by Springel et al. (2001, their Eq. (50)), to avoid unphysical repulsive forces.

3.3.2 Artificial thermal conductivity

As Price (2008) pointed out, an approach similar to that described above should be used to smooth out discontinuities in all physical variables. In particular an artificial thermal conductivity is necessary to resolve discontinuities in thermal energy (even if only a few formulations of SPH in the literature take this into account).

The artificial thermal conductivity is represented by the term

$\displaystyle \Pi^u = -4{\bar{\alpha_{ij}^u} v_{\rm sig}^u (u_i-u_j)}{\bar{\rho_{ij}}}\cdot$     (65)

Here $\alpha^u$ is a conductivity coefficient $4{1}{2}(\alpha_i^u+\alpha_j^u)$ that varies with time according to
$\displaystyle 4{{\rm d}\alpha_i^u}{{\rm d}t} = - 4{\alpha_i^u-\alpha^u_{\rm min}}{\tau} + S_i^u,$     (66)

where $\tau$ is the same time scale as above, $\alpha^u_{\rm min}$ is usually 0, and the source term can be defined as $S_i^u = h_i \vert\nabla^2 u_i\vert/\sqrt{u_i}$ (Price 2008), in which the expression for the second derivative is taken from Brookshaw (1986)
$\displaystyle \nabla^2 u_i = \sum_j 2 m_j 4{u_i - u_j}
{\rho_j} 4{\vert\bar{\nabla_i W_{ij}}\vert}{r_{ij}},$     (67)

which reduces particles noise; $v_{ij}^{\rm sig}$ can be either the same quantity defined in Eq. (62) or
$\displaystyle v_{ij}^{\rm sig} = \sqrt{4{\vert P_i-P_j\vert}{\rho_{ij}}}\cdot$     (68)

We note in passing that adopting the source term suggested by Price & Monaghan (2005) $S_i^u = 0.1 h_i \vert\nabla^2 u_i\vert$would be less accurate for problems requiring an efficient thermal conduction like the standard shock tube test with un-smoothed initial conditions, see Sect. 5.

The term $\Pi^u$ must finally be added to Eq. (57), giving

                         $\displaystyle 4{{\rm d}u_i}{{\rm d}t}$ = $\displaystyle \sum_j m_j \left[ 4{P_i}
{\rho_i^2}\left( 1+4{\zeta_i/m_j}{\Omega_i^*}\right)
(\vec{v}_j-\vec{v}_i) \cdot \nabla_i W_{ij}(h_i) \right.$ (69)
    $\displaystyle + \left. \left( 4{1}{2}\Pi_{ij} + \Pi_{ij}^u \right) w_{ij} \vert\bar{\nabla_i W_{ij}}\vert \right].$  

As in the case of artificial viscosity, it is worth noting that this conductive term is not intended to reproduce a physical dissipation; instead, it is a merely numerical artifact introduced to smooth out unresolvable discontinuities.

3.4 Entropy equation

Instead of looking at the thermal energy, we may follow the evolution of a function of the total particle entropy, for instance the entropic function

$\displaystyle A(s) = 4{P}{\rho^{\gamma}},$   (70)

where $\gamma$ is the adiabatic index. This function is expected to grow monotonically in the presence of shocks, to change because of radiative losses or external heating, and to remain constant for an adiabatic evolution of the gas. Springel & Hernquist (2002) suggest the following SPH expression for the equation of entropy conservation
                        $\displaystyle 4{{\rm d} A_i}{{\rm d}t}$ = $\displaystyle - 4{\gamma -1}
{\rho_i^{\gamma}} S(\rho_i,u_i)$ (71)
    $\displaystyle + 4{1}{2}4{\gamma -1}{\rho_i^{\gamma-1}}
\sum_j m_j \Pi_{ij} \vec{v}_{ij}\cdot \nabla_i W_{ij},$  

where S is the source function describing the energy losses or gains due to non-adiabatic physics apart from viscosity. If $S\ll 1$, the function A(s) can only grow in time because of the shock viscosity. Equation (72) can be integrated instead of Eq. (57), giving a more stable behaviour for some particular cases. Note that internal energy and entropic function of a particle can be related via
$\displaystyle u=4{A(s)}{\gamma-1} \rho^{\gamma-1}.$   (72)

The entropic function can be used to detect situations of shocks since its value only depends on the strength of the viscous dissipation.

In general, if the energy equation is used (integrated) the entropy is not exactly conserved, and viceversa. Moreover, if the density is evolved according to the continuity Eq. (38) and the thermal energy according to Eq. (53), both energy and entropy are conserved; but in this case the mass is not conserved (to ensure this, the density must be computed with Eq. (34)). This problem can be mitigated with the inclusion of the $\nabla h$ terms in the SPH method, as already discussed.

3.5 X-SPH

As an optional alternative, EVOL may adopt the smoothing of the velocity field by replacing the normal equation of motion ${\rm d}\vec{r}_i/{\rm d}t = \vec{v}_i$ with

$\displaystyle 4{{\rm d}\vec{r}_i}{{\rm d}t}=\vec{v}_i+\eta\sum_j m_j \left(
4{\vec{v_{ji}}}{\bar{\rho_{ji}}} \right) W_{ij},$   (73)

(Monaghan 1992) with $\bar{\rho_{ji}} = (\rho_i +
\rho_j)/2$, $\vec{v_{ji}} = \vec{v}_j-\vec{v}_i$, and $\eta$constant, $0 \leq \eta \leq 1$. In this variant of the SPH method, known as X-SPH, a particle moves with a velocity closer to the average velocity in the surroundings. This formulation can be useful in simulations of weakly compressible fluids, where it keeps particles in order even in the absence of viscosity, or to avoid undesired inter-particle penetration.

4 Description of the code: integration

4.1 Leapfrog integrator

Particle positions and velocities are advanced in time by means of a standard leapfrog integrator, in the so-called kick-drift-kick (KDK) version, where the K operator evolves velocities and the D operator evolves positions:

                                $\displaystyle \mbox{\textbf{K$_{1/2}$ }: } \vec{v}_{n+1/2} =
\vec{v}_{n}+4{1}{2}\vec{a}({r_n}) \delta t$  
    $\displaystyle \mbox{\textbf{D: }} {r_{n+1}} =
{r_n}+\vec{v}_{n+1/2} \delta t$  
    $\displaystyle \mbox{\textbf{K$_{1/2}$ }: } \vec{v}_{n+1} =
\vec{v}_{n+1/2}+4{1}{2} \vec{a}({r_{n+1}}) \delta t.$  

A predicted value of physical quantities at the end of each time-step is also predicted at the beginning the same step, to guarantee synchronisation of the calculation of the accelerations and other quantities. In particular, the synchronised predicted velocity $\vec{v}_{n+1} =\vec{v}_{n}+\vec{a}({r_n}) \delta t $ is used in the computation of the viscous acceleration on gas particles.

Moreover, if the individual time-stepping is adopted (see below, Sect. 4.2.1), non-active particles use predicted quantities to give their own contributions to forces and interactions.

4.2 Time-stepping

A trade-off between accuracy and efficiency can be reached by a suitable choice of the time-step. One would like to obtain realistic results in a reasonable amount of CPU time. To do so, numerical stability must be ensured, together with a proper description of all relevant physical phenomena, at the same time reducing the computational cost keeping the time-step as large as possible.

For this purpose, at the end of each step, the optimal time-step for each particle is given by the shortest among the times

               $\displaystyle \delta t_{{\rm acc},i}$ = $\displaystyle \eta_{\rm acc} \sqrt{4{{\rm min}(\epsilon_i,h_i)}{\vert\vec{a}_{i}\vert}}$  
$\displaystyle \delta t_{{\rm vel},i}$ = $\displaystyle \eta_{\rm vel} \sqrt{4{{\rm min}(\epsilon_i,h_i)}{\vert\vec{v}_{i}\vert}}$  
$\displaystyle \delta t_{{\rm av},i}$ = $\displaystyle \eta_{\rm av} \sqrt{4{\vert\vec{v}_{i}\vert}{\vert\vec{a}_{i}\vert}}$  

with obvious meaning of the symbols; the parameters $\eta$are of the order of 0.1. The third of these ratios can assume extremely low values under particular situations, and should therefore be used with caution.

We can compute two more values, the first obtained from the well-known Courant condition and the other constructed to avoid large jumps in thermal energy:

                                  $\displaystyle \delta t_{C,i} = \eta_C 4{h_i}{h_i \vert\nabla \cdot
\vec{v}_{i}\vert + c_i +1.2(\alpha c_i + \beta \max_j \vert\mu_{ij}\vert)}$  
    $\displaystyle \delta t_{u,i} = \eta_u \left\vert 4{u_i}{{\rm d}u_i/{\rm d}t}\right\vert,$  

where $\alpha, \beta$ and $\mu$ are the quantities defined in the artificial viscosity parametrisation, see Sect. 3.3.1, and c is the sound speed.

If the simulation is run with a global time-stepping scheme, all particles are advanced adopting the minimum of all individual time-steps calculated in this way; synchronisation is clearly guaranteed by definition.

If desired, a minimum time-step can be imposed. In this case, however, thresholds should be adopted to avoid numerical divergences in accelerations and/or internal energies. This of course leads to a poorer description of the physical evolution of the system; anyway, in some cases a threshold may be necessary to avoid very short time-steps due to violent high energy phenomena.

4.2.1 Individual time-stepping

Cosmological systems usually display a wide range of densities and temperatures, so that an accurate description of very different physical states is necessary within the same simulation. Adopting the global time-stepping scheme may cause a huge waste of computational time, since gas particles in low-density environments and collisionless particles generally require much longer time-steps than the typical high-density gas particle.

In EVOL an individual time-stepping algorithm can be adopted, which makes better use of the computational resources. It is based on a powers-of-two scheme, as in Hernquist & Katz (1989). All the individual particles' real time steps, $\delta t_{i,{\rm true}}$, are chosen to be a power-of-two subdivision of the longest allowed time-step (which is fixed at the beginning of the simulation), i.e.

$\displaystyle \delta t_{i,{\rm true}} = \delta t_{\rm max} / 2^{n_i},$   (74)

where ni is chosen as the minimum integer for which the condition $\delta t_{i,{\rm true}} \geq \delta t_i$ is satisfied. Particles can move to a smaller time bin (i.e. a longer time step) at the end of their own time step, but are allowed to do so only if that time bin is currently time-synchronised with their own time bin, thus ensuring synchronisation at the end of every longest time step.

A particle is then marked as ``active'' if $t_i + \delta
t_{i,{\rm true}} = t_{\rm sys}$, where the latter is the global system time, updated as $t_{\rm sys,new} = t_{\rm sys,old} + \delta t_{\rm sys}$, where $\delta t_{\rm sys} = {\rm min}(\delta t_i)$. At each time-step only active particles re-compute their density and update their accelerations (and velocities) via a summation over the tree and neighboring particles. Non-active particles keep their acceleration and velocity fixed and only update their position using a prediction scheme at the beginning of the step. Note that some other evolutionary features (i.e. cooling or chemical evolution) are instead updated at every time-step for all particles.

Since in the presence of a sudden release of very hot material (e.g. during a supernova explosion) one or a few particles may have to drastically and abruptly reduce their time-step, the adoption of an individual time-stepping scheme would clearly lead to unphysical results, since neighbouring non-active particles would not notice any change until they become active again. This is indeed a key issue, very poorly investigated up to now. To cope with this, a special recipe has been added, forcing non-active particles to ``wake up'' if they are being shocked by a neighbour active particle, or in general if their time-step is too long (say more than 4-8 times longer) with respect to the minimum time-step among their neighbours. In this way all the neighbouring particles are soon informed of the change and are able to react properly when an active particle suddenly changes its physical state. Saitoh & Makino (2008) recently studied the problem and arrived at similar conclusions, recommending a similar prescription when modelling systems in which sudden releases of energy are expected.

Note that when a non-active particle is woken up, energy and momentum are not perfectly conserved, since its evolution during the current time-step is not completed. This error is negligible if compared to the errors introduced by ignoring this correction though.

4.3 Periodic boundary conditions

Periodic boundary conditions are implemented in EVOL using the well known Ewald (1921) method, i.e. adding to the acceleration of each particle an extra-term due to the replicas of particles and nodes, expanding in Fourier series the potential and the density fluctuation, as described in Hernquist et al. (1991) and in Springel et al. (2001). If $\vec{x}_i$ is the coordinate at the point of force-evaluation relative to a particle or a node j with mass mj, the additional acceleration which must be added to account for the action of the infinite replicas of j is given by

                                $\displaystyle {\rm acc}_{\rm per}(\vec{x})$ = $\displaystyle m_j \left[ 4{\vec{x}}
{\vert\vec{x}\vert^3} - \sum_n 4{\vec{x}-\vec{n}L}{\vert\vec{x}-\vec{n}L\vert^3} \right.$ (75)
    $\displaystyle \times\left( {\rm erfc}(\omega\vert\vec{x}-\vec{n}L\vert) + 4{2\o...
...rt}
{\sqrt{\pi}} \times {\rm e}^{-\omega^2\vert\vec{x}-\vec{n}L\vert^2} \right)$  
    $\displaystyle \left. - 4{2}{L^2} \sum_{\vec{h}/=0} 4{\vec{h}}
{\vert\vec{h}\ver...
...ga^2 L^2} } {\rm sin}
\left( 4{2 \pi}{L} \vec{h} \cdot \vec{x} \right) \right],$  

where $\vec{n}$ and $\vec{h}$ are integer triplets, L is the periodic box size, and $\omega$ is an arbitrary number. Convergence is achieved for $\omega = 2/L$, $\vert\vec{n}\vert<5$ and $\vert\vec{h}\vert<5$ (Springel et al. 2001). The correcting terms acc $_{\rm per}/m_j$ are tabulated, and trilinear interpolation off the grid is used to compute the correct accelerations. It must be pointed out that this interpolation significantly slows down the tree algorithm and almost doubles the CPU time.

The periodicity in the SPH scheme is obtained straightforwardly finding neighbours across the spatial domain and taking the modulus of their distance to obtain their nearest image with respect to the active particle. In this way, no ghost particles need to be introduced.

4.4 Parallelisation

\begin{figure}
\par\includegraphics[width=12.5cm,clip]{Figures/13514f02.eps}
\end{figure} Figure 2:

Data structures in EVOL. Void cells are included to allow for new particles to be created and/or imported from other CPUs. Ghost structures are reallocated at each time-step.

Open with DEXTER

EVOL uses the MPI communication protocol to run in parallel on multiple CPUs. First of all, particles must be subdivided among the CPUs, so that each processor has to deal only with a limited subset of the total number of bodies. for this purpose the spatial domain is subdivided at each time-step using the orthogonal recursive bisection (ORB) scheme. In practice, each particle keeps track of the time spent to compute its properties during the previous time-step in which it has been active, storing it in a work-load variable. At the next time-step the spatial domain is subdivided trying to assign the same total amount of work-load to each CPU (only considering active particles if the individual time-stepping option is selected), re-assigning bodies near the borders among the CPUs. To achieve this the domain is first cut along the x-axis, at the coordinate $x_{\rm cut}$ that better satisfies the equal work-load condition among the two groups of CPUs formed by those with geometrical centres $x_{\rm centre} \leq x_{\rm cut}$ and those with $x_{\rm centre}>x_{\rm cut}$. In practice, each CPU exchanges particles only if its borders are across $x_{\rm cut}$. Then the two groups of CPUs are themselves subdivided into two new groups, this time cutting along the y-axis (at two different coordinates, because they are independent from one another as they have already exchanged particles along the x-axis). The process is repeated as long as required (depending to the number of available CPUS), cutting recursively along the three dimensions. It should be noted that this scheme allows one to use only a power-of-two number of CPUs, whereas other procedures (e.g. a Peano-Hilbert domain decomposition, see e.g. Springel 2005) can more efficiently exploit the available resources.

It may sometimes happen that a CPU wants to acquire more particles than permitted by the dimensions of its arrays. In this case, data structures are re-allocated using temporary arrays to store extra-data, as described in the next section.

Apart from the allocation of particles to the CPUs, the other task for the parallel architecture is to spread the information about particles belonging to different processors. This is achieved by means of ``ghost'' structures, in which these properties are stored when necessary. A first harvest among CPUs is made at each time step before computing SPH densities: at this point, positions, masses and other useful physical features of nearby nodes and particles, belonging to other processors, are needed. Each CPU ``talks'' only to another CPU per time, first importing all the data-structures belonging to it in temporary arrays, and then saving within its ``ghost-tree'' structure only the data relative to those nodes and particles which will be actually used. For example, if a ``ghost node'' is sufficiently far away from the active CPU geometrical position so that the gravitational opening criterion is satisfied, there will be no need to open it to compute gravitational forces, and no other data relative to the particles and sub-nodes it contains will be stored in the ghost-tree.

A second communication among CPUs is necessary before computing accelerations. Here each particle needs to known the exact value of the smoothing and softening lengths (which have been updated during the density evaluation stage) as well as many other physical values of neighbouring (but belonging to different CPUs) particles. The communication scheme is exactly the same as before, involving ghost structures. It was found that instead of upgrading the ghost-tree built before the density evaluation, a much faster approach is to completely re-build it.

The dimensions of the ghost arrays are estimated at the beginning of the simulation and every N time-steps (usually N=100), by means of a ``preliminary walk'' among all CPUs. In intermediate steps, the dimensions of these arrays are modified on the basis of the previous step evaluation and construction of ghost structures.

4.5 Data structures

All data structures are dynamically adapted to the size of the problem under exploration. In practice, all arrays are allocated at the beginning of a simulation so that their dimension is equal to the number of particles per processor, plus some empty margin to allow for an increase of the number of particles to be handled by the processor (see Fig. 2).

Whenever a set of arrays within a processor becomes full of data and has no more room for new particles, the whole data structure of that processor is re-scaled increasing its dimensions, to allow for new particles to be included. Of course, the opposite case (i.e. if the number of particles decreases, leaving too many void places) is also considered.

This is done by first storing the data in excess in temporary T arrays. Then the whole ``old'' data structure O is copied onto new temporary N arrays, which have the new required dimensions. Finally, T arrays are copied into the N structure; this substitutes the O structure, which is then deleted. Clearly, this procedure is quite memory-consuming, but ideally it has to be carried out only a few times per simulation, at least in standard cases. Moreover, it is performed after the ``ghost'' scheme described above has been completed, and ghost-structures have been deallocated, leaving room for other memory-expensive routines.

5 Tests of the code

An extended set of hydrodynamical tests was performed to check the performance of EVOL under different demanding conditions:

Except where explicitly pointed out, the tests were run on a single CPU with the global time-stepping algorithm and adopting the following parameters for the SPH scheme: $\eta = 1.2$, $\alpha_{\rm max}=2$, $\alpha_{\rm min} = 0.01$, $\beta = 2\alpha$, $\gamma=5/3$, and the equation of state $P = (\gamma-1)
\rho u$. Where gravitation is present, the opening angle for the tree code has been set $\theta = 0.8$. The tests in one and two dimensions were run adopting the kernel formulations shown in Appendix A. The exact analytical solutions were obtained with the software facilities freely available at the website http://cococubed.asu.edu/code_pages/codes.shtml.

5.1 Rarefaction wave

We begin our analysis with a test designed to check the the code in extreme, potentially dangerous low-density regions, where some iterative Riemann solvers can return negative values for the pressure/density. In the Einfeldt rarefaction test (Einfeldt et al. 1991) the two halves of the computational domain 0<x<1 move in opposite directions, and thereby create a region of very low density near the initial velocity discontinuity at x=0.5. The initial conditions of this test are

$\displaystyle \left\{\begin{array}{ll}
\rho = 1.0, P = 0.4, v_x = -2.0, & {\rm ...
...5, \\
\rho = 1.0, P = 0.4, v = 2.0, & {\rm for}~x \geq 0.5.
\end{array}\right.$     (76)

The results at t=0.2 for a 1-D, 1000-particle calculation are shown in Fig. 3. Clearly, the low-density region is well described by the code.
\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f03.eps}
\end{figure} Figure 3:

Left to right, top to bottom: density, internal energy, x-velocity, and pressure profiles at t=0.2 for the Einfeldt test. All quantities are in code units.

Open with DEXTER

5.2 Shock tube

The classic Riemann problem to check the shock capturing capability is the Sod's shock tube test (Sod 1978). We ran many different cases changing numerical parameters to check the response to different settings. All tests were started from un-smoothed initial conditions, leaving the code to smear out the initial discontinuities.

5.2.1 1-D tests

The first group of tests was performed in one dimension. 1000 equal mass particles were displaced on the x axis in the domain $0 \leq x \leq 1$ and the inter-particle spacing was changed to obtain the setting

$\displaystyle \left\{\begin{array}{ll}
\rho = 1.0, u = 1.5, v = 0, & {\rm for}~...
...5, \\
\rho = 0.25, u = 1.077, v = 0, & {\rm for}~x \geq 0.5
\end{array}\right.$     (77)

( $m=6.25 \times 10^{-4}$). In this way, particles belonging to the left region of the tube initially have P=1, whereas particles on the right side of the discontinuity have P=0.1795, as in the classic
Monaghan & Gingold (1983) test. We performed four runs:
  • T1 - standard viscosity (with $\alpha = 1$ and $\beta = 2$) and no artificial conduction;
  • T2 - standard viscosity plus artificial conduction;
  • T3 - viscosity with variable $\alpha$ plus artificial conduction;
  • T4 - the same as T2, but with the same density discontinuity obtained by using particles with different masses on a regular lattice instead of equal mass particles on a shrinked grid. To do so, particles on the left of the tube have the mass m = 10-3, whereas those on the right have $m = 2.5 \times 10^{-4}$.
Figures 4 through  7 show the density, internal energy, x-velocity and pressure x-profiles at t=0.12 for the four cases (in code units).

The overall behaviour is good in all cases. We note the typical blipin the pressure profile and the wall-like overshoot in thermal energy at the contact discontinuity in the T1 run. The introduction of the artificial thermal conductivity (T2) clearly helps to mitigate the problem at the expense of a slightly shallower thermal energy profile. Introducing the variable $\alpha$-viscosity (T3), the reduced viscosity causes post-shock oscillations in the density (and energy), and makes the velocity field noisier and turbulent, as expected.

Little differences can be seen in the T4 run, except for a slightly smoother density determination at the central contact discontinuity, which also increases the blip problem. The best results are evidently obtained with the T2 configuration.

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f04.eps}
\end{figure} Figure 4:

Left to right, top to bottom: density, internal energy, x-velocity and pressure profiles at t=0.12 for test T1 (see text for details). Red solid line: exact solution. All quantities are in code units.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f05.eps}
\end{figure} Figure 5:

the same as in Fig. 4, but for test T2 (see text for details).

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f06.eps}
\end{figure} Figure 6:

The same as in Fig. 4, but for test T3 (see text for details).

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f07.eps}
\end{figure} Figure 7:

The same as in Fig. 4, but for test T4 (see text for details).

Open with DEXTER

5.2.2 3-D tests

As pointed out by Steinmetz & Mueller (1993), performing shock tube calculations with 1-D codes with the particles initially displaced on a regular grid essentially avoids the problems caused by numerical diffusivity, but in realistic cosmological 3-D simulations the situation is clearly more intricated. To investigate this issue, we switch to a 3-D description of the shock tube problem. The initial conditions are set using a relaxed glass distribution of $\sim$60 000 particles in a box with dimensions [0, 1] along the x axis and (periodic) [0, 0.1]along the y and z axis. Particles are assigned a mass $m_{\rm right}=1.71 \times 10^{-7}$ and $m_{\rm left}=2.5 \times m_{\rm right}$on the two sides on the discontinuity at x=0.5, with all other parameters as in the 1-D case. A first run (T5) was performed with the T1 configuration (standard viscosity, no artificial conduction), while a second one (T6) was done including the artificial conduction term.

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f08.eps}
\end{figure} Figure 8:

The same as in Fig. 4, but for test T5 (see text for details).

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f09.eps}
\end{figure} Figure 9:

The same as in Fig. 4, but for test T6 (see text for details).

Open with DEXTER

Figures 8 and 9 show the state of the system at t=0.12 for both cases (note that all particles and no mean values are plotted). As in the 1-D case, the overall agreement with the theoretical expectation is quite good. However, the inclusion of the conductive term on the one hand yields sharper profiles and reduces the pressure blip, on the other hand gives a smoother description of the contact discontinuities (see the density profile at x=0.55). We argue that part of the worse results may be due to the use of particles with a different mass as a similar result was found for the corresponding 1-D test (see T4 above). A limit on the conduction efficiency could give better results, but an ad hoc adjustment should be applied to each case.

5.3 Interacting blast waves

Woodward & Colella (1984) proposed a severe test in 1-D, i.e. two strong blast waves develop out of a gas of density $\rho = 1$ that is initially at rest in the domain 0<x<1, with a pressure P = 1000 for x < 0.1, P = 100 for x > 0.9 and P = 0.01 in between (the adiabatic index is $\gamma = 1.4$). The boundary conditions are reflective on both sides; this can be achieved introducing ghost particles created on-the-fly. Evolving in time, the two blast waves initiate multiple interactions of strong shocks, rarefaction and reflections.

We performed two runs: one at a high resolution with 1000 equally spaced particles, and one at a low resolution with only 200 particles. In both cases, the code included the artificial conduction and viscosity with constant $\alpha = 1$.

Figure 10 shows the density x-profiles for the high resolution case at t=0.010, 0.016, 0.026, 0.028, 0.030, 0.032, 0.034, 0.038. The results can be compared with those of Woodward & Colella (1984), Steinmetz & Mueller (1993) and Springel (2010). The complex evolution of the shock and rarefaction waves is reproduced with good accuracy and sharp profiles, in nice agreement with the theoretical expectations. The very narrow density peak at t=0.028, which should have $\rho
\approx 30$, is well reproduced and only slightly underestimated.

Figure 11 shows the comparison of the density profiles of the high and low resolution cases at t=0.038. The lower resolution causes a substantial smoothing of the contact discontinuities; nevertheless, the overall behaviour is still reproduced, shock fronts are located at the correct positions, and the gross features of the density profile are roughly reproduced.

\begin{figure}
\par\includegraphics[width=12cm,height=7cm,clip]{Figures/13514f10.eps}
\end{figure} Figure 10:

Left to right, top to bottom: density profiles at t=0.010, t=0.016, t=0.026, t=0.028, t=0.030, t=0.032, t=0.034, t=0.038 for the Woodward high-resolution test (see text for details). All quantities are in code units.

Open with DEXTER

5.4 Kelvin-Helmoltz instability

The Kelvin-Helmoltz (KH) instability problem is a very demanding test. Recently, Price (2008) replied to the claim by Agertz et al. (2007) that the SPH algorithm is not able to correctly model contact discontinuities like the Kelvin-Helmoltz (KH) problem. He showed how the inclusion of the conductive term is sufficient to correctly reproduce the instability. We tried to reproduce his results running a similar test with the 2-D version of EVOL.

We set up a regular lattice of particles in the periodic domain 0<x<1, 0<y<1, with 2562 particles. The initial conditions were similar to those adopted by Price (2008). The masses of the particles were assigned in a way that $\rho = 2$ for |y - 0.5| < 0.25, and $\rho = 1$ elsewhere (note that in Price 2008,   this density difference was instead obtained changing the disposition of equal mass particles). The regions were brought to the pressure equilibrium with P = 2.5. In this case, although the initial gradients in density and thermal energy were not smoothed, the thermal energy was assigned to the particles after the first density calculation, to ensure a continuous initial pressure field.

The initial velocity of the fluid was set like this:

    $\displaystyle v_x =
\left\{\begin{array}{ll}
0.5 & {{\rm if}~\vert y-0.5\vert < 0.25,} \\
-0.5 & {{\rm if}~\vert y-0.5\vert \geq 0.25,} \\
\end{array}\right.$ (78)

and
$\displaystyle v_y = w_0 \sin(4 \pi x)
\left\{ \exp \left[ -4{(y-0.25)^2}{2\sigma^2} \right] +
\exp \left[ -4{(y-0.75)^2}{2\sigma^2} \right] \right\},$   (79)

where we used $\sigma = 0.05/\sqrt{2}$, and w0 = 0.1or w0 = 0.25 for two different runs (K1 and K2, respectively). So a small perturbation in the velocity field was forced near the contact discontinuity and triggered the instability.

Figures 12 and 13 show the temporal evolution of the instability in the two cases. Clearly, our code is able to reproduce the expected trend of whirpools and mixing between the fluids; the evolution is faster for a stronger initial perturbation. For comparison, we also ran a test with the K2 initial conditions, but switched artificial conduction off; Fig. 14 shows the comparison of the final density fields (at t=1.79) and of the initial pressure fields. In the latter, the blip that inhibits mixing is clearly visible at the discontinuity layer: the resulting spurious surface tension keeps the two fluids separated, a problem efficiently solved by the artificial conduction term.

\begin{figure}
\par\includegraphics[width=6cm,height=6cm,clip]{Figures/13514f11.eps}
\end{figure} Figure 11:

Comparison of the high-resolution (solid line) and low-resolution (dots) density profiles at t=0.038 for the Woodward test (see text for details). The quantities are in code units.

Open with DEXTER

5.5 Strong shock collapse

The strong shock collapse (Noh 1987) is another very demanding test and is generally considered a serious challenge for AMR numerical codes. We ran the test in 2-D, displacing $\sim$125 000 particles on a regular grid and retailing those with $r \leq 2$ to model a gas disk with an initially uniform density $\rho = 1$ and a negligible internal energy; we then added a uniform radial velocity towards the origin, $v_{\rm in} = -1$. A spherical shock wave with a formally infinite Mach number developped from the centre and travelled outwards, leaving a constant density region inside the shock (in 2-D, $\rho_{int}=16$). The test was run on four parallel CPUs.

In Fig. 15, the density in the x>0, y>0 region is shown at t = 0.9885, while in Fig. 16 the density-radius relation at the same time is plotted for all particles.

There is very good agreement with the theoretical expectation, although some scatter is present in the particles density within the shocked region, where the density is moreover slightly underestimated (but this is a common feature for this kind of test: see e.g. Springel 2010). The shock velocity is instead slightly overestimated, and some spurious structures form near the shock layer due to the initial regular displacement of particles. Apart from these minor flaws though, the code is able to handle the very strong shock without any particular difficulty.

\begin{figure}
\par\includegraphics[width=12cm,clip]{Figures/13514f12.eps}
\end{figure} Figure 12:

Kelvin-Helmoltz instability according to test K1. Left to right, top to bottom: density field at t=0.768, t=1.158, t=1.549 and t=1.940. All quantities are in code units.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=12cm,clip]{Figures/13514f13.eps}
\end{figure} Figure 13:

Kelvin-Helmoltz instability according to test K2. Left to right, top to bottom: density field at t=0.377, t=0.767, t=1.158and t=1.549. All quantities are in code units.

Open with DEXTER

\begin{figure}
\includegraphics[width=12cm,clip]{Figures/13514f14.eps}\par\vspac...
...[width=12cm,clip]{Figures/13514f15.eps}\hfill{5.5cm}\vspace*{7cm}
\end{figure} Figure 14:

Kelvin-Helmoltz instability according to test K2, with ( left) and without ( right) artificial thermal conductivity. Top panels: initial pressure field. Bottom panels: density fields at t=1.79. All quantities are in code units.

Open with DEXTER

5.6 Gresho vortex problem

The test for the conservation of angular momentum and vorticity, the so-called Gresho triangular vortex problem (Gresho & Chan 1990) follows the evolution of a vortex initially described in its 2-D version (Liska & Wendroff 2003) by an azimuthal velocity profile

    $\displaystyle v_{\phi}(r) =
\left\{\begin{array}{ll}
5r & {{\rm if}~0 \leq r < ...
... {{\rm if}~0.2 \leq u < 0.4,} \\
0 & {{\rm if}~r \geq 0.4,}
\end{array}\right.$ (80)

in a gas of constant density $\rho = 1$. The centrifugal force is balanced by the pressure gradient given by an appropriate pressure profile,
$\displaystyle P(r) = \left\{\begin{array}{ll}
5 + 12.5 r^2 & {{\rm if}~0 \leq r...
...0.2 \leq u < 0.4,} \\
3 + 4 \ln(2) & {{\rm if}~r \geq 0.4,}
\end{array}\right.$   (81)

so that the vortex should remain independent of time.

As noted by Springel (2010), this test seems to be a serious obstacle for SPH codes. Due to shear forces, the angular momentum tends to be transferred from the inner to the outer regions of the vortex, eventually causing the rotational motion to spread within the r>0.4 regions; these finally dissipate their energy because of the interactions with the counter-rotating regions of the periodic replicas. With the GADGET3 code, the vortex did not survive up to t=3. AMR codes generally give a better description, although under some conditions (for example, the addition of a global bulk velocity, which should leave the system unchanged due to its galileian invariance) they also show some flaws.

We tried to run the test starting from two different initial settings of particles, since as pointed out by Monaghan (2006) the initial particle setting may have some influence on the subsequent evolution of the system. Thus, in the first case we set up a regular cartesian lattice of $\sim$10 000 particles (in the periodic domain -0.5<x<0.5, -0.5<y<0.5), and the second one put the same number of particles on concentric rings, allowing for a more ordered description of the rotational features of the gas (see Fig. 17).

The results are shown in Fig. 18. We found a residual vorticity still present at $t \sim 3$, although strongly degraded and reduced in magnitude. As expected, a substantial amount of the angular momentum was passed to the outer regions of the volume under consideration. This was confirmed by comparing the initial to the final pressure fields (Fig. 19): at t=2.7 the pressure exterted by the outskirts is higher, due to the increased temperature of the regions confining with the periodic replicas. This leads to a compression of the internal region, which in turn must increase its pressure as well.

However, we could not find other direct comparisons for this test with an SPH code in the literature. It must be pointed out that the resolution in these tests is quite low, and a larger number of particles may help to improve the results.

5.7 Point explosion

The presence of the artificial conduction becomes crucial in the point explosion experiment, a classic test to check the ability of a code to follow the evolution of strong shocks in three dimensions. In this test, a spherically symmetric Sedov-Taylor blast-wave develops and must be modelled consistently with the known analytical solution.

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f16.eps}
\end{figure} Figure 15:

The Noh's problem: density field in the first quadrant at t=0.9885. All quantities are in code units. See text for details.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=7cm,height=6cm,clip]{Figures/13514f17.eps}
\end{figure} Figure 16:

The Noh's problem: density vs. radius relation for all particles at t=0.9885. Solid line: theoretical expectation. All quantities are in code units. See text for details.

Open with DEXTER
We ran the test in 3-D. Our initial setting of the SPH particles was a uniform grid in a box with the size [-0.5, 0.5] along each dimension, with a uniform density $\rho = 1$ and a negligible initial internal energy. The grid consisted of 313 particles. At t=0 an additional amount E=1 of thermal energy was given to the central particle; the system was subsequently let free to evolve self-consistently (without considering self-gravity). It must be noted that again the central additional thermal energy was not smoothed to obtain extreme conditions.

The following test runs were made (using the Lagrangian SPH scheme):

  • S1 - constant viscosity with $\alpha = 1$ viscosity, no artificial conduction;
  • S2 - variable viscosity with $\alpha$ plus artificial conduction;
  • S3 - as S2, but without the $\nabla h$ correcting terms;
  • S4 - as S2, with the individual time-stepping scheme;
  • S5 - as S2, with higher resolution (513 particles).
Figure 20 shows the xy positions of particles belonging to the z=0 plane at t=0.09 for the S1 test and the corresponding radial density profile compared to the analytical expectation. A strong noise (which develops soon after the initial explosion) is evident in the particle positions, due to the huge unresolved discontinuity in thermal energy. The description of the shock evolution is quite poor, although its gross features are still captured.

\begin{figure}
\par\includegraphics[width=8cm,height=7cm,clip]{Figures/13514f18.eps}
\end{figure} Figure 17:

Positions of all particles at t=0.02 ( top) and t=2.7( bottom) for the two different initial configurations for the Gresho test: grid ( left) and rings ( right). All quantities are in code units. See text for details.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f19.eps}
\end{figure} Figure 18:

Initial (black dots) and final (red small points) azimuthal velocity profiles for the two Gresho tests: grid ( top) and rings ( bottom). All quantities are in code units. See the text for details.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8.5cm,height=3.5cm,clip]{Figures/13514f20.eps} \vspace*{3mm}
\end{figure} Figure 19:

Initial (t=0.02, left) and final (t=2.7, right) pressure fields in the grid Gresho test. Note the increased pressure in the outskirts (white) and the central regions of the vortex. All quantities are in code units. See the text for details.

Open with DEXTER

\begin{figure}
\par {\hspace*{1cm}\includegraphics[width=6cm,height=6cm,clip]{Fi...
...}
\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f22.eps} \end{figure} Figure 20:

Top: spatial distribution of particles in a slice taken at z=0 and t=0.09 for the Sedov blast wave of test S1. Bottom: radial density profile for the same test. Points: SPH particles; solid line: analytical prediction. All quantities are in code units.

Open with DEXTER

\begin{figure}
\par {\hspace*{1cm}\includegraphics[width=6cm,height=6cm,clip]{Fi...
...
\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f24.eps}
\end{figure} Figure 21:

The same as in Fig. 20, but for test S2.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=7cm,height=5cm,clip]{Figures/13514f25.eps}
\end{figure} Figure 22:

Energy conservations for Sedov test with artificial conductivity and variable viscosity. Points: with $\nabla h$ terms; crosses: without $\nabla h$ terms. All quantities are in code units.

Open with DEXTER

\begin{figure}
\par {\hspace*{1cm}\includegraphics[width=6cm,height=6cm,clip]{Fi...
...m}
\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f27.eps}\end{figure} Figure 23:

The same as in Fig. 20, but for test S5.

Open with DEXTER

Figure 20 shows the xy positions of particles belonging to the z=0 plane at t=0.09 for the S1 test and the corresponding radial density profile compared to the analytical expectation. A strong noise (which develops soon after the initial explosion) is evident in the particle positions, due to the huge unresolved discontinuity in thermal energy. The description of the shock evolution is quite poor, although its gross features are still captured.

Figure 21 presents the same data for the S2 run, in which both the viscosity with variable $\alpha$ and artificial conduction were switched on. The increased precision in the description of the problem is immediately evident: the conductive term acts smoothing out the thermal energy budget of the central particle, strongly reducing the noise and allowing a symmetric and ordered dynamical evolution. The radial density profile (in which single particles, and not averages, are plotted) shows that the shock is well described. The density peak is a factor of $\sim$2 lower than the analytical expectation, due to the intrinsic smoothing nature of the SPH technique.

Another test (S3) was carried out dropping the $\nabla h$ correcting terms (see Sect. 3). While the differences in particle positions and density profiles are almost negligible, the comparison of the total energy conservations E(t)/E(t0) in the two cases (Fig. 22) shows that the correction helps to contain losses due to wrong determinations of the gradient.

A fourth test (S4) was also run to check the behaviour of the individual time-stepping algorithm; the results are virtually indiscernible from the those of the previous case (not shown here). This is remarkable because all particles must be ``woken up'' (with the method described in Sect. 4.2.1), as they are still and cold at the beginning of the simulation.

Finally, a test (S5) with an increased numerical resolution was performed (Fig. 23). As expected, in this case the shock boundary was sharper and closer to the peak value of the analytical solution, while the particles positions again accurately describe the evolution of the system.

5.8 Self-gravitating collapse

The collapse of a gaseous self-gravitating sphere is another standard SPH 3-D test (Evrard 1988). The combined action of hydrodynamics and self-gravity leads the system, a sphere of gas initially far from equilibrium with a negligible internal energy and density profile $\rho \propto r^{-1}$, to a collapse in which most of its kinetic energy is converted into heat. An outward moving shock develops, a slow expansion follows and later a core-halo structure develops with nearly isothermal inner regions and outer regions which cool adiabatically. To set the initial conditions, 10 000 particles with mass $1.25 \times 10^{-2}~M_{\odot}$were placed in a sphere of radius $5\times10^{-6}$ Mpc in a way that their initial density radial profile scales as 1/r. Another sphere with 40 000 particles and consequently smaller particles' masses (higher resolution) was also prepared. Two cases were examined: the collisionless collapse and the adiabatic collapse.

\begin{figure}
\par\includegraphics[width=8.5cm,height=10cm,clip]{Figures/13514f28.eps}
\end{figure} Figure 24:

Collisionless collapse with adaptive softening lengths. Top: spatial distribution of the particles projected onto the xy plane after 12 000 steps; middle: softening lengths (code units) as a function of the radial coordinate; bottom: temporal conservation of the total energies of the systems E(t)/E(t0) for the un-corrected ( left) and corrected ( right) tests.

Open with DEXTER

5.8.1 Collisionless collapse

To check the performance of the adaptive softening length algorithm, tests were run where the hydrodynamical interactions were switched off to mimic the collisionless collapse. A first case dropped the hydrodynamical interactions, included the adaptive softening algorithm, but neglected the correcting terms presented in Sect. 2.1. This provided the reference case. The second one also includes the effects of the correcting terms.

Figure 24 shows in the upper panels the spatial distribution of particles projected onto the xy plane during the collapse of the sphere (after 12 000 steps), for the un-corrected (left) and corrected (right) cases: no evident difference is present. The same holds (middle panels) for the value of the softening lengths of particles as a function of the radial coordinate. However, the temporal conservation of the total energies of the systems E(t)/E(t0) in both cases were quite different (bottom panels of Fig. 24). When the correcting terms were not included, a secular error in the energy conservation developped, which reached $2\%$, while the error was about ten times smaller (albeit not completely eliminated) with the introduction of the extra-terms.

5.8.2 Adiabatic collapse

The standard hydrodynamical tests (Evrard 1988) were calculated with the settings

  • E1 - constant softening lengths ( $\epsilon_i = 0.1 R \times (m_i / M)^{0.2}$, with R and M the total radius and mass of the sphere at the beginning of the simulation); Lagrangian SPH scheme, with constant viscosity ($\alpha = 1$) and no artificial conduction;
  • E2 - as E1, except for using adaptive softening lengths;
  • E3 - adaptive softening lengths, viscosity with variable $\alpha$, and artificial conduction;
  • E4 - as E3, higher resolution (40 000 particles).
The global energy trends are shown in Fig. 25, while Fig. 26 shows a magnification of the energy conservation E(t)/E(t0) for the E1 and E2 runs. The energy conservation was always good and reached a maximum error of $\sim$$0.4\%$ at the moment of maximum compression. For comparison, in the same test the finite differences method by Evrard (1988) ensured conservation at $\simeq$$1\%$, while Harfst et al. (2006) found a maximum error of $\sim$$3\%$ with a standard SPH implementation. Almost no difference can be noted between the variable and the constant $\epsilon $ runs, despite a variation of more than two orders of magnitude in the softening length values in the E2 run (see Fig. 27).

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f29.eps} \end{figure} Figure 25:

Energy trends in the cold collapse test. Light lines: red: test E1; black: test E2; blue: test E3. Heavy dotted blue line: test E4 (see text for details). Top to bottom: thermal, kinetic, total and potential energies. All quantities are in code units.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f30.eps}
\end{figure} Figure 26:

Magnification of the energy conservations E(t)/E(t0) in the cold collapse tests. Black: test E1; red: test E2. See text for details.

Open with DEXTER

The density and internal energy profiles at t=0.8 for the E1 to E3 runs are shown in Fig. 28; the comparison between the E3 and the hi-res E4 runs is shown in Fig. 29 (the shock is moving outward leaving an inner heated core). The discontinuity in density is smoothed out by the kernel smoothing, which in the current implementation requires a high number of neighbours ($\sim$60), but the effects of the inclusion of the artificial conductive term are evident. We did not find any particular problem with the inclusion of the conductive term in a self-gravitating system.

\begin{figure}
\par\includegraphics[width=7.5cm,height=6.5cm,clip]{Figures/13514f31.eps}
\end{figure} Figure 27:

Softening lengths in the cold collapse test T2 at t=0.8. The solid line is the value of the constant softening length in test T1. All quantities are in code units.

Open with DEXTER
\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f32.eps}
\end{figure} Figure 28:

Density ( top) and internal energy ( bottom) profiles at t=0.8 in the cold collapse E1 ( left), E2 ( centre) and E3 ( right) tests. All particles are plotted.

Open with DEXTER

We also ran an X-SPH test, adopting $\eta = 0.25$. While the energy trends are essentially identical to the ones the previous tests (not shown), the energy conservation is slightly worse, reaching an error of $\sim$$2.5\%$. Indeed, Monaghan (2002) pointed out that a more complex treatment of the equations of motion should be adopted to achieve a perfect energy conservation.

5.9 Isothermal collapse

Introduced by Boss & Bodenheimer (1979) and later revisited by Burkert & Bodenheimer (1993), the test on the isothermal collapse combines hydrodynamics and gravity, and also adds rotation. It develops in a complex game of collapse and fragmentation. We ran the test in the version proposed by Bate & Burkert (1997).

A homogeneous sphere of cold gas with an initial radius $R=5\times10^{16}$ cm and a mass $M = 1~M_{\odot}$ was modelled retailing $\sim$78 000 particles out of a uniform lattice. The sphere was put in solid body rotation around the z axis, with an angular velocity $\Omega=7.2\times 10^{-13}$ rad s-1, and the otherwise flat density field was perturbed by $10 \%$ in a way that

$\displaystyle \rho( \phi) = \rho_0 [1 + 0.1 \cos(2 \phi)],$    

where $\phi$ is the azimuthal angle about the rotation axis and $\rho_0 = 3.82 \times 10^{-18}$ g cm-3 (we achieved the density perturbation by varying the masses of particles instead of their positions). The gas is described by an isothermal equation of state, $P = c_{\rm s}^2 \rho$, with the initial sound speed $c_{\rm s} = 1.66 \times
10^4$ cm s-1. It is assumed to be optically thin so that no mechanical heating can occur, and the adiabatic index is $\gamma = 1.4$.
\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f33.eps} \vspace*{3mm}
\end{figure} Figure 29:

Comparison between cold collapse E3 (low-res, left) and E4 (hi-res, right) test: density ( up) and internal energy ( bottom) profiles at t=0.8.

Open with DEXTER

The test is very challenging and has been used to check the behaviour of many AMR and SPH codes. In particular, Bate & Burkert (1997) used it to study the effects of wrong calibrations of the smoothing and softening lengths in SPH (see Sect. 3.2). We ran the test in four different cases:

  • B1 - Lagrangian SPH with constant softening lengths ( $\epsilon \simeq 5.26 \times 10^{14}$ cm, an intentionally high value);
  • B2 - Lagrangian SPH with adaptive softening lengths (no limits imposed on $\epsilon $ and h);
  • B3 - as B2, but imposing a minimum smoothing and softening length $h_{\rm min}=\epsilon_{\rm min}=10^{14}$ cm, to avoid artificial clumping (as in Bate & Burkert 1997);
  • B4 - as B2, with the X-SPH method (adopting $\eta = 0.25$).
Figures 30 to 33 plot the temporal evolution of the density field in the z=0 plane; shown are snapshots at t=1.0, 1.15, 1.23, and 1.26, in units of the free fall time $t_{\rm ff} = 1.0774 \times 10^{12}$ s. Figure 34 plots the final density field at t = 1.29 for the four tests. These plots can be compared to those by Bate & Burkert (1997) and Springel (2005).

The high value of $\epsilon $ assumed in the B1 test clearly demonstrates how a wrong choice of the softening length can result in catastrophic errors. The evolution of the system was clearly different from the grid solution used by Bate & Burkert (1997) as a proxy of the exact solution of the problem. Because of the excessive softening, some clumps proved to be stable against collapse and a rotating structure formed, resembling a barred spiral galaxy. More realistic choices for $\epsilon $ may have given better results, but the opposite problem (artificial clumping of unresolved structures) might have arosen for too small a softening length. Indeed, the case B2, in which the adaptive algorithm was adopted (note that $\epsilon = h$), gave much better results, but disorderly clumped sub-structures formed.

Imposing a minimum $\epsilon $ (=h, case B3) mitigated the problem (note however that the evolution of the system seemed to be somewhat faster than the grid solution), yet this prescription cannot be generalised. A more physically sound solution may be the introduction of a pressure floor in unresolved regions, i.e. where the Jeans mass of the gas is not resolved by the SPH technique. This issue will be discussed in the forthcoming companion paper (Merlin et al. 2010, in preparation).

Finally, the X-SPH test B4 yielded results that were essentially undiscernible from those of case B2, apart from a slightly less disordered density field in the regions surrounding the central collapsed structure.

Figures 35 plots the temporal evolution of the maximum value of the density. This plot can be compared with Fig. 5a in Bate & Burkert (1997) and Fig. 12 in Springel (2005). The results for all tests are very similar and agree quite well with their SPH tests of a comparable resolution (with the plateau at $\rho \simeq 2
\times 10^{-15}$ g cm-3 reached at t = 1.14), except for B1, which clearly evolves faster.

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f34.eps}
\end{figure} Figure 30:

Evolution of the density field in the central region for the test B1. Plotted is the region within $1.54 \times 10^{16}$ cm from the origin, on the xy plane. Left to right, top to bottom: t=1.0, 1.15, 1.23, 1.26, in units of free fall time, $t_{\rm ff} = 1.0774 \times 10^{12}$ s.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f35.eps}
\end{figure} Figure 31:

The same as in Fig. 30, but for test B2.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f36.eps}
\end{figure} Figure 32:

The same as in Fig. 30, but for test B3.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f37.eps}
\end{figure} Figure 33:

The same as in Fig. 30, but for test B4.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f38.eps}
\end{figure} Figure 34:

Final density field at t=1.29 (in units of free fall time) in the central region. Left to right, top to bottom: tests B1, B2, B3, B4. See text for details.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=7cm,height=6.5cm,clip]{Figures/13514f39.eps}
\end{figure} Figure 35:

Maximum density in the isothermal collapse tests. B1: red dashed line; B2: green solid line; B3: blue thick dots; B4: black dot-dashed line. See text for details.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f40.eps}
\end{figure} Figure 36:

Initial (blue) and final (red) smoothing length h of all particles in the four isothermal collapse tests ( left to right, top to bottom: B1, B2, B3, B4). The softening length $\epsilon $ is equal to h in the B2, B3 and B4 runs; the black dots in the top left panel show its constant value in test B1. The abrupt truncation in the bottom left panel is due to the imposed $h_{\rm min}$(= $\epsilon _{\rm min}$) in the test B3.

Open with DEXTER

For reference, Fig. 36 shows the initial and final values of both $\epsilon $ and h (which are equal for B2, B3 and B4) as a function of $\rho$ in the four runs.

\begin{figure}
\par\includegraphics[width=8.5cm,height=3.8cm,clip]{Figures/13514f41.eps}
\end{figure} Figure 37:

Comparison between the final density fields for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of test B2. See the text for details.

Open with DEXTER
\begin{figure}
\vspace*{5mm}
\par\includegraphics[width=8.5cm,height=4cm,clip]{Figures/13514f42.eps}
\end{figure} Figure 38:

Comparison between the final h-radius relation, for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of test B2. See the text for details.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8.5cm,height=3.8cm,clip]{Figures/13514f43.eps}
\end{figure} Figure 39:

Comparison between the final density fields for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of test B2, with tree opening angle $\theta = 0.1$ (see text for details).

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8.5cm,height=4cm,clip]{Figures/13514f44.eps}
\end{figure} Figure 40:

Comparison between the final h-radius relation, for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of the B2 test, with tree opening angle $\theta = 0.1$(see text for details).

Open with DEXTER

5.9.1 Parallel run

Finally, we re-computed the B2 test with 16 parallel CPUs. Figure 37 shows the comparison between the final density field for this run and for the original one with a single CPU. Although the agreement is good and no sign of a multi-processor subdivision of the domain is present, some differences in local morphological features are present; these are more evident in Fig. 38, which shows the comparison for the smoothing lengths values. While the gross features and the minimum and maximum values are very similar, differences in the local clumping of particles are clearly present.

We ascribe this flaw to the parallel oct-tree scheme. The global tree constructed by N>1 CPUs is slightly different from the one built by a single processor on the same spatial domain: the regions in which two or more different CPUs interact are described by a different cell architecture depending on N (note that the reason for this is that the cells have always to be cubic; indeed, the problem should not occur if a binary tree, in which cells have adaptive shapes, was used). This causes a slightly different approximation of the gravitational force due to the opening cell criterion, giving in turn a slightly different dynamical evolution.

To prove the validity of this speculation, we ran the same tests again and reduced the opening angle $\theta$ to 0.1 instead of the standard 0.8. In this way, the approximation given by the adoption of the tree structure should become negligible (at the expenses of a much longer computation time). Indeed, looking at Figs. 39 and 40, we can notice an improvement in that the density fields are more similar, although still not exactly identical. An ideal run with $\theta = 0$(i.e., exact particle-particle interaction) should give almost identical distributions of particles.

We must point out that this flaw may be of non-negligible importance when dealing with phenomena that directly depend on the local density field, like the star formation and feedback processes. The same simulation run on a different number of CPUs may give slightly different results because of this issue.

\begin{figure}
\par\includegraphics[width=8cm,clip]{Figures/13514f45.eps}
\end{figure} Figure 41:

Evolution of the density field in the z=0 plane for the collision test C1. Left to right, top to bottom: t=0.05, 0.15, 0.2, 0.25, 0.3, 0.5. Superposed is the velocity field.

Open with DEXTER
\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f46.eps}
\end{figure} Figure 42:

Top: energy trends in the collision test C1; black dots: total energy, blue dot-dashed line: potential, red dashed line: kinetic, green solid line: thermal. Bottom: magnification of the total energy conservation E(t)/E(t0).

Open with DEXTER

5.10 Collision of two gas spheres

The collision between two gaseous Plummer spheres is a very crucial test for the energy conservation. The tests were run in 3-D, with adaptive softening lengths, variable $\alpha$ viscosity, and thermal conduction.

Each of the two spheres (with unit mass, unit radius, and negligible initial internal energy) were set up randomly selecting 10 000 particles in a way that their initial density radial profile resembles the Plummer profile, $\rho \propto (1+r)^{-5/2}$. Their centres are on the x axis.

In a first run (C1) we followed a head-on collision, assigning a relative velocity of 1.5 in the x direction to the spheres. In a second run (C2) we added a shear component, giving relative velocities of $\vert\Delta v_x\vert=0.15$ and $\vert\Delta v_y\vert=0.075$.

According to Hernquist (1993), early SPH simulations of the violent head-on collision of two polytropic stars did not conserve the energy within $\sim$$10 \%$. Modern formulations of SPH (see e.g. Rosswog & Price 2007) can handle the problem with much more accuracy, reducing the error to below $0.1 \%$.

Figures 41 and 43 plot the density and velocity fields at different times, on a slice taken at z=0. In our tests the energy conservation is good (see Figs. 42 and 44) with a maximum error of $\sim$$0.2 \%$ in the head-on collision, and $\sim$$1\%$ error when the shear component is added.

5.11 Two-components evolution

As a final test, we studied the evolution of a two-components fluid in order to investigate the behaviour of the adaptive smoothing and softening length algorithm in presence of more than one material. We set up two spheres of the same radius, R=103 pc, and mass, $M=4\times10^4~M_{\odot}$, using the particle distribution adopted adiabatic collapse test by Evrard for each sphere. One of the two systems was considered to be made of collisionless bodies, with negligible pressure, thus mimicking the behaviour of a Dark Matter halo; the other one was instead considered to be made of gas, with an initial temperature of 1000 K. The system was the let free to evolve under the action of self-gravity and hydrodynamical interactions in four different runs with the following settings:

  • TC1 - constant softening lengths, $\epsilon_i = 0.1 R \times (m_i / M)^{0.2}$; null initial velocities;
  • TC2 - adaptive softening lengths, null initial velocities;
  • TC3 - as TC2, with an initial solid body rotation $\Omega=2.5\times10^{-17}$ rad s-1, for both components;
  • TC4 - as TC3, but with counter-rotating initial tangential velocities (same magnitude).
While the collisionless component soon collapses under self-gravity and later reaches relaxation, the gas undergoes a phase of expansion because of its internal pressure, except in the central region, where on the contrary it reaches very high densities because of the interaction with the collapsing Dark Matter.

\begin{figure}
\par\includegraphics[width=8cm,clip]{Figures/13514f47.eps}
\end{figure} Figure 43:

Evolution of the density field in the z=0 plane for the collision test C2. Left to right, top to bottom: t=0.03, 0.38, 0.77, 1.16, 1.55, 1.94, 2.72, 3.5, 4.29. Superposed is the velocity field.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f48.eps}
\end{figure} Figure 44:

Top: energy trends in the collision test C2; black dots: total energy, blue dot-dashed line: potential, red dashed line: kinetic, green solid line: thermal. Bottom: magnification of the total energy conservation E(t)/E(t0).

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f49.eps}
\end{figure} Figure 45:

Two components test, energy conservation E(t)/E(t0)for the four runs: dashed red line, TC1; blue dot-dashed line, TC2; green dots, TC3; black solid line, TC4.

Open with DEXTER

The free expansion of a system of particles is by itself a demanding test, and a loss of total energy is a common flaw for Lagrangian codes. Furthermore, the rotation imposed in the last two runs makes the problem more complicated. In our tests, a further complication was given by the dynamical interaction within the central regions of the system, where the hydrodynamical pressure of the gas struggled against self-gravity and the (stronger) gravitational action of the collisionless component. Moreover, when the adaptive $\epsilon $ scheme was used, gas particles had to cope with a large variation of their interaction sphere, due to the presence of Dark Matter particles in the central regions, and to their absence in the outskirts, where in addition gas particles are far away from one another.

Figure 45 plots the energy trends for all the four tests. The conservation is very good in all cases, with a maximum error well below $1\%$; quite surprisingly, the worst performance is given by the constant $\epsilon $ scheme, while the corresponding test with adaptive softening performs better and stays below a $\sim$$0.5 \%$ error.

Figure 46 shows the evolution of the Dark Matter component in the test TC3, projected on the xy and on the xz planes (the TC4 run gives almost undistinguishable plots). Clear is the early formation of a disk due to the initial rotational velocity, and a subsequent expansion which leaves a dense core with a loosely disky shape. On the other hand, the gas component expands with an almost radial motion (Fig. 47), but in the central regions the interaction with the collisionless component plays an important role. Indeed, looking at Fig. 48 where a magnification of the velocity field in the central region at late times is shown for the tests TC3 and TC4, the difference between the two cases is clear: in the counter-rotation run the gas in the innermost zone has inverted its sense of motion and co-rotates with the Dark Matter, creating a complex pattern of velocities.

The conservation of angular momenta in the tests TC3 and TC4 is shown in Fig. 49. We find a maximum error of $\sim$$6\%$in the relative error for the total momentum in the counter-rotation test; here the absolute violation is small anyway because of the very low total initial momentum. In all the other cases the conservation is always very satisfactory.

\begin{figure}
\par\includegraphics[width=8.5cm,height=6cm,clip]{Figures/13514f5...
...\includegraphics[width=8.5cm,height=6cm,clip]{Figures/13514f51.eps}
\end{figure} Figure 46:

Two components test, case TC3. Dark Matter particles projected onto the xy ( top panels) and xz ( bottom panels) planes: left to right, top to bottom, t=0.5, 1.0, 1.5, 2.0, 2.5 Gyr.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8.5cm,height=5.2cm,clip]{Figures/13514f52.eps}
\end{figure} Figure 47:

Two components test, case TC3. Gas density and velocity fields in a slice taken at z=0: left to right, top to bottom, t=0.5, 1.0, 1.5, 2.0, 2.5 Gyr.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8cm,height=3.5cm,clip]{Figures/13514f53.eps}
\end{figure} Figure 48:

Two components test: comparison between the central velocity fields in the cases TC3 ( left) and TC4 ( right), in a slice taken at z=0, at t=2.5 Gyr.

Open with DEXTER

\begin{figure}
\par\includegraphics[width=8.5cm,height=8.5cm,clip]{Figures/13514f54.eps}
\end{figure} Figure 49:

Two components test, angular momenta conservations. Top panels: test TC3, bottom panels: test TC4. Shown are the total (solid lines), gas (dashed lines) and Dark Matter (dash-dotted lines) angular momenta as a function of time L(t), and conservations as a function of time L(t)/L(t0)(same meaning of the symbols). Note that in the TC3 test the gas and Dark Matter lines are superposed because they have identical angular momentum.

Open with DEXTER

6 Conclusions

We have presented the basic features of EVOL, the new release of the Padova parallel N-body code for cosmological simulations of galaxy formation and evolution. In this first paper, the standard gravitational and hydrodynamical algorithms, as well as the parallel architecture and the data structures of the code, were extensively reviewed and discussed. EVOL includes some interesting options like adaptive softening lengths with self-consistent extra-terms to avoid large errors in energy conservation, $\nabla h$ terms in the SPH formalism, variable $\alpha$ viscosity formulation, and artificial thermal conduction terms to smooth out pressure at contact discontinuities.

We also performed and presented an extended series of standard hydrodynamical tests to check the ability of the code to handle potentially difficult situations. The results are encouraging. Almost all tests gave results in nice agreement with theoretical expectations and previous calculations with similar codes, sometimes even showing better performance. In particular, we showed how the inclusion of an artificial thermal conduction term as suggested by Price (2008) significantly improves the modelling of demanding problems like the Kelvin-Helmoltz instability or the Sedov-Taylor point-like explosion. Furthermore, the adoption of a variable softening lentghs algorithm allows for a higher degree of adaptivity without resulting in appreciable losses in terms of the precision and conservation of energy. While some typical flaws of SPH codes are still present (e.g., problems in the conservation of vorticity because of spurious shear viscosity), these new features clearly improve the method and positively aid to solve well-known drawbacks of the SPH algorithm.

It must be pointed out however that the new features must be extensively tested, especially in situations of interest for cosmological simulations (i.e., gas dynamics in presence of a Dark Matter and/or stellar components). Here we have restricted our analysis to standard hydrodynamical problems. Other and new tests will be presented in the companion paper by Merlin et al. (2010, in preparation), dedicated to the inclusion in EVOL of radiative cooling, chemical evolution, star formation, energy feedback, and other non-standard algorithms.

Acknowledgements
The authors thank D.J. Price, S. Borgani, P.A. Thomas, L. Secco, S. Pasetto and G. Tormen for the useful discussions and for their help. All simulations were run using the CINECA facilities and/or the MONSTER cluster at the Department of Astronomy (Padova). The pictures have been produced using MATLAB or SPLASH by D. Price (Price 2007).

Appendix A: N-dimensional kernel

The general form for the N-dimensional spline kernel function ( $1
\leq N \leq 3$) is

    $\displaystyle W_N(r,\epsilon) = \eta_N \times
\left\{\begin{array}{ll}
4{2}{3} ...
...2-u)^3 &{{\rm if}~1 \leq u < 2,} \\
0 &{{\rm if}~u \geq 2,}
\end{array}\right.$ (A.1)

where
    $\displaystyle \eta_N = 4{1}{h^N} \times
\left\{\begin{array}{ll}
1 & {\rm if}~N...
.../ (7 \pi) & {\rm if}~N = 2, \\
3 / (2 \pi) &{\rm if}~N = 3.
\end{array}\right.$ (A.2)

Derivatives are straightforwardly obtained from this expression. The 1-D and 2-D kernels have been used where necessary in some of the hydrodynamical tests presented in Sect. 5.

Appendix B: Summary of equations of motion and conservation

Gravitational acceleration:

                              $\displaystyle 4{{\rm d} \vec{v}_{i,{\rm grav}}}{{\rm d}t}$ = $\displaystyle -\sum_j m_j \left[4{\phi_{ij}'(\epsilon_i)+\phi_{ij}'(\epsilon_j)}{2}\right]4{\vec{r}_i-\vec{r}_j}{\vert\vec{r}_i-\vec{r}_j\vert}$  
    $\displaystyle -\sum_j m_j 4{1}{2} \left[ 4{\xi_i}{\Upsilon_i} 4{\partial W_{ij}...
...{\xi_j}{\Upsilon_j} 4{\partial W_{ij}(\epsilon_i)}{\partial \vec{r}_j} \right],$ (B.1)

Hydrodynamical acceleration (for SPH particles only):
                        $\displaystyle 4{{\rm d}\vec{v}_{i,{\rm hyd}}}{{\rm d}t}$ = $\displaystyle \sum_j m_j \times \left[ 4{P_i}{\rho_i^2} \left( 1+4{\zeta_i/m_j}
{\Omega_i^*}\right) \nabla_i W_{ij}(h_i) \right.$  
    $\displaystyle +\left. 4{P_j}{\rho_j^2}
\left( 1+4{\zeta_j/m_i}{\Omega_j^*}\right) \nabla_i W_{ij}(h_j)
+ \Pi_{ij} \bar{\nabla_i W_{ij}} \right],$ (B.2)

Specific internal energy evolution (for SPH particles only):
                          $\displaystyle 4{{\rm d}u_i}{{\rm d}t}$ = $\displaystyle \sum_j m_j \left[ 4{P_i}
{\rho_i^2}\left( 1+4{\zeta_i/m_j}{\Omega_i^*}\right)
(\vec{v}_j-\vec{v}_i) \cdot \nabla_i W_{ij}(h_i) \right.$  
    $\displaystyle + \left. \left( 4{1}{2}\Pi_{ij} + \Pi_{ij}^u \right) w_{ij} \vert\bar{\nabla_i W_{ij}}\vert \right].$ (B.3)

In these expressions,
$\displaystyle \Omega_i^* = 1 - 4{\partial h_i}{\partial n_i} \sum_j 4{\partial W_{ij}(h_i)}{\partial h_i},$     (B.4)


$\displaystyle \Upsilon_i = \left[ 1 - 4{\partial \epsilon_i}{\partial n_i} \sum_j 4{\partial W_{ij}(\epsilon_i)}{\partial \epsilon_i}\right],$     (B.5)


$\displaystyle \xi_i = 4{\partial \epsilon_i}{\partial n_i} \sum_j 4{\partial \phi_{ij}(\epsilon_i)}{\partial \epsilon_i},$   (B.6)

and
$\displaystyle \zeta_i = 4{\partial h_i}{\partial n_i}\sum_j m_j 4{\partial W_{ij}(h_i)}{\partial h_i}\cdot$   (B.7)

The smoothing kernel W is given by Eq. (4), whereas the softened gravitational potential $\phi$ is given by Eq. (7).

The standard equation of state is that of an ideal gas,

$\displaystyle P = (\gamma - 1) \rho u,$ (B.8)

where $\gamma$ is the adiabatic index (5/3 for a monatomic gas); a more general equation of state will be presented in Merlin et al. (2010, in preparation).

References

Footnotes

... aspects[*]
The core of the old PD-TSPH code was written during the '90s by C. Chiosi, G. Carraro, C. Lia and C. Dalla Vecchia (Carraro et al. 1998; Lia et al. 2002). Over the years, many researchers added their contribution to the development of the code. In its original release, the PD-TSPH was a basic Tree + SPH code, written in Fortran90, conceptually similar to TREE-SPH by Hernquist & Katz (1989). Schematically, PD-TSPH used an early formulation of SPH (Benz 1990) to solve the equations of motion for the gas component, and the Barnes & Hut (1986) Tree algorithm to compute the gravitational interactions.
... considered[*]
A relativistic formulation of both gravitational and hydrodynamical interactions is possible (for a general summary see e.g. Rosswog 2009), but is generally unessential for problems of cosmological structure formation.
...)[*]
Throughout the paper, we only use the three-dimensional formulation of kernels. See Appendix A for the 1-D and 2-D forms.
... simulation[*]
Recently, Shirokov (2007) pointed out that since particles have unequal mass and hence unequal softening lengths, one should actually compute the pairwise gravitational force and potential by solving a double integral over the particle volumes. Therefore the computation of the interactions with the classic approach is likely not accurate. Given the practical difficulty in evaluating those integrals, they also provide a numerical approximation.
... by[*]
A clear advantage of using the Lagrangian to derive the equations of motion is that provided the Lagrangian is appropriately symmetrised, momentum and energy conservation are guaranteed. Note that this derivation closely matches the one described in Sect. 3 to derive the variational formulation of the SPH formalism and the so-called $\nabla h$ correcting terms.
...)[*]
Note that in principle W should be defined over the whole space, as in the first SPH calculations by Gingold & Monaghan (1977) where a Gaussian-shaped kernel was adopted. For practical purposes, anyway, its domain is made compact putting W=0 for distances greater than  $\eta \epsilon$, with $\eta>0$, from the position of the active particle.
... purposes[*]
Price & Monaghan (2007) use the mass density in place of number density to achieve the desired solutions. The formulation in terms of the number density is equivalent and can be advantageous when dealing with particles of different masses. Also note that this is a reformulation of the well-known SPH density summation, see Sect. 3.
...$\vert\vec{r}_{ij}\vert \leq 2 \times
\max(\epsilon_i, \epsilon_j)$[*]
Thus all particles, and not only SPH particles, need to find their neighbours to compute these terms (see Sect. 2.2). While the $\Omega$ term described in Sect. 3 is only needed for the SPH algorithm, and therefore only SPH particles concur to compute it (considering only SPH neighbours in turn), the $\xi$ and $\Upsilon$gravitational terms are required for any kind of gravitating particle and must be computed looping on all neighbouring particles, both SPH and not. The time lost in the neighbour-searching routine for non-gaseous particles can be at least partially balanced adopting the individual time-stepping scheme (see Sect. 4.2.1). In this case, large softening lengths in low-density regions result in larger individual time-steps for particles belonging to those regions.
...)[*]
Alternatively, it could be written as
 
$\displaystyle 4{{\rm d}\rho_i}{{\rm d}t} = \sum_j m_j (\vec{v}_j-\vec{v}_i) \nabla_i W_{ij},$   (38)

which is advantageous in case the simulated fluid has boundaries or edges, but has the disadvantage of not conserving the mass exactly.
...)[*]
Some authors (e.g. Hu & Adams 2005) proposed a different ``number density'' formulation of SPH in which $\rho_i = m_i \times n_i$, and ni is obtained via Eq. (41). While this can help to resolve sharp discontinuities and to take into account the presence of multi-phase flows, it may also lead to potentially disastrous results if mixed unequal mass particles are not intended to model density discontinuities but are instead used as mass tracers in a homogeneous field.
...Monaghan (2002)[*]
As noted by Schuessler & Schmitt (1981), the gradient of the spline kernel Eq. (4) can lead to unphysical clustering of particles. To prevent this, Monaghan (2000) introduced a small artificial repulsive pressure-like force between particles in close pairs. In EVOL a modified form of the kernel gradient is instead adopted, as suggested by Thomas & Couchman (1992):
    $\displaystyle 4{{\rm d}W}{{\rm d}\vec{r}} = -4{1}{4 \pi h^4} \times
\left\{\beg...
...2-u)^2 &{{\rm if}~1 \leq u < 2,} \\
0 &{{\rm if}~u \geq 2,}
\end{array}\right.$ (54)

with the usual meaning of the symbols. We point out that this correction, although useful to avoid pairing problems expecially when dealing with particles of different mass, implies that the kernel gradient is no longer correctly normalised (potentially violating conservations). As long as the correction is small, this effect can be considered of minor importance.
...$r_{ij} < 2 \times \max(h_i, h_j)$[*]
It would also be possible to compute the interactions by only considering neighbours within hi (or $\epsilon_i$). To do so, each particle should return its contribution to the accelerations to its neighbours. But this approach is more complicated with individual timesteps (where one has to compute inactive contributions to active particles), and in a parallel architecture. We therefore decided to adopt the fully symmetric scheme in this release of EVOL.
Copyright ESO 2010

All Figures

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f01.eps} \end{figure} Figure 1:

Determination of the initial density adopting four different SPH algorithms. Left to right, top to bottom: standard SPH, mass density summation; Lagrangian SPH, mass density summation; standard SPH, number density summation; Lagrangian SPH, number density determination. Blue dots: high mass particles; red crosses: low mass particles.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=12.5cm,clip]{Figures/13514f02.eps}
\end{figure} Figure 2:

Data structures in EVOL. Void cells are included to allow for new particles to be created and/or imported from other CPUs. Ghost structures are reallocated at each time-step.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f03.eps}
\end{figure} Figure 3:

Left to right, top to bottom: density, internal energy, x-velocity, and pressure profiles at t=0.2 for the Einfeldt test. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f04.eps}
\end{figure} Figure 4:

Left to right, top to bottom: density, internal energy, x-velocity and pressure profiles at t=0.12 for test T1 (see text for details). Red solid line: exact solution. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f05.eps}
\end{figure} Figure 5:

the same as in Fig. 4, but for test T2 (see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f06.eps}
\end{figure} Figure 6:

The same as in Fig. 4, but for test T3 (see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f07.eps}
\end{figure} Figure 7:

The same as in Fig. 4, but for test T4 (see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f08.eps}
\end{figure} Figure 8:

The same as in Fig. 4, but for test T5 (see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f09.eps}
\end{figure} Figure 9:

The same as in Fig. 4, but for test T6 (see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=12cm,height=7cm,clip]{Figures/13514f10.eps}
\end{figure} Figure 10:

Left to right, top to bottom: density profiles at t=0.010, t=0.016, t=0.026, t=0.028, t=0.030, t=0.032, t=0.034, t=0.038 for the Woodward high-resolution test (see text for details). All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=6cm,height=6cm,clip]{Figures/13514f11.eps}
\end{figure} Figure 11:

Comparison of the high-resolution (solid line) and low-resolution (dots) density profiles at t=0.038 for the Woodward test (see text for details). The quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=12cm,clip]{Figures/13514f12.eps}
\end{figure} Figure 12:

Kelvin-Helmoltz instability according to test K1. Left to right, top to bottom: density field at t=0.768, t=1.158, t=1.549 and t=1.940. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=12cm,clip]{Figures/13514f13.eps}
\end{figure} Figure 13:

Kelvin-Helmoltz instability according to test K2. Left to right, top to bottom: density field at t=0.377, t=0.767, t=1.158and t=1.549. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\includegraphics[width=12cm,clip]{Figures/13514f14.eps}\par\vspac...
...[width=12cm,clip]{Figures/13514f15.eps}\hfill{5.5cm}\vspace*{7cm}
\end{figure} Figure 14:

Kelvin-Helmoltz instability according to test K2, with ( left) and without ( right) artificial thermal conductivity. Top panels: initial pressure field. Bottom panels: density fields at t=1.79. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f16.eps}
\end{figure} Figure 15:

The Noh's problem: density field in the first quadrant at t=0.9885. All quantities are in code units. See text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=7cm,height=6cm,clip]{Figures/13514f17.eps}
\end{figure} Figure 16:

The Noh's problem: density vs. radius relation for all particles at t=0.9885. Solid line: theoretical expectation. All quantities are in code units. See text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=7cm,clip]{Figures/13514f18.eps}
\end{figure} Figure 17:

Positions of all particles at t=0.02 ( top) and t=2.7( bottom) for the two different initial configurations for the Gresho test: grid ( left) and rings ( right). All quantities are in code units. See text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f19.eps}
\end{figure} Figure 18:

Initial (black dots) and final (red small points) azimuthal velocity profiles for the two Gresho tests: grid ( top) and rings ( bottom). All quantities are in code units. See the text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=3.5cm,clip]{Figures/13514f20.eps} \vspace*{3mm}
\end{figure} Figure 19:

Initial (t=0.02, left) and final (t=2.7, right) pressure fields in the grid Gresho test. Note the increased pressure in the outskirts (white) and the central regions of the vortex. All quantities are in code units. See the text for details.

Open with DEXTER
In the text

  \begin{figure}
\par {\hspace*{1cm}\includegraphics[width=6cm,height=6cm,clip]{Fi...
...}
\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f22.eps} \end{figure} Figure 20:

Top: spatial distribution of particles in a slice taken at z=0 and t=0.09 for the Sedov blast wave of test S1. Bottom: radial density profile for the same test. Points: SPH particles; solid line: analytical prediction. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par {\hspace*{1cm}\includegraphics[width=6cm,height=6cm,clip]{Fi...
...
\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f24.eps}
\end{figure} Figure 21:

The same as in Fig. 20, but for test S2.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=7cm,height=5cm,clip]{Figures/13514f25.eps}
\end{figure} Figure 22:

Energy conservations for Sedov test with artificial conductivity and variable viscosity. Points: with $\nabla h$ terms; crosses: without $\nabla h$ terms. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par {\hspace*{1cm}\includegraphics[width=6cm,height=6cm,clip]{Fi...
...m}
\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f27.eps}\end{figure} Figure 23:

The same as in Fig. 20, but for test S5.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=10cm,clip]{Figures/13514f28.eps}
\end{figure} Figure 24:

Collisionless collapse with adaptive softening lengths. Top: spatial distribution of the particles projected onto the xy plane after 12 000 steps; middle: softening lengths (code units) as a function of the radial coordinate; bottom: temporal conservation of the total energies of the systems E(t)/E(t0) for the un-corrected ( left) and corrected ( right) tests.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f29.eps} \end{figure} Figure 25:

Energy trends in the cold collapse test. Light lines: red: test E1; black: test E2; blue: test E3. Heavy dotted blue line: test E4 (see text for details). Top to bottom: thermal, kinetic, total and potential energies. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f30.eps}
\end{figure} Figure 26:

Magnification of the energy conservations E(t)/E(t0) in the cold collapse tests. Black: test E1; red: test E2. See text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=7.5cm,height=6.5cm,clip]{Figures/13514f31.eps}
\end{figure} Figure 27:

Softening lengths in the cold collapse test T2 at t=0.8. The solid line is the value of the constant softening length in test T1. All quantities are in code units.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f32.eps}
\end{figure} Figure 28:

Density ( top) and internal energy ( bottom) profiles at t=0.8 in the cold collapse E1 ( left), E2 ( centre) and E3 ( right) tests. All particles are plotted.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f33.eps} \vspace*{3mm}
\end{figure} Figure 29:

Comparison between cold collapse E3 (low-res, left) and E4 (hi-res, right) test: density ( up) and internal energy ( bottom) profiles at t=0.8.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f34.eps}
\end{figure} Figure 30:

Evolution of the density field in the central region for the test B1. Plotted is the region within $1.54 \times 10^{16}$ cm from the origin, on the xy plane. Left to right, top to bottom: t=1.0, 1.15, 1.23, 1.26, in units of free fall time, $t_{\rm ff} = 1.0774 \times 10^{12}$ s.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f35.eps}
\end{figure} Figure 31:

The same as in Fig. 30, but for test B2.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f36.eps}
\end{figure} Figure 32:

The same as in Fig. 30, but for test B3.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f37.eps}
\end{figure} Figure 33:

The same as in Fig. 30, but for test B4.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f38.eps}
\end{figure} Figure 34:

Final density field at t=1.29 (in units of free fall time) in the central region. Left to right, top to bottom: tests B1, B2, B3, B4. See text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=7cm,height=6.5cm,clip]{Figures/13514f39.eps}
\end{figure} Figure 35:

Maximum density in the isothermal collapse tests. B1: red dashed line; B2: green solid line; B3: blue thick dots; B4: black dot-dashed line. See text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f40.eps}
\end{figure} Figure 36:

Initial (blue) and final (red) smoothing length h of all particles in the four isothermal collapse tests ( left to right, top to bottom: B1, B2, B3, B4). The softening length $\epsilon $ is equal to h in the B2, B3 and B4 runs; the black dots in the top left panel show its constant value in test B1. The abrupt truncation in the bottom left panel is due to the imposed $h_{\rm min}$(= $\epsilon _{\rm min}$) in the test B3.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=3.8cm,clip]{Figures/13514f41.eps}
\end{figure} Figure 37:

Comparison between the final density fields for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of test B2. See the text for details.

Open with DEXTER
In the text

  \begin{figure}
\vspace*{5mm}
\par\includegraphics[width=8.5cm,height=4cm,clip]{Figures/13514f42.eps}
\end{figure} Figure 38:

Comparison between the final h-radius relation, for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of test B2. See the text for details.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=3.8cm,clip]{Figures/13514f43.eps}
\end{figure} Figure 39:

Comparison between the final density fields for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of test B2, with tree opening angle $\theta = 0.1$ (see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=4cm,clip]{Figures/13514f44.eps}
\end{figure} Figure 40:

Comparison between the final h-radius relation, for a single-CPU-run ( left) and a 16-parallel-CPUs-run ( right) of the B2 test, with tree opening angle $\theta = 0.1$(see text for details).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,clip]{Figures/13514f45.eps}
\end{figure} Figure 41:

Evolution of the density field in the z=0 plane for the collision test C1. Left to right, top to bottom: t=0.05, 0.15, 0.2, 0.25, 0.3, 0.5. Superposed is the velocity field.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f46.eps}
\end{figure} Figure 42:

Top: energy trends in the collision test C1; black dots: total energy, blue dot-dashed line: potential, red dashed line: kinetic, green solid line: thermal. Bottom: magnification of the total energy conservation E(t)/E(t0).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,clip]{Figures/13514f47.eps}
\end{figure} Figure 43:

Evolution of the density field in the z=0 plane for the collision test C2. Left to right, top to bottom: t=0.03, 0.38, 0.77, 1.16, 1.55, 1.94, 2.72, 3.5, 4.29. Superposed is the velocity field.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f48.eps}
\end{figure} Figure 44:

Top: energy trends in the collision test C2; black dots: total energy, blue dot-dashed line: potential, red dashed line: kinetic, green solid line: thermal. Bottom: magnification of the total energy conservation E(t)/E(t0).

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=6cm,clip]{Figures/13514f49.eps}
\end{figure} Figure 45:

Two components test, energy conservation E(t)/E(t0)for the four runs: dashed red line, TC1; blue dot-dashed line, TC2; green dots, TC3; black solid line, TC4.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=6cm,clip]{Figures/13514f5...
...\includegraphics[width=8.5cm,height=6cm,clip]{Figures/13514f51.eps}
\end{figure} Figure 46:

Two components test, case TC3. Dark Matter particles projected onto the xy ( top panels) and xz ( bottom panels) planes: left to right, top to bottom, t=0.5, 1.0, 1.5, 2.0, 2.5 Gyr.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=5.2cm,clip]{Figures/13514f52.eps}
\end{figure} Figure 47:

Two components test, case TC3. Gas density and velocity fields in a slice taken at z=0: left to right, top to bottom, t=0.5, 1.0, 1.5, 2.0, 2.5 Gyr.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8cm,height=3.5cm,clip]{Figures/13514f53.eps}
\end{figure} Figure 48:

Two components test: comparison between the central velocity fields in the cases TC3 ( left) and TC4 ( right), in a slice taken at z=0, at t=2.5 Gyr.

Open with DEXTER
In the text

  \begin{figure}
\par\includegraphics[width=8.5cm,height=8.5cm,clip]{Figures/13514f54.eps}
\end{figure} Figure 49:

Two components test, angular momenta conservations. Top panels: test TC3, bottom panels: test TC4. Shown are the total (solid lines), gas (dashed lines) and Dark Matter (dash-dotted lines) angular momenta as a function of time L(t), and conservations as a function of time L(t)/L(t0)(same meaning of the symbols). Note that in the TC3 test the gas and Dark Matter lines are superposed because they have identical angular momentum.

Open with DEXTER
In the text


Copyright ESO 2010

Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.

Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.

Initial download of the metrics may take a while.