a new 3d, fully parallel, unstructured amr mhd high order ... · a new 3d, fully parallel,...

24
A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena Daniel S. Spicer a , Hong Luo b , John E Dorband c , Kevin M. Olson a , Peter J MacNeice d a Department of Physics, Drexel University, Philadelphia, PA 20771, USA b Department of Mechanical and Aerospace Engineering, North Carolina State University, Campus Box 7910, Raleigh, NC 27695-7910, USA c Department of Computer Science and Electrical Engineering, University of Maryland, Baltimore County, 1000 Hilltop Circle, Baltimore, MD 21250 USA d Code 6740, NASA/GSFC Greenbelt, MD 20873 USA Abstract This paper describes a new node centered upwind finite element code, Adapt3DMHD, that solves the compressible magnetohydrodynamics (MHD) equations on an unstructured mesh. In this scheme, the spatial discretization is accomplised by an edge based finite element formulation using Roe’s flux difference split- ting. A MUSCL approach is used to to achieve high order accuracy. Solutions are advanced in time by a multi-stage Runge-Kutta time stepping scheme. The algorithm has been tested and validated on many CFD test problems and real physical problems. Due to the solenoid constraint on the magnetic field B, ∇· B = 0, the requirement that the Lorentz force parallel to the magnetic field must vanish, B · ∇F = 0, and the likelihood there are regions in the flow domain where the magnetic energy density, B 2 /2, is often many orders of magnitude greater than the internal energy density it is not possible to directly apply conservative schemes to the MHD equations without causing violations of the solenoidal constraint, violations of momentum conservation, and obtaining negative pressures. We briefly discuss the measures we use to insure ∇· B = 0, B · ∇F = 0, and non-negative pressures. Results from various test problems are presented as well as those from solar and space physics. Keywords: Preprint submitted to Journal of Atmospheric and Solar-Terrestrial PhysicsApril 25, 2013

Upload: others

Post on 09-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

A New 3D, Fully Parallel, Unstructured AMR MHD

High Order Godunov Code for Modeling Sun-Earth

Connection Phenomena

Daniel S. Spicera, Hong Luob, John E Dorbandc, Kevin M. Olsona, Peter JMacNeiced

aDepartment of Physics, Drexel University, Philadelphia, PA 20771, USAbDepartment of Mechanical and Aerospace Engineering, North Carolina State University,

Campus Box 7910, Raleigh, NC 27695-7910, USAcDepartment of Computer Science and Electrical Engineering, University of Maryland,

Baltimore County, 1000 Hilltop Circle, Baltimore, MD 21250 USAdCode 6740, NASA/GSFC Greenbelt, MD 20873 USA

Abstract

This paper describes a new node centered upwind finite element code, Adapt3DMHD,that solves the compressible magnetohydrodynamics (MHD) equations on anunstructured mesh. In this scheme, the spatial discretization is accomplisedby an edge based finite element formulation using Roe’s flux difference split-ting. A MUSCL approach is used to to achieve high order accuracy. Solutionsare advanced in time by a multi-stage Runge-Kutta time stepping scheme.The algorithm has been tested and validated on many CFD test problems andreal physical problems. Due to the solenoid constraint on the magnetic fieldB, ∇·B = 0, the requirement that the Lorentz force parallel to the magneticfield must vanish, B · ∇F = 0, and the likelihood there are regions in theflow domain where the magnetic energy density, B2/2, is often many ordersof magnitude greater than the internal energy density it is not possible todirectly apply conservative schemes to the MHD equations without causingviolations of the solenoidal constraint, violations of momentum conservation,and obtaining negative pressures. We briefly discuss the measures we use toinsure ∇ · B = 0, B · ∇F = 0, and non-negative pressures. Results fromvarious test problems are presented as well as those from solar and spacephysics.

Keywords:

Preprint submitted to Journal of Atmospheric and Solar-Terrestrial PhysicsApril 25, 2013

Page 2: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

1. Introduction

