Smoothed particle hydrodynamics (SPH) is an N-body integration scheme that was introduced independently by Gingold and Monaghan (1977) and Lucy (1977) in order to model complicated non-symmetric phenomena in astrophysics. For this reason, it is particularly well suited for modelling the Capture Theory. This chapter is a presentation of the existing theory, along with several new extentions that were developed during the course of this investigation2.1.
SPH has several advantages over other methods, that originate directly from its discrete particle nature. For example, in Figure 2.1 two centrally condensed spheres of gas are being modelled. The concentric circles represent contours of equally spaced constant density. Two dimensions are shown for clarity, but the following discussion is equally valid in three.
Figure 2.1(a) uses a traditional finite difference grid, whilst Figure 2.1(b) uses SPH. There are three important features to note. First, the size of a cell in the grid based method must be such that the central condensation is resolved adequately. This leads to a small cell size everywhere, even in regions near the surface of the sphere. SPH handles this contrast in density by distributing a higher concentration of particles in the central regions than at the surface. This leads directly to the second point:
In SPH, the simulated region is represented by particles which carry a certain mass2.2, thus computational run-time is not wasted following the properties of regions devoid of matter. In a simple grid based method, empty regions of space would exist in the memory of the computer, and their evolution in time would be calculated also, leading to longer simulations, or lower spatial resolution (achieved by reducing the fineness of the grid).
The final main difference is in the way the system evolves in time. If in this example the material is flowing towards the centre of each sphere, then two different concepts arise. In the grid based method the material flows through the cells, resulting in an Eulerian system, whereas in SPH the particles move, making it Lagrangian in nature. The advantage of a Lagrangian system in this example, is that as the density in the centre increases, more particles move into this region, resulting in the spatial resolution there increasing. In the grid based method, the density in the central cells of each sphere increases as the mass flows in, but the resolution in that region remains the same. Sophisticated grid based methods exist which subdivide grid cells containing more than a certain mass (Couchman, 1991; Couchman et al., 1995), thus increasing the resolution in that region, but when to divide, and perhaps subdivide again, is almost completely arbitrary. To summarize, SPH handles density gradients and voids quite naturally, and also the resolution in a system is essentially automatic.
So far, the picture built up of SPH is one of point mass particles, distributed according to the density of the material. The `Smoothed' part of SPH is now introduced, according to the desire to represent the particles as a continuum, rather than individual points in space. This is necessary, as the density, which is a continuum variable, is required in order that the hydrodynamic forces on a particle may be calculated, as shall be seen later. In Figure 2.1(a), the density at the centre of a grid cell can easily be calculated from knowing the volume of the grid cell, and the mass associated with it. The density at any point within a grid cell can then be interpolated from surrounding cells via a simple weighting function. In SPH, the procedure is not quite so straightforward, as in general a regular structure with which to associate a volume to a particular particle, is not present. However, at the heart of SPH exists an interpolating function, which is used to estimate the physical quantities and their derivatives at any point in space from disordered particles.
The purpose of the kernel is to transform the representation of a particle from a
point mass one, to a spatially spread one. More specifically, the kernel is a bell
shaped function which has a smooth and continuous first (and usually second)
derivative, and is smooth and continuous itself. A simple mathematical function which
meets these requirements is the Gaussian. This function is used to spread the mass
(and other properties) of the particles in space, and is normalised so as to conserve
the physical quantities in the system. This results in Equation 2.1:
![]() |
Figure 2.2 shows three lines of equally spaced particles, all with
the same unit mass and spacing. The theoretical corresponding continuum density
profile for this distribution is a flat line of
. The density profiles shown
are sampled from the particles using Equation 2.2.
Each particle in Figure 2.2(a) has a relatively small smoothing length associated with it, and thus the resulting density profile is significantly non-uniform. The other extreme, each particle having a relatively large smoothing length, is shown in Figure 2.2(c). In this figure, each particle has been smoothed over a large distance, resulting in an effective decrease in the spatial resolution present. If the resolution was actually required to be lowered, then in terms of computational expense, a fewer number of particles with a greater mass and interparticle distance, should have been employed to sample the region, and a smoothing length giving a density profile similar to Figure 2.2(b) should have been used. The above argument for the size of the smoothing length also applies to the force calculation, introduced in Section 2.4, i.e. the forces on a particle are undersampled in Figure 2.2(a), and oversampled in Figure 2.2(c).
Although the Gaussian kernel is simple, and interpolates with high accuracy, it has
the practical disadvantage that it is not finite in extent. Thus all particles in a
system contribute to the summation in Equation 2.2, even the ones that
are at such a distance that their contribution is effectively zero. Usually when this
kernel is utilised, the contribution is assumed to be zero when the distance from the
particle is greater than
. Nevertheless, a lot of particles still have to
contribute to the calculation for the sampling to be adequate, which leads to an
increased computational effort. To overcome this problem, many authors use a kernel
which is more spatially compact, and finite in extent. A popular one, which is used in
this work, is the spherically symmetric
spline kernel proposed by
Monaghan and Lattanzio (1985):
To compare the two smoothing kernels they are equated at the origin, so that
can be expressed in terms of
(or visa versa), and renormalised for
convenience. In three dimensions this requires that:
![]() |
(2.4) |
| (2.5) |
A more common procedure for specifying the smoothing length, is to require that the
kernel contains a constant number of particles, i.e.
is specified such that the
kernel just overlaps onto the
neighbour2.3, the distance
to this particle being
for the
spline kernel. Typical values for
in one, two, and three dimensions are
,
, and
respectively. Most
implementations that use this method are quite relaxed about including exactly
neighbours, claiming that to do so would require too much computational run-time. In
these cases, the number of neighbours of a particle typically varies between
and
during a simulation.
However, when a constant number of neighbours is not maintained, an additional time
dependence is introduced into the equations of motion: Consider for the moment, forces
that are a function of position and smoothing length only2.4. If a simulation has exactly the same distribution of particles at
a time
as it had at an earlier time
, then in theory the forces between
the particles should also be exactly the same. In a simulation where the kernel
extends out to the
neighbour at all times, this will be the case.
However, when this criteria is not met, the smoothing lengths at times
and
will in general differ, resulting in different interparticle forces also.
Oscillatory motion is an example where the effects of this can be demonstrated. Here
an effective lag on the size of the smoothing length, can produce either erroneous
damping, or exponential growth in the velocity, depending on the exact implementation
of the smoothing length update. When using Equation 2.6 to update the
smoothing lengths, lag, and consequent damping of the velocity field can occur if
insufficient iterations are performed.
The extent of this effect has not been investigated, and perhaps is negligible in most
SPH simulations. Nevertheless it is present, and to avoid complicating analysis, an
efficient method of finding the
neighbour of a particle was developed:
The combined forces act on the matter of the system, and if not in balance cause it to
accelerate according to Newton's second law of motion:
| (2.7) |
The hydrodynamical component of the acceleration is easily derived by considering Figure 2.5.
In this figure, a small box of mass belonging to particle| (2.9) |
| (2.10) |
| (2.12) |
![]() |
(2.13) |
How to calculate the density at a point has already been discussed in Section
2.2, both for SPH and grid based methods, but
nothing has been said so far about how to calculate derivatives. In a grid based
method, the acceleration of the material in a grid cell could be calculated by
simply applying the approximation of Equation 2.11, where
and
would be the pressure from neighbouring grid cells of cell
. In this grid
based approximation to the pressure gradient, more accuracy and stability is obtained
by considering the pressure of the grid cell, along with grid cells further out along
a given axis, to form an equation of the pressure field about the cell, along that
axis. This approach results in a more smoothly varying pressure field than the simple
two neighbour approximation. A very similar method to estimating the pressure
gradient at particle
is used in SPH, i.e. a weighted average of the estimated
pressure gradient from particle
's neighbours is used.
In SPH, the standard equation for estimating a physical quantity
, at position
, is given by:
![]() |
(2.14) |
Although Equation 2.15 can be used as it stands, higher accuracy is
obtained by rewriting the gradient of
to include the density, usually as
or
, and applying Equation
2.15 to the result. This requires that:
The simplest form is used in this work,
, due to
there being no discernible advantage of any one method over another. The smoothing
length average also applies to the density calculation, Equation 2.2, to
avoid a violation of the reciprocity principle (Serna et al., 1996; Evrard, 1988).
Artificial viscosity is included as a means of dissipating macro-scale translational energy in the system, into micro-scale energy of the molecules. In most astrophysical problems, the molecular viscosity of the gas is very small, such that the dissipation should ideally only occur in shocks. For example, without some form of energy dissipation, supersonic colliding streams of gas would penetrate each other quite readily, as the pressure present would never be sufficient to prevent this from happening, Figure 2.6(a).
![]() |
Many different forms of the artificial viscosity have emerged recently, each one being
more suited to a particular type of problem (Watkins et al., 1996; Navarro and Steinmetz, 1997; Selhammar, 1997).
It is likely that in the future one of these methods will become the standard
prescription, but at present however, the standard equations of Monaghan and Gingold (1983)
given below, are used here and by most workers in the field. This form of the
artificial viscosity was designed with shocks in mind, and hence many of the terms are
related to the shock phenomena.
![]() |
(2.22) |
The constant viscosity parameters,
and
, are of order unity, and
control the strength of the viscosity. The term involving
is linear in
, and is associated with the effective bulk and shear viscosity of the gas.
The quadratic term is necessary where strong shocks are present to prevent
interparticle penetration, and can be left out otherwise. In a typical simulation,
and
, although values a factor of five or so larger are
often used to produce bodies in static equilibrium, on timescales much shorter than
would have occurred otherwise.
Equation 2.21, is readily combined with Equation 2.20, to produce
the total hydrodynamical acceleration at particle
:
A distribution of point masses contributes to the gravitational acceleration at
a point
by:
One method which is sometimes used to overcome this problem is gravitational
softening via a Plummer law:
The method can be explained by considering a particle pair, and how the force between the pair is modified. In the SPH representation, there are three simple ways of visualising how the gravitational force acts between the pair: Particle-Particle interaction, Sphere-Sphere interaction, and Particle-Sphere interaction. The first, both particles thought of as point masses, has already been discussed, and found to be problematic in the absence of artificial softening. The second, both particles viewed as spread out distributions of matter, is perhaps the most realistic, but it is also the most difficult to implement.
If the kernels associated with each sphere are overlapping, then the force given by
Equation 2.27 is attenuated by an amount that depends on the degree of
overlap. An example of this scenario is shown in Figure 2.7. The
force between the spheres, which is subsequently applied to the particles, is still
directed along the line joining the particles, but is reduced by an amount that
depends on
,
, and
. It is very difficult to find an analytical
solution to this problem, due to the
spline kernel being defined in three
regions. However, a numerical solution was found, and reduced to a two dimensional
lookup table. The procedure for doing this is not given here, as it was concluded that
the final method given next, gave very similar results in typical experimental
conditions, and was by far the simpler of the two.
When considering the acceleration on a point mass
, due to a spherically symmetric
distribution of matter
, only the enclosed mass of
, contained in a concentric
sphere of radius
, need be considered. An example of this is shown in Figure
2.8, where the shaded region denotes the enclosed mass of sphere
,
with respect to particle
.
| (2.28) |
![]() |
(2.29) |
![]() |
(2.31) |
In this work, the
in the above equations related to gravity is in general the same
as in the hydrodynamical calculations. Some implementations of SPH prefer to set a
lower limit on the gravitational smoothing length, or keep it constant in time, but
not necessarily space. Setting a minimum value of
is similar to setting a maximum
value of the density and, indirectly, a minimum value for the time-step. This has
advantages in simulations where material is flowing into a region of space, and it is
the nature of the flow that is important, and not the resulting high density region.
The reason for avoiding high density regions in this example, is because the
simulation would grind to a halt due to small time-steps being required to model the
high density region correctly. Another reason for keeping the gravitational smoothing
length constant in time, is that it does not introduce complications when considering
the energy of the system, as discussed in Section 2.10.
When using the hydrodynamic acceleration derived earlier, Equation 2.20, in
addition to a numerical value for the density of the gas, a numerical value for the
pressure must also be available. This is achieved via the equation of state. Three
different forms of equation of state are used in this thesis. The first is derived
from the ideal gas law, and is expressed as:
These first two equations both assume that the ratio of specific heats,
, is
unchanging throughout the calculation. The third equation has no such restriction, as
the temperature appears explicitly in the equation of state:
The temperature of a gas is related to the translational component of the kinetic
energy of its constituent molecules. At very low temperatures
, only
translational degrees of freedom are present, resulting in all the internal energy of
the gas being associated with the thermal component. The ratio of specific heats is
related to the number of degrees of freedom,
by:
The standard SPH formalism provides for the specific internal energy of the gas to be
followed in time, via a
term, as shall be seen in Section 2.10.
A means of expressing the temperature and mean molecular weight of the gas, as a
function of its specific internal energy is therefore required.
Experimental results are available for the specific heat capacity as a function of
temperature at constant pressure for many gases. The source used here is a compilation
of numerous published works, weighted by how reliable they were judged to be
(Touloukian and Ho, 1970). Two sets of values are available: The first for a pressure of one
atmosphere, and the second for an interpolated estimate of zero pressure. The latter
is the appropriate one to use in these simulations, however for hydrogen both sets of
results are within
of each other. Two sets of data were supplied, because in
general for other materials the correlation between
and
is
not so close.
The specific heat capacity of molecular hydrogen at zero pressure is given by:
| (2.42) |
![]() |
For simplicity in this work, above
all of the hydrogen is assumed to have
dissociated, resulting in a specific heat capacity twice that at
. This is because
the number of degrees of freedom has reduced back to three, and there are now twice as
many bodies per kilogram. The degree of dissociation is actually pressure dependent:
At a pressure of one atmosphere,
dissociation has occurred by
, and
total dissociation by
; for a tenth of an atmosphere, the corresponding
temperatures are
and
(Schofield, 1979). These values tend towards
for zero pressure, and is the reason for using that temperature as a
simplified cross over point in this work. The pressure present in hydrostatic gas
bodies with constant central temperature scales as
. A Jupiter mass
protoplanet in quasi-static collapse, with a central temperature of
, has a
central pressure of around a tenth of an atmosphere. This cross over approximation
should therefore be applied with caution when studying the evolution of small mass
bodies beyond
. However, for larger mass protoplanets, and for protostars, it
is a reasonably valid assumption. The specific heat capacity as a function of
temperature is shown in Figure 2.9.
The specific internal energy as a function of temperature, can be found by integrating
the heat capacity equations with respect to temperature in the appropriate ranges.
For example, the specific internal energy of the hydrogen-helium mix at
is
given by the area under the curve between
and
in Figure
2.9(c). The specific heat capacity at constant volume is used in this
calculation, due to the energy of expansion already being accounted for in the SPH
energy equations:
| (2.43) |
In the above integration, the energy of dissociation of a hydrogen molecule,
, must be included. For the given mix of gases, and current dissociation
approximation, this corresponds to a sink of energy at
equivalent to
. Whilst the molecules are absorbing this energy, the mean molecular
weight gradually reduces in value. This is included in a linear fashion, i.e. when
has been supplied to a kilogram of gas, half of the hydrogen molecules present
in that kilogram are assumed to have dissociated. The mean molecular weight and
temperature can be expressed as a function of specific internal energy by solving the
resulting equations numerically, Figure 2.10.
One advantage of this method, is that other sources of latent heat can be included in
the same manner as the energy of dissociation. In fact the latent heat of evaporation
of icy grains was included at low temperatures, but found to have negligible effect,
and was omitted in this presentation for clarity2.7. The dependences of
and
on
, are stored in one
dimensional look up tables for use during a simulation.
Some implementations of SPH use variations on the polytropic equation of state,
Equation 2.36, to simulate both the dissociation of hydrogen, and the
varying opacity of the material (Bate, 1998; Bonnell, 1994). Normally a piece-wise
polytropic equation of state, divided according to density is used. Each density
regime has an effective value of
that controls the behaviour of the gas in
that regime, e.g.
results in the gas being isothermal, and is appropriate
at low densities. At high densities, the gas is diatomic and opaque, and
is used. At higher densities still, a value of
accounts for the
energy required to dissociate hydrogen molecules. Once the dissociation is complete,
the last density range corresponds to an opaque atomic gas, where
is
appropriate.
Procedures like this are required in simulations that contain both optically thin and optically thick regions of space. This is due to the standard SPH equations lacking a satisfactory radiative energy transfer scheme. More is said on this in Section 3.2, where a new general radiative energy transfer scheme is presented.
So far, only the forces acting on the particles have been examined. How these forces affect the properties of the particles is the subject of this section and the next. In this section, the differential equations that govern how the properties of the particles evolve in time are derived. Also derived are the global energy equations that keep track of the different forms of energy in the system, and can be used to give an indication of how accurately the integration is performing. The method for integrating the particle properties in time is explained in Section 2.11.
In this implementation of SPH, there are three intrinsic properties of the particles
that must be followed in time: Position, velocity and the internal energy of the
particles if a non polytropic equation of state is used. Differential equations for
updating the velocity have already been derived from the forces, Equation
2.8. The change in position with time is equivalent to the velocity, thus:
| (2.44) |
![]() |
(2.48) |
| (2.51) |
![]() |
(2.52) |
![]() |
(2.54) |
![]() |
(2.55) |
Given that the mass of the particles are spread out by the
spline kernel, and
that the gravitational force is applied using this assumption, then the
gravitational energy due to the separation of the particles is given by:
The extra terms that are introduced, coined the
terms, describe how the
force between a pair of particles varies with
. In theory,
terms
should also be included in the hydrodynamic force and energy equations.
Nelson and Papaloizou (1994) have investigated the inclusion of the hydrodynamic
's, and
concluded that they are correction terms to the standard equations, and that omitting
them results in non conservation of energy at the
level over the course of a
typical simulation2.9.
Even though the
terms have not been included in this work, the total
measured energy of the system remains constant in the absence of gravitational forces.
This is due to the internal energy being updated consistently from the hydrodynamic
force. The gravitational energy calculated from Equation 2.56 is only
consistent with the gravitational force equation when the smoothing lengths are kept
constant in time. If the total energy is required to remain constant in the presence of gravitational
forces, as a check on the performance of the integration say, then a similar approach
to updating the internal energy can be adopted for updating the gravitational energy.
Initially the gravitational energy of the system is calculated using Equation
2.56. It is then subsequently integrated forward in time via the differential
equation:
![]() |