SpringerLink
Forum Springer Astron. Astrophys.
Forum Whats New Search Orders


Astron. Astrophys. 324, 534-548 (1997)

Previous Section Next Section Title Page Table of Contents

4. Tests

4.1. Test of the gravitational interaction; King models

For objects like galaxies, which have a tremendous number of constituent bodies, the dynamics may be described by the Boltzmann equation. A dark matter component can usually be considered collision-less in contrast to the collisional gas component, for which the Boltzmann equation can be well approximated with the hydrodynamical equations. In an N-body method discreetness effects are unavoidable, due to the finite number of particles used. A practical way to test an N-body code, is to run it on a steady state system. Conservation of energy, and linear and angular momentum, can be examined. Also important is that the effects of two-body relaxation may be investigated. For a steady state system the potential is time-independent, and thus the energies of individual particles should be conserved. Moreover, if the system is spherically symmetric, individual particle angular momenta are conserved. Due to the motions of the particles in an N-body model the potential will never be strictly time-independent, the forces not strictly central, and there will always be some relaxation. The particles energies and angular momenta will diffuse, and this effect can be measured.

[FIGURE] Fig. 1. Density profile of a King model with central potential [FORMULA]. Units are given by [FORMULA].

The most practical static models to choose for testing purposes are King models (King 1966 ), since they are of finite extent in phase space. Following Binney & Tremaine (1987 ), King models have a phase space density

[EQUATION]

where the relative energy, [FORMULA], and the relative potential, [FORMULA], are defined as

[EQUATION]

The parameter [FORMULA] is a measure of the one dimensional velocity dispersion, and [FORMULA] is a mass-normalization constant. Integrating over velocity space we get the density as a function of [FORMULA],

[EQUATION]

where [FORMULA] is the error function. [FORMULA] will satisfy the Poisson equation,

[EQUATION]

which is an ordinary differential equation for [FORMULA] and can be integrated numerically once we have suitable boundary conditions. For positive [FORMULA], which is our region of interest, we must have positive [FORMULA], thus the value of [FORMULA] is one condition. We note that the enclosed mass inside radius r can be given in terms of [FORMULA] as

[EQUATION]

Restricting ourselves to a finite central density, we see that [FORMULA] at [FORMULA] is a natural condition. Since [FORMULA] is positive and [FORMULA] is negative for [FORMULA], [FORMULA] must decrease and become zero for some radius [FORMULA] where also the density will vanish. This radius is known as the tidal radius.

King models are commonly parameterized in terms of [FORMULA], because the dispersion parameter [FORMULA] just specifies the velocity scale. The mass scale is still free, but can be specified with a change of scale, i.e., by adjusting the parameter [FORMULA]. The radial Poisson equation is solved numerically using a Runge Kutta method. The enclosed mass [FORMULA], is calculated in order to distribute the particles. Particles are initially placed on a grid in a spherical region and then the grid is stretched into the desired density profile.

In general, it can be hazardous to use grid-setups for very cool collision-less systems, but this will not be the case here since the particles are started with substantial velocities that are randomly distributed. The advantage with the grid placement, over a random placement, is that random fluctuations are minimized, and it is easier to compare the realization with the analytic potential. The system will also be closer to equilibrium.

Particles are given random velocity directions, isotropically distributed. Random velocity magnitudes are then assigned to the particles, with a distribution given by Eq. (21).

The velocity probability density is given by

[EQUATION]

where [FORMULA] is the conditional probability density and

[EQUATION]

The distribution function is then

[EQUATION]

and can may integrated in closed form.

In order to be able to compare results with the tests of Hernquist & Barnes (1990 ) and Huang et al. (1993 ) we set up a King model with central potential [FORMULA]. Units were chosen such that the gravitational constant [FORMULA], the total mass [FORMULA] and dispersion parameter [FORMULA]. This gives a total three-dimensional velocity dispersion of unity, and thus a total energy of [FORMULA]. The tidal radius is 2.18.

