Numerical methods to improve the treatment of magnetic fields in smoothed field magnetohydrodynamics (SPMHD) are developed and tested. Chapter 2 is a review of SPMHD. In Chapter 3, a mixed hyperbolic/parabolic scheme is developed which cleans divergence error from the magnetic field. Average divergence error is an order of magnitude lower for all test cases considered, and allows for the stable simulation of the gravitational collapse of magnetised molecular cloud cores. The effectiveness of the cleaning may be improved by explicitly increasing the hyperbolic wave speed or by cycling the cleaning equations between timesteps. In the latter, it is possible to achieve DivB=0. Chapter 4 develops a switch to reduce dissipation of the magnetic field from artificial resistivity. Compared to the existing switch in the literature, this leads to sharper shock profiles in shocktube tests, lower overall dissipation of magnetic energy, and importantly, is able to capture magnetic shocks in the highly super-Alfvenic regime. Chapter 5 compares these numerical methods against grid-based MHD methods (using the Flash code) in simulations of the small-scale dynamo amplification of a magnetic field in driven, isothermal, supersonic turbulence. Both codes exponentially amplify the magnetic energy at a constant rate, though SPMHD shows a resolution dependence that arises from the scaling of the numerical dissipation terms. The time-averaged saturated magnetic spectra have similar shape, and both codes have PDFs of magnetic field strength that are log-normal, which become lopsided as the magnetic field saturates. We conclude that SPMHD is able to reliably simulate the small-scale dynamo amplification of magnetic fields. Chapter 6 concludes the thesis and presents some preliminary work demonstrating that SPMHD can activate the magneto-rotational instability in 2D shearing box tests.