<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">AM</journal-id><journal-title-group><journal-title>Applied Mathematics</journal-title></journal-title-group><issn pub-type="epub">2152-7385</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/am.2012.331250</article-id><article-id pub-id-type="publisher-id">AM-24764</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  LSFEM Implementation of MHD Numerical Solver
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>an</surname><given-names>Skála</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Miroslav</surname><given-names>Bárta</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>University J. E. Purkinje, ústí nad Labem, Czech Republic</addr-line></aff><aff id="aff2"><addr-line>Astronomical Institute of Czech Academy of Sciences, Ond?ejov, Czech Republic</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>barta@asu.cas.cz(MB)</email>;</corresp></author-notes><pub-date pub-type="epub"><day>27</day><month>11</month><year>2012</year></pub-date><volume>03</volume><issue>11</issue><fpage>1842</fpage><lpage>1850</lpage><history><date date-type="received"><day>August</day>	<month>7,</month>	<year>2012</year></date><date date-type="rev-recd"><day>September</day>	<month>8,</month>	<year>2012</year>	</date><date date-type="accepted"><day>September</day>	<month>16,</month>	<year>2012</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  Many problems in physics are inherently of multi-scale nature. The issues of MHD turbulence or magnetic reconnection, namely in the hot and sparse, almost collision-less astrophysical plasmas, can stand as clear examples. The Finite Element Method (FEM) with adaptive gridding appears to be the appropriate numerical implementation for handling the broad range of scales contained in such high Lundquist-number MHD problems. In spite the FEM is now routinely used in engineering practice in solid-state and fluid dynamics, its usage for MHD simulations has recently only begun and only few implementations exist so far. In this paper we present our MHD solver based on the Least-Square FEM (LSFEM) formulation. We describe the transformation of the MHD equations into form required for finding the LSFEM functional and some practical issues in implementation of the method. The algorithm was tested on selected problems of ideal (non-resistive) and resistive MHD. The tests show the usability of LSFEM for solving MHD equations.
 
