Hydromagnetic waves in an expanding universe -- cosmological MHD code
  tests using analytic solutions
  We describe how analytic solutions for linear hydromagnetic waves can be used
for testing cosmological magnetohydrodynamic (MHD) codes. We start from the
comoving MHD equations and derive analytic solutions for the amplitude
evolution of linear hydromagnetic waves in a matter-dominated, flat
Einstein-de-Sitter (EdS) universe. The waves considered are comoving, linearly
polarized Alfv\'en waves and comoving, magnetosonic (fast) waves modified by
selfgravity. The solution for compressible waves is found for a general
adiabatic index and we consider the limits of hydrodynamics without selfgravity
in addition to the full solution. In addition to these analytic solutions, the
linearized equations are solved numerically for a $\Lambda$CDM cosmology. We
use the analytic and numeric solutions to compare with results obtained using
the cosmological MHD code AREPO and find good agreement in all cases. We
envision that our examples could be useful when developing a new cosmological
MHD code or for regression testing of existing codes.
