  A nonlinear force-free field (NLFFF) extrapolation is widely used to
reconstruct the three-dimensional magnetic field in the solar corona from the
observed photospheric magnetic field. However, the pressure gradient and
gravitational forces are ignored in the NLFFF model, even though the
photospheric and chromospheric magnetic fields are not in general force-free.
Here we develop a magnetohydrodynamic (MHD) relaxation method that reconstructs
the solar atmospheric (chromospheric and coronal) magnetic field as a
non-force-free magnetic field (NFFF) in magnetohydrostatic equilibrium where
the Lorentz, pressure gradient, and gravitational forces are balanced. The
system of basic equations for the MHD relaxation method is derived, and
mathematical properties of the system are investigated. A robust numerical
solver for the system is constructed based on the modern high-order shock
capturing scheme. Two-dimensional numerical experiments that include the
pressure gradient and gravitational forces are also demonstrated.