</p></abstract><kwd-group><kwd>Magnetohydrodynamics (MHD); Least-Squares Finite Element Method; Adaptive Mesh Refinement; Magnetic Reconnection; Solar Eruptions; MHD Turbulence</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Dynamics of magnetized plasma at sufficiently large spatial and temporal scales can be adequately described by the set of magnetohydrodynamic (MHD) equations [<xref ref-type="bibr" rid="scirp.24764-ref1">1</xref>]. In many problems we face the situation with high Lundquist (a.k.a. magnetic Reynolds) number</p><p><img src="11-7401035\9c19f378-fc91-42c2-8ca9-aa29f2ccbae2.jpg" /></p><p>where L is the characteristic size of the system, <img src="11-7401035\2db5b913-df9b-4303-b234-c1daae2f4355.jpg" />the typical Alfv&#233;n velocity (B and <img src="11-7401035\5e4dd476-97fd-4112-99f2-8fb9e50f04b7.jpg" /> being the magnetic field strength and plasma density, respectively) and <img src="11-7401035\536a6b65-30a5-4526-8e02-4dc874ddf39a.jpg" /> the electric resistivity. A direct consequence of the high Lundquist number is a large separation between the system size and the dissipation scale. The cascading fragmentation of the current layer in the magnetic reconnection in solar flares [2-4] can serve as an example of such a multi-scale problem: The span between the eruption size (<img src="11-7401035\fd5ce2ba-8980-4922-bc26-93e2ca18dd14.jpg" />km) and the dissipation scale (1 m - 10 m) in the practically collision-less coronal plasmas easily extends seven orders of magnitude.</p><p>In general, there are two approaches how to handle such a broad range of scales. The first one uses a moderate numerical resolution and models the physics on the sub-grid (unresolved) scales using some plausible assumptions on the micro-scale statistical properties (correlations) of the quantities that define the system (e.g. flow or magnetic field). Among them, e.g., the LargeEddy Simulations (LES) [<xref ref-type="bibr" rid="scirp.24764-ref5">5</xref>] or Reynolds-Averaged Numerical Simulations (RANS) [<xref ref-type="bibr" rid="scirp.24764-ref6">6</xref>] belong to the well known methods used widely in engineering applications in the fluid dynamics.</p><p>The second approach is based on direct simulations that cover all the scales contained in the problem. Traditionally, the Adaptive Mesh Refinement (AMR) technique is used with the Finite-Difference/Finite Volume Methods in order to resolve high-gradient regions locally, keeping the total number of grid points required for simulation at a manageable level [7-9]. Nevertheless, also this approach has its limitations caused by introduction of artificial boundaries between fine and coarse meshes. This problem, however, can be cured by the methods based on unstructured mesh, such as is used in FEM. With this in mind we have implemented a FEM-based solver for MHD equations and present it in the current paper. From various FEM formulations we have chosen the LSFEM because it is robust, universal (it can solve all kinds of partial differential equations) and it is efficient—it always leads to the system of linearized equations with symmetric, positive definite matrix [<xref ref-type="bibr" rid="scirp.24764-ref10">10</xref>]. The LSFEM keeps many key properties of the Rayleigh-Ritz formulation even for systems of equations for which the equivalent optimization problem (in Rayleigh-Ritz sense) does not exist [<xref ref-type="bibr" rid="scirp.24764-ref11">11</xref>].</p><p>Despite of the FEM applications in the fluid dynamics made a substantial development in the past years, its usage for numerical solution of MHD equations is still rather rare. For example, the NIMROD [<xref ref-type="bibr" rid="scirp.24764-ref12">12</xref>] and M3D codes [<xref ref-type="bibr" rid="scirp.24764-ref13">13</xref>]—based on Galerkin formulation—belong to a few known implementations of FEM-based MHD solvers. Related work also has been done by [<xref ref-type="bibr" rid="scirp.24764-ref14">14</xref>] who implemented the MHD (and two-fluid) equations within the more general code framework SEL [<xref ref-type="bibr" rid="scirp.24764-ref15">15</xref>] based on the Galerkin formulation with high-order Jacobi polynomials as the basis functions. However, to our knowledge, the LSFEM implementation of the MHD solver described in the current paper is the first attempt of this kind.</p><p>The paper is organized as follows: First, we briefly describe the underlying MHD model. Then, the MHD equations are re-formulated in the general flux/source (conservative) formulation. Temporal discretization, reduction to the first-order system, and linearization procedure are described subsequently. Then, the properties of the least-square formulation of FEM are briefly summarized. Some practical arrangements of the LSFEM implementation of the MHD solver follows. Finally, the code is tested on a couple of standardized model problems and the results are discussed with respect to the intended application of the code to the current-layer filamentation and decay during the magnetic reconnection in solar eruptions.</p></sec><sec id="s2"><title>2. MHD Equations</title><p>The large-scale dynamics of magnetized plasma can be described by MHD equations for compressible resistive fluid [<xref ref-type="bibr" rid="scirp.24764-ref1">1</xref>]:</p><disp-formula id="scirp.24764-formula24194"><label>(1)</label><graphic position="anchor" xlink:href="11-7401035\4ffb9fbc-c9c5-4a84-ac3e-44d2d0879601.jpg"  xlink:type="simple"/></disp-formula><p>where ρ, v, B, U are density, macroscopic velocity, magnetic field, and total energy density, respectively, g being the gravity acceleration. The energy flux S and auxiliary variables j (current density) and p (plasma pressure) are given by the following relations:</p><disp-formula id="scirp.24764-formula24195"><label>(2)</label><graphic position="anchor" xlink:href="11-7401035\c0284e5d-9e59-493f-a9c9-5a371ec6af12.jpg"  xlink:type="simple"/></disp-formula><p>In the (almost) collision-less plasma, in which we are mostly interested, the classical resistivity usually plays a small role. Instead of that various microscopical (kinetic) effects influence the plasma dynamics via other terms in the generalized Ohms law [<xref ref-type="bibr" rid="scirp.24764-ref16">16</xref>]. In order to mimic these processes, whose modeling is beyond the scope of MHD approach, we re-consider the parameter <img src="11-7401035\70de63d6-bd8a-4ac0-96e3-ada3e2779a9d.jpg" /> as a generalized resistivity, including the effects like wave-particle interactions or off-diagonal components in the electron pressure tensor into it. As such effects are—in general— observed in the highly filamented, intense current sheets we model the anomalous generalized resistivity as follows:</p><disp-formula id="scirp.24764-formula24196"><label>(3)</label><graphic position="anchor" xlink:href="11-7401035\1b2fd364-8621-4b8e-89cb-be259c6eafd4.jpg"  xlink:type="simple"/></disp-formula><p>Thus, the non-ideal effects are turned on whenever the current-carrier drift velocity</p><disp-formula id="scirp.24764-formula24197"><label>(4)</label><graphic position="anchor" xlink:href="11-7401035\956ce68d-039e-40b3-95a7-6194a46b55e5.jpg"  xlink:type="simple"/></disp-formula><p>exceeds the critical threshold<img src="11-7401035\f080f171-d7b3-4a0a-aa66-08b46cd6ffc0.jpg" />.</p><p>In order to solve the Equation (1) numerically, it is convenient to rescale all the quantities into the dimensionless units. Thus, all the spatial coordinates are expressed in the characteristic size L and times in Alfv&#233;n transit time<img src="11-7401035\e8e8c0da-5e8e-49df-8c43-f612ca36acc9.jpg" />, where <img src="11-7401035\92667d71-9931-4e64-b521-5e6408e4ca7d.jpg" /> is a typical Alfv&#233;n speed. Magnetic field strength B and plasma density <img src="11-7401035\ba9bf68e-8ff9-49a3-a430-b8c06b2bb90f.jpg" /> are given in units of their characteristic values <img src="11-7401035\930f4004-44eb-4e94-b6ec-6bbecb4f737e.jpg" /> and <img src="11-7401035\5306c5d1-f295-4d05-a690-07b3e703010a.jpg" /> and similar scaling holds for the other quantities—see [<xref ref-type="bibr" rid="scirp.24764-ref17">17</xref>] or [<xref ref-type="bibr" rid="scirp.24764-ref3">3</xref>] for details. From now on we shall use this dimension-less system.</p><p>In order to utilize a more universal LSFEM implementation for more general form of equations (c.f. with SEL approach [<xref ref-type="bibr" rid="scirp.24764-ref14">14</xref>]) the set of MHD Equation (1) is rewritten into the conservative (flux/source) formulation:</p><disp-formula id="scirp.24764-formula24198"><label>(5)</label><graphic position="anchor" xlink:href="11-7401035\da6f5435-3a7b-4794-8102-308f9ffceaf7.jpg"  xlink:type="simple"/></disp-formula><p>Here the local state vector<img src="11-7401035\a7334de2-996e-4ab4-8519-d0fda9ffa3c9.jpg" />, <img src="11-7401035\8573656e-636c-4b41-a3b8-dd3d84d93f7d.jpg" />being the momentum density. The flux <img src="11-7401035\c3dcb829-91ff-4fdd-9506-06ba39b87f30.jpg" /> and the source-term <img src="11-7401035\06bb3012-c3a0-4d44-af16-b00c0ed329ba.jpg" /> are defined as</p><disp-formula id="scirp.24764-formula24199"><label>(6)</label><graphic position="anchor" xlink:href="11-7401035\fe7744d8-e78f-48c2-9d3b-748964c8d3c2.jpg"  xlink:type="simple"/></disp-formula><p>where <img src="11-7401035\13489631-8069-4ad5-ad6d-cf4e53b84925.jpg" /> is the <img src="11-7401035\7e0c6f4d-afc7-4c1e-a18e-26fe8b1ef874.jpg" /> unit matrix, <img src="11-7401035\60c27255-8532-4729-bdcd-9314432aaf03.jpg" />is the permutation pseudo-tensor, <img src="11-7401035\e1236943-a6f8-4b02-8c62-880bbdc13131.jpg" />is the electric field strength. The the enthalpy and kinetic energy densities are <img src="11-7401035\d4ba6bdb-9089-4e9e-8806-dfb9c719fdeb.jpg" /> and<img src="11-7401035\8532a4c3-0a46-478b-a558-a5e0608378c1.jpg" />, respectively.</p></sec><sec id="s3"><title>3. FEM Formulation of MHD System</title><p>In general, FEM is formulated for the linear problem</p><disp-formula id="scirp.24764-formula24200"><label>(7)</label><graphic position="anchor" xlink:href="11-7401035\939d3ced-de2b-47ba-84b1-0d93a848e119.jpg"  xlink:type="simple"/></disp-formula><p>where L is the linear (differential) operator, B the boundary operator, <img src="11-7401035\f99cd0e4-fafc-4135-9c90-a00c9e19b551.jpg" />is the domain and <img src="11-7401035\c72e806d-6d7d-4ed8-8c4f-a0e1dd75849e.jpg" /> is the boundary of<img src="11-7401035\e37511d9-3de9-4e78-9637-ceea070e5767.jpg" />.</p><p>In order to reformulate the system of Equations (5) into the standardized problem (7) several steps have to be undertaken. First of all, we perform the time discretization. We use the standard <img src="11-7401035\3873a728-1908-4973-bfa9-df3aecbd7fda.jpg" />-differencing scheme (see [<xref ref-type="bibr" rid="scirp.24764-ref18">18</xref>]):</p><disp-formula id="scirp.24764-formula24201"><label>(8)</label><graphic position="anchor" xlink:href="11-7401035\f34033de-dc1b-48bd-a831-2d1bbacc74bb.jpg"  xlink:type="simple"/></disp-formula><p>where parameter <img src="11-7401035\cd355b6d-770c-4859-8e54-e09a1deec82d.jpg" /> controls the implicitness of the scheme, and n and <img src="11-7401035\c22825ef-40c6-4ca5-8806-f5d5efa72e2b.jpg" /> designate the old and new time-steps, respectively. The scheme leads to the following semi-implicit equation</p><disp-formula id="scirp.24764-formula24202"><label>(9)</label><graphic position="anchor" xlink:href="11-7401035\4bd7c87f-476e-4736-994a-451d65df3126.jpg"  xlink:type="simple"/></disp-formula><p>where the RHS vector <img src="11-7401035\e749ea81-7a0d-4402-b82f-4caaf92b3a94.jpg" /> consists of components known at old time step.</p><p>Since practical implementations of LSFEM require first order system of PDEs [10,11] we further transform the system (5) to the required form introducing a new independent system variable—the electric field</p><disp-formula id="scirp.24764-formula24203"><label>(10)</label><graphic position="anchor" xlink:href="11-7401035\b64eafb5-e265-4d25-a3fe-1fdccb51ef63.jpg"  xlink:type="simple"/></disp-formula><p>The procedure is basically analogous to the velocityvorticity formulation of the Navier-Stokes equations in the CFD.</p><p>A frequent problem in the numerical MHD is a violence of the solenoidal condition<img src="11-7401035\b0f23d64-9c6b-4fdb-b072-139acf3b7973.jpg" />, where the (dummy) variable <img src="11-7401035\5538f23e-95d2-4572-afd9-901757a41d36.jpg" /> represents the artificial density of the magnetic charge. The advantage of the LSFEM implementation is that this constraint can be directly included into the set of the governing equations [<xref ref-type="bibr" rid="scirp.24764-ref10">10</xref>]. Then assembling the solenoidal condition together with Equations (9) and (10) we arrive to the following 1st-order vector equation for our modeled system:</p><disp-formula id="scirp.24764-formula24204"><label>(11)</label><graphic position="anchor" xlink:href="11-7401035\88ceb198-2670-4d08-b5b2-e5d35f5211d4.jpg"  xlink:type="simple"/></disp-formula><p>where all the LHS terms are evaluated in the advanced time-step<img src="11-7401035\45dce6a5-c8fd-4074-84a3-f8b5f1d70476.jpg" />. Here, <img src="11-7401035\a78e65db-e93b-44f1-bf95-31ec69af1c32.jpg" />and <img src="11-7401035\a012cd4b-a37a-4ef9-b26f-143e9a39df99.jpg" /> are given by Equation (6) with <img src="11-7401035\fce811a4-850a-4329-b0b4-7d5a4da458d0.jpg" /> considered as an independent variable now and<img src="11-7401035\b4451546-2318-4100-9b40-cbe32ad1e20b.jpg" />. The fluxes <img src="11-7401035\b5109cb6-2359-4c7d-ab27-3474e2353a5d.jpg" /> and <img src="11-7401035\c4b33577-81ad-43f2-b97e-13614ae6f4ee.jpg" /> imply from Equation (10) and the solenoidal condition. The source term component <img src="11-7401035\9f17ee0e-9648-4895-a1a2-67ce177cac67.jpg" />. We keep the artificial magnetic-charge density <img src="11-7401035\65ed4d34-baa9-4570-83dc-80c2dc8832f5.jpg" /> at zero.</p><p>Equation (11) can be written in the conservative form similarly as in Equation (5)</p><disp-formula id="scirp.24764-formula24205"><label>(12)</label><graphic position="anchor" xlink:href="11-7401035\014f36fa-f2bc-4657-980d-f17bfd34bfe6.jpg"  xlink:type="simple"/></disp-formula><p>with the extended state vector, fluxes and source terms in the form</p><disp-formula id="scirp.24764-formula24206"><label>(13)</label><graphic position="anchor" xlink:href="11-7401035\1732e49a-5303-465d-87f6-7d1ee0c8e73f.jpg"  xlink:type="simple"/></disp-formula><p>Since the extended flux <img src="11-7401035\9e9f559d-0b5f-4c8b-b9f5-1d91fb0cd469.jpg" /> and source term <img src="11-7401035\4954762d-661e-4c00-bbb6-27ca25240464.jpg" /> depend non-linearly on the state vector<img src="11-7401035\9cd45f9c-2439-4cf1-8b85-2ebb28ca7d4f.jpg" />, a linearization procedure has to be applied in order to transform the system (12) into the FEM-conforming form (7). We use the standard Newton-Raphson (NR) iterations in each time step [10,19]. Thus, the flux at the NR iteration <img src="11-7401035\056ae8e0-a0bd-4c3f-a285-1a0bdb4cd9c0.jpg" /> can be expressed as [<xref ref-type="bibr" rid="scirp.24764-ref18">18</xref>]:</p><disp-formula id="scirp.24764-formula24207"><label>(14)</label><graphic position="anchor" xlink:href="11-7401035\36cbcfac-6311-4f2f-be44-77130a7e1426.jpg"  xlink:type="simple"/></disp-formula><p>and analogous expression holds for the source term. Introducing the Jacobians</p><disp-formula id="scirp.24764-formula24208"><label>(15)</label><graphic position="anchor" xlink:href="11-7401035\d64ebade-6e3e-4201-bac3-02e2cfdc5df4.jpg"  xlink:type="simple"/></disp-formula><p>the final equation for NR iterations reads</p><disp-formula id="scirp.24764-formula24209"><label>(16)</label><graphic position="anchor" xlink:href="11-7401035\3d1fe7e0-9d0b-4ca6-b32c-9f1beb87c135.jpg"  xlink:type="simple"/></disp-formula><p>where the RHS contains only the terms from the <img src="11-7401035\4949ac34-788b-4db9-83cf-c8371bf0d631.jpg" />th iteration of the currently solved time-step <img src="11-7401035\ee1b4da3-4965-4185-8bc3-3534e9910577.jpg" /> and variables known at the previous step<img src="11-7401035\046a290e-d2ff-4b20-ad1a-743d5bb43610.jpg" />. Equation (16) is already in the form (7) with</p><disp-formula id="scirp.24764-formula24210"><label>(17)</label><graphic position="anchor" xlink:href="11-7401035\5dd1f1df-3aa6-48a2-b476-5be8ad867ec9.jpg"  xlink:type="simple"/></disp-formula></sec><sec id="s4"><title>4. LSFEM Implementation</title><p>In the least-square formulation of the FEM the problem described by Equation (7) is transformed to seeks the minimum of the functional</p><disp-formula id="scirp.24764-formula24211"><label>(18)</label><graphic position="anchor" xlink:href="11-7401035\716de57d-4ea9-418b-91b6-28a945096614.jpg"  xlink:type="simple"/></disp-formula><p>where w is appropriate mesh-dependent weighting factor [<xref ref-type="bibr" rid="scirp.24764-ref11">11</xref>]. As in other FEM implementations, the solution is searched for in a limited subspace of functions that are formed as a union of the piece-wise functions <img src="11-7401035\07ee4c75-1da4-4673-a053-f283570850a0.jpg" /> defined on a single, in our code triangular element, as a linear combination of the basis functions<img src="11-7401035\9faa9f16-8400-4365-a2b1-64e491c743bd.jpg" />:</p><disp-formula id="scirp.24764-formula24212"><label>(19)</label><graphic position="anchor" xlink:href="11-7401035\6ecf4c37-6380-4f0b-8590-28c8d834c22c.jpg"  xlink:type="simple"/></disp-formula><p>where <img src="11-7401035\b67e44f3-40a5-438e-b601-8320ba0ed0d2.jpg" /> can always represent the value of a function <img src="11-7401035\7dd3603e-4ec2-4360-a487-d58ad920edad.jpg" /> in a properly selected point (the node)<img src="11-7401035\00db43b4-e263-4757-ae19-78b84f6516e8.jpg" />. Here <img src="11-7401035\4e7a0c01-68f0-465f-81f6-f28e3aa667fd.jpg" /> denotes element-wise index of the node. In our code we use Lagrangian polynomials for basis functions<img src="11-7401035\88aaa9d3-fd39-4fff-b123-df3102d52a54.jpg" />.</p><p>Varying the functional (18) and inserting the expansion (19) we arrive to a set of linear algebraic equations for each internal element in the form</p><disp-formula id="scirp.24764-formula24213"><label>(20)</label><graphic position="anchor" xlink:href="11-7401035\cb91b971-04ac-41cd-88f8-0b4e91d04449.jpg"  xlink:type="simple"/></disp-formula><p>where <img src="11-7401035\0914610a-d9e4-4b39-8f18-138010d872e9.jpg" /> is the domain of the <img src="11-7401035\e9e94837-eb97-47ab-a909-346c6d419e27.jpg" />-th element in the global domain<img src="11-7401035\235bc3d6-3829-4d82-89c8-bc3b767f0d21.jpg" />. The boundary elements contain additional terms obtained from the boundary operator (the second term in Equation (18)). For fast evaluation of local integrals we use Gaussian quadrature [<xref ref-type="bibr" rid="scirp.24764-ref18">18</xref>] in the system of element natural coordinates [<xref ref-type="bibr" rid="scirp.24764-ref20">20</xref>].</p><p>Equations (20) for each element are finally assembled to a global linear system of equations via mapping the element-wise node index j to a global node index N described in [<xref ref-type="bibr" rid="scirp.24764-ref18">18</xref>], to obtain</p><disp-formula id="scirp.24764-formula24214"><label>(21)</label><graphic position="anchor" xlink:href="11-7401035\e80eca01-71f9-46bf-b760-c1d058cfe68f.jpg"  xlink:type="simple"/></disp-formula><p>The final matrix K is sparse, symmetric and positive definite. In our code we use preconditioned Jacobi Conjugate Gradient Method (JCGM) [<xref ref-type="bibr" rid="scirp.24764-ref21">21</xref>] for solution of the system (21).</p><p>The entire algorithm can be summarized as follows:</p><p>−&#160;&#160;&#160;&#160;&#160; time loop—adapt time step size according to CFL condition, check final desired time</p><p>−&#160;&#160;&#160;&#160;&#160; linearization loop—if <img src="11-7401035\a5cb4b91-b7be-4519-aa35-41603314e999.jpg" /> or maximum iteration count is reached continue to next time step&#160;</p><p>−&#160;&#160;&#160;&#160;&#160; assembling stiffness matrix <img src="11-7401035\67e5c5d8-66d0-4a29-b1e1-776f6ba9d205.jpg" /> element by element&#160;</p><p>−&#160;&#160;&#160;&#160;&#160; integration by Gaussian quadrature&#160;</p><p>1)&#160; compute the operator matrices for each basis function 2)&#160; multiply the operator matrices then add the result into stiffness matrix 3)&#160; multiply the operator matrix by the RHS then add result into the load vector</p><p>−&#160;&#160;&#160;&#160;&#160; next Gaussian point</p><p>−&#160;&#160;&#160;&#160;&#160; next element</p><p>−&#160;&#160;&#160;&#160;&#160; find new solution <img src="11-7401035\bad648ce-207d-45cc-9d56-21962a45c14d.jpg" /> of system (21) by the JCGM</p><p>−&#160;&#160;&#160;&#160;&#160; next linearization</p><p>−&#160;&#160;&#160;&#160;&#160; next time step Thanks to the iterative nature of the JCGM, the solver algorithm can be rather easily parallelized via MPI. We decompose the entire domain into subdomains, splitting the global matrix K and the load vector <img src="11-7401035\5f21b428-18f3-47cb-97db-da81d02e498d.jpg" /> into corresponding segments with rather small overlaps related to internal-boundary nodes shared by both adjacent subdomains. Matrix multiplications are then performed only locally (per-process) and, finally, resulting global vectors are appropriately assembled using MPI operations that transfer the data related to overlapping nodes only.</p></sec><sec id="s5"><title>5. Numerical Tests</title><p>In order to assess usability and properties of the LSFEM MHD solver we perform several tests on standardized ideal (non-resistive) and resistive MHD problems. For all test we use the adiabatic index<img src="11-7401035\6b93e48c-e1cd-49f6-b0e7-fd23bc1cfdc6.jpg" />, the implicitness parameter <img src="11-7401035\d1fc86ae-beb9-44ff-9fd8-1354ba9ad66f.jpg" /> (Crank-Nicholson time discretization), and the Courant number 0.6.</p><sec id="s5_1"><title>5.1. Ryu-Jones Discontinuity Test Problem</title><p>First, we applied our code onto the standard Ryu-Jones ideal MHD 1D shock/discontinuity problem [<xref ref-type="bibr" rid="scirp.24764-ref22">22</xref>]. The initial state is given by prescriptions <img src="11-7401035\7e1b99a7-519e-4267-a2d0-e779d8a280dd.jpg" /> in the left half, and <img src="11-7401035\017b0550-29cd-44e2-95ee-fc97f85038c1.jpg" /> in the right half of the computational box, respectively. The domain <img src="11-7401035\9167caa5-fe1f-4e06-8947-96736fbb46be.jpg" /> was divided into 512 elements. We used the first order basis functions to approximate the FEM solution. The boundary conditions on both ends are of von Neumann type. Results at time <img src="11-7401035\53df5960-af6e-43cc-a770-62e9ee722fd9.jpg" /> are shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>. They correspond and could be compared with <xref ref-type="fig" rid="fig3">Figure 3</xref>(b) in [<xref ref-type="bibr" rid="scirp.24764-ref22">22</xref>].</p><p>In order to study influence of basis-function order on the approximate solution we calculate the same test problem, now with the second-order Lagrange polynomials. All other parameters are the same as in the previous case displayed in <xref ref-type="fig" rid="fig1">Figure 1</xref>. The results are shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>.</p></sec><sec id="s5_2"><title>5.2. Orszag-Tang Vortex Test Problem</title><p>A next test we performed standard Orszag-Tang 2D ideal-MHD vortex problem [<xref ref-type="bibr" rid="scirp.24764-ref23">23</xref>]. The initial state was given by the following relations:</p><p><img src="11-7401035\18e30a2c-5b41-4c27-abd9-49d555d7b97d.jpg" /></p><p><img src="11-7401035\7878fdd2-1824-4ca4-bdbb-c4b060d1763d.jpg" /></p><p><img src="11-7401035\4ce1df69-8b10-4886-90b6-1df30676d9fd.jpg" /></p><p><img src="11-7401035\e86140d1-41f6-4505-a701-26a285308975.jpg" /></p><p>The computational domain 1.0 &#215; 1.0 was discretized by 2 &#215; 640 &#215; 640 triangular elements. We apply periodic boundary conditions at all boundaries. The first-order basis functions were used in this simulation. Results in Figures 3 and 4 show the plasma density and the magnitude of the magnetic field, respectively, at times t = 0.25 (a), and t = 0.50 (b).</p></sec><sec id="s5_3"><title>5.3. Resistive Decay of a Cylindric Current</title><p>In order to assess the applicability of our code to the solutions of non-ideal (resistive) MHD problems and to estimate its numerical resistivity we performed a following test: At the initial state <img src="11-7401035\8c64c2dc-d42c-460d-ba4a-a61e15145c3f.jpg" /> a cylindrical current <img src="11-7401035\5eba9749-5f43-42b7-82da-55a17a085c07.jpg" /> with</p><p>flows through a plasma of a uniform density<img src="11-7401035\fc18b45b-a050-431f-b4a7-43a5755811aa.jpg" />. Here, <img src="11-7401035\9b620497-f721-4505-a8dd-9e359b66120e.jpg" />is the amplitude of the current density on the cylinder axis, <img src="11-7401035\12cec5be-b22b-4d61-a21d-648bf4381cf7.jpg" />is the cylinder radius, and <img src="11-7401035\eaee91c3-514d-4461-897a-199f77fda829.jpg" /> is the first null of the Bessel function of the 0th order<img src="11-7401035\513c4421-24e0-4138-b89b-9f58f6d2eee1.jpg" />. The resistivity inside the cylinder <img src="11-7401035\dd6a8ed2-0d8b-4d78-b56d-ec94572f2825.jpg" /> is uniform<img src="11-7401035\3daf6900-b4a7-4c42-8744-7bdbcff38f58.jpg" />, outside<img src="11-7401035\104601ed-d785-42b5-81b0-804b922719d3.jpg" />. In order to be able to compare the numerical results with an analytical solution and to split advective and resistive properties of the code we set all velocities to zero at <img src="11-7401035\e01097ef-f115-42c8-99fa-33550d1685ed.jpg" /> and the density to a very high value <img src="11-7401035\367fb827-b417-431b-9a36-6a28820454eb.jpg" /> to keep the plasma in rest. In the limit <img src="11-7401035\b720f0fb-8452-4b03-9f45-a061bf98a26a.jpg" /> the MHD system (1) effectively reduces into the diffusion equation</p><p><img src="11-7401035\629809dd-61c3-49bb-8f34-c57378e80049.jpg" /></p><p>whose analytical solution for our initial state keeps the form <img src="11-7401035\342afa11-025d-44a8-bfcd-2f8276665ea9.jpg" /> with</p><disp-formula id="scirp.24764-formula24215"><label>(22)</label><graphic position="anchor" xlink:href="11-7401035\0bdcb799-dcdd-4c1f-9958-e158813443af.jpg"  xlink:type="simple"/></disp-formula><p>where <img src="11-7401035\9641132b-a985-4816-ad1f-4dfb5fd41206.jpg" /> is the Bessel function of the 1st order and <img src="11-7401035\8a298096-ece8-468a-8c18-8bfb699ca64a.jpg" /> is the Dirac delta function. The decrement <img src="11-7401035\4881b5e6-aac8-4203-a434-5ca6464ccb66.jpg" /> reads</p><disp-formula id="scirp.24764-formula24216"><label>(23)</label><graphic position="anchor" xlink:href="11-7401035\7cc6a964-6d81-4fd1-9939-994639514906.jpg"  xlink:type="simple"/></disp-formula><p>The second term in Equation (22) represents an induced surface current that compensates resistive decrease of the current density inside the column to keep the magnetic field in the outer super-conducting domain constant. The corresponding magnetic field is of the form <img src="11-7401035\3ed5eadb-4bc4-4d60-a1b6-1cf81fd70e4d.jpg" /> where</p><p><img src="11-7401035\85b7ff92-75b9-44df-8c77-ae4f18cb6c2b.jpg" /></p><p>for internal <img src="11-7401035\c089a49b-a60d-4c3b-8f3b-a49f254dbed3.jpg" /> region and</p><p><img src="11-7401035\caa15605-f4bd-44e9-8b3b-e7caa16fba3e.jpg" /></p><p>for the outer space.</p><p>Computational domain is divided into a homogeneous mesh of <img src="11-7401035\d545d411-3a1a-4e47-9be1-8ecdbded7f05.jpg" /> triangles in our numerical test. We use the first order basis functions to approximate the numerical solution. Free boundary conditions were applied on all boundaries. The results of this test are shown in <xref ref-type="fig" rid="fig5">Figure 5</xref>. <xref ref-type="fig" rid="fig5">Figure 5</xref>(a) shows time evolution of the current density profile along <img src="11-7401035\a50d7419-1375-4214-ae43-ee96edb4dd79.jpg" /> for five subsequent time instants. Resistive decrease of <img src="11-7401035\4f761f9d-8133-438b-8cc4-2a5b129dd7fb.jpg" /> inside the column accompanied by formation of the induced surface current are well visible. <xref ref-type="fig" rid="fig5">Figure 5</xref>(b) shows a comparison of numerical and analytical solutions for time evolution of the current density <img src="11-7401035\269e0959-fed0-42ae-9a36-7a94eec391ba.jpg" /> at<img src="11-7401035\f5433203-7d5a-4a97-9eda-47dec7d023f3.jpg" />,<img src="11-7401035\0760741f-40fd-4421-bb4c-021d3a06faf9.jpg" />.</p></sec></sec><sec id="s6"><title>6. Discussion and Conclusions</title><p>The FEM represent an alternative to FDM/FVM that are traditionally used for solution of MHD problems in astrophysics. Its attractivity implies from its unstructured mesh that allows for appropriate local refinement without formation of qualitative internal boundaries between the fine and coarse meshes. This property makes it very useful for handling the multi-scale problems, for example the problem of magnetic reconnection in solar flares [<xref ref-type="bibr" rid="scirp.24764-ref3">3</xref>] (and other large-scale systems) or MHD turbulence.</p><p>With this intention in mind we have developed the LSFEM implementation of a MHD solver whose descriptions and preliminary results from its application to the standardized test problems are presented in this paper.</p><p>To sum up the main points of our implementation: Transformation of the MHD equations (1) to the standard FEM problem (7) involves several steps: 1) Standard <img src="11-7401035\5d11f00f-02a0-4784-bfee-34468bff4fcf.jpg" />-time discretization; 2) Decrease of the order of the system of equations by introduction of a new variable— electric field strength; and 3) Newton-Raphson linearization. The possibility to include the solenoidal condition <img src="11-7401035\73a23e51-d263-4b5f-80cb-f38f492b16e6.jpg" /> directly into the system of equations certainly belongs to advantages of LSFEM formulation, as well as a natural involvement of the boundary conditions. The element-by-element assembling of the global stiffness matrix and the iterative nature of JCGM solver allow for rather easy and efficient MPI parallelization. Integrals over elements are efficiently performed via Gauss quadrature.</p><p>We performed several standardized tests focused on an</p><p>ideal and resistive MHD. The LSFEM MHD solver quite closely reproduces results published for the Ryu-Jones shock tube problem [<xref ref-type="bibr" rid="scirp.24764-ref22">22</xref>]. Small spurious oscillations appear around the points where the first derivative of an analytical solution does not exist. Choice of the higherorder basis functions makes the situation even slightly worse.</p><p>Similar feature can be seen in the results from the Orszag-Tang vortex test problem. While the large-scale dynamics agree well with those obtained from the “gauge” codes, small oscillations accompanying the shocks are visible again. These effects are caused by the least squares curve fitting approach [<xref ref-type="bibr" rid="scirp.24764-ref11">11</xref>]. We believe that it can be cured by an introduction of a small background resistivity and local refinement of the mesh around the discontinuities, with the element size corresponding to the resistivity-controlled (magnetic) Reynolds number. Such approach is fully in line with the intended usage of the code for detailed studies of the current sheet filamentation and fragmentation in a large-scale magnetic reconnection in solar flares. Indeed, in the solar corona we have a very small background classical resistivity due to (rare) collisions between electrons and ions as well. Hence, having mesh around the filamenting current sheet locally refined as much as possible we can set the background (physical) resistivity accordingly and approach thus the realistic Lundquist number in the solar corona.</p><p>Finally—with the intended usage of the code in mind —we have tested the properties of our implementation for solution of the resistive problems. In order to get a comparison with an analytical solution we have “frozen” the plasma dynamics by setting high matter density and we concentrated on a purely diffusive problem. The results show a rather good agreement with the analytical solution. Namely, the induced surface current density is located only at a few elements and did not diffuse further with time. This is an important result for intended future studies of the current-sheet filamentation in the flare reconnection.</p><p>The tests show basic applicability of our LSFEM implementation of the MHD solver for a solution of selected problems. At the same moment they reveal the necessity to involve both the adaptive spatial refinement (it has already been implemented) and adaptive change of the order of basis functions over selected elements (h-p refinement). These features will be implemented into our code in a near future.</p></sec><sec id="s7"><title>7. Acknowledgements</title><p>This research was supported by the grants P209/12/0103 (GA <img src="11-7401035\2d6c4a90-eae5-4a90-b195-e3c89dda6274.jpg" />R), P209/10/1680 (GA <img src="11-7401035\ff08e28b-4560-4cef-a583-4f1011a085b6.jpg" />R), and the research projects RVO: 67985815 (CZ) and CRC 963 (DE). M.B. acknowledges support of the European Commission via the PCIG-GA-2011-304265 project financed in frame of the FP7-PEOPLE-2011-CIG programme.</p></sec><sec id="s8"><title>REFERENCES</title></sec></body><back><ref-list><title>References</title><ref id="scirp.24764-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">E. R. Priest, “Solar Magneto-Hydrodynamics,” Reidel, Dordrecht, 1984.</mixed-citation></ref><ref id="scirp.24764-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">K. Shibata and S. Tanuma, “Plasmoid-Induced-Reconnection and Fractal Reconnection,” Earth, Planets, and Space, Vol. 53, 2001, pp. 473-482. 
http://adsabs.harvard.edu/abs/2001EP%26S...53..473S</mixed-citation></ref><ref id="scirp.24764-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">M. Bárta, J. Büchner, M. Karlicky and J. Skála, “Spontaneous Current-Layer Fragmentation and Cascading Reconnection in Solar Flares. I. Model and Analysis,” Astrophysical Journal, Vol. 737, No. 1, 2011. 
doi:10.1088/0004-637X/737/1/24</mixed-citation></ref><ref id="scirp.24764-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">M. Bárta, J. Büchner, M. Karlicky and P. Kotr?, “Spontaneous Current-Layer Fragmentation and Cascading Reconnection in Solar Flares. II. Relation to Observations,” Astrophysical Journal, Vol. 730, No. 1, 2011, 6 pages. 
doi:10.1088/0004-637X/730/1/47</mixed-citation></ref><ref id="scirp.24764-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">O. Mátais, “Course 3: Large-Eddy Simulations of Turbulence,” In: M. Lesieur, A. Yaglom and F. David, Eds., New Trends in Turbulence, Vol. 730, No. 1, 2001, pp. 113-186.</mixed-citation></ref><ref id="scirp.24764-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">M. A. Leschziner, “Course 4: Statistical Turbulence Modelling for the Computation of Physically Complex Flows,” In: M. Lesieur, A. Yaglom and F. David, Eds., New Trends in Turbulence, Springer Verlag, Berlin, 2001, p. 187. 
doi:10.1007/3-540-45674-0_4</mixed-citation></ref><ref id="scirp.24764-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">M. J. Berger and J. Oliger, “Adaptive Mesh Refinement for Hyperbolic Partial Differential Equations,” Journal of Computational Physics, Vol. 53, No. 3, 1984, pp. 484-512. doi:10.1016/0021-9991(84)90073-1</mixed-citation></ref><ref id="scirp.24764-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">B. Fryxell, K. Olson, P. Ricker, F. X. Timmes, M. Zingale, D. Q. Lamb, P. MacNeice, R. Rosner, J. W. Truran, and H. Tufo, “FLASH: An Adaptive Mesh Hydrodynamics Code for Modeling Astrophysical Thermonuclear Flashes,” Astrophysical Journal Supplements, Vol. 131, No. 1, 2000, pp. 273-334.</mixed-citation></ref><ref id="scirp.24764-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">B. van der Holst and R. Keppens, “Hybrid Block-AMR in Cartesian and Curvilinear Coordinates: MHD Applications,” Journal of Computational Physics, Vol. 226, No. 1, 2007, pp. 925-946.</mixed-citation></ref><ref id="scirp.24764-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">B. Jiang, “The Least-Squares Finite Element Method,” Springer-Verlag, Berlin, 1998.</mixed-citation></ref><ref id="scirp.24764-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">P. P. Bochev and M. D. Gunzburger, “Least-Squares Finite Element Methods,” Springer Science+Business Media, New York, 2009.</mixed-citation></ref><ref id="scirp.24764-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">C. R. Sovinec, A. H. Glasser, T. A. Gianakon, D. C. Barnes, R. A. Nebel, S. E. Kruger, D. D. Schnack, S. J. Plimpton, A. Tarditi and M. S. Chu, “Nonlinear Magnetohydrodynamics Simulation Using High-Order Finite Elements,” Journal of Computational Physics, Vol. 195, No. 1, 2004, pp. 355-386. doi:10.1016/j.jcp.2003.10.004</mixed-citation></ref><ref id="scirp.24764-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">S. C. Jardin and J. A. Breslau, “Implicit Solution of the Four-Field Extended-Magnetohydrodynamic Equations Using High-Order High-Continuity Finite Elements,” Physics of Plasmas, Vol. 12, No. 5, 2005, Article ID: 056101.  
doi:10.1063/1.1864992</mixed-citation></ref><ref id="scirp.24764-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">V. S. Lukin, “Computational Study of the Internal Kink Mode Evolution and Associated Magnetic Reconnection Phenomena,” Ph.D. Thesis, Princeton University, Princeton, 2008.</mixed-citation></ref><ref id="scirp.24764-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">A. H. Glasser and X. Z. Tang, “The SEL Macroscopic Modeling Code,” Computer Physics Communications, Vol. 164, No. 1-3, 2004, pp. 237-243. 
doi:10.1016/j.cpc.2004.06.034</mixed-citation></ref><ref id="scirp.24764-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">J. Büchner and N. Elkina, “Anomalous Resistivity of Current-Driven Isothermal Plasmas Due to Phase Space Structuring,” Physics of Plasmas, Vol. 13, No. 8, 2006, Article ID: 082304.</mixed-citation></ref><ref id="scirp.24764-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">B. Kliem, M. Karlicky and A. O. Benz, “Solar Flare Radio Pulsations as a Signature of Dynamic Magnetic Reconnection,” Astronomy &amp; Astrophysics, Vol. 360, 2000, pp. 715-728. http://adsabs.harvard.edu/abs/2000A%26A...360..715K</mixed-citation></ref><ref id="scirp.24764-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">T. J. Chung, “Computational Fluid Dynamics,” Cambridge University Press, Cambridge, 2002.</mixed-citation></ref><ref id="scirp.24764-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">T. W. H. Sheu and R. K. Lin, “Newton Linearization of the Incompressible Navier-Stokes Equations,” International Journal for Numerical Methods in Fluids, Vol. 44, No. 3, 2004, pp. 297-312. doi:10.1002/fld.639</mixed-citation></ref><ref id="scirp.24764-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">H. T. Rathod, K. V. Nagaraja and N. L. Ramesh, “Gauss Legendre Quadrature over a Triangle,” Journal of the Indian Institute of Science, Vol. 84, 2004, pp. 183-188. 
http://journal.library.iisc.ernet.in/vol200405/paper6/rathod.pdf</mixed-citation></ref><ref id="scirp.24764-ref21"><label>21</label><mixed-citation publication-type="other" xlink:type="simple">W. H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery, “Numerical Recipes,” Cambridge University Press, Cambridge, 2007.</mixed-citation></ref><ref id="scirp.24764-ref22"><label>22</label><mixed-citation publication-type="other" xlink:type="simple">D. Ryu and T. W. Jones, “Numerical Magetohydrodynamics in Astrophysics: Algorithm and Tests for One-Dimensional Flow,” Astrophysical Journal, Vol. 442, No. 1, 1995, pp. 228-258. doi:10.1086/175437</mixed-citation></ref><ref id="scirp.24764-ref23"><label>23</label><mixed-citation publication-type="other" xlink:type="simple">S. A. Orszag and C. M. Tang, “Small-Scale Structure of Two-Dimensional Magnetohydrodynamic Turbulence,” Journal of Fluid Mechanics, Vol. 90, No. 1, 1979, pp. 129-143. doi:10.1017/S002211207900210X</mixed-citation></ref></ref-list></back></article>