Add support for 3d MHD, make MHD test program independent of number of dimensions.