Hostname: page-component-76d6cb85b7-5qg8f Total loading time: 0 Render date: 2026-07-24T04:03:41.668Z Has data issue: false hasContentIssue false

Phantom: A Smoothed Particle Hydrodynamics and Magnetohydrodynamics Code for Astrophysics

Published online by Cambridge University Press:  25 September 2018

Daniel J. Price*
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia
James Wurster
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia School of Physics, University of Exeter, Exeter EX4 4QL, UK
Terrence S. Tricco
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia Canadian Institute for Theoretical Astrophysics (CITA), University of Toronto, Toronto, ON M5S 3H8, Canada
Chris Nixon
Affiliation:
Theoretical Astrophysics Group, Department of Physics & Astronomy, University of Leicester, Leicester LE1 7RH, UK
Stéven Toupin
Affiliation:
Institut d’Astronomie et d’Astrophysique (IAA), Université Libre de Bruxelles (ULB), CP226, Boulevard du Triomphe B1050 Brussels, Belgium
Alex Pettitt
Affiliation:
Department of Cosmosciences, Hokkaido University, Sapporo 060-0810, Japan
Conrad Chan
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia
Daniel Mentiplay
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia
Guillaume Laibe
Affiliation:
Centre de Recherche Astrophysique de Lyon, Univ Lyon, ENS de Lyon, CNRS, Saint-Genis-Laval F-69230, France
Simon Glover
Affiliation:
Institut für Theoretische Astrophysik, Zentrum für Astronomie der Universität Heidelberg, D-69120 Heidelberg, Germany
Clare Dobbs
Affiliation:
School of Physics, University of Exeter, Exeter EX4 4QL, UK
Rebecca Nealon
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia Theoretical Astrophysics Group, Department of Physics & Astronomy, University of Leicester, Leicester LE1 7RH, UK
David Liptai
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia
Hauke Worpel
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia AIP Potsdam, An der Sternwarte 16, 14482 Potsdam, Germany
Clément Bonnerot
Affiliation:
Leiden Observatory, Leiden University, PO Box 9513, NL-2300 RA Leiden, the Netherlands
Giovanni Dipierro
Affiliation:
Theoretical Astrophysics Group, Department of Physics & Astronomy, University of Leicester, Leicester LE1 7RH, UK
Giulia Ballabio
Affiliation:
Theoretical Astrophysics Group, Department of Physics & Astronomy, University of Leicester, Leicester LE1 7RH, UK
Enrico Ragusa
Affiliation:
Dipartimento di Fisica, Università Degli Studi di Milano, Via Celoria 16, Milano 20133, Italy
Christoph Federrath
Affiliation:
Research School of Astronomy and Astrophysics, Australian National University, Canberra ACT 2611, Australia
Roberto Iaconi
Affiliation:
Department of Physics and Astronomy, Macquarie University, 2109 Sydney, Australia
Thomas Reichardt
Affiliation:
Department of Physics and Astronomy, Macquarie University, 2109 Sydney, Australia
Duncan Forgan
Affiliation:
St Andrews Centre for Exoplanet Science and School of Physics and Astronomy, University of St. Andrews, North Haugh, St. Andrews, Fife KY16 9SS, UK
Mark Hutchison
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia Physikalisches Institut, Universität Bern, Gesellschaftstrasse 6, 3012 Bern, Switzerland Institute for Computational Science, University of Zurich, Winterthurerstrasse 190, CH-8057 Zürich, Switzerland
Thomas Constantino
Affiliation:
School of Physics, University of Exeter, Exeter EX4 4QL, UK
Ben Ayliffe
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia Met Office, FitzRoy Road, Exeter EX1 3PB, UK
Kieran Hirsh
Affiliation:
Monash Centre for Astrophysics (MoCA) and School of Physics and Astronomy, Monash University, Vic. 3800, Australia
Giuseppe Lodato
Affiliation:
Dipartimento di Fisica, Università Degli Studi di Milano, Via Celoria 16, Milano 20133, Italy
Rights & Permissions [Opens in a new window]

