Institute of Astronomy, Madingley Rd, Cambridge, CB3 0HA, UK
School of Mathematical Sciences, Monash University, Clayton 3800, Australia
In this paper we show how a Lagrangian variational principle can be used to derive the SPMHD (Smoothed Particle Magnetohydrodynamics) equations for ideal MHD. We also consider the effect of a variable smoothing length in the SPH kernels after which we demonstrate by numerical tests that the consistent treatment of terms relating to the gradient of the smoothing length in the SPMHD equations significantly improves the accuracy of the algorithm. Our results complement those obtained in a companion paper (\citealt{pm03a}, paper I) for non ideal MHD where artificial dissipative terms were included to handle shocks.
*The pdf version is an electronic version of an article published in Monthly Notices of the Royal Astronomical Society: complete citation information for the final version of the paper, as published in the print edition of Monthly Notices of the Royal Astronomical Society, is available on the Blackwell Science Synergy online delivery service, accessible via the journal's Website at:http://www.blacksci.co.uk/MNR