An efficient implementation of the divergence free constraint in a discontinuous Galerkin method for magnetohydrodynamics on unstructured meshes

Similar documents
An efficient implementation of the divergence free constraint in a discontinuous Galerkin method for magnetohydrodynamics on unstructured meshes

High Order Accurate Runge Kutta Nodal Discontinuous Galerkin Method for Numerical Solution of Linear Convection Equation

Locally Divergence-Free Central Discontinuous Galerkin Methods for Ideal MHD Equations

Positivity-preserving high order schemes for convection dominated equations

Fourier analysis for discontinuous Galerkin and related methods. Abstract

Bound-preserving high order schemes in computational fluid dynamics Chi-Wang Shu

A Comparative Study of Divergence-Cleaning Techniques for Multi-Dimensional MHD Schemes )

Weighted Essentially Non-Oscillatory limiters for Runge-Kutta Discontinuous Galerkin Methods

Hierarchical Reconstruction with up to Second Degree Remainder for Solving Nonlinear Conservation Laws

Multi-D MHD and B = 0

AN OPTIMALLY ACCURATE SPECTRAL VOLUME FORMULATION WITH SYMMETRY PRESERVATION

Local discontinuous Galerkin methods for elliptic problems

Hierarchical Reconstruction with up to Second Degree Remainder for Solving Nonlinear Conservation Laws

Runge-Kutta discontinuous Galerkin method with a simple and compact Hermite WENO limiter

A numerical study of SSP time integration methods for hyperbolic conservation laws

A Space-Time Expansion Discontinuous Galerkin Scheme with Local Time-Stepping for the Ideal and Viscous MHD Equations

Hyperbolic Divergence Cleaning for the MHD Equations

A New Fourth-Order Non-Oscillatory Central Scheme For Hyperbolic Conservation Laws

Entropy stable high order discontinuous Galerkin methods. for hyperbolic conservation laws

A Bound-Preserving Fourth Order Compact Finite Difference Scheme for Scalar Convection Diffusion Equations

State of the Art MHD Methods for Astrophysical Applications p.1/32

A SIMPLE TUTORIAL ON DISCONTINUOUS GALERKIN METHODS. Jennifer Proft CERMICS, ENPC. J. Proft CERMICS, ENPC

A class of the fourth order finite volume Hermite weighted essentially non-oscillatory schemes

The RAMSES code and related techniques 2- MHD solvers

A Finite Volume Code for 1D Gas Dynamics

On divergence-free reconstruction schemes for CED and MHD

Conservation Laws & Applications

On limiting for higher order discontinuous Galerkin method for 2D Euler equations

Discontinuous Galerkin Methods

Chapter 1. Introduction and Background. 1.1 Introduction

Math 660-Lecture 23: Gudonov s method and some theories for FVM schemes

AMS 529: Finite Element Methods: Fundamentals, Applications, and New Trends

Hybrid semi-lagrangian finite element-finite difference methods for the Vlasov equation

Discontinuous Galerkin methods Lecture 2

A parametrized maximum principle preserving flux limiter for finite difference RK-WENO schemes with applications in incompressible flows.

CENTRAL DISCONTINUOUS GALERKIN METHODS ON OVERLAPPING CELLS WITH A NON-OSCILLATORY HIERARCHICAL RECONSTRUCTION

Fourier Type Error Analysis of the Direct Discontinuous Galerkin Method and Its Variations for Diffusion Equations

Implicit Solution of Viscous Aerodynamic Flows using the Discontinuous Galerkin Method

Finite volumes for complex applications In this paper, we study finite-volume methods for balance laws. In particular, we focus on Godunov-type centra

Part 1: Numerical Modeling for Compressible Plasma Flows

YINGJIE LIU, CHI-WANG SHU, EITAN TADMOR, AND MENGPING ZHANG

Numerical resolution of discontinuous Galerkin methods for time dependent. wave equations 1. Abstract

Solution of Two-Dimensional Riemann Problems for Gas Dynamics without Riemann Problem Solvers

Strong Stability Preserving Properties of Runge Kutta Time Discretization Methods for Linear Constant Coefficient Operators

A High-Order Discontinuous Galerkin Method for the Unsteady Incompressible Navier-Stokes Equations

The Center for Astrophysical Thermonuclear Flashes. FLASH Hydrodynamics

A simple robust and accurate a posteriori subcell finite

Computational Astrophysics

A central discontinuous Galerkin method for Hamilton-Jacobi equations

Improvement of convergence to steady state solutions of Euler equations with. the WENO schemes. Abstract

DISCONTINUOUS GALERKIN METHOD FOR TIME DEPENDENT PROBLEMS: SURVEY AND RECENT DEVELOPMENTS

A minimum entropy principle of high order schemes for gas dynamics. equations 1. Abstract

A recovery-assisted DG code for the compressible Navier-Stokes equations

Divergence Formulation of Source Term

Advection / Hyperbolic PDEs. PHY 604: Computational Methods in Physics and Astrophysics II

A local-structure-preserving local discontinuous Galerkin method for the Laplace equation

The RAMSES code and related techniques I. Hydro solvers

A Central Compact-Reconstruction WENO Method for Hyperbolic Conservation Laws

Numerische Mathematik

A Multi-Dimensional Limiter for Hybrid Grid

An interface treating technique for compressible multi-medium flow with. Runge-Kutta discontinuous Galerkin method. Abstract