Abstract

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, dust–gas mixtures, H2 chemistry, physical viscosity, external forces including numerous galactic potentials, Lense–Thirring precession, Poynting–Robertson drag, and stochastic turbulent driving. Phantom is hereby made publicly available.

Information

Type
Research Article
Copyright
Copyright © Astronomical Society of Australia 2018 
Figure 0

Table 1. Compact support radii, variance, standard deviation, recommended ranges of hfact, and recommended default hfact settings (hdfact) for the kernel functions available in Phantom.

Figure 1

Figure 1. Smoothing kernels available in Phantom (solid lines) together with their first (dashed lines) and second (dotted lines) derivatives. Wendland kernels in Phantom (bottom row) are given compact support radii of 2, whereas the B-spline kernels (top row) adopt the traditional practice where the support radius increases by 0.5. Thus, use of alternative kernels requires adjustment of hfact, the ratio of smoothing length to particle spacing (see Table 1).

Figure 2

Figure 2. Example of the kd-tree build. For illustrative purposes only, we have constructed a 2D version of the tree on the projected particle distribution in the xy plane of the particle distribution from a polytrope test with 13 115 particles. Each level of the tree recursively splits the particle distribution in half, bisecting the longest axis at the centre of mass until the number of particles in a given cell is <Nmin. For clarity, we have used Nmin = 100 in the above example, while Nmin = 10 by default.

Figure 3

Figure 3. Functional form of the softening kernel functions −ϕ(r, h) and ϕ′(r, h) used to compute the gravitational force in Phantom, shown for each of the available kernel functions w(r, h) (see Figure 1). Dotted lines show the functional form of the unsoftened potential (−1/r) and force (1/r2) for comparison.

Figure 4

Figure 4. Double hump smoothing kernels D(r, h) available in Phantom, used in the computation of the dust–gas drag force.

Figure 5

Figure 5. Dependence of the drag stopping time ts on differential Mach number, showing the increased drag (decrease in stopping time) as the velocity difference between dust and gas increases. The black line shows the analytic approximation we employ [Equation (250)] which may be compared to the red line showing the exact expression from Epstein (1924). The difference is less than 1% everywhere.

Figure 6

Figure 6. Drag stopping time ts (in years) as a function of grain size, showing the continuous transition between the Epstein and Stokes drag regimes. The example shown assumes fixed density ρ = 10−13g/cm3 and sound speed cs = 6 × 104 cm/s with subsonic drag Δv = 0.01cs and material density ρgrain = 3g/cm3.

Figure 7

Figure 7. Emissivity, ΛE (erg s−1 cm3) as a function of temperature for the ISM cooling assuming default abundances appropriate for the warm neutral medium (WNM). Note that as we treat cooling from atomic hydrogen using a full non-equilibrium treatment, the behaviour of ΛE close to 104 K is highly sensitive to the electron fraction, which in the case shown here is much smaller than it would be in collisional ionisation equilibrium. Values of ΛE below 104 K depend strongly on the current chemical state of the gas and are not shown in this plot.

Figure 8

Table 2. Heating and cooling processes in the Phantom cooling module.

Figure 9

Table 3. Default fractional abundances for C, O, Si, and e in the ISM cooling and chemistry modules. Abundances are taken from Sembach et al. (2000) appropriate for the warm neutral medium (WNM). These are lower than solar because it is assumed some fraction of the metals are locked up in dust rather than being available in the gas phase.

Figure 10

Table 4. Processes and references for the Phantom ISM chemistry module tracing the evolution of H, H2, and CO.

Figure 11

Figure 8. Results of the Sod shock tube test in 3D, showing projection of all particles (black dots) compared to the analytic solution (red line). The problem is set up with [ρ, P] = [1, 1] for x ⩽ 0 and [ρ, P] = [0.125, 0.1] for x > 0 with γ = 5/3, with zero velocities and no magnetic field. The density contrast is initialised using equal mass particles placed on a close packed lattice with 256 × 24 × 24 particles initially in x ∈ [− 0.5, 0] and 128 × 12 × 12 particles initially in x ∈ [0, 0.5]. The results are shown with constant αAV = 1.

