This self-contained and detailed mathematical exposition will provide graduate students and researchers with a rigorous understanding of the unique challenges of modelling the Sun's atmosphere and magnetic field, drawing upon the principles of fluid mechanics and electromagnetism to explain observations of solar phenomena.