Four different runs were made with [FORMULA] or [FORMULA]. A softening parameter [FORMULA] was used in all runs, and they were continued to time [FORMULA], which corresponds to around 20 half-mass dynamical times. The Barnes-Hut parameter [FORMULA] was 1.0 in all runs, except run 3, where [FORMULA] was used. All runs used individual time-steps, except run 4, where a constant time step [FORMULA], was used. In order to test the relaxation effects we examined the relative changes in particle energies

[EQUATION]

between times [FORMULA] and [FORMULA], where [FORMULA] In Fig. 2, the results for run 1 is shown. In Table 1, the standard deviation S and mean value [FORMULA] are presented for the runs. Absolute deviations were also examined, but they had the same behavior as the standard deviations. The changes in energies are expected to be a random walk diffusion process because of small random accelerations, caused by the random noise in the particle forces. The diffusion is expected to behave such that

[EQUATION]

where [FORMULA] is an empirical diffusion constant. [FORMULA] was calculated with a linear least squares fit of [FORMULA] as function of [FORMULA]. The diffusion rates are slightly larger, but comparable to those of Hernquist & Barnes (1990 ).

[FIGURE] Fig. 2. The relative change in individual particle energies, as a function of the energies, Measured at times [FORMULA] and [FORMULA]. Internal units are given by [FORMULA].

[TABLE]

Table 1. Data for the various King-model runs. Relative changes in particle energies, between times [FORMULA] and [FORMULA]. Conserved quantities.


Conservation of energy, linear and angular momentum, and center of mass position was also examined. The maximum deviations during each run, are listed in Table 1. The time evolution of S is plotted in Fig. 3. The straight line implies a fairly good fit of Eq. (30). In agreement with what was found by Hernquist & Barnes (1990 ), the only parameter having a significant effect on the diffusion rate was the number of particles used.

[FIGURE] Fig. 3. The standard deviation of relative particle energies, S, as a function of the time, for run 2. The slope of the dashed line is 0.506.

Judging from the CPU time used, run 4 seems to be over two times as fast as run 1, but run 4 uses a constant time step, five times larger than the smallest time step of run 1. Run 1 conserves energy roughly a factor of four better than run 4. Three time levels are occupied for run 1, and the benefit of individual time-steps is roughly a factor of two.

4.2. The collapse test

One of the most common tests for astrophysical SPH codes is the collapse test of Evrard (1988 ). It has also been presented by Hernquist & Katz (1989 ), Steinmetz & Müller (1993 ), Nelson & Papaloizou (1994 ), and Serna et al. (1995 ). One dimensional, (spherically symmetric), finite difference solutions have been calculated by Thomas (1987 ) and Steinmetz & Müller (1993 ). We will henceforth refer to this test as the "collapse test". The reason why this test is popular is that it is simple to set up, and that it tests an "SPH + gravity" code on the aspects of adiabatic flow, shocks and gravitational collapse. The initial setup for this problem is a gas sphere, of mass M and radius R, with density profile

[EQUATION]

The gas is initially isothermal with an internal energy [FORMULA], and the velocity is zero everywhere. Other test parameters are the specific heat ratio [FORMULA], the artificial viscosity parameters [FORMULA], [FORMULA] and [FORMULA], the Barnes-Hut tolerance for the gravitational interaction [FORMULA] and a softening parameter [FORMULA]. The number of particles used was [FORMULA], and the number of neighbors in the SPH summations was [FORMULA].

We use the same kind of stretched grid set up, as in Sect.  4.1. It gives a more relaxed initial configuration than the corresponding random distribution. For this particular distribution the errors in the SPH-density are very small, as can be seen in Fig. 5.

[FIGURE] Fig. 4. Density, pressure, internal energy, velocity and Mach number, for some different times, in the "collapse test". Units are given by [FORMULA]
[FIGURE] Fig. 5. The initial [FORMULA] -density profile for the collapse test. The dotted line is a plot of the desired density, Eq. (31). The SPH density of the particles follows the desired density, except at the very center [FORMULA], and at the outer edge [FORMULA], where boundary effects are visible. Internal units are given by [FORMULA].