Figure 12

Figure 9. As in Figure 8, but with code defaults for all dissipation terms (αAV ∈ [0, 1]; αu = 1). These leave more noise in the velocity field behind the shock but provide second-order convergence in smooth flow. The lower right panel in this case shows the resultant values for the viscosity parameter αAV.

Figure 13

Figure 10. Results of the 3D blast wave test, showing projection of all particles (black dots) compared to the analytic solution (red line). The problem is set up with [ρ, P] = [1, 1000] for x ⩽ 0 and [ρ, P] = [1, 0.1] for x > 0 with γ = 7/5, with zero velocities and no magnetic field. We use equal mass particles placed on a close packed lattice with 800 × 12 × 12 particles initially in x ∈ [− 0.5, 0.5]. Results are shown with constant αAV = 1.

Figure 14

Figure 11. As in Figure 10, but with code defaults for dissipation switches (αAV ∈ [0, 1]; αu = 1). As in Figure 9, the velocity field behind the shock is more noisy with switches applied, but the switches reduce the numerical dissipation away from shocks.

Figure 15

Figure 12. Relative error in energy conservation for the 3D blast wave test. Energy is conserved to an error of 10−6 in this test.

Figure 16

Figure 13. Evolution of the relative error in total energy for the Sedov blast wave problem. Resolutions are given in the legend; solid lines use individual timestepping while dotted lines show global timestepping.

Figure 17

Figure 14. Density as a function of radius in the Sedov blast wave problem at three resolutions. All particles are placed initially on a closepacked lattice, are evolved using individual timesteps and we use the quintic kernel. The analytic solution is given by the solid line, and the bottom panels show the residuals compared to the analytical solution.

Figure 18

Figure 15. Results of the well-posed Kelvin–Helmholtz instability test from Robertson et al. (2010), shown at a resolution of (from top to bottom) 64 × 74 × 12, 128 × 148 × 12 and 256 × 296 × 12 equal mass SPH particles. We use stretch mapping (Section 3.2) to achieve the initial density profile, consisting of a 2:1 density jump with a smoothed transition.

Figure 19

Figure 16. Growth of the amplitude of the seeded mode for the Kevin–Helmholtz instability test. The amplitude at t = 2 between the nx = 128 and nx = 256 calculations is within 4%.

Figure 20

Figure 17. Lense–Thirring precession test from a disc inclined by 30°. Here, the precession timescale is measured from the cumulative twist in the disc and the exact solution, tp = R3/2a is represented by the red line.

Figure 21

Figure 18. Inspiral of a test particle subjected to Poynting–Robertson drag using Phantom (blue curve) compared to the expected solution (red curve). For clarity, only some of the points are plotted. The results are indistinguishable on this scale. Bottom panel shows the distance (Δr) between the PHANTOM particle and the test code particle. This demonstrates that the implementation of Poynting–Robertson drag in Phantom is consistent with a fourth-order numerical solution to (106).

Figure 22

Figure 19. Gas in a galactic disc under the effect of different galactic potentials. Top row shows models with a 2, 3, and 4 armed spiral (left to right) with a pitch angle of 15° and pattern speed of 20 km s−1 kpc−1. Bottom row shows a bar potential with pattern speeds of 40, 60, and 80 km s−1 kpc−1 (left to right).

Figure 23

Figure 20. Calibration of the disc viscosity in Phantom, comparing the input value of the Shakura–Sunyaev α from (124) (x-axis) with the measured diffusion rate of the surface density by fitting to a 1D code (y-axis). Triangles indicate simulations with the disc viscosity computed using the artificial viscosity (Section 2.6.1), while squares represent simulations using physical viscosity (Section 2.7.1). All simulations use 2 million particles except for the green, cyan, and red triangles which use 20 million particles. Figure taken from Lodato & Price (2010).

Figure 24

Figure 21. Warp diffusion rate as a function of disc viscosity, showing the Phantom results compared to the non-linear theory of Ogilvie (1999) (dashed line). The linear prediction, α2 = 1/(2α), is shown by the solid line, highlighting the agreement of Phantom with the non-linear theory. Colouring of points is as in Figure 20. Figure taken from Lodato & Price (2010).