A Fourth-Order Central Runge-Kutta Scheme for Hyperbolic Conservation Laws

A Fifth Order Flux Implicit WENO Method

TOTAL VARIATION DIMINISHING RUNGE-KUTTA SCHEMES

Locally divergence-free spectral-dg methods for ideal magnetohydrodynamic equations on cylindrical coordinates

Strong Stability-Preserving (SSP) High-Order Time Discretization Methods

Superconvergence of discontinuous Galerkin methods for 1-D linear hyperbolic equations with degenerate variable coefficients

arxiv: v2 [math.na] 4 Mar 2014

On Numerical Simulation of Flow Problems by Discontinuous Galerkin and Finite Volume Techniques

HIGH ORDER NUMERICAL METHODS FOR TIME DEPENDENT HAMILTON-JACOBI EQUATIONS

30 crete maximum principle, which all imply the bound-preserving property. But most

Divergence- and Curl-Preserving Prolongation and Restriction Formulas

Finite Volume for Fusion Simulations

Energy Stable Discontinuous Galerkin Methods for Maxwell s Equations in Nonlinear Optical Media

Introduction to Partial Differential Equations

Discontinuous Galerkin and Finite Difference Methods for the Acoustic Equations with Smooth Coefficients. Mario Bencomo TRIP Review Meeting 2013

A general well-balanced finite volume scheme for Euler equations with gravity

Riemann Solvers and Numerical Methods for Fluid Dynamics

k=6, t=100π, solid line: exact solution; dashed line / squares: numerical solution

Numerical Simulation of Rarefied Gases using Hyperbolic Moment Equations in Partially-Conservative Form

Adaptive TVD-RK Discontinuous Galerkin Algorithms for Shallow Water Equations

Constrained Transport Method for the Finite Volume Evolution Galerkin Schemes with Application in Astrophysics

FUNDAMENTALS OF LAX-WENDROFF TYPE APPROACH TO HYPERBOLIC PROBLEMS WITH DISCONTINUITIES

Constrained hyperbolic divergence cleaning in smoothed particle magnetohydrodynamics with variable cleaning speeds

RESEARCH HIGHLIGHTS. WAF: Weighted Average Flux Method

Numerical Solutions for Hyperbolic Systems of Conservation Laws: from Godunov Method to Adaptive Mesh Refinement

Constrained hyperbolic divergence cleaning in smoothed particle magnetohydrodynamics with variable cleaning speeds

Chapter 1. Introduction

ALGEBRAIC FLUX CORRECTION FOR FINITE ELEMENT DISCRETIZATIONS OF COUPLED SYSTEMS

The CG1-DG2 method for conservation laws

A positivity-preserving high order discontinuous Galerkin scheme for convection-diffusion equations

Dedicated to the 70th birthday of Professor Lin Qun

An Improved Non-linear Weights for Seventh-Order WENO Scheme

Emerging Numerical Methods for Atmospheric Modeling

Sub-Cell Shock Capturing for Discontinuous Galerkin Methods

arxiv: v3 [physics.comp-ph] 22 Mar 2018

Numerical Simulation for Porous Medium Equation by Local Discontinuous Galerkin Finite Element Method

High order finite difference WENO schemes with positivity-preserving. limiter for correlated random walk with density-dependent turning rates

A discontinuous Galerkin spectral/hp method on hybrid grids

Advanced numerical methods for nonlinear advectiondiffusion-reaction. Peter Frolkovič, University of Heidelberg

Transcription:

An efficient implementation of the divergence free constraint in a discontinuous Galerkin method for magnetohydrodynamics on unstructured meshes Christian Klingenberg, Frank Pörner, Yinhua Xia Abstract In this paper we consider a discontinuous Galerkin discretization of the ideal magnetohydrodynamics (MHD) equations on unstructured meshes, and its divergence free constraint ( B = 0) in its magnetic field B. We first present two pre-process and post-process procedures for maintaining the divergence free constraint, namely an approach of locally divergence free projection inspired by the locally divergence free element [18], and another approach of the divergence cleaning technique given by Dedner et al. [14]. By combining these two approaches we obtain a efficient method at the almost same numerical cost. Finally, numerical experiments are performed to show the capacity and efficiency of the scheme. Key words: Ideal magnetohydrodynamics equations, discontinuous Galerkin method, divergence free constraint, locally divergence free projection, divergence free cleaning technique. Department of Mathematics, University of Würzburg, Emil-Fischer-Str. 40, 97074 Würzburg, Germany, E-mail: klingen@mathematik.uni-wuerzburg.de Department of Mathematics, University of Würzburg, Emil-Fischer-Str. 40, 97074 Würzburg, Germany, E-mail: frank.poerner@mathematik.uni-wuerzburg.de Corresponding author, School of Mathematical Sciences, University of Science and Technology of China, Hefei, Anhui 230026, P.R. China, E-mail: yhxia@ustc.edu.cn. Research supported by NSFC grant No.11371342, No. 11471306 1