A good way to check for SPH sampling errors, is to perform an SPH evaluation of a constant unity field, putting [FORMULA] in Eq. (3). It is important that no edges etc., where the sampling necessarily is bad due to the neglect of surface terms are within the investigated volume. Correspondingly, the gradient of the unit field may be examined. The statistics of the SPH representations of a unit field and its gradient, for the initial configuration in Fig. 5, are presented in Table 2. Although the result for a unit field shows very little spread for this particular configuration, the result for the corresponding gradient field shows considerably more spread. However, these fluctuations are much smaller than those corresponding to a random placement setup, as shown in Table 3. To avoid boundary effects, when calculating the numbers in Table 5 and Table 3, only a selection of 1800 particles within radius 0.7 were used.


[TABLE]

Table 2. SPH sampling errors for a [FORMULA] -density profile, using a stretched grid setup.



[TABLE]

Table 3. SPH sampling errors for a [FORMULA] -density profile, using random placement.


Units in the collapse test are chosen so that [FORMULA], and the usual plots of density, pressure, internal energy, velocity and Mach number are shown in Fig. 4. The results show good agreement with what have been reported by the authors mentioned above.

With only 4000 particles the outgoing shock is not very sharp, but as noted in Steinmetz & Müller (1993 ) all global quantities are still reproduced rather well. Usually the smearing of shock fronts is rather severe in SPH, but still this affects the evolution of the shock fronts surprisingly little. Depending on the problem, one often needs some factors of 10000 particles in shock regions, to see the shocks clearly resolved. As for the King-model test, some conservation properties were examined and are listed in Table 4. The shortest (individual) time-step during the simulation was [FORMULA], and the particles occupied a span of 7 time-levels. In Fig. 6, the total thermal energy, total kinetic energy, total potential energy and total energy, are plotted. The maximum thermal energy is slightly lower, than reported by Hernquist & Katz (1989 ) and Steinmetz & Müller (1993 ). This is because of the higher number of neighbors used, here being 64, as compared to the 32 neighbors used by above mentioned authors.


[TABLE]

Table 4. Conserved quantities for the collapse test.


[FIGURE] Fig. 6. Energies plotted against time for the collapse test. From top to bottom are the curves for the thermal, kinetic, total and potential energy. Units are given by [FORMULA].

4.3. Test with strong radiative cooling

As a test including radiative cooling, and merging of particles, we have simulated the collapse of a rotating sphere, with parameters reminiscent of a proto-galaxy. This test case has been studied by Navarro & White (1993 ) and Serna et al. (1995 ).

The initial density field is spherically symmetric, with a radial density profile [FORMULA]. The sphere is started in solid body rotation with a dimensionless spin parameter [FORMULA] (J and E are the total angular momentum and total energy). The initial radius is 100 kpc, and the total mass is [FORMULA], with 10% of the mass in gas and 90% of the mass in dark matter. The gas starts at a temperature of 1000 K. The gas and the dark matter components are represented by 2000 particles each. Gravitational softening parameters were taken to be 2 and 5 kpc for the gas and dark matter, respectively.

In these simulations a significant fraction of the gas falls into unresolved clumps in the central parts of the disk. It is therefore a demanding test of the particle merging scheme.

Fig. 7 shows the evolution of the gas and dark matter distributions for a simulation without particle merging. The dark matter virializes soon after the main collapse, whereas the gas forms a thin disk. Collisional line cooling is almost completely effective in radiating away thermal energy from adiabatic compression and shock heating. Only a slight fraction of the gas is heated to temperatures above 30,000 K (see Fig. 10), and thermal pressure does not play any significant role in the evolution. Radial velocities are effectively dissipated, and most of the gas has formed a rotationally supported disk after one collapse time.

[FIGURE] Fig. 7. Collapse of a rotating sphere consisting of gas and dark matter, and with a 1/r-density profile. All numbers are given in the same units as Navarro & White (1993). (Distances are in kpc, and the time unit is 4.71 Myrs.)

