Smoothed Particle Hydrodynamics for Astrophysics problems
Abstract
Smoothed particle hydrodynamics (SPH) is a mesh-free numerical method which leads to an N-body problem-like. This method was specifically created for astrophysical simulations and has been proved to be useful for certain hydrodynamical problems. In this article SPH is introduced, and implemented for solving the free-fall collapse of a planet, which is an ideal problem for validation because its analytical solution is known. In order to compare with a mesh method, the finite difference method (FDM) is also implemented. Although FDM allows to implement restrictions that affect the symmetry of the problem, resulting in better solutions, discretization with SPH is less restrictive and it is straightforward to formulate more complex problems
Full text
SMOOTHED PARTICLE HYDRODYNAMICS FOR ASTROPHYSICS PROBLEMS PROJECTES D’ENGINYERIA FÍSICA 2 Smoothed Particle Hydrodynamics for Astrophysics problems Revised 30/05/2019 16:00:00 Guillem Ramírez and Eric Soriano Technical University of Catalonia, Engineering Physics e-mail address: [email protected] ; [email protected] Smoothed particle hydrodynamics (SPH) is a mesh-free numerical method which leads to an N-body problem-like. This method was specifically created for astrophysical simulations and has been proved to be useful for certain hydrodynamical problems. In this article SPH is introduced, and implemented for solving the free-fall collapse of a planet, which is an ideal problem for validation because its analytical solution is known. In order to compare with a mesh method, the finite difference method (FDM) is also implemented. Although FDM allows to implement restrictions that affect the symmetry of the problem, resulting in better solutions, discretization with SPH is less restrictive and it is straightforward to formulate more complex problems. Keywords: SPH, FDM, gravitational collapse problem I. INTRODUCTION Computational simulations allow to check whether a physical model evolves as desired or could even lead to the prediction of unknown phenomena under conditions that are not easily reachable with experiments. Although we can see the model as the set of laws or mathematical expressions that affect the different magnitudes, as well as the fixed or initial conditions, whether we treat the different parts as a mesh or in some other way can have different effects on the results of our simulation. For instance, the finite element method (FEM) subdivides the large system into smaller parts using a mesh. In the finite difference method (FDM) derivatives are approximated by the discrete ones. An alternative approach, which will be discussed and implemented in this article, will be the smoothed particle hydrodynamics (SPH). SPH leads to a N-body problem-like. Instead of a dense body, the whole object is divided into smaller particles, which are independent with each other but subject to interactions with the other particles. This approach allows the different parts of the body to freely move, which cannot be done in a mesh-like formulation. This is the reason why SPH is useful for certain hydrodynamical problems, thus resulting interesting for astrophysical simulations such as star formation or the evolution of a planet. SPH is also often used in movies in order to simulate the movement of fluids or even solid parts of the body such as hair. II. SMOOTHED PARTICLE HYDRODYNAMICS In order to properly introduce more complex SPH formulations, let’s consider first a simple problem. A bunch of particles form a fluid with no internal viscosity. Therefore, the equations describing the movement of the particles in the absence of external forces would be [1]: (2.1) (2.2) where is the vector of the position of the particle number i, is its velocity, the density, the pressure and the gravitational potential. Equation (2.1) is the definition of velocity and equation (2.2) obtains the acceleration through Newton’s second law. The position and velocity are the variables that are going to be obtained through an integration method such as Euler or Runge-Kutta. Instead of only considering point-like particles, it is better to consider a weight function (normalised with respect the position), called a kernel , which will be useful for obtaining average values in space. The density at position of the particle will be (2.3) where is the mass of the particle, its position and the smoothing length, which is a measure of how broad is the distribution of mass and the range of effect of forces like pressure. The kernel is a Dirac delta at the limit: (2.4) Although the value of may be set constant, it makes more sense to relate it with the average density of the entire body. If density increases, particles tend to be closer, so it is better to restrict more the domain at which the particle directly affects the others. Defining a constant , it is common to use the law in (2.5) or a similar one.
SMOOTHED PARTICLE HYDRODYNAMICS FOR ASTROPHYSICS PROBLEMS PROJECTES D’ENGINYERIA FÍSICA 2 (2.5) The average density is straightforwardly calculated by averaging the density of the particles. Although the exponential kernel is the most extended one, the used in this article is a different one, because it produced better results and was reported to be successfully used in similar simulations [1]. (2.6) The kernel allows to calculate physical magnitudes associated with the fluid. Using density-weighted interpolations, a good approximation of a magnitude can be obtained: (2.7) For this example, this property shows how to obtain the gradient of pressure: (2.8) FIG. 1. Evolution of a system with only two particles. Although intuition tells that the two particles should get together and bound, a gravitational force inversely proportional to the position makes them reach very high velocities, thus separating them. Although it strictly is not part of the SPH formulation, the only thing left is to use a method for calculating the acceleration due to the gravitational force ( ). The typical Newtonian gravitational force formula may introduce some distortion to the system since each couple of particles coming together ends with both of them escaping with infinite velocity on the opposite side (see Figure 1) due to the fact that the gravitational force is proportional to the inverse of the squared distance. This problem has been overcome in the following simulations adopting a spline-softened form of the potential. This exact form was first introduced by Gingold and Monaghan [2]: (2.9) with , the gravitational constant (6.67259· ), and the gravitational smoothing10−8 length. The key of this approximation is that it limits the cubic dependence of the inverse of the position to a region outside the sphere of radius [3]. Gravitational force appears to be softened in the interior of that sphere, controlled by , eluding the pole of this force. III. FREE-FALL COLLAPSE OF A PLANET The free-fall collapse of a planet has been tested using both methods (FDM and SPH). The planet’s initial conditions were set to imitate the planet Jupiter, but assuming homogeneous density and spherical symmetry. The two equations of the problem are the following: (3.1) (3.2) where is the density, the mass, the position and the velocity. The first equation stands for conservation of mass and the second one for the second Newton law. It can be proved that the evolution of the radius with respect to the time , starting with an initial radius at and initial density has the following analytical solution [4]: (3.3) In the following simulations the conditions were set to resemble a planet like Jupiter. This means that the initial density is adjusted to 1.33 and the initial radius is /cmg 3 about to 6.9911· .109mc In order to apply the FDM, the planet was subdivided into a hundred spherical shells of same mass, and equations (3.1) and (3.2) were discretized in time and space. The method used , a parameter that was a compromise between a fully implicit and fully explicit
SMOOTHED PARTICLE HYDRODYNAMICS FOR ASTROPHYSICS PROBLEMS PROJECTES D’ENGINYERIA FÍSICA 2 Euler integration method, which would slightly vary the speed of the collapse. Using the fact that the sphere is symmetrical, this problem ends up being a 1D problem with parameters the radius, the velocity and the density of each shell. One astonishing result of this simulation was to find out that the density remained constant along the sphere at each instant of time [4]. The same problem was tackled from the SPH perspective. Since in this section the problem studied is a free-fall, SPH resumes to a N body simulation of gravity using the kernel proposed in the previous section. For this simulation 2500 particles where used (as recommended in [1]), distributed at random through the volume of the sphere obtaining a pseudo-uniform distribution. The use of a higher number of particles would improve, strictly speaking, the simulation, but also it would slow down the calculations enormously. Figure 2 depicts an example of the progressive collapse of the sphere. FIG. 2. The free-fall of a Jupiter-type planet, 2500 particules, projection of the sphere at different instants on the XY plane. From left to right and up to down: planet at 0s, 744s, 1464s and 1824s. The most relevant parameter in this simulation is , defined in the equation (2.9), the gravitational smoothing length. As it has been seen in the previous section, this smoothing length is used to avoid the infinite type potential and numerical errors when particles are very close. It is clear that induces a change in the behaviour of the free-fall: a large would smooth the gravitational force in a large volume around each particle, inducing a slower collapse; a low would induce particles very close to each other to experiment forces with no physical meaning and their possible escape from the body. To find a proper , simulations with different values where executed searching for a tradeoff between compactness of the object and small impact on the free-fall. In Figure 3 those simulations are plotted. As expected, initially the differences are not visible and as the sphere compresses, the higher the , the slower the collapse, but also the more compact the object is (although it cannot be seen in this particular Figure). Finally the kept was . For calculating the radius, the particles that have left the body were not taken into account (as we can see in Figure 2, the fourth subfigure, some particles are detached from the main sphere due to the effects of gravity between two close particles). FIG. 3. (Color online) Radius of the simulations of free-fall with 2500 particles and different (orange, green and red) compared to the analytical solution (blue): , , . Once parameters are set, the comparison is made. The first point to take into account is that the calculation time for FDM is around 5 minutes whereas for SPH is slightly more that 24h. Figure 4 shows the results of both methods for identical initial conditions. It can be observed that (i) results for the two methods satisfactorily reproduce the analytical solution (ii) the 80th percentile for the radius imitates better the solution for longer time when compared to the evolution of the longest radius and (iii) FDM looks to work better for longer time. Let’s discuss the second point. Since the planet is divided into 2500 particles, these are distributed among what is considered a sphere. But, as what can be seen from Figure 2, the projections of the particles in a plane do not distribute among a perfect circle. This small distortion makes it hard to tell what is the radius of the entire body. Sometimes, a few particles move to the center slower than the rest, or can leave the body altering the total radius. This problem can be tackled by considering percentiles, although it is a bit arbitrary which one should be chosen. Smaller percentiles
SMOOTHED PARTICLE HYDRODYNAMICS FOR ASTROPHYSICS PROBLEMS PROJECTES D’ENGINYERIA FÍSICA 2 ignore the outer shells while greater percentiles do not ignore spoiled particles. This problem does not exist for the FDM since all the shells are formulated, and the radius corresponds with the radius of the most external one. FIG. 4. (Color online) Evolution of the radius with respect to the time, for the analytical solution (blue), for the FDM (orange), SPH with the radius given by the most external particle (green) and SPH with the radius given by the 80th percentile (red) On the other hand, FDM appears to be more consistent with the analytical solution, or at least it lasts more without diverging from it. But one must be cautious with this impression because the FDM implemented here assumes the condition of radial symmetry, whereas SPH has not a perfect radial symmetry. In fact, as we can see in Figure 2, the little asymmetries that are inevitable when using a random distribution cause some disturbances in the final solution, affecting in a relevant way the result. But it is also clear that the fact that SPH does not assume spherical symmetry for the calculations allows to study more complex and real systems (such as stars or planets, which are known to be non spherical). So SPH looks like a much more polyvalent method and appropriated to real physical problems. IV. OTHER SYSTEMS Since the free-fall collapse results are close to the analytical solution, the next logical step is to use the concepts shown to simulate a more realistic planet including all the SPH parameters, by adding pressure and viscosity. Trying to simulate a stable (self-sustained) planet would be the ideal result. Once it is simulated, there are other situations that can be easy to produce, such as the collision between two planets, which could be harder to formulate with other methods. The formulation of the problem does not differ much from equations (2.1) and (2.2); actually, they are the limit cases for null viscosity. The second equation gets transformed by adding a viscous term: (4.1) where is the viscosity term for the particle proportional to the gradient of the kernel and that is different from 0 if the relative position and relative velocity of two particles are in opposite directions. An expression that gives good results -and is the one implemented in this articleis the one given by Monaghan [5]. FIG. 5. (Color online) SPH simulations with the introduction of pressure and viscosity (blue and orange) and in free-fall (orange), 2500 particles. Figure 5 depicts the obtained results including the pressure and viscosity in front of the previous experiment. As expected, the collapse has been slowed down by the pressure and the viscosity. It can be seen that larger (smoothing length introduced in equation (2.3)) slow the collapse since it increases the radius of effect of pressure and viscosity. Here the number of particles is determinant and can induce large changes in the final result mostly due to the range of effect of pressure and viscosity. Increasing the number of particles (although computationally very expensive since more that 24 hours of calculation are needed for 2500 particles) can be seen as another method to slow down the collapse, an intuitive result. V. CONCLUSIONS SPH has been implemented for the free-fall collapse of a planet. Results suggest that, although FDM is closer to the analytical solution, SPH reaches decent results without imposing symmetry conditions. Certain parameters have been adjusted. The ambiguity in the definition of the radius indicates that sometimes this method could lead to interpretation problems, since instead of an entire body the system is replaced by a set of independent particles. The fact that SPH allows low-symmetry problems such as mass transfer or collisions makes it most suitable for certain Astrophysics problems.
SMOOTHED PARTICLE HYDRODYNAMICS FOR ASTROPHYSICS PROBLEMS PROJECTES D’ENGINYERIA FÍSICA 2 ACKNOWLEDGEMENTS We would like to be extremely grateful to our tutor Jordi José, who proposed this project and provided us with references, ideas and revisions. He also provided us the computational power required for this project. [1] P. Bodenheimer, G. P. Laughlin, M. Rozyczka and H. W. Yorke, Numerical Methods in Astrophysics , CRC Press (2006). [2] R. A. Gingold and J. J. Monaghan, Smoothed particle hydrodynamics - Theory and application to non-spherical stars , Monthly Notices of the Royal Astronomical Society, vol. 181, pp. 375-389 (May 1977). [3] L. Hernquist and N. Katz, A unification of SPH with the hierarchical tree method , Astrophysical Journal Supplement Series, vol. 70, pp. 419-446 (June 1989). [4] J. José, Stellar Explosions, Hydrodynamics and Nucleosynthesis , CRC Press (2015). [5] J. J. Monaghan, Smoothed Particles Hydrodynamics , Annual Review on Astronomy and Astrophysics, 199