OpenMHD code

Japanese | English

OpenMHD is a two-dimensional finite-volume code for magnetohydrodynamics (MHD). The code is written in Fortran 90. It is parallelized by using MPI-3 and OpenMP.

OpenMHD was originally developed for my studies on magnetic reconnection [1,2]. In addition, substantial improvements have been made since then. The code has been made publicly available in the hope that others may find it useful.

Obtaining the code

The following versions are available in .tar.gz format.

The source code is hosted on GitHub.

Basic equations

OpenMHD solves the following equations of magnetohydrodynamics. \begin{align} \frac{\partial \rho}{\partial t} &+ \nabla \cdot ( \rho \vec{v} ) = 0, \\ \frac{\partial \rho \vec{v}}{\partial t} &+ \nabla \cdot ( \rho\vec{v}\vec{v} + p_T\overleftrightarrow{I} - \vec{B}\vec{B} ) = 0, \\ \frac{\partial e}{\partial t} &+ \nabla \cdot \Big( (e+p_T )\vec{v} - (\vec{v}\cdot\vec{B}) \vec{B} + \eta \vec{j} \times \vec{B} \Big) = 0, \\ \frac{\partial \vec{B}}{\partial t} &+ \nabla \cdot ( \vec{v}\vec{B} - \vec{B}\vec{v} ) + \nabla \times (\eta \vec{j}) + \nabla \psi = 0, \\ \frac{\partial \psi}{\partial t} &+ c_h^2 \nabla \cdot \vec{B} = - \Big(\frac{c_h^2}{c_p^2}\Big) \psi, \end{align} where $p_T=p+B^2/2$ is the total pressure, $\overleftrightarrow{I}$ is the unit tensor, $e=p/(\Gamma-1) + \rho v^2/2 + B^2/2$ is the energy density, $\Gamma=5/3$ is the adiabatic index, and $\psi$ is a virtual potential for hyperbolic divergence cleaning [3]. The second-order Runge=Kutta methods and second-order MUSCL scheme are employed. The source term for $\psi$ is handled by an operator splitting method and an analytic solution $\psi = \psi_0 \exp [ - ({c_h^2}/{c_p^2}) t ]$. Other numerical techniques are documented in Ref. [1] and references therein. In addition, the latest version contains the HLLD flux solver [4,2] and other improvements such as the parallel I/O.

References
  1. S. Zenitani & T. Miyoshi, Phys. Plasmas 18, 022105 (2011)
  2. S. Zenitani, Phys. Plasmas 22, 032114 (2015)
  3. A. Dedner et al., J. Comput. Phys. 175, 645 (2002)
  4. T. Miyoshi & K. Kusano, J. Comput. Phys. 208, 315 (2005)
Presentation file