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 both Einstein and spin-induced precession around black holes. We benchmark our scheme in 1D and 3D against mildly and ultra relativistic shock tubes, exact solutions for epicyclic and vertical oscillation frequencies, and Bondi accretion. We assume fixed background metrics (Minkowski, Schwarzschild and Kerr in Cartesian Boyer-Lindquist coordinates) but the method lays the foundation for future direct coupling with numerical relativity.
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…
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…
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 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 …
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.
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…
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 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…
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.
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.
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 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…
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…
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…
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-…
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…
The behavior of IAD_0 scheme, a fully conservative SPH scheme based on a tensor formulation, is analyzed in connection with several astrophysical scenarios, and compared to the same simulations carried out with the standard SPH technique. The proposed hydrodynamic scheme is validated using a variety of numerical tests that cover important topics in astrophysics, such as the evolution of supernova remnants, the stability of self-gravitating bodies and the coalescence of compact objects. The results suggest that the SPH scheme built with the integral approach to the derivatives premise improves …
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…
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…
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…
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…
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 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 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…
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…
We present a novel implementation of Smoothed Particle Hydrodynamics (SPHS) that uses the spatial derivative of the velocity divergence as a higher order dissipation switch. Our switch -- which is second order accurate -- detects flow convergence before it occurs. If particle trajectories are going to cross, we switch on the usual SPH artificial viscosity, as well as conservative dissipation in all advected fluid quantities (for example, the entropy). The viscosity and dissipation terms (that are numerical errors) are designed to ensure that all fluid quantities remain single-valued as particl…
We present a new radiative transfer method (SPH-M1RT) that is coupled dynamically with smoothed particle hydrodynamics (SPH). We implement it in the (task-based parallel) SWIFT galaxy simulation code but it can be straightforwardly implemented in other SPH codes. Our moment-based method simultaneously solves the radiation energy and flux equations in SPH, making it adaptive in space and time. We modify the M1 closure relation to stabilize radiation fronts in the optically thin limit. We also introduce anisotropic artificial viscosity and high-order artificial diffusion schemes, which allow the…
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 …
We describe a simple method for estimating the vertical column density in Smoothed Particle Hydrodynamics (SPH) simulations of discs. As in the method of Stamatellos et al. (2007), the column density is estimated using pre-computed local quantities and is then used to estimate the radiative cooling rate. The cooling rate is a quantity of considerable importance, for example, in assessing the probability of disc fragmentation. Our method has three steps: (i) the column density from the particle to the mid plane is estimated using the vertical component of the gravitational acceleration, (ii) th…
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…
The numerical convergence of smoothed particle hydrodynamics (SPH) can be severely restricted by random force errors induced by particle disorder, especially in shear flows, which are ubiquitous in astrophysics. The increase in the number NH of neighbours when switching to more extended smoothing kernels at fixed resolution (using an appropriate definition for the SPH resolution scale) is insufficient to combat these errors. Consequently, trading resolution for better convergence is necessary, but for traditional smoothing kernels this option is limited by the pairing (or clumping) instability…