1 Introduction Many physical problems arising in a modeling process can be described by the magnetohydrodynamic (MHD) equations which model the dynamics of electrically conducting fluids (e.g. plasma). Due to ionization and high temperature, all gases will change to plasma. Therefore the MHD equations are important in many physical applications. Since the equations are highly nonlinear, analytic solutions are not available for the problem. We will focus on the numerical solutions of the ideal MHD equations, which form the hyperbolic conservation laws with an additional involution constraint B = 0 in its magnetic field B. Besides the numerical challenges when solving such a nonlinear system, this divergence free constraint introduces another difficulty. On the analytic level the involution constraint is always fulfilled, but numerical experiments indicate that negligence in dealing with the divergence constraint leads to numerical instability and nonphysical solutions. Many different numerical approaches have been made to solve hyperbolic conservation laws, e.g. finite volume method (FVM) or finite element method (FEM), each having its advantages and disadvantages. We will focus on the discontinuous Galerkin (DG) method which combines the flexibility of FEM and the physical influence of FVM. The DG method uses a completely discontinuous basis. Normally they are chosen to be piecewise polynomials. Due to the discontinuity, the scheme is very flexible compared to standard continuous finite element method, such as as the allowance of arbitrary unstructured grids with hanging nodes and each cell can have its own polynomial degree independent of its neighbors. Furthermore, the DG scheme admits extremely local data structure (elements only communicate with its immediate neighbors) which leads to a extremely high parallel efficiency. The first discontinuous Galerkin method was introduced by Reed and Hill [27] in 1973. They were interested in the neutron transport problem, i.e. a time independent linear hyperbolic equation. In a series of papers [8, 9, 10, 11, 12] Cockburn and Shu developed a framework to solve nonlinear time dependent problems, like Euler or MHD equations. For time integration they are using explicit, nonlinearly stable high order Runge-Kutta time discretizations [29] and for the spatial DG discretization they apply exact or approximate Riemann solvers as interface numerical fluxes and total variation bounded nonlinear limiters to avoid numerical oscillation near shocks [28]. Due to its perfect parallelization property, the discontinuous 2

Galerkin method has found rapid applications in diverse areas as aeroacoustics, electro-magnetism, gas dynamics and many more. Several numerical results establish the good convergence behavior and reveal an excellent level of details in numerical runs, see e.g. [1]. In regard to the numerical influence of the divergence constraint, several modifications and ideas have been developed to satisfy the constraint or at least reduce the negative impact on the numerical solution. One of the first persons to notice the impact of nonzero divergence to the stability of the numerical schemes were Brackbill and Barnes. In [5], they proposed a global projection method to stabilize their scheme. Since the projection is based on solving a global elliptic partial differential equation, the scheme increases the computational cost a lot. Another approach is given by Powell [24, 26]. The derivation of onedimensional fluxes (for a finite volume scheme) is based on the symmetrizable form of the MHD equations. In order to symmetrize MHD, we have to add source terms proportional to B, see [25]. It was discovered later that the robustness of a MHD code can be improved by adding these so called Powell-Source terms, see [33]. In 2002 Dedner et al. [14] introduced their hyperbolic divergence cleaning technique which has several advantages over the Powell-Terms. They introduces a generalized Lagrangian multiplier to the MHD equations along with some control parameters. While the Powell source terms only propagates the divergence with fluid velocity, Dedner s method allows it to control this movement speed and additionally smooths the divergence. Powell s and Dedner s methods are not able to reduce the divergence to zero, like the projection method of Brackbill and Barnes does, but these methods are local and easily to implement. In [20, 19] Li et al. introduces a DG scheme which is based on the local reconstruction and preserves the zero divergence of the magnetic field globally. This is done by first discretizing the normal components of the magnetic field along the edges of the elements, followed by a locally divergence free reconstruction inside the elements. This method is restricted to cartesian grids, since it uses the information of the normal components of the elements. Li et al. also introduced in [18] a DG scheme which uses a locally divergence free basis for the magnetic field, which is more natural with regard to the the DG-formalism. Another big class of numerical schemes preserving the divergence of the 3

magnetic fields are schemes using constrained transport. The main idea of the constrained transport approach is to use a special discretization of the evolution equation for the magnetic field. These schemes are restricted to structured grids and require large stencils for the spatial discretization (see [32]). In this article, we discuss the divergence free constraint implementation on the unstructured mesh based on the DG method. Locally divergence free element [18] is simple, but it is not trivial to find a basis which results in a well-behaved problem for higher polynomial order and can not control the global divergence. We overcome this by projecting the magnetic field into the subspace of locally divergence free vector fields as a pre-process (LDFP). The result does not differ much from the locally divergence free element. And it also decouples the control of the divergence from the RKstep. To control the global part of the divergence, we adopt the approach of Dedner et al. (DEDNER) where we have two parameters to control both the advection speed and the smoothing factor of the divergence. We implement this approach as a post-process procedure. To control both the local and the global part of the divergence we combine both methods (ProjDED), where we apply the local projection as a pre-process step, and for the global part we apply the mixed approach of Dedner as a post-process step. This paper is organized as follows. In section 2, we introduce the MHD equations along with its involution constraint and the DG-scheme for a two dimensional system of conservation laws. Section 3 is dedicated to the divergence constraint and its numerical treatment. We present the divergence cleaning technique and the locally divergence free basis projection. We combine those two methods to obtain an efficient method. Subsequently, the numerical verification and experimental validation are discussed with several test problems: accuracy, Orszag-Tang, Blast-Problem and the magnetic rotor. Finally, conclusions are drawn in the Section 5. 4