The principal objective of this paper is to introduce to the Solar, Helio-sphere, and Space Physics communities a new fully parallel adaptive 3D mag-netohydrodynamics (MHD) code that utilizes an unstructured mesh made upof node based control volumes. While the majority of MHD codes reportedin the Solar, Heliosphere, and Space Physics literature are stuctured, that is,they use meshes that are simply connected by incrementing the local cell in-dex (i,j,k), our new code, Adapt3DMHD requires a lookup table which allowsthe use of highly complex internal and external flow boundaries, a capabil-ity difficult to implement with structured codes unless cut-cells are utilized,which to our knowledge have never been successfully used in MHD codes.Modeling a realistic solar atmosphere requires a 3D spherical or ellipsoidalsurface on which solar active regions can be allowed to evolve and move dueto realistic solar differential rotation. Global modeling of a realistic solaratmosphere also requires a numerical approach that will permit improvedphysical models be easily integrated into the over all code, vastly increasingthe model functionality and for this reason alone justifies the added com-plexity of an unstructured numerical model. This increased functionalityincludes but is not limited to : a), the study of flows around complex bound-aries representing complex objects embedded in the domain of the flow; b),unstructured meshes allow multiple connected domains, permitting the useof different physical approximations within each connected domain, but withshared boundary points and shared boundaries that can deform or “breathe”in response to internal and external forces, which we have dubbed ”virtualboundaries”; and c), the ability to permit the grid points making up a surfaceboundary to act as an independent grid on which two dimensional physicaleffects can be modeled . Examples of a) are the Jupiter-Io problem, thecoupling of the solar interior to the solar atmosphere, a star orbiting a star,and the Sun-Earth system. An example of b) is a set of concentric spher-ical shells, each shell representing a different physical domain. Since eachboundary shared between each shell also shares common boundary points,various physical domains representing the thermasphere, the ionosphere, theplasmasphere, and the magnetosphere, can be consistently modeled and cou-pled without the overhead of coupling independently designed models. Anexample of c), is the magnetosphere-ionosphere coupling, which has an MHDdomain with a simple ionospheric model on the spherical surface representingthe inner boundary of the MHD domain.

2

Page 3: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

2. Governing Equations

The MHD equations governing unsteady compressible inviscid flows canbe expressed in conservative form as

∂Qi(x, t)

∂t+