The disk displays clear spiral structures after [FORMULA]. As reported by Navarro & White (1993 ), the disk is unstable and starts breaking up into small clumps towards the end of the simulation. Navarro & White found that if the gas mass fraction is reduced to 2%, thereby increasing the Toomre (1964) stability parameter, the disk is substantially stabilized. Serna et al. (1995 ) found the stability of the disk, when the gas mass fraction was 10%, to be intermediate to the 10% and 2% gas mass fraction case of Navarro & White. Our results resemble those of Serna et al. The reason that we get a more stable disk than Navarro & White, is probably due to the fact that we set the SPH smoothing so as to acquire [FORMULA] particle neighbors ([FORMULA]), whereas Navarro & White uses roughly 32 neighbors. When we reduce the number of SPH neighbors to [FORMULA], we find that the disk evolution closely matches that of Navarro & White.

In the simulation that includes our prescription for merging particles in high density regions (see Fig. 8), the number of particles decrease as more particles collapse into high density regions and merge with other particles. As can be seen from Fig. 9, the number of particles has been reduced to half the initial value at the end of the simulation.

[FIGURE] Fig. 8. Collapse of a rotating sphere consisting of gas and dark matter, and with a 1/r-density profile. All numbers are given in the same units as Navarro & White (1993 ). (Distances are in kpc, and the time unit is 4.71 Myrs.) Particles were allowed to merge during the simulation. Note that individual gas particle masses vary, and therefore that the number density of gas particles is not proportional to the gas mass density.
[FIGURE] Fig. 9. Number of gas particles, in the simulation with merging of particles, as a function of time. The number decreases as particles in high density regions merge into more massive particles.

The gas cooling rate depends on the square of the local gas density. When particles are merged the local resolution decreases, and small scale fluctuations in the density field are damped. This could potentially have significant effects on the gas cooling. This is a fundamental problem in all gas dynamical simulations of galaxy formation. The gas density field has to be assumed to be reasonably smooth on scales smaller than can be resolved in the simulation. Fig. 10 shows that the fraction of hot gas is not altered by the inclusion of particle merging.

[FIGURE] Fig. 10. The mass fraction of gas with a temperature above [FORMULA] K for the simulation, without merging (solid line), and with merging of particles (dashed line).

The rotation curves, ([FORMULA]), for the simulations are shown in Fig. 11. The mass distribution when merging is included is in excellent agreement with the more conventional run, without merging. The rotation curves are approximately flat out to the edge of the disk at [FORMULA]. The disk that forms in the run without particle merging is slightly more concentrated, with a 30% higher gas mass inside 3 kpc. Fig. 7 and 8 indicates that particle merging stabilizes the disk, and slightly suppresses the formation of substructure. This is a natural consequence of the decreasing gas mass resolution and gravitational force resolution, when particles merge.

[FIGURE] Fig. 11. Circular velocity curves, with merging of particles (solid line), and without merging of particles (dashed line).

The total CPU time for the simulation is halved when particle merging is allowed, At the end of the simulation the CPU cost per unit time has been reduced by a factor of five, and the total CPU time for the simulation is halved, when particle merging is allowed.

4.4. Formation of a galactic object

In order to test our code, and especially the particle merging scheme, on problems that are typical of those we wish to study, we simulate the collapse of a proto-galaxy that has been set up consistently with the CDM cosmological model, in a fashion similar to Katz & Gunn (1991 ). The same starting conditions were used for three different simulations, two with particle merging and one without.

The Zeldovich approximation together with a standard CDM model ([FORMULA], [FORMULA], [FORMULA], [FORMULA], [FORMULA], Bardeen et al. 1986 ) power spectrum, was used to set up a cosmological density field. The system is given an initial over-density corresponding to a 3 [FORMULA] peak in the CDM spectrum when it is convolved with a top hat filter of mass [FORMULA]. This density field was realized inside a sphere with a co-moving radius of 1.46 Mpc, using both gas and dark matter (collision-less) particles. Gas and dark matter particles had a gravitational smoothing of 2 and 5 kpc, respectively. The system is started in solid body rotation, corresponding to a dimensionless spin parameter of [FORMULA], in an attempt to roughly approximate the effects of tidal interactions. The initial gas temperature is 10,000 K, and the gas cooling rate is that of a gas in collisional ionization equilibrium and with a 0.1 solar metallicity, as given by Sutherland & Dopita (1993 ).