2 Discontinuous Galerkin method for the MHD equation 2.1 The equations of ideal MHD The dynamics of electrically conductive fluids is not fully described by the Euler equations, but by coupling the Euler equations with Maxwell s equations, i.e. the ideal MHD equations t ϱ + (ϱv) = 0, t (ϱv) + (ϱvv T + (p + 12 ) BT B)I BB T = 0, t B + (vb T Bv T ) = 0, ( t E + (E + p + 1 ) 2 BT B)v (B T v)b = 0, (1) together with the involution constraint B = 0. (2) Here ϱ, v, B, E denotes the density, velocity, magnetic field and total energy, respectively. The MHD equations are closed by connecting the pressure p with the conserved variables p = (γ 1)(E 1 2 ϱvt v 1 2 BT B). The ratio of specific heats is denoted with γ > 1. For a derivation of system (1) we refer to [31]. If the initial magnetic field satisfies (2) the exact solution of system (1) will fulfill (2) for all time. 2.2 Discontinuous Galerkin Finite Element Method Consider a two dimensional hyperbolic partial differential system in conservation form u t + f(u) x + g(u) = 0, (3) y 5

with the flux functions f(u) = ( ) f1 (u), g(u) = f 2 (u) where u = (u 1, u 2 ) T is in the domain Ω R 2. ( ) g1 (u), g 2 (u) Let T be a regular triangulation of our computational domain Ω with shape-regular elements K, then our test function space is given as ( ) v1 V h = {v = : v i K P N (K); i = 1, 2; K T }, v 2 where P N (K) is the space of polynomial functions of degree at most N over K. Notice that functions in V h are allowed to be completely discontinuous across element interfaces. We multiply (3) with a test function v V h and integrate over K T to obtain [ ( ) ( ) f1 (u) f2 (u) 0 = u t v dx v g 1 (u) 1 + v g 2 (u) 2 ]dx K K ) ] + [(f(u)n x + g(u)n y v ds, K where n = (n x, n y ) T is the outward pointing normal vector of K. We now replace u with the approximate solution u h V h and the term f(u)n x + g(u)n y by a suitable numerical flux function h(u h ; n). It is enough to test with basis functions ψ = (ψ 1, ψ 2 ) T V h and we end up with the semi-discrete DG formulation for system (3) in two space dimensions: Find u h V h, such that [ ( ) ( ) ] f1 (u (u h ) t ψ dx = h ) f2 (u ψ g 1 (u h ) 1 + h ) ψ g 2 (u h ) 2 dx K K [ ] (4) h(u h ; n) ψ ds, K for all basis functions ψ V h and for all K T. The extension to more space dimensions and to systems with more than two components is straight 6

forward and is omitted here. Note that ideal MHD equations have 8 components in three space dimensions. For more details see [17]. By the method of lines, we formulate (4) as an ODE (for details see e.g. [17]) ū h = L(ū h, t), t where L denotes the right handed side of (4) and ū h is the coefficient vector of u h V h. To perform a time integration we consider an explicit Runge-Kutta scheme with s stages v (0) = ū n h i = 1,..., s : v (i) = i 1 α ij v (j) + β ij tl(v (j), t n + γ j t), (5) ū n+1 h = v (s) j=0 To be more precise, we use a strongly stability preserving RK-Scheme of order 4 (see [15, 17] for details). The time step is given as (compare to [13]) c t h κ (N + 1) 2, where κ (0, 1] is a constant. Since we use a triangular grid, the parameter h is the minimal altitude of the triangles. The wave speed c is obtained by computing the fast wave arising in the one-dimensional Riemann-Problem located at the interface of each triangle. In our simulations we use κ = 0.2 independent of the polynomial degree N. 3 Handling the divergence of the magnetic field A suitable measurement for B is given by B div := B dx + K T e E B ds, (6) K } {{ } local e } {{ } global 7

where E contains all edges of our triangulation T and denotes the jump in the normal component across the edge e. This can either derived by taking properties of the space H(div) into account ([21]) or by a functional approach ([7]). We see that B div consists of two different part which we want to refer as local and global part and we want to develop a scheme which works on both parts. It is well known that the standard DG-scheme does not preserve a divergence free magnetic field, which is initially divergence free. This is not very surprising since the additional constraint is not used in the derivation of the scheme. Unfortunately the error of the divergence is accumulating in time due to numerical errors and may lead to numerical instabilities. Next we describe some methods that deal with this negative influence. A well known method is the divergence cleaning given by Dedner et al. ([14]), where the divergence is coupled with the evolution equation of the magnetic field with a nonphysical variable ψ: B t + (vb T Bv T ) + ψ = 0, D(ψ) + B = 0, (7) and D is a linear differential operator. One possible choice is the hyperbolic approach D(ψ) = 1 c 2 h t ψ where ψ satisfies the wave equation 2 ttψ c 2 h ψ = 0. If we choose the parabolic approach D(ψ) = 1 c 2 p ψ, we obtain that ψ satisfies the heat equation ψ t c 2 p ψ = 0. Combing both yields the mixed approach D(ψ) = 1 c 2 t ψ + 1 ψ where ψ c h 2 p satisfies the telegraph equation ttψ 2 + c2 h c 2 t ψ c 2 h ψ = 0. p Here ψ is a abstract measurement for B and it should therefore be initialized with ψ(, 0) = 0. The parameter c h (0, ) influences the advection speed at which the error in the divergence is transported to the boundary of the domain and the parameter c p (0, ) controls the smoothing effect 8

of the parabolic approach. For more details see [14] and for possible choices of c h, c p see Altmann ([1]). We choose in our simulations c h = 7c v where c v is the maximal physical speed within the cells determined by the CFL condition. To determine c p we follow the suggestion in [14] and take the ratio between hyperbolic and parabolic effects to be constant c r = c2 p c h (0, ). It is found by Dedner that this choice gives results which are quite independent of the grid resolution and the scheme used. Furthermore they suggested a value c r = 0.18 which is a good compromise between damping and hyperbolic transport. If more damping is forced, we lose the effect of the hyperbolic transport of the error in the divergence (see [1]). For the one-dimensional MHD system Dedner proved under some simplifying assumptions, that B gets transported out of the domain, when the hyperbolic approach is used. If the parabolic approach is used we obtain a smoothing on B. For the mixed approach both properties are obtained. This method is also very effective in more than one space dimensions. When solving system (7) for the hyperbolic approach with an operator split approach we have to solve B t + ψ = 0, t ψ + c 2 h B = 0, with a DG approach. When applying the DG formalism to (8) with the Riemann-Solver suggested in [14] we noticed that for the computation of the Riemann-Solver we only need the value of ψ and B n at the boundary of the cells. We therefore conclude that the hyperbolic divergence cleaning works on the global part of our measurement of the divergence. If we want to use the mixed approach we have to take the parabolic source term into account. Again we do another operator splitting and since the source term only influences ψ we have to solve t ψ = c2 h ψ c 2 p which is an ordinary differential equation and can be done exactly ( ) ψ n+1 c 2 h = exp t n ψ n (9) c 2 p 9 (8)

where ψ n is the solution to system (8). We see that the parabolic approach operates both on the local and global part of B. To deal with the local part, one possibility is to modify the test function space V h to guarantee that the numerical solution is locally divergence free. Hence use V h := {v ( L 2 (Ω) ) 6 : v K ( P N (K) ) 6 (v4, v 5 ) K = 0, K T } where v 4 and v 5 denote the x and y component of the two dimensional magnetic field respectively. For MHD such an approach is made in [18]. Since the construction of a well-suited basis for Vh (see [17]) is not straight forward, we suggest to use a local L 2 projection instead, which can be done nearly without additional numerical expenses. First let P K be the L 2 projection on the element K, P K : ( P N (K) ) 2 LDF N (K) =: {p ( P N (K) ) 2 : p = 0}. Now define the local operator P ldf K : ( P N (K) ) 6 ( P N (K) ) 6 through q = P ldf K (p) : q i = p i, i 4, 5 and (q 4, q 5 ) = P K ((p 4, p 5 )) The global operator P ldf : V h V h is now defined q = P ldf (p) : q K = P ldf K (p K ), K T. If we apply P ldf in each time-step before applying the DG scheme with the test function space V h, we obtain nearly the same behavior in B as the DG scheme by using the locally divergence free space Vh (see Fig. 2). We therefore suggest a hybridized method ProjDED presented in Figure 1 where we also present a comparison between the different methods. For the description of the other schemes see section 4. In the hybridized method ProjDED, the projection is applied before the RK-step in order to work as a pre-smoother for the divergence and Dedner s mixed approach is used as a post-process to deal with the global part of the divergence and the additional local error introduced by the RK-step (note that the parabolic part of the mixed approach operates also on the local part of the divergence). Since the operator P K is a projection between finite dimensional spaces the numerical for applying P ldf cost are negligible (see also 10

Table 2). Furthermore P ldf preserves positivity in the means which allows us to apply the positivity results for MHD-DG given by Li ([6]) when a positivity preserving limiter ([34, 30]) is used after the projection. Thus, the projection method does not affect the stability of the DG scheme. Lemma 1. The operator P ldf defined above preserves positivity of density and pressure in the means. Proof. Since the density is not touched we focus on the pressure. Let P K as above and denote B ( P N (K) ) 2 the magnetic field in one cell K T for a given approximation q V h. Assume that the pressure p > 0 and denote q = P ldf (q). With P K 1 we obtain B K B K hence we get positivity of the pressure in the mean p dx = (γ 1)(E 1 2 ϱv2 1 2 B 2 ) dx K K K = K (γ 1)(E 1 2 ϱv2 1 2 B2 ) p dx > 0. 4 Numerical experiments The schemes we are using in the numerical tests are the following. The BASE scheme is just the DG scheme with test function space V h. The LDFB (locally divergence free basis) scheme are the DG scheme by using the test function space Vh. If we use instead a locally divergence free projection as a pre-process step for the BASE scheme, we call the scheme LDFP. DEDNER refers to the scheme of the divergence cleaning technique described in the last section is applied in the BASE scheme as a post-process step. And ProjDED is the combined method of LDFP and DEDNER described above (see Figure 1). Unless otherwise stated the local Lax-Friedrichs flux is used. 11

LDFB LDFP DEDNER ProjDED Pre-Process Apply operator Pre-Process Apply operator P ldf P ldf DG-RK-step Use Vh as testfunction space DG-RK-step Use V h as testfunction space DG-RK-step Use V h as testfunction space DG-RK-step Use V h as testfunction space Post-Process Apply Dedner div. cleaning Post-Process Apply Dedner div. cleaning Figure 1: Overview over the different schemes used. We separate each DG- RK step into a pre-process step, the actual DG-RK-step and a post-process step. To show the impact of the divergence, we compute the numerical convergence rates for the smooth test problem given in [6]. We only give the results for the density in Table 1, since for the other components the results look the same. We see that the error in the divergence decreases significantly the numerical order of convergence and our hybrid method is not destroying the numerical convergence order. Furthermore we encounter a strange behavior of our convergence order. For even polynomial order we get order N +1/2 but for uneven polynomial order we obtain the optimal rate of N +1. In the hydrodynamic case we do not discover such a behavior. The different behavior of the L 2 -rate of convergence for even and uneven polynomial approximations was also discovered in [16] and [22]. If we take a look at the computational time needed for the local projection method we define one complete time-step in the 4th order SSP-RK without any modifications to be 100%. In Table 2 we compare the time needed for one projection step compared with one step in the SSP-RK. We furthermore test our numerical scheme with 3 different test problems: Orszag-Tang ([23]), Blast-Problem [2] and the magnetic rotor ([32]). Our scheme is not breaking down and the results are in good agreement with results given in the literature. In Figure 3-5 we compare the divergence B div 12

ϱ N=1 scheme BASE LDFB LDFP DEDNER ProjDED h/h0 L 2 -error order L 2 -error order L 2 -error order L 2 -error order L 2 -error order 2 3 8.1e-03 8.5e-03 7.5e-03 7.8e-03 8.0e-03 2 4 4.7e-03 0.78 5.5e-03 0.64 4.9e-03 0.62 5.8e-03 0.42 6.3e-03 0.34 2 5 1.6e-03 1.55 1.9e-03 1.49 1.6e-03 1.59 2.1e-03 1.50 2.3e-03 1.47 2 6 4.1e-04 1.99 4.0e-04 2.27 4.0e-04 2.02 4.6e-04 2.16 4.9e-04 2.22 N=2 2 3 7.8e-03 7.9e-03 7.4e-03 7.3e-03 7.4e-03 2 4 2.7e-03 1.53 2.0e-03 2.00 2.0e-03 1.91 1.7e-03 2.07 1.7e-03 2.09 2 5 6.0e-04 2.16 4.0e-04 2.31 4.3e-04 2.18 3.6e-04 2.26 3.6e-04 2.26 2 6 1.0e-04 2.57 7.5e-05 2.41 7.6e-04 2.52 6.2e-05 2.55 6.2e-05 2.55 N=3 2 3 3.0e-03 2.2e-03 2.4e-03 2.4e-03 2.4e-03 2 4 3.4e-04 3.15 1.5e-04 3.86 1.5e-04 3.97 1.4e-04 4.12 1.4e-04 4.11 2 5 3.1e-05 3.43 1.0e-05 3.89 9.5e-06 4.02 7.0e-06 4.31 7.1e-06 4.30 2 6 2.7e-06 3.54 6.4e-07 3.96 6.0e-07 3.98 4.1e-07 4.11 4.2e-07 4.09 N=4 2 3 5.6e-04 3.8e-04 3.8e-04 3.7e-04 3.7e-04 2 4 4.2e-05 3.75 1.4e-05 4.79 1.4e-05 4.78 1.3e-05 4.86 1.3e-05 4.87 2 5 3.4e-06 3.58 5.9e-07 4.56 5.9e-07 4.56 5.6e-07 4.51 5.6e-07 4.51 2 6 3.0e-07 3.51 2.7e-08 4.52 2.6e-08 4.48 2.5e-08 4.49 2.5e-08 4.50 Table 1: Numerical order of convergence for the density of the MHD test problem 13

grid size 8x8 16x16 32x32 64x64 128x128 N=1 3.7% 1.8% 1.1% 0.4% 0.2% N=2 3.2% 1.6% 1.0% 0.3% 0.2% N=3 2.0% 1.5% 0.7% 0.2% 0.2% N=4 2.0% 1.5% 0.5% 0.2% 0.2% N=5 2.0% 1.4% 0.5% 0.2% 0.3% N=6 2.1% 1.4% 0.4% 0.3% 0.3% N=7 2.0% 1.3% 0.3% 0.3% 0.3% N=8 2.0% 1.1% 0.3% 0.3% 0.3% Table 2: Computational time needed for one projection step in relation to one time-step with 4th order SSP-RK for different mesh sizes and polynomial orders. for different numerical methods for this problems. We see that our combined method gives good result in all our test-cases. In all our computations 80.000 triangles are used. To show the difference between the Dedner scheme and our combined method we also plot the relative error div(dedner) div(projded) div(dedner) (10) over time, where div(dedner) denotes B div when the Dedner divergence cleaning is used. The results are given in Figure 6 and we see that ProjDED is about 25% more efficient than the Dedner scheme in our test simulations. We also test the 3-wave solver as a numerical flux specially designed for MHD by Bouchut et. al. ([3, 4]) which takes the divergence constraint into account. We expect for the combination of the 3-wave solver and our hybrid method ProjDED an improvement in our numerical scheme both in resolution of details for long time simulations and a decrease in the divergence compared to LLF. Both results are confirmed - see Figure 7. 14

25 20 Base LDFP LDFB 15 10 5 0 0 0.5 1 1.5 2 2.5 3 Figure 2: Measurement of the divergence for Orszag-Tang vortex problem. The results of LFDB and LDFP do not differ much. 25 20 BASE LDFP DEDNER ProjDED 15 10 5 0 0 0.5 1 1.5 2 2.5 Figure 3: Divergence error for different schemes for the Orszag-Tang vortex problem 15

10 8 BASE LDFP DEDNER ProjDED 6 4 2 0 0 0.003 0.006 0.009 0.012 Figure 4: Divergence error for different schemes for the blast problem 0.4 0.3 BASE LDFP DEDNER ProjDED 0.2 0.1 0 0 0.1 0.2 0.3 Figure 5: Divergence error for different schemes for the magnetic rotor problem 16

0.3 0.25 0.2 0.15 0.1 0.05 0.15 0 0 0.5 1 1.5 2 2.5 0.1 0.05 0.25 0.05 0 0 0.003 0.006 0.009 0.012 0.2 0.15 0.1 0 0 0.1 0.2 0.3 Figure 6: Relative error (10) for different test problems. Top: Orszag-Tang vortex problem, Middle: Blast problem, Bottom: Magnetic Rotor 17

2.5 LLF 3-wave 2 1.5 1 0.5 0 0 1 2 3 Figure 7: Demonstration of the impact of different numerical fluxes both on the level of resolution for long time computations and on the divergence. Top: kbkdiv for the LLF-flux and for the 3-wave solver. Bottom: Grayscale image of the density of Orszag-Tang vortex problem at time t = 6 with different numerical flux functions. Left: local Lax-Friedrichs, Right: 3-wave solver. Both computations are done on 45.000 triangles with linear polynomials, TVB-limiter and LDFP. 18

5 Conclusion We have presented four methods to deal with the error of the divergence of the magnetic field and compared their efficiency on several test problems. The advantage of LDFB is that the resulting magnetic field is locally divergence free for all time. This is guaranteed by the scheme itself, we do not need any pre- or post-process operators. But on the other side it is not trivial to find a basis which results in a well-behaved problem for higher polynomial order. Furthermore the coefficients of a linear combination of such basis function are non-physical. We overcome this by projecting the magnetic field into the subspace of locally divergence free vector fields as a pre-process. This is done in LDFP. The results do not differ from those obtained by LDFB and we have decoupled the control of the divergence from the RK-step. In fact, if we use the projection before each stage in the RK-step both schemes yield the same results. A very effective way of controlling the error in the divergence is the approach of Dedner et al.(dedner) where we have two parameters to control both the advection speed and the smoothing factor of the divergence, but choosing these parameters is not trivial. To control both the local and the global part of the divergence, we present the scheme (ProjDED) by combining the local projection as a pre-process step, and the mixed approach of Dedner et al. as a post-process step. Note that the projection does not destroy the positivity of the scheme. We see that all of these methods stabilize the DG method in the sense that the error in the divergence stays small or at least is significant smaller than the solution of BASE. As a result, we avoid non-physical oscillations leading to a more stable scheme. If we look at the relation of computational costs and efficiency, LDFP clearly wins. But since we are interested in getting B close to zero, it is worth to implement DEDNER. As already mentioned that the numerical costs of LDFP are negligible, so applying ProjDED is as costly as the Dedner approach. Furthermore, the projection does not affect the positivity of the scheme. Thus, the projection method does not affect the stability of the BASE scheme. As a result we conclude that ProjDED is a suitable and robust method to deal with the negative influence of a non-vanishing divergence of the magnetic field. 19

References [1] Altmann, C.: Explicit Discontinuous Galerkin Methods for Magnetohydrodynamics, University of Suttgart, Diss., 2012 [2] Balsara, D.S. ; Spicer, D.S.: A staggered mesh algorithm using high order Godunov fluxes to ensure solenoidal magnetic fields in magnetohydrodynamic simulations. In: Journal of Computational Physics 149 (1999), p. 270 292 [3] Bouchut, F. ; Klingenberg, C. ; Waagan, K.: A multiwave approximate Rieman solver for ideal MHD based on relaxation. I: theoretical framework. In: Numerische Mathematik 108 (2007), p. 7 42 [4] Bouchut, F. ; Klingenberg, C. ; Waagan, K.: A multiwave approximate Rieman solver for ideal MHD based on relaxation. II: numerical implementation with 3 and 5 waves. In: Numerische Mathematik 115 (2010), p. 647 679 [5] Brackbill, J. U. ; Barnes, D.C.: The Effect of Nonzero B on the numerical solution of the magnetohydrodynamic equations. In: Journal of Computational Physics 35 (1980), p. 426 430 [6] Cheng, Y. ; Li, F. ; Qiu, J. ; Xu, L.: Positivity-preserving DG and central DG methods for ideal MHD equations. In: Journal of Computational Physics 238 (2013), p. 255 280 [7] Cockburn, B. ; Li, F. ; Shu, C.-W.: Locally divergence-free discontinuous Galerkin methods for the Maxwell equations. In: Journal of Computational Physics 194 (2003), p. 588 610 [8] Cockburn, B. ; Shu, C.-W.: TVB Runge-Kutta Local Projection Discontinuous Galerkin Finite Element Method for Conservation Laws II: general framework. In: Mathematics of Computation 52 (1989), p. 411 435 [9] Cockburn, B. ; Shu, C.-W.: TVB Runge-Kutta Local Projection Discontinuous Galerkin Finite Element Method for Conservation Laws III: One-Dimensional Systems. In: Journal of Computational Physics 84 (1989), p. 90 113 20

[10] Cockburn, B. ; Shu, C.-W.: The Runge-Kutta Local Projection Discontinuous Galerkin Finite Element Method for Conservation Laws IV: The Multidimensional Case. In: Mathematics of Computation 54 (1990), p. 545 581 [11] Cockburn, B. ; Shu, C.-W.: The Runge-Kutta local projection P 1 - discontinuous-galerkin finite element method for scalar conservation laws. In: Mathematical Modelling and Numerical Analysis 25 (1991), p. 337 361 [12] Cockburn, B. ; Shu, C.-W.: The Runge-Kutta Discontinuous Galerkin Method for Conservation Laws V: Multidimensional Systems. In: Journal of Computational Physics 141 (1997), p. 199 224 [13] Cockburn, B. ; Shu, C.-W.: Runge-Kutta Discontinuous Galerkin Methods for Convection-Dominated Problems. In: Journal of Scientific Computing 16 (2001), p. 173 261 [14] Dedner, A. ; Kemm, F. ; Kroener, D. ; C.-D. Munz, T. S. ; Wesenberg, M.: Hyperbolic Divergence Cleaning for the MHD Equations. In: Journal of Computational Physics 175 (2002), p. 645 673 [15] Gottlieb, S. ; Shu, C.-W. ; Tadmor, E.: Strong stability preserving high order time discretization method. In: SIAM Rev. 43 (2001), p. 89 112 [16] Guzmán, J. ; Rivière, B.: Sub-optimal Convergence of Non-symmetric Discontinuous Galerkin Methods for Odd Polynomial Approximations. In: J. Sci. Comp. 40 (2009), p. 273 280 [17] Hesthaven, J. S. ; Warburton, T.: Nodal Discontinuous Galerkin Methods. Springer Verlag, 2008 [18] Li, F. ; Shu, C.-W.: Locally divergence-free discontinuous Galerkin methods for MHD equations. In: Journal of Scientific Computing 22-23 (2005), p. 413 442 [19] Li, F. ; Xu, L.: Arbitrary order exactly divergence-free central discontinuous Galerkin methods for ideal MHD equations. In: Journal of Computational Physics 231 (2012), p. 2655 2675 21

[20] Li, F. ; Xu, L. ; Yakovlev, S.: Central discontinuous Galerkin methods for ideal MHD equations with the exactly divergence-free magnetic field. In: Journal of Computational Physics 230 (2011), p. 4828 4847 [21] Nédélec, J.C.: A New Family of Mixed Finite Elements in R3. In: Numerical Mathematics 50 (1986), p. 57 81 [22] Oden, J. T. ; Babuska, I. ; Baumann, C. E.: A Discontinuous hp Finite Element Method for Diffusion Problems. In: Journal of Computational Physics 146 (1998), p. 491 519 [23] Orszag, S. ; Tang, C.-M.: Small-scale structure of two-dimensional magnetohydrodynamic turbulence. In: Journal of Fluid Mechanics 90 (1979), p. 129 143 [24] Powell, K. G.: An Approximate Riemann Solver for Magnetohydrodynamics (That Works in More than One Dimension). In: ICASE-Report 94-24 (1994) [25] Powell, K. G. ; Row, P. L. ; Myong, R. S. ; Gombosi, T. ; Zeeuw, D. D.: The symmetric form of magnetohydrodynamics equation. In: Numer. Methods Mech. Contin. Media 1 (1994), p. 26 [26] Powell, K. G. ; Row, P. L. ; Myong, R. S. ; Gombosi, T. ; Zeeuw, D. D.: An upwind scheme for magnetohydrodynamics. In: Numerical Methods for Fluid Dynamics V (1994), p. 163 [27] Reed, W. H. ; Hill, T. R.: Triangular mesh methods for the neutron transport equation. In: Tech. Report LA-UR-73-479, Los Alamos Scientific Laboratory (1973) [28] Shu, C.-W.: TVB uniformly high-order schemes for conservation laws. In: Mathematics of Computation 49 (1987), p. 105 121 [29] Shu, C.-W. ; Osher, S.: Efficient implementation of essentially nonoscillatory shoch-capturing schemes. In: Journal of Computational Physics 77 (1988), p. 439 471 [30] Shu, C.-W. ; Zhang, X.: On positivity-preserving high order discontinuous Galerkin schemes for compressible Euler equations on rectangular meshes. In: Journal of Computational Physics 229 (2010), p. 8918 8934 22

[31] Torrilhon, M.: Zur Numerik der idealen Magnetohydrodynamik, Eidgenssische Technische Hochschule Zrich, Diss., 2003 [32] Tóth, G.: The B = 0 constraint in shock-capturing magnetohydrodynamics codes. In: Journal of Computational Physics 161 (2000), p. 605 [33] Waagan, K. ; Klingenberg, C. ; Federrath, C.: A robust numerical scheme for highly compressible magnetohydrodynamics: Nonlinear stability, implementation and tests. In: Journal of Computational Physics 230 (2011), p. 3331 3351 [34] Zhang, X. ; Xia, Y. ; Shu, C.-W.: Maximum-Principle-Satisfying and Positivity-Preserving High Order Discontinuous Galerkin Schemes for Conservation Laws on Triangular Meshes. In: Journal of Scientific Computing 50 (2012), Nr. 1, p. 29 62 23