∂Fij(Q(x, t)

∂xj= 0, in Ω (1)

where, Ω is a bounded connected domain in Rd, d is the number of spatialdimensions, and conservative state vector Qi and inviscid flux vectors F aredefined by

Qi =

ρρui

ρeBi

,Fij =

ρuj

ρuiuj + (p + B2

2)δij − BiBj

uj(ρe + p + B2

2) − (B · u)Bj

ujBi − Biuj

, (2)

where the summation convention has been used and ρ, p, and e denote thedensity, pressure, and specific total energy of the fluid, respectively. ui andBi are the velocity of the flow and magnetic field in the coordinate directionxi. This set of equations is completed by the equation of state

p = (γ − 1)ρ(e − 1

2ujuj −

BjBj

2ρ), (3)

which is valid for perfect gas, ρe = ρu2/2 + p/(γ − 1) + B2/2, γ is the ratioof the specific heats, and the constraint ∇ · B = 0. We chose to solve theMHD equations in a conservative form using a finite volume approach

∂t

Ω

QdV +

∂Ω

F (Q) · ndS = 0 (4)

where

F(Q) · n = (u · n)

ρρuρvρwBx

By

Bz

H

+ P

0nx

ny

nz

0000

− (B · n)

0Bx

By

Bz

uvw

(u · B)

(5)

3

Page 4: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

H = ρh = ρ(e +P

ρ+

B2

ρ) (6)

h =1

2u2 +

γP

(γ − 1) ρ+

B2

ρ(7)

and n = (nx, ny, nz) represents the unit normal to the control volume faceand S is the face area.

2.1. Solving the MHD Equations

2.1.1. Space Discretization

The equations are solved by a finite volume method utilizing the edgebased scheme of [7]. For the control volume ΩI , Eq.(4) can be written in aspace-discretized form as:

∂ 〈QI〉∂t

= − 1

∆VI

N∑

κ=1

∆SκFIκ

(〈Q〉Rκ , 〈Q〉Lκ

)nκ , (8)

an upwinded approximate flux from a linearized Riemann solver is used ofthe form

F(Qf) · n =1

2

[F(QL) + F(QR) −

∣∣∣A(Q

)∣∣∣ (QR −QL)]· n (9)

where ∆Sκ is the κ face area of the control volume ∆VI , N the number offaces enclosing the control volume, the Jacobian matrix A ≡ ∂F

∂Qusing the

appropriate average Q of the right QR and left QL states, and Qf representsthe conservative resolved state (the states at the faces). Eq.(8) states thatthe time rate of change of the volume averaged state 〈Q〉I in the I th volumeis balanced by the sum of the area-averaged flux FIκ through the discreteboundary faces κ. The subdomains ΩI may be represented by any arbitrar-ily shaped volume. For structured methods, the control volume is typicallya hexahedral with orthogonal Cartesian coordinates and the summation inEq.(8) is over the six faces making up the hexahedral control volume. Struc-tured methods are based on a logical indexing of the data structure. Eqs(8)can also be solved using a general indexing system are usually referred to asunstructured methods. The method employed in this paper uses a indexingscheme with a node averaged control volume. The global computational do-main is subdivided into arbitrary shaped control volumes, or cells, that areenclosed by n faces ∆Sk.

4

Page 5: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

2.1.2. Higher Spatial and Temporal Order

Adapt3DMHD uses a fully explicit Runge-Kutta time-stepping scheme.Defining

RI =

N∑

κ=1

∆SκFIκ

(〈Q〉Rκ , 〈Q〉Lκ

)nκ (10)

the residual acccrued by summation of fluxes through the N faces of a volumesurrounding a node I, Eq.(8) becomes

∂ 〈QI〉∂t

= − 1

∆VIRI (11)

Thus the timestepping strategy [6] follows

Q(0)I = Q

(n)I (12)

Q(1)I = Q

(0)I − α1

∆tI∆VI

R(0)I

· · · = · · ·

Q(m−1)I = Q

(0)I − αm−1

∆tI∆VI

R(m−2)I

Q(m)I = Q

(0)I − αm

∆tI∆VI

R(m−1)I

Q(n+1)I = Q

(m)I

where the superscript n denotes the time level, m the order of temporalaccuracy, and the weighting factors are given by

αk =1

m − k + 1, k = 1, · · · , m

The results presented here use m = 3 to insure 2nd order in time [8].The high order spatial reconstruction follows [7]. The MHD fluxes are

obtained through a linearized Riemann solver using a Roe like flux differingscheme for the numerical flux

Fij =1

2

[F R

i + F Lj

]− 1

2

∣∣A(QRi ,QL

j )∣∣ (QR

j −QLi ) , (13)

5

Page 6: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

where F Ri = F (QR

i ) and F Lj = F (QL

j ). The upwinded biased reconstructionfor QR

i and QLj are

QRi = Qi +

1

4

[(1 − k)∆L

i + (1 + k)(Qj − Qi)]

, (14)

QLj = Qj −

1

4

[(1 − k)∆R

j + (1 + k)(Qj −Qi)]

, (15)

and the forward and back wards difference operators are just

∆Li = Qi − Qi−1 = 2(Q)i · ℓij − (Qj − Qi) , (16)

∆Rj = Qj+1 −Qj = 2(Q)j · ℓij − (Qj − Qi) , (17)

where ℓij = xj − xi is the lenght vector for edge ji. The parameter k usedhere has a value 1/3 and yields a third order-accurate upwind scheme, asleast in linear 1D problems.

Since higher order schemes can lead to dispersive effects, particularly inthe vicinity if steep gradients, we use a MUSCL [9] like limitor monotonicityscheme. Thus equations 14 and 15 are modified as

QRi = Qi +

si

4

[(1 − ksi)∆

Li + (1 + ksi)(Qj − Qi)

](18)

, (19)

QLj = Qj −

sj

4

[(1 − ksj)∆

Rj + (1 + ksj)(Qj − Qi)

], (20)

where s is defined as

si = max

[0,

2∆Ri (Qj −Qi) + ǫ

(∆Ri )2 + (Qj − Qi)2 + ǫ

](21)

sj = max

[0,

2∆Rj (Qj − Qi) + ǫ

(∆Rj )2 + (Qj − Qi)2 + ǫ

](22)

where ǫ is a small number to prevent division by zero in smooth regions ofthe flow.

6

Page 7: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 2: 3D grid used to model solar phenomena. Note the inner sphere is at 1R⊙ andthe outer sphere is at 30R⊙

3. Special MHD Concerns

There are serious errors that can be introduced into the solution of theMHD equations which do not occur in the solution of the Euler equations. Anexamination of the MHD momentum flux shows that the MHD momentumflux differs from the Euler momentum flux by the term Fij = B2

2δij − BiBj .

This term is sometimes referred to as the MHD Maxwell stress tensor andits divergence is just the usual Lorentz force, −J × B. Since B · J × B = 0it follows that B · ∇ · F = 0 also. Since discretization errors can lead to∇ · B 6= 0, it is not only necessary to insure ∇ · B = 0 numerically (thenumber one source of error; see 3.1) but it is also necessary to insure that

B ·∇ · F = 0 by projecting out any component of B ·∇ · F 6= 0 parallel to B

(see 3.2). In addition, it is often the case that in regions where 2P/B2 << 1discretization errors can be large enough to cause negative pressures whichis unacceptable in most applications of MHD. These errors are producedwhen computing the pressure from the total energy because the kinetic and

7

Page 8: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

magnetic energies in some regions of the flow are very large and dominatethe interna energy there. In section 3.3 we provide a short summary of ourpresent approaches to solving these problems.

3.1. Solenoidal Condition

The approach we have chosen to insure ∇ · B = 0 is a technique knownas the Hodge projection which yields a magnetic field that is divergencefree to truncation. Hodge projection uses the fact that a vector B can bedecomposed into a solenoidal part and an irrotational part. In the case of themagnetic field vector we write the exact (analytical) magnetic field vector Be

as the sum of two parts, the part obtained from the numerical solution forBi in equation (2), which we denote as Bn, and a irrotational correction ∇φ,that is,

Be = Bn + ∇φ . (23)

Since ∇ ·Be = 0 it follows that

∇2φ = −∇ ·Bn

which can be solved using standard elliptical solver techniques subject toappropriate boundary conditions. Admittedly, our present algorithm for in-suring the magnetic field is solenoidal is not the best but it works surprisinglywell. In addition, the algorithm can only be used at every time level of atime step at considerable computational expense. Further, the technique,because it is global in nature can be dangerous from a physical point ofview. For this reason we are investigating an approach used on structuredmeshes [2], which because of the duality of the MHD electric fields and theircorresponding fluxes, permits the use of the upwinded Riemann fluxes toobtain solenoidal components of the magnetic field normal to the each faceof the node control volume. These magnetic field normals can then be usedto reconstruct B on the control nodes that are solenoidal. However, eventhe straggered mesh approach does not eliminate the need for removing thefield aligned frictious force or the negative pressure problem endemic in MHDcodes that are used to study flows in low β plasmas.

We solve the spatial discretization of the Poisson equation using a fi-nite element formulation, where a piecewise linear basis function is used toapproximate the equation. The resulting system of the linear equations issolved using a conjugate gradient method. Both diagonal and LU-SGS pre-conditioners are implemented to accelerate the convergence of the ConjugateGradient method.

8

Page 9: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

3.2. Fictious Field Aligned Force

While it is the case that analytically

B · J × B = −B · ∇ · F = 0

it is not the case numerically. It is not possible to simultaneously insure mo-mentum conservation and to insure there are no fictious field aligned forcesunless ∇ · B = 0 everywhere in the computational domain which is numer-ically difficult to insure. However, from our tests it can be shown that if∇ · B = 0 to round-off, or to truncation, that the application of projectingout any component of ∇ · F parallel to B leads to only small violations tototal momentum conservation. The major numerical issue is how to split offthe MHD momentum flux from the total momentum flux when using a highfidelity Reimann solver so that ∇ · F can be computed. To accomplish thiswe compute not only the resolved state fluxes but also the resolved state con-served quanties. Using the resolved state conserved quantites we constructthe MHD momentum fluxes and substract them from the total momentumfluxes. We then proceed as usual, that is, we update the conserved quan-tities but without the MHD momentum sources. We then use the MHDmomentum fluxes to compute the change in momentum due to thee Lorentzforce

∆M = dt∆F (q) · ndS

∆V(24)

and correct ∆M so that ∆Mcorrected = ∆M − (nb · ∆M)nb, where nb isa unit vector parallel to B. ∆Mcorrected is then added back into the totalmomemtum.

3.3. Positive Pressures

When the magnetic energy density, B2/2, or the flow energy density,ρu2/2, is large compared to the internal energy p/(γ − 1) computing thepressure from p = (γ − 1)ρ(e − 1

2u2 − B2

2ρ) can easily yield non-physical

negative pressures. We employ a number of physical strategies to insure thepressure remains positive. Two of these are outlined in [1] both relying onthe entropy density P/ργ−1 being a conserved quantity in regions of the flowthat are incompressible. A third strategy in additional to transporting theMHD total energy EM = Ee + B2/2 is to transport in addition the Eulerenergy Ee = ρu2/2 + P/(γ − 1) and to correct the kinetic energy for theLorentz force. To utilize this strategy it is first important to recognize that

9

Page 10: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

the Lorentz force cannot directly affect the pressure so that the Lorentz forcewill only affect the kinetic energy in the Euler energy. To take advantage ofthis fact we use the well known fact that Euler energy equation is correctedfor the Lorentz force by u · J ×B so that

∂Ee

∂t+ ∇ · [u(Ee + P )] = u · J ×B (25)

and since

u · J × B =1

2ρdu2

dt(26)

Ee can be corrected for the Lorentz force by first computing the updatedkinetic energy without the effect of the Lorentz force, 1

2ρu2

WOLF , and thencorrecting the kinetic energy with the the Lorentz force, 1

2ρu2

WLF , so thatthe corrected total Euler energy is corrected as

Ee = Ee +1

(u2

WLF − u2WOLF

)(27)

where uWLF is the velocity corrected for the Lorentz force and uWOLF isthe velocity corrected without the Lorentz force. This approach permitsthe pressure to be computed without the need to substracting the magneticenergy density from the total energy.

3.4. Heat Conduction

In many space and solar phenomena thermal conduction plays a majorrole in the energy balance. To account for this we solve the electron heatconduction equation using implicit methods, which have the virtue of beingunconditionally stable. The second order accurate Crank-Nicholson methodis used for the time-accurate simulations, while the first order accurate im-plicit Euler scheme is used for the steady state problems. The spatial dis-cretization is carried using a finite element formulation, where a piecewiselinear basis function is used to approximate the heat conduction equation.The resulting system of the linear equations is solved using a conjugate gra-dient method. Both diagonal and LU-SGS preconditioners are implementedto accelerate the convergence of the Conjugate Gradient method.

ne

γ − 1

d(kBTe)

dt= −∇ · qe + Qe (28)

10

Page 11: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

whereqe = −κe

‖∇‖(kbTe) − κe⊥∇⊥(kbTe) − κe

∧nb ×∇⊥(kbTe) (29)

κe‖ = 3.2

nekbTeτe

me

, κe⊥ = 4.7

nekbTe

meΩ2ceτe

, κe∧ =

5nekbTe

meΩce

, Ω =eB

mec, τe =

3√

me(kbTe)3/2

4√

2πneλe4(see [3] for additional details), Qe represents the various heat-

ing and cooling functions depending on the physical problem at hand. Usingthe RHS of Eq.(28) we correct the energy density for the new electron tem-perature. We also carry Te as an independent variable in order to use itto compute accurately source terms such as radiation losses etc. where thetelectron temperature is explicitly required.

Figure 3: A cutting plane showing the temperature contours and magnetic lines resultingfrom a 3D simulation of the of the volume from 1-30R⊙ around the sun.

11

Page 12: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

4. Numerical Examples

In this section we provide results from a number of common, and not socommon, MHD test problems. While our selection of problems is not exhaus-tive they are excellent examples that demonstrate the numerical approachwe have chosen is fully capable of solving the MHD equations and providingresults consistent and comparable to those solutions found with structuredgrid solvers.

4.1. Brio-Wu Shock Tube Problem

The Brio-Wu test Shock tube problem Brio and Wu [4] is the stan-dard 1D test problem used to demonstrate the prowess of a MHD solver. Itdemonstrates whether the algorithm used to solve the ideal MHD equationsis capable of properly characterizing various MHD structures. The initialleft and right states are given by ρl = 1 , ul = vl = 0 , pl = 1 , Byl = 1 ;and ρr = 0.125 , ur = vr = 0 , pr = 0.1 , Byr = −1 . Further, Bx = 0.75and γ = 2 . This problem tests wave properties of a particular MHD solver,because it involves a slow compound wave, two fast rarefaction waves, a con-tact discontinuity, and a slow shock wave. No AMR was used in this test norwas it necessary to use any divergence cleaning of the magnetic field. As atest problem it is rather limited because it is strictly a 1D problem.

0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

Rho

x

"frame_00060.txt" using 1:2

0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

P

x

"frame_00060.txt" using 1:3

-0.2

0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

Vx

x

"frame_00060.txt" using 1:4

-1.5

-1

-0.5

0

0 0.2 0.4 0.6 0.8 1

Vy

x

"frame_00060.txt" using 1:5

-1

-0.5

0

0.5

1

0 0.2 0.4 0.6 0.8 1

By

x

"frame_00060.txt" using 1:8

Figure 4: The Brio-Wu Shock Tube (a) Density (b) Pressure (c) Vx-Component (d) Vy-Component and (e) By-component.

12

Page 13: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

4.2. Tang-Orzag Problem

The Orszag-Tang MHD vortex problem (Orszag and Tang, 1979), is astraight forward 2D problem that uses periodic boundary conditions whichhas become a default test for MHD codes to examine the ability of a par-ticular solver to deal with turbulence. In this problem a simple initialcondition is imposed at time t = 0 v = v0 (− sin(2πy), sin(2πx), 0) , B =B0 (− sin(2πy), sin(4πx), 0) , (x, y) =∈ [0, 1]2, where B0 is chosen so that theratio of the gas pressure to the RMS magnetic pressure is equal to 2γ . Weuse an initial density, a speed of sound, and V0 that are set to unity whichin turn requires the initial pressure p0 = 1/γ and B0 = 1/γ .

The development of vortex flow becomes increasingly complicated result-ing from the nonlinear interactions of waves produced by the initial velovityfield. A highly resolved simulation of this problem should produce two-dimensional MHD turbulence (see [5] for an example). Figures 5 showsdensity and magnetic field contours at t = 0.5. The non-linear flow patternat this time shows that a number of strong non-linear waves have formed andpassed through one another, causing turbulent eddies at all resolved spatialscales. This problem has also been used to compare spectral methods withfinite element methods on an unstructured grid using AMR [5].

Figure 5: Density contours (left) and Magnetic pressure contours (right) in the Oszag-TangMHD vortex problem at t = 0.5

13

Page 14: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

4.3. Balsara-Spicer Rotor problem

The two-dimensional MHD rotor problem [2] was designed to study theonset and propagation of strong torsional Alfvn waves such as occurs in thesun. The computational domain is a unit square [0, 1] × [0, 1] with non-reflecting boundary conditions on all four sides. The initial conditions aregiven by

ρ(x, y) =

10 r ≤ r0

1 + 9f(r) r0 < r < r1

1 r ≥ r1

u(x, y) =

−f(r)u0(y − 12)/r0 r ≤ r0

−f(r)u0(y − 12)/r r0 < r < r1

0 r ≥ r1

v(x, y) =

f(r)u0(x − 12)/r0 r ≤ r0

f(r)u0(x − 12)/r r0 < r < r1

0 r ≥ r1

p(x, y) = 1 , Bx(x, y) =5√4π

, By(x, y) = 0, where r0 = 0.1, r1 = 0.115,

r =

√(x − 1

2)2 + (y − 1

2)2 , w = Bz = 0, f(r) =

(r1 − r

)/(r − r0

)and,

γ = 1.4. The initial set-up is a high density rotating disk at the centerof the domain, surrounded by the ambient uniform density and pressure atrest. The rapidly spinning rotor not being in an equilibrium state due to thecentrifugal forces spins with the given initial rotating velocity, the initiallyuniform magnetic field in x -direction will wind up the rotor. The rotor willbe wrapped around by the magnetic field, and hence start launching torsionalAlfvn waves into the ambient fluid. The angular momentum of the rotor willbe shred by torsional Alfvn waves in later times. The circular rotor will beincreasingly compressed by the build-up of the magnetic pressure around therotor into an oval shape.

14

Page 15: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 6: The Rotor problem at t = 0.15 (a) Density (b) Pressure (c) Mach number (d)Magnetic pressure.

4.4. Solar Differential Rotation

This test problem is a more realistic test than the 2D rotor in section 4.3because it is 3D and uses a realistic model of differential rotation. The ini-tial magnetic field used was that of a 3D dipole centered within a sphere.The differential rotation flow pattern is imposed on the surface of the sphereas a boundary condition and the flow is allowed to wrap up the magneticfield. The angular momentum of the differentially rotating sphere launchestorsional Alfvn waves which then propagate away from the sphere along theaxis of symmetry of the rotating sphere which is the z− direction. As ex-pected, the faster the rotation speed the tighter the wrapping of the magneticfields became. However, unlike the rotor in section 4.3 the angular momen-tum transferred to the magnetic field in the form of torsional Alfvn wavescan propagate out of the domain of the simulation. This minimizes anydistortion of the sphere by the build up of magnetic pressure. In the casemodeled here the sphere is a rigid body and cannot be distorted by magneticpressure unlike the rotor in section 4.3. However, if we were to use ALE theshape of the sphere could respond to the Lorentz and centrifugal forces beinggenerated.

This test problem used an inner sphere at R = 1 and an outer sphere atR = 30. The boundary conditions on the outer sphere were “free” while theinner sphere used a flow field given by

u(x, y, z) = −r sin θ sin φφ

v(x, y, z) = r sin θ cos φφw(x, y, z) = 0

(30)

15

Page 16: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

where φ = 2.886 × 10−6 − 2.0 × 10−6 sin2 Θ − 0.370 × 10−6 sin4 Θ which isidentical to that of the Sun except that a larger rotation speed was used,where Θ = π

2− φ is the heliospheric latitude. The boundary condition on

the magnetic field at the inner boundary required the normal component ofB not to change while a zero derivative was imposed on ρ and P .

Figure 7: Accelerated Differential Rotation of a Magnetized Sphere: left view in the x-zplane and on the right a view looking straight down the axis of rotation

16

Page 17: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 8: Solar sphere showing active regions obtained from solar magnetograms

4.5. 3D Magnetized Explosion Test Problem

This test is essentially a 3D exploding diaphragm. A spherical grid with nouter radius of 0.87 was used. The explosion is driven by a high pressure, p =1000, region within a radius r ≤ 0.1 expanding into a low pressure region ofp = 0.1 with a constant density throughout both regions. A uniform magneticfield in the z−direction of magnitude 100 and a ratio of specific heats of γ =1.4. The explosion results in an anisotropic expansion, the greatest expansionbeing at z = 0. Essentially the explosion forms a diamagnetic bubble. Thevelocity components vx and vy in the x, y plane are anti-symmetric while thedensity and pressure are symmetric. The flow velocity vz in the z−directionis symmetric.

Figure 9: 3 Magnetized Explosion Test at t = 0.003 and xy plane (a) Density (b) Pressure(c) y-velocity (d) z-magnetic field.

17

Page 18: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 10: 3D Magnetized Explosion Test at t = 0.003 and zy plane (a) Density (b)Pressure (c) y-magnetic (d) z-magnetic field.

4.6. Magnetosphere

The magnetosphere of the earth represents a far superior test of an MHDcode than any other 3D test problem that the authors are aware of becauseinsitu empirical data exists which allows us to compare our MHD results tomeasured results. However, because we do not have a realistic ionosphericmodel coupled to the MHD code our simulation does not take account of thedepletion of day-side magnetic flux by reconnection and its replenishing fromthe night-side reconnecting magneto-tail. Our test assumes a southward IMFwith supersonic inflow of 400km/s with a density of 1.88×10−23g/cm3, pres-sure of 1.40 × 10−12 and a magnetic field of Bz = −0.5 × 104 gauss from thesun The results presented here are the first of their kind because the grid usedis a paraboloid of rotation as opposed to a rectangular box (see Figure( 11)).A typical magnetospheric model must impose boundary conditions on sevensurfaces, six sides of box, and the inner surface representing the boundary forthe plasma sphere and/or the ionosphere. Because the paraboloid of rotationhas only two surfaces plus the inner surface representing the boundary for theplasma sphere and/or the ionosphere implementation of boundary conditionsis easy. The bullet shaped surface represents the supersonic inflow bound-ary while the flat boundary represents the supersonic outflow boundary. Inaddition, the inner boundary is a real sphere.

5. Concluding Remarks

We have described the development, validation, and application of anupwind finite element algorithm to the simulation of three dimensional com-pressible MHD flow.

A discontinuous Galerkin formulation based a Taylor basis has been pre-sented for solving the compressible Euler equations. This formulation is

18

Page 19: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 11: Parabolic Mesh

able to provide a unified framework, where the finite volume schemes can berecovered as special cases of the discontinuous Galerkin method by choos-ing reconstruction schemes to compute the derivatives, offer the insight whythe DG methods are a better approach than the finite volume methodsbased on either TVD/MUSCL reconstruction or essentially non-oscillatory(ENO)/weighted essentially non-oscillatory (WENO) reconstruction, and hasa number of distinct, desirable, and attractive features, which can be effec-tively used to address some of shortcomings of the DG methods. The de-veloped method is used to compute a variety of both steady-state and time-accurate flow problems on arbitrary grids. The numerical results demon-strated the superior accuracy of this discontinuous Galerkin method in com-parison with a second order finite volume method and a third order WENOmethod, indicating its promise and potential to become not just a competi-tive but simply a superior approach than its finite volume and ENO/WENOcounterparts for solving flow problems of scientific and industrial interest.

19

Page 20: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 12: Logarithm of the pressure in the z-x plane

The versatility of this DG method is also demonstrated in its ability to com-pute 1D, 2D, and 3D problems using the very same code, greatly alleviatingthe need and pain for code maintenance and upgrade.

References

[1] Balsara, D. S., Spicer, D., Jan. 1999. Maintaining Pressure Positivity inMagnetohydrodynamic Simulations. Journal of Computational Physics148, 133–148.

[2] Balsara, D. S., Spicer, D. S., Mar. 1999. A Staggered Mesh AlgorithmUsing High Order Godunov Fluxes to Ensure Solenoidal Magnetic Fieldsin Magnetohydrodynamic Simulations. Journal of Computational Physics149, 270–292.

[3] Braginskii, S. I., 1965. Transport Processes in a Plasma. Reviews ofPlasma Physics 1, 205.

20

Page 21: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 13: Density in the z-x plane

[4] Brio, M., Wu, C. C., Apr. 1988. An upwind differencing scheme forthe equations of ideal magnetohydrodynamics. Journal of ComputationalPhysics 75, 400–422.

[5] de Fainchtein, R., Zalesak, S. T., Lohner, R., Spicer, D. S., Apr. 1995.Finite element simulation of a turbulent MHD system: comparison to apseudo-spectral simulation. Computer Physics Communications 86, 25–39.

[6] Jameson, A., Schmidt, W., Turkel, E. (Eds.), Jun. 1981. Numerical solu-tion of the Euler equations by finite volume methods using Runge Kuttatime stepping schemes.

[7] Luo, H., Baum, J. D., Loehner, R., Jun. 1994. Edge-based finite elementscheme for the Euler equations. AIAA Journal 32, 1182–1190.

21

Page 22: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 14: Cutting Plane in the z-x plane

[8] Swanson, R. C., Turkel, E., Feb. 1985. A multistage time-stepping schemefor the Navier-Stokes equations. Tech. rep.

[9] van Leer, B., Jul. 1979. Towards the ultimate conservative differencescheme. V - A second-order sequel to Godunov’s method. Journal of Com-putational Physics 32, 101–136.

22

Page 23: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 15: Magnetic field lines in the z-x plane

Figure 16: Field aligned current pattern resulting from a southward IMF: view from abovenorth pole

23

Page 24: A New 3D, Fully Parallel, Unstructured AMR MHD High Order ... · A New 3D, Fully Parallel, Unstructured AMR MHD High Order Godunov Code for Modeling Sun-Earth Connection Phenomena

Figure 17: Electric potential pattern and the resulting E × B drifts from a southwardIMF: view from above north pole

24