Magnetohydrodynamics (MHD) is the fluid dynamics of conducting fluid or plasma, coupled with Maxwell's equations. The fluid motion induces currents, which produce Lorentz body forces on the fluid. Ampere's Law relates the currents to the magnetic field. The MHD approximation is that the electric field vanishes in the moving fluid frame, except for possible resistive effects.
MHD is described by higher order system of partial differential equations than fluid dynamics. It admits additional waves, the Alfvén waves and their instabilities. A typical feature of MHD is the tendency to form a singular current density. Current sheets, in the presence of resistive dissipation, are associated with the breaking and reconnecting of magnetic field lines.
Various approaches have been used in computational MHD to reduce numerical magnetic dissipation. Lagrangian and partially Lagrangian methods  are less diffusive than Eulerian methods, but require substantial rezoning for sheared or straining flow. Mixed finite difference and spectral discretizations have been very effective in dealing with reconnection in periodic geometry . Finite difference codes with nonuniform, Cartesian product grids have also been successful in reconnection simulations in which intense current sheets are aligned with the grid . These approaches, while effective in specialized geometric configurations, are not able to adaptively add grid refinement when current sheets form at arbitrary locations on the mesh. Recently, adaptive structured mesh methods have been successfully applied to these problems . However, these methods are not particularly effective with arbitrarily shaped boundaries. For these reasons we are led to try adaptive unstructured mesh methods. Unstructured meshes have also been used in other computational MHD approaches , . We have chosen to apply these methods to two dimensional, incompressible MHD, using a stream function approach to enforce the divergence free conditions on the magnetic and velocity fields. Our approach differs in the use of a symmetrized form of the equations to eliminate difficulties with the calculation of the current density.
The incompressible MHD equations are:
where is the magnetic field, is the velocity, and is the viscosity. To enforce incompressibility, it is common to introduce stream functions:
In two dimensions, with incompressible flow, the MHD equations can be written
where the two dimensional Laplacian is
The left hand side of (7), along with (9) is the familiar vorticity - stream function formulation of two dimensional incompressible hydrodynamics. The right hand side of (7) comes from the Lorentz force with current density C,, and the viscosity with coefficient . Eq. (8) is from Ohm's Law and Faraday's Law and represents the conservation of magnetic flux The z component of the magnetic field does not enter (7) - (10), so its evolution is not followed. A large, nearly constant is often invoked to justify the incompressible approximation.
The MHD equations conserve energy and magnetic flux. Since the magnetic flux function is advected with the flow, any function of is a constant of the motion. The energy, can be shown to be conserved by pre multiplying the evolution equation by and the C evolution equation by and integrating by parts, or working directly from the primitive form of the equations. One obtains
assuming either Dirichlet boundary conditions, with constant on the boundary, Neumann conditions with the normal derivatives of equal to zero, or periodic boundary conditions.