Three simulations were made, differing only in the number of particles used, and whether or not particles were allowed to merge. Two simulations were started with 8000 particles, half of them used to represent the gas and the other half to represent the dark matter component. The only difference between these two simulations is that one employed the previously described scheme for merging gas particles, and the other did not. The third simulation was made with ten times more gas particles, and with particle merging. The same realization of initial conditions were used in all three simulations, in order to make the final initial conditions as similar as possible.

The systems were started at z = 30, and evolved to z=0. The main collapse of the proto-galaxy occurs at [FORMULA]. At z=0 a single dominant gas object with galactic densities has formed in all the simulations. This galactic object consists of a compact core surrounded by a thin disk, Fig. 12, Fig. 13, and Fig. 14. This object is built up from a combination of continuous in-fall and the merging of smaller collapsed objects.

[FIGURE] Fig. 12. Three orthogonal views of projected gas particle positions for the simulation with 4,000 gas particles and no particle merging. Frames sizes are 136 kpc.
[FIGURE] Fig. 13. Three orthogonal views of projected gas particle positions for the simulation with 4,000 initial gas particles and particle merging. Frames sizes are 136 kpc. Note that the individual particle mass is not constant, and that the number density of particles is therefore not proportional to the mass density.
[FIGURE] Fig. 14. Three orthogonal views of projected gas particle positions for the simulation with 40,000 initial gas particles and particle merging. Frames sizes are 136 kpc. Note that the individual particle mass is not constant, and that the number density of particles is therefore not proportional to the mass density.

The mass build-up of the final objects can be seen in Fig. 15, which shows the gas mass of the most massive collapsed object as a function of redshift. Collapsed gas objects were identified using a friends-of-friends algorithm, grouping particles together that had an over-density exceeding 1000. The magnitude of the mass build-up over time is very similar in all three simulations.

[FIGURE] Fig. 15. The gas mass of the most massive collapsed object as a function of redshift, for 4000 particles no merging (solid line), 4000 particles with merging (dashed line), and 40,000 particles with merging (dotted line).

The mass fraction of gas with a temperature exceeding [FORMULA], as a function of redshift, is shown in Fig. 16. The two 8000 particle simulations differ slightly, with roughly 1% more hot gas being produced after z=1.2 in the simulation including merging. The curve for the high resolution simulation deviates clearly from the other two after z = 1. Between [FORMULA] more hot gas is produced, and after [FORMULA] more hot gas is able to cool than in the lower resolution simulations. At z=0 the mass fraction of hot gas is close to 10% for all three simulations.

[FIGURE] Fig. 16. The mass fraction of the gas that has a temperature exceeding [FORMULA] as a function of redshift, for 4000 particles no merging (solid line), 4000 particles with merging (dashed line), and 40,000 particles with merging (dotted line).

These results seem to indicate that the effects of applying the particle merging scheme are small, outside the gravitationally unresolved cores of collapsed gas objects. Furthermore, a ten-fold increase of the initial number of gas particles in a simulation produced only moderate differences, lending some tentative support for low resolution SPH simulations of galaxy formation.

Evolving a system with 4000 gas and 4000 dark matter particles initially, took 64 CPU hours on a CRAY-YMP. The same system with merging of particles required only 13 CPU hours. The high resolution system required 63 CPU hours, almost the same as the low resolution system without merging. The decrease in the CPU time required for a simulation, due to particle merging, will vary with the problem and the tolerance parameters used in the merging scheme.

Previous Section Next Section Title Page Table of Contents

© European Southern Observatory (ESO) 1997

Online publication: May 26, 1998

helpdesk.link@springer.de