SMOOTHED PARTICLE HYDRODYNAMICS J.J. MONAGHAN Department of Mathematics, Monash University, Clayton, Victoria 3168, Australia In this review of SPH we describe advances made in the last few years. SPH is now seen as one of the simplest of the meshless numerical methods. Despite its simplicity it is a proven, robust tool for investigating uid dynamics with or without gravity. One of the desirable features of SPH is that the resolution can vary with both space and time. This has now been extended to include variation with direction. The dissipation terms have been improved and their relation to Riemann solutions claried. For relativistic blast waves and similar problems SPH gives results comparable to the best Riemann and FCT methods. New applications include impact and fragmentation, dusty gases, and nearly incompressible uids. A wide range of problems in planetesimal formation and collision, engineering and geophysics can now be studied using SPH. Abstract. 1. Introduction SPH is a Lagrangian particle method which has now been used for many problems in astrophysics. Its main attraction is its simplicity, the ease with which complicated physics can be introduced, and the fact that it is very forgiving. In this review I will report on some of the improvements in the formulation of SPH, on new applications and make some comments about the use of new hardware such as GRAPE and BEOWULF congurations. The improvements in formulation come from simulations of relativistic gas dynamics (Chow and Monaghan 1997) where Riemann solvers have led the way, and from work on the automatic adjustment of the resolution (Shapiro et al. 1996). The new applications range from the ground breaking work of Benz and Asphaug (1994) on fracture and fragmentation, and to dusty gas dynamics (Monaghan 1997a). There has also been a great deal of in- 358 J.J. MONAGHAN teresting work on problems in engineering and geology which, while not directly applicable to astrophysics, may suggest solutions to astrophysical problems. I have noticed that many of the people that use SPH are often intimidated by the wonderful results achieved by nely tuned FCT and Riemann solvers applied to simple gas dynamics. I thought I might start this review by commenting on some of the problems with these nite dierence methods. It is already clear that SPH has an obvious advantage in the ease with which resolution in space and time can be introduced. A further consideration is that some Riemann methods can fail. For example linear Riemann solvers fail where large regions of low density are suddenly created, as in the Sjorgreen test (Einfeldt et al. 1991). When a shock moves slowly through the nite dierence mesh (Roberts 1990) signicant down stream noise can be generated. Colella and Woodward (1984) spend one third of their paper discussing an articial viscosity to get rid of this problem. Exact, or good, non-linear Riemann solvers do not have these problems, but you then need to solve the Riemann problem and, in physically complicated problems, this is a substantial undertaking. No Riemann solutions have yet been obtained for the important class of problems where chemical reactions occur and more than one phase exists. Other defects of Riemann methods are discussed by Quirk (1994) in a fascinating paper. 2. 2.1. Advances in Formulation DISSIPATION, SHOCKS AND RELATIVITY The standard form of viscous dissipation in SPH was constructed by analogy with the dissipation in gases and then a quadratic term was included to prevent interpenetration of gas streams colliding with high relative velocity. While this works satisfactorily it gives no clue as to how a dissipation term should be constructed for relativistic gas dynamics. The solution of this problem was indirectly due to the Riemann solver nite dierence solution simulation of relativistic gas dynamics by Marti and Muller (1996). It is simpler to talk about the non-relativistic case. The Riemann solver formulation involves a dissipative term associated with eigenvalues and jumps in the momentum, energy and density across a cell boundary. The natural way to mimic these terms is to replace the eigenvalue by a signal velocity vsig and the jumps in a variable by the dierence of the variable between the two SPH particles being considered (Monaghan 1997a). Rather than use the thermal energy equation an equation for the energy/unit mass (kinetic and thermal energy) was used. In non-relativistic calculations there is an advantage in using the thermal energy equation because if the kinetic energy dominates small errors in the velocity can have severe eects on SMOOTHED PARTICLE HYDRODYNAMICS 359 Figure 1. Velocity against distance for the non-relativistic blast wave using the new dissipation and the momentum and energy equations. Initial particle spacing is 0.001. the thermal energy. However, if you wish to simulate relativistic gases, the natural variables are the momentum and energy. Following the Riemann ideas the acceleration equation takes the form X dva = 0 mb dt b Pa Pb + 2 2a b 0 ! Kvsig (a; b) vab 1 j ab raWab ; (2.1) Where the non-standard SPH quantities are K a constant 1, vsig is a signal velocity replacing the Riemann eigenvalues, and j is a unit vector from b to a. The signal velocity is the velocity (measured in the computing frame) with which sound waves from a and b approach each other. In the simplest approximation this is vsig (a; b) = ca + cb 0 vab 1 j: (2.2) If you now look at the viscous dissipation you will see that we have automatically included the quadratic term which was obtained previously by an argument about stopping interpenetration using a kinetic pressure term. By combining these equations with the continuity equation very good results have been achieved for the blast wave, Roberts and Sjogreen problems (Monaghan 1997a). The only example we show here is the one dimensional blast wave problems with zero initial velocity, initial pressure to the left of the interface 1000 and on the right 0.01, density 1.0 and = 1:4. Typical results are shown in Figures 1 and 2. While the results for the non-relativistic problem are similar to those with standard SPH dissipation terms the new formulation comes into its own for the relativistic case. We will not give the details but conne ourselves to one example, the relativistic blast wave. We assume the gas is composed of one type of baryon with rest mass m0 , the energy per unit 360 J.J. MONAGHAN Figure 2. Figure 3. Density against distance for the non-relativistic blast wave. Baryon number density for the relativistic blast wave. Particle spacing 0:001. mass is scaled with c2 , and the velocity with c. The initial conditions are P = 1000 to the left and P = 0:01 to the right with baryon number density N = 1 everywhere. These are the same scaled values as for the nonrelativistic problem. The simulation uses a resolution varying in space. The results for the baryon number density is shown in Figure 3. These results are comparable in accuracy those obtained with the best Riemann solvers, LCPFCT, and RHHLE and substantially better than those obtained using SHASTA. 2.2. ADAPTIVE RESOLUTION SPH with h varying in space and time has been used for some time. However, it would clearly be desirable to have a dierent resolution in some directions than in others e.g. when there is a shock along one of the axes. Signicant advances in achieving this goal have been made by Shapiro et SMOOTHED PARTICLE HYDRODYNAMICS 361 Figure 4. ASPH calculation of a one dimensional Zeldovich Pancake on the left, and a standard SPH calculation on the right. al. (1996) and Owen et al. (1998) and incorporated in an ASPH code. The basic idea is to work with ellipsoidal kernels where the principal axes of the ellipsoid are orientated according to the motion of neighbouring particles. In the case of the spherically symmetric kernel, with single smoothing length h, it is common to determine h from the equation 1 r 1 v d 1 = ; (2.3) dt h h d where d is the number of dimensions where I have used an equation for 1=h rather than for h. The r 1 v takes into account the average eect of the relative motion of the particles. In ASPH a matrix G replaces h. G has eigenvalues 1=hk where hk , with k = 1; 2; 3 are the smoothing lengths along the principal axis of an ellipsoid. 362 J.J. MONAGHAN In test calculations involving shock tubes, blast waves, Zeldovich pancakes and rotating disks the ASPH code works extremely well. In these problems it is much more ecient than a standard SPH code. In Figure 4 a Zeldovich-pancake simulation. The gure (and those that follow are taken from Owen et al. 1998) shows the ellipsoidal contours of the ASPH simulation adjusting to the compression along the vertical axis. Because the gradient of an ellipsoidal kernel is not along the line joining the particles the angular momentum is not conserved exactly. In problems involving disks the loss of conservation of total angular momentum is small (3 percent over the time for one rotation period of the outer layers and several rotation periods of the core). However if the material changes density rapidly the velocity gradients are not calculated accurately and G has very large errors. 3. 3.1. New Applications IMPACT AND FRAGMENTATION When planetesimals collide they may fragment. The same physics occurs in rotating ore mixers and grinders. It is straightforward to include strength into the SPH formulation of a perfectly elastic solid and that has been done by a number of researchers (see for example Libersky and Petschek 1991). This only requires including terms which enable the rate of change of the elastic stress to be calculated in terms of the strain tensor. The uid stress tensor is given by ij = 0P ij + sij ; (3.4) where P is the pressure and sij is the traceless deviatoric stress tensor. In the Hookian approximation dsij 1 = 2(_ij 0 ij _ ) + rotation terms (3.5) dt 3 where is the shear modulus and the strain tensor is dened by _ij = @vi =@xj + @vj =@xi : (3.6) Benz and Asphaug (1994) begin with the elastic model and use a quantitative model of fracture damage due to Grady and Kipp (1980). The formulation depends on a damage factor D which enters the denition of the stress tensor in the form ij = 0P 3 ij + (1 0 D )sij (3.7) where P 3 = P if P > 0 and P 3 = (1 0 D)P if P < 0. The damage factor changes with time according to the local strain. Because the damage is a lagrangian quantity it is ideally suited to an SPH simulation. SMOOTHED PARTICLE HYDRODYNAMICS 363 Figure 5. Density (vertical axis) at the SPH gas and dust particles for a layer of dust falling through air plotted against vertical distance x (horizontal axis). Upper symbols show the dust layer, lower symbols the gas atmosphere. In agreement with theory there is a slight change in the slope of the air density due to the dust layer falling through it. Further details in (Monaghan 1997b). In their ground breaking paper Benz and Asphaug (1994) rst showed that SPH gives good results for the ideal elastic material and for crack propagation When applied to the fragmentation case, SPH gives the best results ever achieved for these problems (see also Asphaug et al. 1998). 3.2. CLUMPING AND THE TENSILE INSTABILITY In impact problems involving solids, the pressure can become negative. This is the physical eect of the forces between the atoms. When the solid is pulled (tensile stress) the atoms move further apart and the elastic contribution to the pressure becomes negative. When this happens the standard forms of the pressure gradient terms in SPH become negative and the particles tend to clump (Swegle et al. 1995). This was already seen in early MHD calculations (Phillips and Monaghan 1985). The clumping produces errors in the estimates of the fragments in an impact problem so it would be better to remove the problem. It also means that particles forced by some means to be within a distance r satisfying r=h < 1=3 in an ideal gas will tend to clump. There has been no entirely satisfactory solution to this problem for the fragmentation of solids (but see Libersky and Randles (1996) who use dissipation and Thomas and Couchman (1992) who truncate the gradient of the kernel so that for r=h < 1=3 the gradient of the kernel has the same value as at r=h = 1=3. The same problem in MHD simulations can be evaded by working with 364 J.J. MONAGHAN the J 2 B force although momentum is not then conserved exactly. It would be clearly be useful to be able to solve this tensile instability for both the MHD and the impact problems. 3.3. DUSTY GAS Once heavy elements have been made and dust can form we need to take into account the eect of dust on the gas. In the early and middle stages of star formation the eect of dust is primarily through the radiation attempting to drive the dust from the system. The drag between the dust and the gas allows the force to be transferred to the gas. In many astrophysical problems the drag is enormous so it is natural to use implicit methods. Implicit methods have been tried with SPH for gas ow but they are cumbersome and so inecient they are not worth using. Because the drag involves pair interactions it turns out that by working with each pair a very ecient implicit scheme can be worked out (Monaghan 1997b). This technique has been tested for two basic problems (Monaghan 1997b, all in one dimension) wave propagation and dust layers falling under gravity through air. In Figure 6 we show the density of the dust and gas particles in a one dimensional simulation of a layer of dust falling through gas in hydrostatic equilibrium under gravity. The SPH simulation accurately predicts the slight change in gas density gradient within the moving dust layer, and the motion of the dust layer. 3.4. RADIATIVE TRANSFER AND CONDUCTION Radiative transfer in the conduction form involves second derivative terms which require some care in an SPH formulation. The appropriate formulation has been known for some time. What isn't so well known is how to handle the case where there is a rapid jump in the eective thermal conductivity. The answer is surprisingly simple. When the thermal conductivities changes discontinuously the ux of heat must still be continuous. By taking this into account the appropriate change is to replace the sum of the thermal conductivities according to a + b by 4a b a + b (3.8) Amazingly this gives excellent results even when the thermal conductivity jumps by a factor 1000 from one particle to the next. An extensive series of calculations have been made by Cleary and Monaghan (1998). SMOOTHED PARTICLE HYDRODYNAMICS 3.5. 365 ACCRETION, STAR FORMATION AND DISKS Standard SPH, combined perhaps with some of the improvements discussed earlier, can be used to study the formation of stars. When a fragment in a cloud begins to collapse the density and scale eventually requires such small time steps that the calculation is paralysed. Bate et. al (1995) have worked out a way to continue the calculation by replacing the dense region by a single particle with appropriate boundary conditions. This allows the evolution of the cloud to be followed as binary and other n-body systems form. SPH continues to be used as a tool to study the dynamics of disks. The work of Artymowicz and Lubow (1994), Murray (1997) and Nelson et al. (1998) are examples of the widespread application of SPH to these problems. 4. New Hardware The GRAPE board was developed in Tokyo (Sugimoto et al. 1990) originally to calculate the gravitational forces on a set of particles by direct summation. Its advantage is cheapness (a board plus a work station). The summation was extended to work with a tree code (Makino and Funato 1993). They then extended to calculate SPH terms. Steinmetz (1996) has given a detailed analysis of version of GRAPE for cosmological SPH simulations (GRAPESPH). He shows that (given the technology of 3 years ago) it is possible to emulate results previously achieved by super computers. The situation is now more dicult to assess because the technology is changing so rapidly. For example the introduction of cheap BEOWULF congurations (http://qso.lanl.gov/msw). 5. Summary While there have been many applications of standard forms of SPH over the last few years there have been generalizations which increase the efciency and extensions to deal with more complex problems. There has been a big interest in SPH by computational engineers and computational geophysicists because of the ease with which SPH can be applied to complicated geometry and complicated ow problems. Further developments can be expected in these areas as well as in astrophysical problems associated with relativistic ows, mixtures of solid particles and gas, radiative transfer and MHD problems. As always, new computers, in this case probably the BEOWULF congurations, will be a major resource. 366 J.J. MONAGHAN References Artymowicz, P., and Lubow, S.H., Ap.J. 421 (1994), 651. Asphaug, E., Ostro, S.J., Hudson, R.S., Scheeres, D.J. and Benz, W., Nature, 393 (1998), 437. Bate, M.R., Bonnell, I.A., and Price, N.M., Mon. Not. Roy. Astr. Soc. 277 (1995), 362. Benz, W., and Asphaug, E., Icarus 107 (1994), 98. Chow, E., and Monaghan, J.J., J. Computat. Phys. 134 (1997), 296. Cleary, P., and Monaghan, J.J., J. Computat. Phys. (to appear 1998). Colella, P., and Woodward. P., J. Computat. Phys., 54 (1984), 174. Einfeldt, B., Munz, C.D., Roe, P.L., and Sj orgreen, B.J. J. Computat. Phys., 92 (1991), 273. Grady, D.E., and Kipp, M.E. Int. J. Rock. Mech. Sci. Geomech. Abst., 17 (1980), 147. Libersky, L.D., and Petscheck, A.G., Advances in the Free-Lagrange method (Trease and Cowley, eds), Springer Verlag, 1991 pp. 248. Makino, J., and Funato, Y., PASJ 42 (1993), 279. Marti, J.M a , and M uller, E., J. Computat. Phys. 123 (1996), 1. Monaghan, J.J., Ann.Rev.Astron.Astrophys. 30 (1992), 543. Monaghan, J.J., J. Computat. Phys. 136 (1997a), 298. Monaghan, J.J., J. Computat. Phys. 138 (1997b), 801. Murray, J., Mon. Not. R. astr. Soc. 297 (1998), 323. Nelson, A.F., Benz, W., Adams, F.C., and Arnett, D., Dynamics of Circumstellar Disks, Preprint of the Steward Observatory, No. 1424, Univ. of Arizona, USA. Owen, J.M., Villumsen, J.V., Shapiro, P.R., and Martel, H., Adaptive Smoothed Particle Hydrodynamics, II, Ap. J. (1998). Phillips, G.J., and Monaghan, J.J., Mon. Not. R. astr. Soc. 216 (1985), 883. Quirk, J.J., Int. J. for Num. Methods in Fluids, 18 (1994), 141. Randles, P.W., and Libersky, L.D., Computer Methods in Applied Mechanics and Engineering (1996). Roberts, T.W., J. Computat. Phys. 90 (1990), 141. Shapiro., P.R., Martel, H., Villumsen, J.V., and Owen, J.M., Ap. J. Supp. 103 (1996), 269. Steinmetz, M., GRAPESPH: Cosmological SPH simulations with special purpose hardware GRAPE, Max Planck Institute f. Astrophysik, Garching. Sugimoto, D., Chikada, Y., Makino, J., Ito, T., Ebisuzaki, T.,Umemura, M., Nature 345 (1990), 33. Swegle, J.W., Hicks, D.L., and Attaway, S.W., J. Comp. Phys. 116 (1995), 123. Thomas, P.A. and Couchman, H.M.P., M.N.R.A.S. 257 (1992), 11.