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-of-the-art astrophysics simulations, these schemes produce large force errors that can easily evade detection as they do not manifest as energy non-conservation. Here two scenarios are evaluated: the injection of energy into the fluid (common for stellar feedback) and radiative cooling. In the former scenario, force and energy conservation errors manifest (of the same order as the injected energy), and in the latter large force errors that change rapidly over a few timesteps lead to instability in the fluid (of the same order as the energy lost to cooling). Potential ways to remedy these issues are explored with solutions generally leading to large increases in computational cost. Schemes using a Density-based formulation do not create these instabilities and as such it is recommended that they are preferred over Pressure-based solutions when combined with an energy diffusion term to reduce errors at contact discontinuities.
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 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…
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…
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…
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…
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 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…
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…
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-…
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…
It is believed that protostellar accretion disks to be formed from nearly ballistic infall of the molecular matters in rotating core collapse. Collisions of these infalling matters lead to formation of strong supersonic shocks, which if they cool rapidly, result in accumulation of that material in a thin structure in the equatorial plane. Here, we investigate the relaxation time of the protostellar accretion post-shock gas using the smoothed particle hydrodynamics (SPH). For this purpose, a one-dimensional head-on collision of two molecular sheets is considered, and the time evolution of the t…
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…
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 perform a series of smoothed particle hydrodynamics simulations of isolated dwarf galaxies to compare different metal mixing models. In particular, we examine the role of diffusion in the production of enriched outflows, and in determining the metallicity distributions of gas and stars. We investigate different diffusion strengths, by changing the pre-factor of the diffusion coefficient, by varying how the diffusion coefficient is calculated from the local velocity distribution, and by varying whether the speed of sound is included as a velocity term. Stronger diffusion produces a tighter […
Parallel implementation features of self-gravitating gas dynamics modeling on multiple GPUs are considered applying the GPU-Direct technology. The parallel algorithm for solving of the self-gravitating gas dynamics problem based on hybrid OpenMP-CUDA parallel programming model has been described in detail. The gas-dynamic forces are calculated by the modified SPH-method (Smoothed Particle Hydrodynamics) while the N-body problem gravitational interaction is obtained by the direct method (so-called Particle-Particle algorithm). The key factor in the SPH-method performance is creation of the neig…
In this paper we investigate whether Smoothed Particle Hydrodynamics (SPH), equipped with artificial conductivity, is able to capture the physics of density/energy discontinuities in the case of the so-called shearing layers test, a test for examining Kelvin-Helmholtz (KH) instabilities. We can trace back each failure of SPH to show KH rolls to two causes: i) shock waves travelling in the simulation box and ii) particle clumping, or more generally, particle noise. The probable cause of shock waves is the Local Mixing Instability (LMI), previously identified in the literature. Particle noise on…
The ionising feedback of young massive stars is well known to influence the dynamics of the birth environment and hence plays an important role in regulating the star formation process in molecular clouds. For this reason, modern hydrodynamics codes adopt a variety of techniques accounting for these radiative effects. A key problem hampering these efforts is that the hydrodynamics are often solved using smoothed particle hydrodynamics (SPH), whereas radiative transfer is typically solved on a grid. Here we present a radiation-hydrodynamics (RHD) scheme combining the SPH code Phantom and the Mo…
We present the smoothed-particle hydrodynamics implementation SPHGal, which combines some recently proposed improvements in GADGET. This includes a pressure-entropy formulation with a Wendland kernel, a higher order estimate of velocity gradients, a modified artificial viscosity switch with a modified strong limiter, and artificial conduction of thermal energy. With a series of idealized hydrodynamic tests we show that the pressure-entropy formulation is ideal for resolving fluid mixing at contact discontinuities but performs conspicuously worse at strong shocks due to the large entropy discon…
Standard formulations of smoothed particle hydrodynamics (SPH) are unable to resolve mixing at fluid boundaries. We use an error and stability analysis of the generalised SPH equations of motion to prove that this is due to two distinct problems. The first is a leading order error in the momentum equation. This should decrease with increasing neighbour number, but does not because numerical instabilities cause the kernel to be irregularly sampled. We identify two important instabilities: the clumping instability and the banding instability, and we show that both are cured by a suitable choice …
We suggest a novel discretisation of the momentum equation for Smoothed Particle Hydrodynamics (SPH) and show that it significantly improves the accuracy of the obtained solutions. Our new formulation which we refer to as relative pressure SPH, rpSPH, evaluates the pressure force in respect to the local pressure. It respects Newtons first law of motion and applies forces to particles only when there is a net force acting upon them. This is in contrast to standard SPH which explicitly uses Newtons third law of motion continuously applying equal but opposite forces between particles. rpSPH does …