Smoothed Particle Hydrodynamics and Magnetohydrodynamics
Daniel J. Price
备注:
44 pages, 14 figures, accepted to special edition of J. Comp. Phys. on "Computational Plasma Physics". The ndspmhd code is available for download from http://users.monash.edu.au/~dprice/ndspmhd/
This paper presents an overview and introduction to Smoothed Particle Hydrodynamics and Magnetohydrodynamics in theory and in practice. Firstly, we give a basic grounding in the fundamentals of SPH, showing how the equations of motion and energy can be self-consistently derived from the density estimate. We then show how to interpret these equations using the basic SPH interpolation formulae and highlight the subtle difference in approach between SPH and other particle methods. In doing so, we also critique several `urban myths' regarding SPH, in particular the idea that one can simply increase the `neighbour number' more slowly than the total number of particles in order to obtain convergence. We also discuss the origin of numerical instabilities such as the pairing and tensile instabilities. Finally, we give practical advice on how to resolve three of the main issues with SPMHD: removing the tensile instability, formulating dissipative terms for MHD shocks and enforcing the divergence constraint on the particles, and we give the current status of developments in this area. Accompanying the paper is the first public release of the NDSPMHD SPH code, a 1, 2 and 3 dimensional code designed as a testbed for SPH/SPMHD algorithms that can be used to test many of the ideas and used to run all of the numerical examples contained in the paper.
Obtaining a stable magnetohydrodynamical (MHD) formalism in SPH - i.e. smoothed particle magnetohydrodynamics (SPMHD) - has proven remarkably difficult. To implement MHD requires two steps: a modification to the momentum equation and an induction equation, and both present challenges. We first provide an overview of how SPMHD is implemented, and then discuss how this implementation fails and the limitation of various corrective methods - with particular reference to the effects of particle disorder. Although there are many problems for which, with careful choice of corrective measures, good re…
We present an updated constrained hyperbolic/parabolic divergence cleaning algorithm for smoothed particle magnetohydrodynamics (SPMHD) that remains conservative with wave cleaning speeds which vary in space and time. This is accomplished by evolving the quantity $ψ/ c_h$ instead of $ψ$. Doing so allows each particle to carry an individual wave cleaning speed, $c_h$, that can evolve in time without needing an explicit prescription for how it should evolve, preventing circumstances which we demonstrate could lead to runaway energy growth related to variable wave cleaning speeds. This modificati…
In this paper, we develop a new method for magnetohydrodynamics (MHD) using smoothed particle hydrodynamics (SPH). To describe MHD shocks accurately, the Godunov method is applied to SPH instead of artificial dissipation terms. In the interaction between particles, we solve a nonlinear Riemann problem with magnetic pressure for compressive waves and apply the method of characteristics for Alfv{é}n waves. An extensive series of MHD test calculations is performed. In all test calculations, we compare the results of our SPH code with those of a finite-volume method with an approximate Riemann sol…
Smoothed particle magnetohydrodynamics has reached a level of maturity that enables the study of a wide range of astrophysical problems. In this review, the numerical details of the modern SPMHD method are described. The three fundamental components of SPMHD are methods to evolve the magnetic field in time, calculate accelerations from the magnetic field, and maintain the divergence-free constraint on the magnetic field (no monopoles). The connection between these three requirements in SPMHD will be highlighted throughout. The focus of this review is on the methods that work well in practice, …
We present Phantom, a fast, parallel, modular and low-memory smoothed particle hydrodynamics and magnetohydrodynamics code developed over the last decade for astrophysical applications in three dimensions. The code has been developed with a focus on stellar, galactic, planetary and high energy astrophysics and has already been used widely for studies of accretion discs and turbulence, from the birth of planets to how black holes accrete. Here we describe and test the core algorithms as well as modules for magnetohydrodynamics, self-gravity, sink particles, H_2 chemistry, dust-gas mixtures, phy…
The development of smooth particle magnetohydrodynamic (SPMHD) has significantly improved the simulation of complex astrophysical processes. However, the preservation the solenoidality of the magnetic field is still a severe problem for the MHD. A formulation of the induction equation with a vector potential would solve the problem. Unfortunately all previous attempts suffered from instabilities. In the present work, we evolve the vector potential in the Coulomb gauge and smooth the derived magnetic field for usage in the momentum equation. With this implementation we could reproduce classical…
Artificial resistivity is included in Smoothed Particle Magnetohydrodynamics simulations to capture shocks and discontinuities in the magnetic field. Here we present a new method for adapting the strength of the applied resistivity so that shocks are captured but the dissipation of the magnetic field away from shocks is minimised. Our scheme utilises the gradient of the magnetic field as a shock indicator, setting α_B = h|gradB|/|B|, such that resistivity is switched on only where strong discontinuities are present. The advantage to this approach is that the resistivity parameter does not depe…
Supersonic turbulence is believed to be at the heart of star formation. We have performed smoothed particle magnetohydrodynamics (SPMHD) simulations of the small-scale dynamo amplification of magnetic fields in supersonic turbulence. The calculations use isothermal gas driven at rms velocity of Mach 10 so that conditions are representative of star-forming molecular clouds in the Milky Way. The growth of magnetic energy is followed for 10 orders in magnitude until it reaches saturation, a few percent of the kinetic energy. The results of our dynamo calculations are compared with results from gr…
In this paper we investigate the use of the vector potential as a means of maintaining the divergence constraint in the numerical solution of the equations of Magnetohydrodynamics (MHD) using the Smoothed Particle Hydrodynamics (SPH) method. We derive a self-consistent formulation of the equations of motion using a variational principle that is constrained by the numerical formulation of both the induction equation and the curl operator used to obtain the magnetic field, which guarantees exact and simultaneous conservation of momentum, energy and entropy in the numerical scheme. This leads to …
In this study, we investigate the dispersive properties of smoothed particle magnetohydrodynamics (SPM) in a strongly magnetized medium by using linear analysis. In modern SPM, a correction term proportional to the divergence of the magnetic fields is subtracted from the equation of motion to avoid a numerical instability arising in a strongly magnetized medium. From the linear analysis, it is found that SPM with the correction term suffer from significant dispersive errors, especially for slow waves propagating along magnetic fields. The phase velocity for all wave numbers is significantly la…
The equations of smoothed particle magnetohydrodynamics (SPMHD), even with the various corrections to instabilities so far proposed, have been observed to be unstable when a very steep density gradient is necessarily combined with a variable smoothing length formalism. Here we consider in more detail the modifications made to the SPMHD equations in LBP2015 that resolve this instability by replacing the smoothing length in the induction and anisotropic force equations with an average smoothing length term. We then explore the choice of average used and compare the effects on a test `cylinder-in…
We formulate a smoothed-particle hydrodynamics numerical method, traditionally used for the Euler equations for fluid dynamics in the context of astrophysical simulations, to solve the non-linear Schrodinger equation in the Madelung formulation. The probability density of the wavefunction is discretized into moving particles, whose properties are smoothed by a kernel function. The traditional fluid pressure is replaced by a quantum pressure tensor, for which a novel, robust discretization is found. We demonstrate our numerical method on a variety of numerical test problems involving the simple…
We present a constrained formulation of Dedner et al's hyperbolic/parabolic divergence cleaning scheme for enforcing the \nabla\dot B = 0 constraint in Smoothed Particle Magnetohydrodynamics (SPMHD) simulations. The constraint we impose is that energy removed must either be conserved or dissipated, such that the scheme is guaranteed to decrease the overall magnetic energy. This is shown to require use of conjugate numerical operators for evaluating \nabla\dot B and \nablaψ in the SPMHD cleaning equations. The resulting scheme is shown to be stable at density jumps and free boundaries, in contr…
In numerical simulations, artificial terms are applied to the evolution equations for stability. To prove their validity, these terms are thoroughly tested in test problems where the results are well known. However, they are seldom tested in production-quality simulations at high resolution where they interact with a plethora of physical and numerical algorithms. We test three artificial resistivities in both the Orszag-Tang vortex and in a star formation simulation. From the Orszag-Tang vortex, the Price et. al. (2017) artificial resistivity is the least dissipative thus captures the density …
We present a novel method of magnetohydrodynamics (MHD) within the smoothed particle hydrodynamics scheme using the Geometric Density average force expression (GDSPH). GDSPH has recently been shown to reduce the leading order errors and greatly improve the accuracy near density discontinuities, eliminating surface tension effects. Here, we extend the study to investigate how SPMHD benefits from this method. We implement ideal MHD in the Gasoline2 and Changa codes with both GDSPH and traditional SPH (TSPH) schemes. An constrained hyperbolic divergence cleaning scheme is employed to control the …
There has been interest in recent years to assess the ability of astrophysical hydrodynamics codes to correctly model the Kelvin-Helmholtz instability. Smoothed particle hydrodynamics (SPH), in particular, has received significant attention, though there has yet to be a clear demonstration that SPH yields converged solutions that are in agreement with other methods. We have performed SPH simulations of the Kelvin-Helmholtz instability using the test problem put forward by Lecoanet et al (2016). We demonstrate that the SPH solutions converge to the reference solution in both the linear and non-…
We review existing SPH setup methods and outline their advantages, limitations and drawbacks. We present a new method for constructing initial conditions for smoothed particle hydrodynamics (SPH) simulations, which may also be of interest for N-body simulations, and demonstrate this method on a number of applications. This new method is inspired by adaptive binning techniques using weighted Voronoi tesselations. Particles are placed and iteratively moved based on their proximity to neighboring particles and the desired spatial resolution. This new method can satisfy arbitrarily complex spatial…
Numerical methods to improve the treatment of magnetic fields in smoothed field magnetohydrodynamics (SPMHD) are developed and tested. Chapter 2 is a review of SPMHD. In Chapter 3, a mixed hyperbolic/parabolic scheme is developed which cleans divergence error from the magnetic field. Average divergence error is an order of magnitude lower for all test cases considered, and allows for the stable simulation of the gravitational collapse of magnetised molecular cloud cores. The effectiveness of the cleaning may be improved by explicitly increasing the hyperbolic wave speed or by cycling the clean…
In this paper, we present an explicit scheme for Ohmic dissipation with smoothed particle magneto-hydrodynamics (SPMHD). We propose a SPH discretization of Ohmic dissipation and solve Ohmic dissipation part of induction equation with the supertime-stepping method (STS) which allows us to take a longer time-step than Courant-Friedrich-Levy stability condition. Our scheme is second-order accurate in space and first-order accurate in time. Our numerical experiments show that optimal choice of the parameters of STS for Ohmic dissipation of SPMHD is νsts ~ 0.01 and Nsts ~ 5.
FleCSPH is a smoothed particle hydrodynamics simulation tool, based on the compile-time configurable framework FleCSI. The asynchronous distributed tree topology combined with a fast multipole method allows FleCSPH to efficiently compute hydrodynamics and long range particle-particle interactions. FleCSPH provides initial data generators, particle relaxation techniques, and standard evolution drivers, which can be easily modified and extended to user-specific setups. Data input/output uses the H5part format, compatible with modern visualization software.
In this paper, we present a new formulation of smoothed particle hydrodynamics (SPH), which, unlike the standard SPH (SSPH), is well-behaved at the contact discontinuity. The SSPH scheme cannot handle discontinuities in density (e.g. the contact discontinuity and the free surface), because it requires that the density of fluid is positive and continuous everywhere. Thus there is inconsistency in the formulation of the SSPH scheme at discontinuities of the fluid density. To solve this problem, we introduce a new quantity associated with particles and "density" of that quantity. This "density" e…
I discuss the key features of Smoothed Particle Hydrodynamics (SPH) as a numerical method - in particular the key differences between SPH and more standard grid based approaches - that are important to the practitioner. These include the exact treatment of advection, the absence of intrinsic dissipation, exact conservation and more subtle properties that arise from its Hamiltonian formulation such as the existence of a minimum energy state for the particles. The implications of each of these are discussed, showing how they can be both advantages and disadvantages.
Many astrophysical and terrestrial scenarios involving magnetic fields can be approached in axial geometry. Although the smoothed particle hydrodynamics (SPH) technique has been successfully extended to magneto-hydrodynamics (MHD), a well-verified, axisymmetric MHD scheme based on such technique does not exist yet. In this work we fill that gap in the scientific literature and propose and check a novel axisymmetric MHD hydrodynamic code, that can be applied to physical problems which display the adequate geometry. We show that the hydrodynamic code built following these axisymmetric hypothesis…
This paper describes a new fast and implicitly parallel approach to neighbour-finding in multi-resolution Smoothed Particle Hydrodynamics (SPH) simulations. This new approach is based on hierarchical cell decompositions and sorted interactions, within a task-based formulation. It is shown to be faster than traditional tree-based codes, and to scale better than domain decomposition-based approaches on hybrid shared/distributed-memory parallel architectures, e.g. clusters of multi-cores, achieving a $40\times$ speedup over the Gadget-2 simulation code.
We present the smoothed-particle hydrodynamics simulation code, Bonsai-SPH, which is a continuation of our previously developed gravity-only hierarchical $N$-body code (called Bonsai). The code is optimized for Graphics Processing Unit (GPU) accelerators which enables researchers to take advantage of these powerful computational resources. Bonsa-SPH produces simulation results comparable with state-of-the-art, CPU based, codes, but using an order of magnitude less computation time. The code is freely available online and the details are described in this work.
Smoothed particle magnetohydrodynamics for simulations of galaxy and cosmic structure formation
Lorentz Institute for Theoretical Physics, Leiden University(莱顿大学洛伦兹理论物理研究所);Leiden Observatory, Leiden University(莱顿大学莱顿天文台);Instituto de Astronomía teórica y experimental-Conicet(理论与实验天体物理学研究所-阿根廷国家科学研究委员会);Observatorio Astronómico de Córdoba, Universidad Nacional de Córdoba(科尔多瓦天文台,科尔多瓦国立大学)
In this paper we test a special-relativistic formulation of Smoothed Particle Hydrodynamics (SPH) that has been derived from the Lagrangian of an ideal fluid. Apart from its symmetry in the particle indices, the new formulation differs from earlier approaches in its artificial viscosity and in the use of special-relativistic ``grad-h-terms''. In this paper we benchmark the scheme in a number of demanding test problems. Maybe not too surprising for such a Lagrangian scheme, it performs close to perfectly in pure advection tests. What is more, the method produces accurate results even in highly …
We present a fix to the overdamping problem found by Laibe & Price (2012) when simulating strongly coupled dust-gas mixtures using two different sets of particles using smoothed particle hydrodynamics. Our solution is to compute the drag at the barycentre between gas and dust particle pairs when computing the drag force by reconstructing the velocity field, similar to the procedure in Godunov-type solvers. This fixes the overdamping problem at negligible computational cost, but with additional memory required to store velocity derivatives. We employ slope limiters to avoid spurious oscillation…
We perform simulations of the Kelvin-Helmholtz instability using smoothed particle hydrodynamics (SPH). The instability is studied both in the linear and strongly non-linear regimes. The smooth, well-posed initial conditions of Lecoanet et al. (2016) are used, along with an explicit Navier-Stokes viscosity and thermal conductivity to enforce the evolution in the non-linear regime. We demonstrate convergence to the reference solution using SPH. The evolution of the vortex structures and the degree of mixing, as measured by a passive scalar `colour' field, match the reference solution. Tests wit…
The smoothed particle hydrodynamics (SPH) method is a useful numerical tool for the study of a variety of astrophysical and planetlogical problems. However, it turned out that the standard SPH algorithm has problems in dealing with hydrodynamical instabilities. This problem is due to the assumption that the local density distribution is differentiable. In order to solve this problem, a new SPH formulation, which does not require the differentiability of the density, have been proposed. This new SPH method improved the treatment of hydrodynamical instabilities. This method, however, is applicab…
We present a method for general relativistic smoothed particle hydrodynamics (GRSPH), based on an entropy-conservative form of the general relativistic hydrodynamic equations for a perfect fluid. We aim to replace approximate treatments of general relativity in current SPH simulations of tidal disruption events and accretion discs. We develop an improved shock capturing formulation that distinguishes between shock viscosity and conductivity in relativity. We also describe a new Hamiltonian time integration algorithm for relativistic orbital dynamics and GRSPH. Our method correctly captures bot…
We describe a simple method for simulating the dynamics of small grains in a dusty gas, relevant to micron-sized grains in the interstellar medium and grains of centimetre size and smaller in protoplanetary discs. The method involves solving one extra diffusion equation for the dust fraction in addition to the usual equations of hydrodynamics. This "diffusion approximation for dust" is valid when the dust stopping time is smaller than the computational timestep. We present a numerical implementation using Smoothed Particle Hydrodynamics (SPH) that is conservative, accurate and fast. It does no…
We present a new method for including radiative feedback from sink particles in smoothed particle hydrodynamics simulations of low-mass star formation, and investigate its effects on the formation of small stellar groups. We find that including radiative feedback from sink particles suppresses fragmentation even further than calculations that only include radiative transfer within the gas. This reduces the star-formation rate following the formation of the initial protostars, leading to fewer objects being produced and a lower total stellar mass. The luminosities of sink particles vary due to …
We present a novel method for particle splitting in smoothed particle hydrodynamics simulations. Our method utilizes the Voronoi diagram for a given particle set to determine the position of fine daughter particles. We perform several test simulations to compare our method with a conventional splitting method in which the daughter particles are placed isotropically over the local smoothing length. We show that, with our method, the density deviation after splitting is reduced by a factor of about two compared with the conventional method. Splitting would smooth out the anisotropic density stru…
Firstly, we give a historical overview of attempts to incorporate magnetic fields into the Smoothed Particle Hydrodynamics method by solving the equations of Magnetohydrodynamics (MHD), leading an honest assessment of the current state-of-the-art in terms of the limitations to performing realistic calculations of the star formation process. Secondly, we discuss the results of a recent comparison we have performed on simulations of driven, supersonic turbulence with SPH and Eulerian techniques. Finally we present some new results on the relationship between the density variance and the Mach num…
We present a new algorithm, MULTIGRAIN, for modelling the dynamics of an entire population of small dust grains immersed in gas, typical of conditions that are found in molecular clouds and protoplanetary discs. The MULTIGRAIN method is more accurate than single-phase simulations because the gas experiences a backreaction from each dust phase and communicates this change to the other phases, thereby indirectly coupling the dust phases together. The MULTIGRAIN method is fast, explicit and low storage, requiring only an array of dust fractions and their derivatives defined for each resolution el…
Smoothed Particle Hydrodynamics (SPH) is a Lagrangian method for solving the fluid equations that is commonplace in astrophysics, prized for its natural adaptivity and stability. The choice of variable to smooth in SPH has been the topic of contention, with smoothed pressure (P-SPH) being introduced to reduce errors at contact discontinuities relative to smoothed density schemes. Smoothed pressure schemes produce excellent results in isolated hydrodynamics tests; in more complex situations however, especially when coupling to the `sub-grid' physics and multiple time-stepping used in many state…
In this paper we develop and test a fully conservative SPH scheme based on a tensor formulation that can be applied to simulate astrophysical systems. In the proposed scheme, derivatives are calculated from an integral expression that leads to a tensor (instead of a vectorial) estimation of gradients and reduces to the standard formulation in the continuum limit. The new formulation improves the interpolation of physical magnitudes, leading to a set of conservative equations that resembles those of standard SPH. The resulting scheme is verified using a variety of well-known tests, all of them …
In this paper we discuss recent applications of the Smoothed Particle Hydrodynamics (SPH) method to the simulation of supersonic turbulence in the interstellar medium, as well as giving an update on recent algorithmic developments in solving the equations of magnetohydrodynamics (MHD) in SPH. Using high resolution calculations (up to 134 million particles), we find excellent agreement with grid-based results on a range of measures including the power spectrum slope in both the velocity field and the density-weighted velocity rho^(1/3) v, the latter showing a Kolmogorov-like k^-5/3 scaling as p…
As hydrodynamic simulations increase in scale and resolution, identifying structures with non-trivial geometries or regions of general interest becomes increasingly challenging. There is a growing need for algorithms that identify a variety of different features in a simulation without requiring a "by-eye" search. We present tensor classification as such a technique for smoothed particle hydrodynamics (SPH). These methods have already been used to great effect in N-Body cosmological simulations, which require smoothing defined as an input free parameter. We show that tensor classification succ…
I present a review of Smoothed Particle Hydrodynamics (SPH), with the aim of providing a mathematically rigorous, clear derivation of the algorithms from first principles. The method of discretising a continuous field into particles using a smoothing kernel is considered, and also the errors associated with this approach. A fully conservative form of SPH is then derived from the Lagrangian, demonstrating the explicit conservation of mass, linear and angular momenta and energy/entropy. The method is then extended to self-consistently include spatially varying smoothing lengths, (self) gravity a…
We describe a strategy for code modernisation of Gadget, a widely used community code for computational astrophysics. The focus of this work is on node-level performance optimisation, targeting current multi/many-core IntelR architectures. We identify and isolate a sample code kernel, which is representative of a typical Smoothed Particle Hydrodynamics (SPH) algorithm. The code modifications include threading parallelism optimisation, change of the data layout into Structure of Arrays (SoA), auto-vectorisation and algorithmic improvements in the particle sorting. We obtain shorter execution ti…
The smoothed-particle hydrodynamics (SPH) technique is a numerical method for solving gas-dynamical problems. It has been applied to simulate the evolution of a wide variety of astrophysical systems. The method has a second-order accuracy, with a resolution that is usually much higher in the compressed regions than in the diluted zones of the fluid. In this work, we propose and check a scheme to balance and equalize the resolution of SPH between high- and low-density regions. This method relies on the versatility of a family of interpolators called Sinc kernels, which allows increasing the int…
We present a method for simulating the dynamics of a mixture of gas and multiple species of large Stokes number dust grains, typical of evolved protoplanetary discs and debris discs. The method improves upon earlier methods, in which only a single grain size could be represented, by capturing the differential backreaction of multiple dust species on the gas. This effect is greater for large dust-to-gas ratios that may be expected in the later stages of the protoplanetary disc life. We benchmark the method against analytic solutions for linear waves, drag and shocks in dust-gas mixtures, and ra…
Smoothed Particle Hydrodynamics (SPH) is a ubiquitous numerical method for solving the fluid equations, and is prized for its conservation properties, natural adaptivity, and simplicity. We introduce the Sphenix SPH scheme, which was designed with three key goals in mind: to work well with sub-grid physics modules that inject energy, be highly computationally efficient (both in terms of compute and memory), and to be Lagrangian. Sphenix uses a Density-Energy equation of motion, along with variable artificial viscosity and conduction, including limiters designed to work with common sub-grid mod…