Figure 25

Figure 22. Planet–disc interaction in 3D, showing the ‘viscous Jupiter’ calculation comparable to the 2D results shown with various grid and SPH codes in Figure 10 of de Val-Borro et al. (2006). The dotted lines shows the estimated position of the planetary shocks from Ogilvie & Lubow (2002). The offset between this solution and the numerical shock position is due to the approximate nature of the analytic solution (see de Val-Borro et al. 2006).

Figure 26

Figure 23. Test of physical Navier–Stokes viscosity in the Taylor–Green vortex using kinematic shear viscosity ν = 0.05, 0.1, 0.2. The exponential decay rate of kinetic energy may be compared to the analytic solution in each case (solid black lines), demonstrating that the calibration of physical viscosity in Phantom is correct.

Figure 27

Figure 24. Errors in energy conservation in a sink particle binary integration with code default parameters for the timestep control, showing the energy drift caused by the adaptive timestepping. Angular momentum is conserved to machine precision.

Figure 28

Figure 25. Orbit of a sink particle in the restricted three-body problem from Chin & Chen (2005) using default code parameters. This tests both the time integrator for sink particles and the interaction with a time-dependent binary potential (Section 2.4.2). The trajectory of the sink is plotted every timestep for three periods (t = 27π).

Figure 29

Figure 26. Results of the 3D circularly polarised Alfven wave test after five periods, showing perpendicular component of the magnetic field on all particles (black dots) as a function of distance along the axis parallel to the wave vector. Results are shown using 32 × 18 × 18, 64 × 36 × 39, and 128 × 74 × 78 particles (most to least damped, respectively), compared to the exact solution given by the solid red line. Convergence is shown in Figure 27.

Figure 30

Figure 27. Convergence in the 3D circularly polarised Alfven wave test, showing the L1 error as a function of the number of particles along the x-axis, nx alongside the expected slope for second-order convergence (dotted line). Significantly, this demonstrates second-order convergence with all dissipation switched on.

Figure 31

Figure 28. Results of the Brio & Wu (1988) shock tube test in 3D, showing projection of all particles (black dots) compared to the reference solution (red line). The problem is set up with [ρ, P, By, Bz] = [1, 1, 1, 0] for x ⩽ 0 and [ρ, P, By, Bz] = [0.125, 0.1, −1, 0] for x > 0 with zero initial velocities, Bx = 0.75 and γ = 2. The density contrast is initialised using equal mass particles placed on a close packed lattice with 256 × 24 × 24 particles initially in x ∈ [− 0.5, 0] and 128 × 12 × 12 particles initially in x ∈ [0, 0.5].

Figure 32

Figure 29. As in Figure 28 but using code defaults which give second-order convergence away from shocks. Some additional noise in the velocity field is visible, while otherwise the solutions are similar.

Figure 33

Figure 30. Results of the seven-discontinuity MHD shock tube test 2a from Ryu & Jones (1995) in 3D, showing projection of all particles (black dots) compared to the reference solution (red line). The problem is set up with $[\rho , P, v_{x}, v_{y}, v_{z}, B_{x}, B_{y}, B_{z}] = [1.08,0.95,1.2,0.01,0.5,2/\sqrt{4\pi },3.6/\sqrt{4\pi },2/\sqrt{4\pi }]$ for x ⩽ 0 and $[\rho , P, v_{x}, v_{y}, v_{z}, B_{x}, B_{y}, B_{z}] = [1,1,0,0,0,2/\sqrt{4\pi },4/\sqrt{4\pi },2/\sqrt{4\pi }]$ for x > 0 with γ = 5/3. The density contrast is initialised using equal mass particles placed on a close packed lattice with 379 × 24 × 24 particles initially in x ∈ [− 0.5, 0] and 238 × 12 × 12 particles initially in x ∈ [0, 0.5].

Figure 34

