  We develop a nonlinear force-free field (NLFFF) extrapolation code based on
the magnetohydrodynamic (MHD) relaxation method. We extend the classical MHD
relaxation method in two important ways. First, we introduce an algorithm
initially proposed by cite{2002JCoPh.175..645D} to effectively clean the
numerical errors associated with $nabla cdot vec{B}$. Second, the multi-grid
type method is implemented in our NLFFF to perform direct analysis of the
high-resolution magnetogram data. As a result of these two implementations, we
successfully extrapolated the high resolution force-free field introduced by
cite{1990ApJ...352..343L} with better accuracy in a drastically shorter time.
We also applied our extrapolation method to the MHD solution obtained from the
flux-emergence simulation by cite{2012ApJ...748...53M}. We found that NLFFF
extrapolation may be less effective for reproducing areas higher than a
half-domain, where some magnetic loops are found in a state of continuous
upward expansion. However, an inverse S shaped structure consisting of the
sheared and twisted loops formed in the lower region can be captured well
through our NLFFF extrapolation method. We further discuss how well these
sheared and twisted fields are reconstructed by estimating the magnetic
topology and twist quantitatively.
