Dynamo theory is the only plausible explanation for the omnipresence of magnetic fields in the universe. First proposed by Sir Joseph Larmor in 1919, the basic idea is that the motion of an electrically conducting fluid acts to first amplify and then maintain a magnetic field in a body such as the Earth.

The basic equations of the problem are the Navier-Stokes equation (the form provided below assumes an incompressible fluid), with the addition of the Lorentz force,

and the magnetic induction equation,

(2)Unfortunately an analytic solution, which satisfies these coupled PDEs, is only possible with physically unrealistic assumptions.

Hence progress with reasonably realistic parameters is limited to asymptotic methods or numerical simulations.

Whilst numerical simulations, in particular, have been crucial in expanding our knowledge of the underlying physical mechanisms at work, we are still a long way from operating at anything close to realistic parameters, even implementing massively parallel schemes.

At present I am working on simulations of shocks induced by a gravitational well, such as is expected in the spiral arms of galaxies using the pencil code. I plan to investigate the effect of strong compression and then the subsequent decompression of a random magnetic field moving through the shock.

Below is an image of the galaxy M83 where prominent spiral arms are evident.

Magnetic fields are also found much closer to home, take for example these stunning images taken from NASA's Solar Dynamics Observatory (SDO). Magnetic flux tubes are visible as bundles leaving the surface of the sun, arcing up into the corona , before returning back to the solar surface.

Magnetic reconnection, between the field in the corona, can lead to vast explosions releasing energy, in the form of light and heat. Fortunately on Earth we have our own magnetic field to protect us from the dangerous radiation produced. See this article on the BBC news website for information about a large flare in February 2011.