A Free, Fast, Simple, and Efficient Total Variation Diminishing Magnetohydrodynamic Code
Abstract
We describe a numerical method to solve the magnetohydrodynamic (MHD) equations. The fluid variables are updated along each direction using the flux-conservative, second-order, total variation diminishing (TVD), upwind scheme of Jin & Xin. The magnetic field is updated separately in two-dimensional advection-constraint steps. The electromotive force (EMF) is computed in the advection step using the TVD scheme, and this same EMF is used immediately in the constraint step in order to preserve ∇˙B=0 without the need to store intermediate fluxes. Operator splitting is used to extend the code to three dimensions, and Runge-Kutta is used to get second-order accuracy in time. The advantages of this code are high-resolution per grid cell, second-order accuracy in space and time, enforcement of the ∇˙B=0 constraint to machine precision, no memory overhead, speed, and simplicity. A three-dimensional FORTRAN implementation less than 400 lines long is made freely available. We also implemented a fully scalable message-passing parallel MPI version. We present tests of the code on MHD waves and shocks.
- Publication:
-
The Astrophysical Journal Supplement Series
- Pub Date:
- December 2003
- DOI:
- 10.1086/378771
- arXiv:
- arXiv:astro-ph/0305088
- Bibcode:
- 2003ApJS..149..447P
- Keywords:
-
- Methods: Numerical;
- Magnetohydrodynamics: MHD;
- Astrophysics
- E-Print:
- 17 pages, 6 figures, submitted to the astrophysical journal