Figure 31. Results of the MHD shock tube test 1a from Ryu & Jones (1995) in 3D, showing projection of all particles (black dots) compared to the reference solution (red line). The problem is set up with $[\rho , P, v_{x}, v_{y}, v_{z}, B_{x}, B_{y}, B_{z}] = [1.0,20.0,10,0,0,5/\sqrt{4\pi },5/\sqrt{4\pi },0]$ for x ⩽ 0 and $[\rho , P, v_{x}, v_{y}, v_{z}, B_{x}, B_{y}, B_{z}] = [1,1,-10,0,0,5/\sqrt{4\pi },5/\sqrt{4\pi },0]$ for x > 0 with γ = 5/3. We show results using 652 × 12 × 12 particles. This has historically proven difficult for SPMHD codes. We find ${\cal L}_1$ within 1% of the reference solution except in vy (5%).

Figure 35

Figure 32. Density in a z = 0 cross section of the Orszag-Tang vortex test performed in 3D. Results are shown at t = 0.5 (top) and t = 1 (bottom) at a resolution of 128 × 148 × 12, 256 × 296 × 12 and 512 × 590 × 12 particles (left to right). Compare e.g. to Figure 4 in Dai & Woodward (1994b) or Figure 22 in Stone et al. (2008), while improvements in the SPMHD method over the last decade can be seen by comparing to Figure 14 in Price & Monaghan (2005).

Figure 36

Figure 33. Horizontal slices of pressure shown at t=0.5 in the Orszag–Tang vortex test. We show cuts along y = 0.3125 (top) and y = 0.4277 (bottom) in the z = 0 plane for three different numerical resolutions (see legend).

Figure 37

Figure 34. Density, pressure, Mach number, and magnetic pressure shown in a z = 0 cross section at t = 0.15 in the 3D MHD rotor problem, using nx = 256, equivalent to ~3002 resolution elements in 2D. The plots show 30 contours with limits identical to those given by Tóth (2000); 0.483 < ρ < 12.95, 0.0202 < P < 2.008, 0 < |v|/cs < 1.09, and $0 < \frac{1}{2} B^{2} < 2.642$.

Figure 38

Figure 35. Magnitude of the current density $\vert \nabla \times {\bm B} \vert$ in the current loop advection test performed in 3D, showing comparing the initial conditions (top) to the result after two (middle) and five (bottom) crossings of the box, using 128 × 74 × 12 particles. Full dissipation, shock capturing, and divergence cleaning terms were applied for this test, without which the advection is exact to machine precision. The advection is affected mainly by the divergence cleaning acting on the outer (infinite) current sheet.

Figure 39

Figure 36. Slices through y = 0 for the MHD blast wave problem showing density (top left), gas pressure (top right), magnetic energy density (bottom left), and kinetic energy density (bottom right). The plot limits are ρ ∈ [0.19, 2.98], P ∈ [1, 42.4], [25.2, 64.9] for the magnetic energy density and [0, 33.1] for the kinetic energy density. These are directly comparable to Figure 8 in Gardiner & Stone (2008).

Figure 40

Figure 37. Balsara–Kim supernova-driven turbulence, showing column density at three different times at a resolution of 64 × 74 × 78 particles. Supernovae are injected every 0.00125 in code units, leading to a series of interacting blast waves. Interstellar chemistry and cooling is turned on, producing a dense filaments in a turbulent interstellar medium.

Figure 41

Figure 38. Cross-section slice of magnetic pressure at t = 0.006 in the Balsara–Kim supernova-driven turbulence test using 128 × 148 × 156 particles. No large-scale artefacts in magnetic energy are visible, indicating that the simulation is not corrupted by divergence cleaning.

Figure 42

Figure 39. Magnetic energy as a function of time in the Balsara–Kim supernova-driven turbulence problem. The magnetic energy increases monotonically by approximately an order of magnitude before reaching its saturation value at t ≈ 0.02. There are no spurious spikes in magnetic energy caused by divergence cleaning, in contrast to what was found by Balsara & Kim (2004).

Figure 43

Figure 40. Wave damping test showing the decay of Alfvén waves in the presence of ambipolar diffusion, using the coefficient ηAD = 0.01v2A. The ${\cal L}_2$ error between the analytic and numerical solution is 7.5 × 10−5.

