  In two previous papers (Price & Monaghan 2004a,b) (papers I,II) we have
described an algorithm for solving the equations of Magnetohydrodynamics (MHD)
using the Smoothed Particle Hydrodynamics (SPH) method. The algorithm uses
dissipative terms in order to capture shocks and has been tested on a wide
range of one dimensional problems in both adiabatic and isothermal MHD. In this
paper we investigate multidimensional aspects of the algorithm, refining many
of the aspects considered in papers I and II and paying particular attention to
the code's ability to maintain the div B = 0 constraint associated with the
magnetic field. In particular we implement a hyperbolic divergence cleaning
method recently proposed by Dedner et al. (2002) in combination with the
consistent formulation of the MHD equations in the presence of non-zero
magnetic divergence derived in papers I and II. Various projection methods for
maintaining the divergence-free condition are also examined. Finally the
algorithm is tested against a wide range of multidimensional problems used to
test recent grid-based MHD codes. A particular finding of these tests is that
in SPMHD the magnitude of the divergence error is dependent on the number of
neighbours used to calculate a particle's properties and only weakly dependent
on the total number of particles. Whilst many improvements could still be made
to the algorithm, our results suggest that the method is ripe for application
to problems of current theoretical interest, such as that of star formation.
