This paper presents an overview and introduction to Smoothed Particle
Hydrodynamics and Magnetohydrodynamics in theory and in practice. Firstly, we
give a basic grounding in the fundamentals of SPH, showing how the equations of
motion and energy can be self-consistently derived from the density estimate.
We then show how to interpret these equations using the basic SPH interpolation
formulae and highlight the subtle difference in approach between SPH and other
particle methods. In doing so, we also critique several `urban myths' regarding
SPH, in particular the idea that one can simply increase the `neighbour number'
more slowly than the total number of particles in order to obtain convergence.
We also discuss the origin of numerical instabilities such as the pairing and
tensile instabilities. Finally, we give practical advice on how to resolve
three of the main issues with SPMHD: removing the tensile instability,
formulating dissipative terms for MHD shocks and enforcing the divergence
constraint on the particles, and we give the current status of developments in
this area. Accompanying the paper is the first public release of the NDSPMHD
SPH code, a 1, 2 and 3 dimensional code designed as a testbed for SPH/SPMHD
algorithms that can be used to test many of the ideas and used to run all of
the numerical examples contained in the paper.Comment: 44 pages, 14 figures, accepted to special edition of J. Comp. Phys.
on "Computational Plasma Physics". The ndspmhd code is available for download
from http://users.monash.edu.au/~dprice/ndspmhd