Figure 44

Figure 41. Hall-dominated standing shock using ηOR = 1.12 × 10−12, ηHE = −3.53 × 10−2B, and ηAD = 7.83 × 10 − 3v2A. The numerical and analytical results agree to within 3% everywhere.

Figure 45

Figure 42. Polytrope static structure using 106 particles (black), compared to the exact solution (red), shown at t = 100.

Figure 46

Figure 43. y- and x-positions of the centre of mass of one star of a binary system (top and bottom, respectively). Each star is a polytrope with mass and radius of unity, and N = 104 particles; the initial separation is 6.0 in code units. After ~15 orbits, the separation remains within 1%, and the period remains constant within the given time resolution. The red line represents the analytical position with respect to time, and the black line represents the numerical position.

Figure 47

Figure 44. Thermal, kinetic, total, and potential energies as a function of time during the Evrard collapse (Evrard 1988). Green lines are calculated using a 1D PPM code, taken from Figure 6 of Steinmetz & Mueller (1993), while remaining colours show SPH simulations of different resolutions. Both energy and time are given in code units, where R = M = G = 1.

Figure 48

Figure 45. Radial profile of the Evrard collapse (Evrard 1988) at t = 0.77, red lines are taken from Figure 7 of Steinmetz & Mueller (1993), with panels showing density (top) and radial velocity (bottom) as a function of (log) radius. All values are given in code units, where R = M = G = 1. The outward propagating shock at r ≈ 0.1 is sharper at high resolution.

Figure 49

Figure 46. Decay of kinetic energy as a function of time in the dustybox test, involving a uniformly translating mixture of gas and dust coupled by drag. Solid lines show the Phantom results for drag coefficients K = 0.01, 0.1, 1.0, 10, and 100 (top to bottom), which may be compared to the corresponding analytic solutions given by the dashed red lines.

Figure 50

Figure 47. Velocity of gas (solid) and dust (circles) at t = 4.5 in the dustywave test, using the two-fluid method (left; with 64 × 12 × 12 gas particles, 64 × 12 × 12 dust particles) and the one-fluid method (right; with 64 × 12 × 12 mixture particles) and a dust-to-gas ratio of unity. Panels show results with K = 0.5, 5, 50, and 500 (top to bottom), corresponding to the stopping times indicated. The two-fluid method is accurate when the stopping time is long (top three panels in left figure) but requires hcsts to avoid overdamping (bottom two panels on left; Laibe & Price 2012a). The one-fluid method should be used when the stopping time is short (right figure).

Figure 51

Figure 48. Dust diffusion test from Price & Laibe (2015a), showing the evolution of the dust fraction on the particles (black dots) as a function of radius at six different times (top to bottom), which may be compared to the analytic solution given by the red lines.

Figure 52

Figure 49. 3D version of the dust settling test from Price & Laibe (2015a), showing the dust density in the ‘rz’ plane of a protoplanetary disc. We assume mm-sized grains with a 1% initial dust-to-gas ratio in a stratified disc atmosphere with H/R0 = 0.05 with R0 = 50 au in (331).

Figure 53

Figure 50. Temperature and pressure profiles resulting from the ISM heating and cooling functions (top) and the abundances of H2 and CO as a function of gas density (bottom). The behaviour of the H2 and CO fractions close to n = 10cm−3 is a consequence of H2 self-shielding: In gas which was initially molecular, this remains effective down to lower densities than is the case in gas which was initially atomic. This behaviour is discussed in much greater detail in Dobbs et al. (2008).

Figure 54

Figure 51. Gas column density in Phantom simulations of driven, isothermal, supersonic turbulence at Mach 10, similar to the calculations performed by Price & Federrath (2010). We show the numerical solutions at t = 1, 2, and 3 crossing times (left to right, respectively). The colour scale is logarithmic between 10−1 and 10 in code units.

Figure 55

Figure 52. Time-averaged PDF of s = ln(ρ/ρ0) for supersonic Mach 10 turbulence, with the shaded region representing the standard deviation of the averaging. The PDF is close to a log-normal distribution, shown by the dashed red line.

