Computer Physics Communications ( ) Contents lists available at ScienceDirect Computer Physics Communications journal homepage: www.elsevier.com/locate/cpc GRADSPMHD: A parallel MHD code based on the SPH formalism S. Vanaverbeke a,b, , R. Keppens b , S. Poedts b a KU Leuven Campus Kortrijk, E.-Sabbelaan 53, 8500 Kortrijk, Belgium b Centre for Mathematical Plasma Astrophysics, Department of Mathematics, KU Leuven, Celestijnenlaan 200B, 3001 Leuven, Belgium article info Article history: Received 25 June 2013 Received in revised form 4 November 2013 Accepted 12 November 2013 Available online xxxx Keywords: Magnetohydrodynamics SPH Meshfree methods Magnetorotational instability Turbulence abstract We present GRADSPMHD, a completely Lagrangian parallel magnetohydrodynamics code based on the SPH formalism. The implementation of the equations of SPMHD in the ‘‘GRAD-h’’ formalism assembles known results, including the derivation of the discretized MHD equations from a variational principle, the inclusion of time-dependent artificial viscosity, resistivity and conductivity terms, as well as the inclusion of a mixed hyperbolic/parabolic correction scheme for satisfying the ∇· B constraint on the magnetic field. The code uses a tree-based formalism for neighbor finding and can optionally use the tree code for computing the self-gravity of the plasma. The structure of the code closely follows the framework of our parallel GRADSPH FORTRAN 90 code which we added previously to the CPC program library. We demonstrate the capabilities of GRADSPMHD by running 1, 2, and 3 dimensional standard benchmark tests and we find good agreement with previous work done by other researchers. The code is also applied to the problem of simulating the magnetorotational instability in 2.5D shearing box tests as well as in global simulations of magnetized accretion disks. We find good agreement with available results on this subject in the literature. Finally, we discuss the performance of the code on a parallel supercomputer with distributed memory architecture. Program summary Program title: GRADSPMHD 1.0 Catalogue identifier: AERP_v1_0 Program summary URL: http://cpc.cs.qub.ac.uk/summaries/AERP_v1_0.html Program obtainable from: CPC Program Library, Queen’s University, Belfast, N. Ireland Licensing provisions: Standard CPC licence, http://cpc.cs.qub.ac.uk/licence/licence.html No. of lines in distributed program, including test data, etc.: 620503 No. of bytes in distributed program, including test data, etc.: 19837671 Distribution format: tar.gz Programming language: FORTRAN 90/MPI. Computer: HPC cluster. Operating system: Unix. Has the code been vectorized or parallelized?: Yes, parallelized using MPI. RAM: 30 MB for a Sedov test including 15625 particles on a single CPU. Classification: 12. Nature of problem: Evolution of a plasma in the ideal MHD approximation. Solution method: The equations of magnetohydrodynamics are solved using the SPH method. This paper and its associated computer program are available via the Computer Physics Communication homepage on ScienceDirect (http://www.sciencedirect.com/ science/journal/00104655). Corresponding author at: KU Leuven Campus Kortrijk, E.-Sabbelaan 53, 8500 Kortrijk, Belgium. Tel.: +32 50213260. E-mail addresses: Sigfried.Vanaverbeke@kuleuven-kortrijk.be, siegfriedvanaverbeke@gmail.com, sigfried.vanaverbeke@telenet.be (S. Vanaverbeke), Rony.Keppens@wis.kuleuven.be (R. Keppens), Stefaan.Poedts@wis.kuleuven.be (S. Poedts). 0010-4655/$ – see front matter © 2013 Elsevier B.V. All rights reserved. http://dx.doi.org/10.1016/j.cpc.2013.11.006