Figure 56

Figure 53. Star cluster formation with Phantom, showing snapshots of gas column density during the gravitational collapse of a 50 M molecular cloud core, following Bate, Bonnell, & Bromm (2003). Snapshots are shown every 0.2 tff (left to right, top to bottom), with the panels after t > tff zoomed in to show the details of the star formation sequence. As in Bate et al. (2003), we resolve the fragmentation to the opacity limit using a barotropic equation of state.

Figure 57

Figure 54. Magnetically propelled jet of material bursting out of the first hydrostatic core phase of star formation.

Figure 58

Table 5. Component breakdown for each galaxy. For each component, the total mass is M, the particle mass is m, and the number of particles is N.

Figure 59

Figure 55. Evolution of the gas column density in a major merger of two Milky Way-sized galaxies, comparing Phantom to the Hydra code. Times shown are from the onset of the simulation, with each frame (100 kpc)2. The colour bar is log [column density/(M pc−1)].

Figure 60

Figure 56. Top: The evolution of the separation of the galaxies, using centre of mass of the star particles that were assigned to each galaxy as a proxy for the galaxy’s centre; the stars are sufficiently mixed after 1000 Myr, thus a meaningful separation cannot be calculated. Bottom: The evolution of the maximum (solid) and mean (dashed) gas densities for each model.

Figure 61

Figure 57. Gap opening in dusty protoplanetary discs with Phantom (from Dipierro et al. 2016), showing surface density in gas (left) and mm dust grains (right) in two simulations of planet–disc interaction with planet masses of 0.1 MJupiter (top) and 1 MJupiter (bottom) in orbit around a 1.3 M star. In the top case, a gap is opened only in the dust disc, while in the bottom row, the gap is opened in both gas and dust. The colour bar is logarithmic surface density in cgs units.

Figure 62

Figure A1. Flowchart showing the basic structure of Phantom. To the user what appears is a sequence of output files written at discrete time intervals. The core of the code is the timestepping loop, while most of the computational cost is spent building the tree and evaluating density and acceleration by summing over neighbours.

Figure 63

Table A1. Particle types in Phantom. The density and smoothing length of each type is computed only from neighbours of the same type (c.f. Section 2.13.3). Sink particles are handled separately in a different set of arrays.

Figure 64

Figure A2. Pseudo-code for the tree build. The construct_node procedure computes, for a given node, the centre of mass, size, maximum smoothing length, quadrupole moments, and the child and parent pointers and the boundaries of the child nodes.

Figure 65

Figure A3. Pseudo-code for the neighbour search (referred to as the get_neigh routine in Figure A4).

Figure 66

Figure A4. Pseudo-code for the density evaluation in Phantom, showing how Equations (3)–(5) are computed. The force evaluation [evaluating Equations (34) and (35)] is similar except that get_neigh returns neighbours within the kernel radius computed with both hi and hj and there is no need to update/iterate h (see Figure A5).

Figure 67

Figure A5. Pseudo-code for the force calculation, showing how the short and long-range accelerations caused by self-gravity are computed. The quantity fnode refers to the long-range gravitational force on the node computed from interaction with distant nodes not satisfying the tree-opening criterion.

Figure 68

Figure A6. Strong scaling results for the pure OpenMP code for the magnetised star formation problem, showing wall time as a function of the number of OpenMP threads.

Figure 69

Figure A7. Strong scaling results for the pure OpenMP code for the magnetised star formation problem, showing speedup as a function of the number of OpenMP threads.

Figure 70

Figure A8. Pseudo-code for the timestepping routine, showing how the interaction between individual timestepping and the RESPA algorithm is implemented. External forces and sink–gas interactions are computed on the fastest timescale Δtshort ≡ Δtext. Additional quantities defined on the particles follow the velocity terms. The variable twas stores the last time the particle was active and is used to interpolate and synchronise the velocities at the beginning and end of each timestep.

Figure 71

Table A2. Various runtime parameters in the code and their relation to this paper.