numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand eare the density,...

59
Numerical methods for hyperbolic systems Eric Sonnendr¨ ucker Max-Planck-Institut for Plasma Physics und Department of Mathematics, TU Munich Lecture notes Summer semester 2020 June 28, 2020

Upload: others

Post on 23-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Numerical methods for hyperbolic systems

Eric Sonnendrucker

Max-Planck-Institut for Plasma Physics

und

Department of Mathematics, TU Munich

Lecture notes

Summer semester 2020

June 28, 2020

Page 2: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Contents

1 Introduction 2

2 1D linear advection 62.1 Finite Difference schemes for the advection equation . . . . . . . . . . . . . . . . . . 6

2.1.1 Obtaining a Finite Difference scheme . . . . . . . . . . . . . . . . . . . . . . . 62.1.2 The first order explicit upwind scheme . . . . . . . . . . . . . . . . . . . . . . 62.1.3 The first order upwind implicit scheme . . . . . . . . . . . . . . . . . . . . . . 72.1.4 The method of lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.1.5 Convergence of linear finite difference schemes . . . . . . . . . . . . . . . . . 82.1.6 von Neumann stability analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 102.1.7 High-order time schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.1.8 The Cauchy-Kowalevski procedure . . . . . . . . . . . . . . . . . . . . . . . . 192.1.9 Modified equation analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.2 The Finite Volume method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.2.1 The first order Finite Volume schemes . . . . . . . . . . . . . . . . . . . . . . 262.2.2 Higher order schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

2.3 The Finite Element method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.4 The Discontinuous Galerkin (DG) method . . . . . . . . . . . . . . . . . . . . . . . . 33

3 Linear hyperbolic systems 373.1 The Riemann problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373.2 The discontinuous Galerkin method for linear systems . . . . . . . . . . . . . . . . . 39

3.2.1 General formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.2.2 Derivation of DG scheme for Maxwell’s equations . . . . . . . . . . . . . . . . 40

3.3 The Discontinuous Galerkin method for linear systems in 2D . . . . . . . . . . . . . 413.3.1 Derivation of the discrete equations . . . . . . . . . . . . . . . . . . . . . . . 423.3.2 Matrix formulation of the discrete problem . . . . . . . . . . . . . . . . . . . 443.3.3 Computation of the fluxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493.3.4 Semi-discrete energy conservation . . . . . . . . . . . . . . . . . . . . . . . . . 513.3.5 A leap-frog time scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

4 Non linear conservation laws 534.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.2 Weak solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

4.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544.2.2 The Rankine-Hugoniot condition . . . . . . . . . . . . . . . . . . . . . . . . . 54

1

Page 3: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Chapter 1

Introduction

Hyperbolic systems arise naturally from the conservation laws of physics, when dissipation effectsare not included. Writing down the conservation of mass, momentum and energy yields a systemof equations that needs to be solved in order to describe the evolution of the system. In contrast toparabolic equations which have a smoothing effect, hyperbolic equations transport discontinuitiesand nonlinear hyperbolic equations can even generate discontinuities, called shocks, from smoothinitial data. Note that the absence of diffusion is an idealized problem. In real physics thereis always some dissipation, but in some cases it is very small so that the hyperbolic system is thecorrect model. However, in cases where hyperbolic systems have multiple weak solutions, the correctsolution is obtained from the limit when the dissipation goes to zero.

In this lecture we will introduce the classical methods for numerically solving such systems.Because local conservation is essential to capture correctly the shocks in numerical methods, FiniteVolume discretizations that are based on the cell average of the unknowns rather than the pointvalues and where the interaction of neighboring cells is implemented through the definition ofnumerical flux between cell are more natural. Finite Volume methods, unless relying on data fromneighboring grid cells, are of order one. This is why a new class of very efficient and flexible methodhas emerged as a generalization of Finite Volume Methods the Discontinuous Galerkin method,which is based on the numerical flux coming from Finite Volumes and the piecewise polynomialdescription on a cell coming from Finite Elements.

Another generalization of the Finite Volume Method can be useful for some equations, whenthe important conservation properties are not the local conservation of cell averages, but of edgeor face averages. This leads to a class of less known methods, which are called generalized FiniteVolumes.

Even though local conservation properties are essential for capturing shocks, often other conser-vation properties of the initial system of equations also play an important role and should be keptat the discrete level.

Examples of scalar hyperbolic equations Classical time dependent partial differential fallinto two classes:

• parabolic equations, which have second order space derivatives, the standard example of whichis the heat equation

∂u

∂t+ ∆u = 0, (1.1)

which has to be supplemented with boundary conditions for example u = g on the boundaryof the considered domain.

• hyperbolic equations, which have first order time derivatives and for which a typical simple

2

Page 4: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

example is the linear advection equation

∂u

∂t+ a · ∇u = 0 (1.2)

This only needs incoming boundary conditions, i.e. u = g if a ·ν < 0, where ν is the outwardnormal. If ∇ · a = 0, the advection equation can also be written in conservative form

∂u

∂t+∇ · (au) = 0. (1.3)

• A classical nonlinear hyperbolic conservation law is the Burgers equation

∂u

∂t+

1

2

∂u2

∂x= 0, (1.4)

which can also be written∂u

∂t+ u

∂u

∂x= 0. (1.5)

• The Vlasov equation is an advection equation in phase space:

∂f

∂t+ v · ∇xf +

q

m(E + v ×B) · ∇vf = 0. (1.6)

Linear hyperbolic systems

• Maxwell’s equations

−∂E

∂t+∇× B = J, (1.7)

∂B

∂t+∇× E = 0, (1.8)

∇ · E = ρ, (1.9)

∇ · B = 0, (1.10)

where the charge density ρ and the current density J are the sources that are related by thecontinuity equation ∂ρ

∂t +∇ · J = 0, and all the constants are put to one.

The hyperbolic system consists of the first two equations (Ampere’s and Faraday’s laws). Thetwo last equations are constraints, which are satisfied automatically at continuous level. Thereenforcement by a numerical scheme is an important issue.

• The linearized acoustics equations

∂p

∂t+∇ · u = 0, (1.11)

∂u

∂t+∇p = 0, (1.12)

(1.13)

where p is the pressure and u the velocity and all constants are put to one.

3

Page 5: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Non linear systems of conservation laws

• The compressible Euler equations in conservative form read

∂ρ

∂t+∇ · (ρu) = 0, (1.14)

∂(ρu)

∂t+∇ · (ρu⊗ u) +∇p = 0, (1.15)

∂E

∂t+∇ · (u(E + p)) = 0, (1.16)

where E is the total energy per unit volume. For an ideal gas it is related to the pressure byE = ρu2 + p

γ−1 .

• The compressible ideal MHD equations read

∂ρ

∂t+∇ · (ρu) = 0, (1.17)

ρ

(∂u

∂t+ u · ∇u

)+∇p− (∇× B)×B = 0, (1.18)

∂B

∂t−∇× (u×B) = 0, (1.19)

∂p

∂t+∇ · (pu) + (γ − 1)p∇ · u = 0 (1.20)

General form of 1D systems of conservation laws In 1D the systems of conservation lawswe consider have the form

∂u

∂t+∂F(u)

∂x= 0, (1.21)

where u is a vector of unknown values. This can be written also

∂u

∂t+A(u)

∂u

∂x= 0, (1.22)

where A(u) is the Jacobian matrix with components ((∂Fi∂uj))i,j .

Definition 1 (Hyperbolic system).

• The system (1.21) is called hyperbolic if for all u the matrix A has only real eigenvalues andis diagonalizable.

• It is called strictly hyperbolic if all eigenvalues are distinct.

Examples:

• 1D Maxwell’s equation

∂E

∂t+∂B

∂x= J

∂B

∂t+∂E

∂x= 0

• 1D Euler equations

∂t

ρ

ρu

E

+∂

∂x

ρu

ρu2 + p

Eu+ pu

= 0,

4

Page 6: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

where ρ, u and E are the density, velocity and energy density of the gas and p is the pressurewhich is a known function of ρ.

The idea behind all numerical methods for hyperbolic systems is to use the fact that the systemis locally diagonalizable and thus can be reduced to a set of scalar equations. For this reason, beforegoing to systems it will be useful to first understand the scalar case and then see how it can beextended to systems by local diagonalization.

The first part of the lecture will be devoted to the linear case, starting with the scalar casewhich boils down to linear advection for which the core methods will be first introduced. This isfairly straightforward.

Many additional problems arise in the nonlinear case. Indeed in this case even starting from asmooth initial condition discontinuities can appear in the solution. In this case the concept of weaksolutions need to be introduced and there can be several solutions only one of which is physical. Wethus need a criterion to find the physical solution and numerical schemes that capture the physicalsolution. The notion of conservativity plays an essential role there. These will be addressed in thesecond part.

5

Page 7: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Chapter 2

1D linear advection

2.1 Finite Difference schemes for the advection equation

We consider first the linear 1D advection equation

∂u

∂t+ a

∂u

∂x= 0 for x ∈ [0, L], t ≥ 0. (2.1)

Let us assume for simplicity that the boundary conditions are periodic. This means that u andall its derivatives are periodic of period L. We have in particular u(0) = u(L). The constant a isgiven. As the problem is time dependent we also need an initial condition u(x, 0) = u0(x). For thisproblem, the exact solution is given by

u(t, x) = u0(x− at).

2.1.1 Obtaining a Finite Difference scheme

We first consider a uniform mesh of the 1D computational domain, i.e. of the interval [0, L] wherewe want to compute the solution, see Figure 2.1. The cell size or space step is defined by ∆x = L

N

. .

0 L

x1x0 x2 xNxN−1

Figure 2.1: Uniform mesh of [0, L]

where N is the number of cells in the mesh. The coordinates of the grid points are then definedby xj = j∆x. We then need a time step ∆t and we will compute approximations of the solutionat discrete times tn = n∆t, n ∈ N. As we assume the solution to be periodic of period L it will bedefined by its values at xj for 0 ≤ i ≤ N − 1 and we shall have u(tn, xN ) = u(tn, x0).

We shall denote by unj = u(tn, xj).

2.1.2 The first order explicit upwind scheme

A Finite Difference scheme is classically obtained by approximating the derivatives appearing inthe partial differential equation by a Taylor expansion up to some given order which will give theorder of the scheme. As we know only the values of the unknown function at the grid points, we

6

Page 8: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

use Taylor expansion at different grid points xj and linearly combine them so as to eliminate allderivatives up to the needed order. For example, considering only space derivatives

u(xj+1) = u(xj) + ∆x∂u

∂x(xj) +

∆x

2

∂2u

∂x2(xj) +O(∆x3), (2.2)

u(xj−1) = u(xj)−∆x∂u

∂x(xj) +

∆x

2

∂2u

∂x2(xj) +O(∆x3). (2.3)

The same can be done for the time discretization. For an approximation of order 1 in space andtime, we can simply write

∂u

∂t(tn, xj) =

u(tn+1, xj)− u(tn, xj)

∆t+O(∆t), (2.4)

∂u

∂x(tn, xj) =

u(tn, xj)− u(tn, xj−1)

∆x+O(∆x). (2.5)

Denoting by unj , the approximation of the solution at point xj and time tn and using the aboveformulas for the approximation of the partial derivatives we get the following approximation (2.1)at point xj and time tn:

un+1j − unj

∆t+ a

unj − unj−1

∆x= 0. (2.6)

We thus obtain the following explicit formula which enables to compute un+1j in function of the

values of u at time tn and points xj and xj−1 :

un+1j = unj − a

∆t

∆x(unj − unj−1). (2.7)

Denoting by Un the vector of RN whose components are un1 , . . . , unN−1 and

A =

(1− a∆t

∆x ) 0 a∆t∆x

a∆t∆x

. . .. . .

. . .. . . 0

0 a∆t∆x (1− a∆t

∆x )

.

The terms at the end of the first line comes from the periodic boundary conditions. We use thatun−1 = unN−1 and unN = un0 . Except on the two diagonals all the terms vanish

In this case the scheme (2.7) can be written in matrix form

Un+1 = AUn.

2.1.3 The first order upwind implicit scheme

When using an uncentered difference scheme in the other direction for the time derivative, we get

∂u

∂t(xj , tn+1) =

u(xj , tn+1)− u(xj , tn)

∆t+O(∆t), (2.8)

We use the same finite difference approximation for the space derivative. We then get the followingformula

un+1j + a

∆t

∆x(un+1j − un+1

j−1 ) = unj . (2.9)

7

Page 9: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

In this case the un+1j are defined implicitly from the unj as solutions of a linear system. This is why

this scheme is called implicit.Denote by B the matrix of the linear system:

B =

(1 + a∆t

∆x ) 0 −a∆t∆x

−a∆t∆x

. . .. . .

. . .. . . 0

0 −a∆t∆x (1 + a∆t

∆x )

.

The term at the end of the first line comes from the periodic boundary conditions. We use thatun−1 = unN−1 and unN = un0 . The terms not on the two diagonals vanish.

Going now from time step n to n+ 1 the implicit scheme in matrix form becomes

BUn+1 = Un.

2.1.4 The method of lines

As we saw, the time discretization can be performed by finite differences as for the space discretiza-tion. However it is generally more convenient to separate the space and time discretization for abetter understanding. The method of lines consists in applying only a discretization scheme in spacefirst (this can be Finite Differences or any other scheme). Then one obtains a system of ordinarydifferential equations of the form

dU

dt= L(U),

where U(t) is the vector whose components are ui(t) the unknown values at the grid point at any timet. Then one can use any Ordinary Differential Equation (ODE) solver for the time discretization.For example using an explicit Euler method with the upwind method in space yields the previousexplicit upwind scheme and when we use an implicit Euler method we get the implicit upwindscheme.

2.1.5 Convergence of linear finite difference schemes

Let us consider Finite Difference schemes in the following generic matrix form

Un+1 = AUn, (2.10)

where A is a matrix which does not depend on U .Let us denote by

U(tn) =

u(tn, x0)

...

u(tn, xN−1),

where u is the exact solution of the Partial Differential Equation (PDE) that is approximated bythe scheme (2.10).

Definition 2. A scheme of the form (2.10) is called consistent of order (q, p) if

U(tn+1)−AU(tn) = ∆tO(∆tq + ∆xp).

8

Page 10: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Definition 3. A scheme of the form (2.10) is called stable for some given norm ‖.‖ if there existconstants κ and τ independent of ∆t such that its solution Un at time tn = n∆t ≤ T verifies

‖Un‖ ≤ κ‖U0‖ ∀∆t such that 0 < ∆t < τ.

Theorem 1 (Lax). The scheme (2.10) is convergent if it is stable and consistent.

Proof. Let U(tn) be the vector whose components are the exact solution at the grid points at timetn. Then, as the scheme is consistent, we have

U(tn+1) = AU(tn) + ∆t en, with en = O(∆tq + ∆xp), i.e. ‖en‖ ≤ κ(∆tq + ∆xp),

for some constant κ. Denote by En = U(tn) − Un the vector containing the errors at each gridpoint at time tn, then as Un+1 = AUn, we have En+1 = AEn + ∆t en. Hence

En+1 = AEn + ∆t en,

= A(En−1 + ∆t en−1) + ∆ten,

= An+1E0 + ∆t (Ane0 +An−1e1 + · · ·+ en).

Hence‖En+1‖ ≤ ‖An+1E0‖+ ∆t (‖Ane0‖+ ‖An−1e1‖+ · · ·+ ‖en‖). (2.11)

The stability condition implies that ‖An−mem‖ ≤ κ‖em‖ and the consistency condition implies that‖em‖ ≤ κ(∆tq + ∆xp) for all m ≤ n. Plugging this into (2.11), we obtain:

‖En+1‖ ≤ κ‖E0‖+ κκn∆t(∆tq + ∆xp).

Then, as on the one hand E0 taking as an initial condition in the scheme U0 = U(0), and on theother hand n∆t ≤ T the maximal considered time, we have

‖En+1‖ ≤ κκT (∆tq + ∆xp),

which proves the convergence of the scheme.

Application to our first order schemes

Proposition 1. If the exact solution is of class C3, the upwind explicit scheme (2.7) and the upwindimplicit scheme (2.9) are consistent of order 1 in t and in x.

Proof. Let’s start with (2.7). Using the formulas (2.4) and (2.5), we obtain for the ith line ofU(tn+1)−AU(tn),

(U(tn+1)−AU(tn))i = u(xi, tn+1)− u(xi, tn) +a∆t

∆x(u(xi, tn)− u(xi−1, tn))

= ∆t

(∂u

∂t(xi, tn) +O(∆t) + a

∂u

∂x(xi, tn) +O(∆x)

).

The result follows as u is a solution of our equation. We thus get the (1,1) consistency of thisscheme.

Then for (2.9), we use (2.8) and (2.5). The ith line of BU(tn)− U(tn−1),

(BU(tn)− U(tn−1))i = u(xi, tn)− u(xi, tn−1) +a∆t

∆x(u(xi, tn)− u(xi−1, tn))

= ∆t

(∂u

∂t(xi, tn) +O(∆t) + a

∂u

∂x(xi, tn) +O(∆x)

).

The result follows as u is a solution of the equation. We thus get the (1,1) consistency of thisscheme.

9

Page 11: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Proposition 2. Assuming a > 0, the upwind scheme (2.7) is stable for the L∞ norm provided

a∆t

∆x≤ 1.

This condition is called the Courant-Friedrichs-Lewy or CFL condition.

Proof. Consider the scheme (2.7). Grouping the terms in unj−1 and unj , this scheme (2.7) becomes

un+1j =

a∆t

∆xunj−1 + (1− a∆t

∆x)unj .

As, a, ∆t and ∆x are positive, if a∆t∆x ≤ 1 the two factors of unj−1, unj are positive and equal to their

absolute value. Hence

|un+1j | ≤ a∆t

∆x|unj−1|+ (1− a∆t

∆x)|unj | ≤

(a∆t

∆x+ (1− a∆t

∆x))

maxj|unj |,

and somaxj|un+1j | ≤ max

j|unj |,

from which it follows that maxj |unj | ≤ maxj |u0j | for all n, which yields the L∞ stability.

2.1.6 von Neumann stability analysis

Let us start with an example. Consider the implicit centered Crank-Nicolson scheme. First thespace discretization with the centered scheme yields the system of differential equations:

dujdt

= −auj+1 − uj−1

2∆x.

Then integrating between tn and tn+1 and taking the trapezoidal quadrature rule yields

un+1j = unj −

a∆t

4∆x(un+1j+1 − u

n+1j−1 + unj+1 − unj−1).

Writing on the left the variables at tn+1 and on the right the variables at tn yields

un+1j +

a∆t

4∆x(un+1j+1 − u

n+1j−1 ) = unj −

a∆t

4∆x(unj+1 − unj−1). (2.12)

The idea of the von Neumann stability analysis is to evaluate the action of the scheme on the gridFourier modes. For k ∈ N the continuous kth Fourier mode on a L-periodic domain is e2 iπkx/L. Itsvalues at the grid points xj = j∆x = jL/N of our L-periodic grid with N cells are e2 iπkj/N . Sowe assume that unj = unk e2 iπkj/N and un+1

j = un+1k e2 iπkj/N . Plugging these expressions into (2.12)

yields

e2 iπNkj

(1 +

a∆t

4∆x( e

2 iπkN − e

−2 iπkN )

)un+1k = e

2 iπNkj

(1− a∆t

4∆x( e

2 iπkN − e

−2 iπkN )

)unk . (2.13)

It follows that

un+1k =

1 + i a∆t2∆x sin 2πk

N

1− i a∆t2∆x sin 2πk

N

unk ,

so that |un+1k | = |unk |. The Fourier modes are neither amplified nor attenuated by this scheme. It is

therefore stable.

10

Page 12: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Let us now consider an arbitrary linear scheme for updating unj the approximation at tn to un+1j

at tn+1 of the forml2∑

l=−l1

αlun+1j+l =

m2∑m=−m1

βmunj+m (2.14)

with (αl)−l1≤l≤l2 and (βm)−m1≤m≤m2 given constants. We also consider that the sequence (uj)j isperiodic of period N the number of grid cells, which means that uj+qN = uj for any q ∈ Z.

So if we take a grid function Un such that unj = unk e2 iπkj/N , then

m2∑m=−m1

βmunj+m =

m2∑m=−m1

βmunk e

2 iπNk(j+m) = unk e

2 iπNkj

m2∑m=−m1

βm e2 iπNkm. (2.15)

In the same way the left-hand-side of (2.14) becomes

l2∑l=−l1

αlun+1j+l =

l2∑l=−l1

αlun+1k e

2 iπNk(j+l) = un+1

k e2 iπNkj

l2∑l=−l1

αl e2 iπNkl. (2.16)

So if we denote by

λα,k =

l2∑l=−l1

αl e2 iπNkl, and λβ,k =

m2∑m=−m1

βm e2 iπNkm, (2.17)

we see that our scheme (2.14) becomes, assuming that λα,k 6= 0

un+1k =

λβ,kλα,k

unk . (2.18)

This means that the amplification factor of the scheme for the kth Fourier mode is |λβ,kλα,k|, which

means that the scheme is stable if this term directly related to the coefficients of the scheme is lessthan one.

In fact, the von Neumann analysis consists in applying the discrete Fourier transform to thediscretized equation. To make this more precise we first recall the definition and main propertiesof the discrete Fourier transform.

Let us denote by

Ek =

1...

e2iπjkN

...

e2iπ(N−1)k

N

(2.19)

the values at the grid points of the kth Fourier mode x 7→ e2 iπkx/L.Let P be the symmetric matrix whose columns are the 1√

NEk. They are normalized by 1√

Nto

get a similar form for the inverse. The coefficients of P are Pjk = 1√N

e2 iπjkN . We denote by P the

complex conjugate of P and by P ∗ = P> its conjugate transpose.

Lemma 1. The matrix P is unitary and symmetric, i.e. P−1 = P ∗ = P .

11

Page 13: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Proof. We clearly have P> = P , so P ∗ = P . There remains to prove that PP = IN . We compute

(PP )jk =1

N

N−1∑l=0

e2iπjlN e

−2iπlkN =

1

N

N−1∑l=0

e2iπl(j−k)

N .

Then if j = k it follows that (PP )jk = 1 and if j 6= k we have that

N−1∑l=0

(e

2iπ(j−k)N

)l=

1− e2iπNN(j−k)

1− e2iπN

(j−k)= 0,

so that indeed PP = IN .

Definition 4. Discrete Fourier Transform.

• The discrete Fourier transform of a vector U ∈ CN is the vector V = P ∗U .

• The inverse discrete Fourier transform of a vector V ∈ CN is the vector U = P ∗−1V =PV .

Corollary 1. Let F,G ∈ Cn and denote by F = P ∗F and G = P ∗G, their discrete Fouriertransforms. Then we have

• the discrete Parseval identity:

(F,G) = F>G = F>¯G = (F , G), (2.20)

• The discrete Plancherel identity:‖F‖ = ‖F‖, (2.21)

where (., .) and ‖.‖ denote the usual euclidean dot product and norm in Cn.

Proof. The dot product in CN of F = (f1, . . . , fN )> and G = (g1, . . . , gN )> is defined by

(F,G) =

N∑i=1

figi = F>G.

Then using the definition of the inverse discrete Fourier transform, we have F = PF , G = PG, weget

F>G = (PF )>PG = F>P>P¯G = F>

¯G,

as P> = P and P = P−1. The Plancherel identity follows from the Parseval identity by takingG = F .

Remark 1. The discrete Fourier transform is defined as a matrix-vector multiplication. Its compu-tation hence requires a priori N2 multiplications and additions. But because of the specific structureof the matrix there exists a very fast algorithm, called Fast Fourier Transform (FFT) for perform-ing it in O(N log2N) operations. This makes it particularly interesting for many applications, andmany fast PDE solvers make use of it.

12

Page 14: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Circulant matrices Let us now consider linear Finite Difference schemes on a periodic uniformgrid. They can be expressed as in (2.14), which can be written in matrix form

AUN+1 = BUN , (2.22)

where each line of A consists of the coefficients αl and each line of B of the coefficients βm. Dueto the periodicity, going to the next line consists in shifting the coefficients by one index. So thesematrices are of the form

C =

c0 c1 c2 . . . cN−1

cN−1 c0 c1 cN−2

cN−2 cN−1 c0 cN−3

.... . .

...

c1 c2 c3 . . . c0

(2.23)

with c0, c1, . . . , cN−1 ∈ R are called circulant.

Example 1. The explicit upwind scheme reads for a > 0

un+1j = unj −

a∆t

∆x(unj − unj−1) =

(1− a∆t

∆x

)unj +

a∆t

∆xunj−1

This yields the matrix form Un+1 = CUn with

c0 = 1− a∆t

∆x, cN−1 =

a∆t

∆x

and cj = 0 for 1 ≤ j ≤ N − 2.

Proposition 3. The eigenvalues of the circulant matrix C are given by

λk =

N−1∑j=0

cj e2 iπjkN . (2.24)

Proof. Let J be the circulant matrix of the form (2.23) with c1 = 1 and cj = 0 for j 6= 1. We noticethat an arbitrary circulant matrix C can be written as a polynomial in J

C =N−1∑j=0

cjJj .

As JN = I, the eigenvalues of J are the N th roots of unity that are given by ωk = e2 iπkπ/N . Wealso observe that Ek defined in (2.19) verifies JEk = ωkEk which means that Ek is an eigenvectorof J associated to the eigenvalue ωk.

This implies that

CEk =N−1∑j=0

cjJjEk =

N−1∑j=0

cj e2 iπjkN Ek,

and so the eigenvalues of C associated to the eigenvectors Ek are those defined in (2.24).

Proposition 4. Any circulant matrix C can be written in the form C = PΛP ∗ where P is thematrix of the discrete Fourier transform and Λ is the diagonal matrix of the eigenvalues of C. Inparticular all circulant matrices have the same eigenvectors (which are the columns of P ), and anymatrix of the form PΛP ∗ is circulant.

13

Page 15: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Corollary 2. We have the following properties:

• The product of two circulant matrix is a circulant matrix.

• A circulant matrix whose eigenvalues are all non vanishing is invertible and its inverse iscirculant.

Proof. The key point is that all circulant matrices can be diagonalized in the same basis of eigen-vectors. If C1 and C2 are two circulant matrices, we have C1 = PΛ1P

∗ and C2 = PΛ2P∗ so

C1C2 = PΛ1Λ2P∗.

If all eigenvalues λi of C = PΛP ∗ are non vanishing, Λ−1 is well defined and its diagonalcoefficients are 1/λi, 0 ≤ i ≤ N − 1 and

PΛP ∗PΛ−1P ∗ = I.

So the inverse of C is the circulant matrix PΛ−1P ∗.

Now applying the discrete Fourier transform to our generic scheme (2.22)

P ∗AUn+1 = P ∗BUn ⇔ P ∗APP ∗Un+1 = P ∗BPP ∗Un

which is equivalent toΛAU

n+1 = ΛBUn,

where ΛA and ΛB are the diagonal matrices containing the eigenvalues of the circulant matrices Aand B which are given explicitly from the matrix coefficients. This implies that

‖Un+1‖2 ≤ ‖Λ−1A ΛBU

n‖2 ≤ maxi

(|λB,i||λA,i|

)2

‖Un‖2,

It follows because ‖U‖ = ‖U‖ for any vector U that the scheme is L2 stable if maxi|λB,i||λA,i| ≤ 1.

L2 stability of the implicit upwind scheme Let us now apply this technique to prove thestability of the implicit upwind scheme (2.9):

Proposition 5. The scheme (2.9) is stable for the L2 norm for all strictly positive values of ∆xand ∆t.

Proof. Let us denote by α = a∆t∆x . We notice that matrix B is circulant with c0 = 1+α, cN−1 = −α,

the other ci being 0.The eigenvalues of B thus are λk = c0 + cN−1 e−2ikπ/N . Which implies that

Re(λk) = 1 + α(1− cos2kπ

N) ≥ 1,

as α ≥ 0. It follows that all eigenvalues of B have a modulus larger or equal to 1, which implies thatB is invertible Moreover the eigenvalues of its inverse all have modulus less or equal to 1, whichimplies the L2 stability of the scheme.

Proposition 6. The centred scheme second order in space and first order in time:

un+1j = unj −

a∆t

2∆x(unj+1 − unj−1).

is unstable in L2

14

Page 16: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Proof. Let us denote by α = a∆t∆x . The first order in time centred scheme becomes in matrix form

Un+1 = AUn where A is the circulant matrix with three non vanishing diagonals corresponding to

c0 = 1, c1 = −cN−1 = α2 e

2iπkN . Hence its eigenvalues are λk = 1− α

2 (e2iπkN − e−

2iπkN ) = 1 + iα sin 2πk

N

so that |λk| > 1 for all k such that sin 2kπN 6= 0. Hence the scheme is unstable.

Corollary 3. If the exact solution is of class C3, the schemes (2.7) and (2.9) converge.

Proof. This follows immediately from the Lax theorem by applying propositions 1 and 2.

2.1.7 High-order time schemes

We consider here an approach based on the method of lines, where we first perform a semi-discretization in space and then look for an appropriate time discretization.

When working with linear homogeneous equations with no source term, the simplest way toderive high order time schemes is to use a Taylor expansion in time and plug in the expressionof the successive time derivatives obtained from the differential system resulting from the semi-discretization in space. Consider for example that after semi-discretization in space using FiniteDifferences (or any other space discretization method) we obtain the differential systems

dU

dt= LU, with U =

u0(t)

...

uN−1(t)

,

and L the appropriate matrix coming from the semi-discretization in space. Then a Taylor expansionin time up to order p yields

U(tn+1) = U(tn) + ∆tdU

dt(tn) + · · ·+ ∆tp

p!

dpU

dtp(tn) +O(∆tp+1).

Now if L does not depend on time and U verifies dUdt = LU , we get that

dpU

dtp= LpU, for any integer p.

Hence, denoting Un an approximation of U(tn), we get a time scheme of order p using the formula

Un+1 = Un + ∆tLUn + · · ·+ ∆tp

p!LpUn = (I + ∆tL+ · · ·+ ∆tp

p!Lp)Un. (2.25)

For p = 1 this boils down to the standard explicit Euler scheme.Writing Un the solution in vector form at time tn, we define the propagation matrix

A = I + ∆tL+ · · ·+ ∆tp

p!Lp

such thatUn+1 = AUn.

The propagation matrix defines the fully discrete explicit scheme, which advances the solutionfrom time tn to time tn+1. Assuming the space discretization to be consistent, as the temporalscheme has been derived using a Taylor expansion it is also consistent. So the scheme will beconvergent if it is stable.

Definition 5. The numerical scheme defined by the propagation matrix A is stable if there existsτ > 0 such that Un is bounded for all n ∈ N and ∆t < τ .

15

Page 17: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

The criterion we shall use to determine the stability of a scheme is given by the followingproperty:

Proposition 7. The numerical scheme defined by the propagation matrix A is stable if there existsτ > 0 such that for all ∆t < τ all eigenvalues of A are of modulus less or equal to 1.

Stability of Taylor schemes. For a Taylor scheme of order p applied to dUdt = LU , we have

A = I + ∆tL+ · · ·+ ∆tp

p! Lp. Then denoting by λ an eigenvalue of L, the corresponding eigenvalue

of A is µ = 1 + λ∆t+ · · ·+ λp∆tp

p! .

Definition 6. The stability region of an explicit scheme defined by the propagation matrix A =I + ∆tL+ · · ·+ ∆tp

p! Lp is the region of the complex plane

z ∈ C | |µ(z)| = |1 + z + · · ·+ ∆zp

p!| ≤ 1

This means that the time scheme used for the semi-discrete model dUdt = LU is stable provided

all the eigenvalues λ of L are such that λ∆t is in the stability region.

Examples.

1. The Upwind scheme reads dui(t)dt = −aui(t)−ui−1(t)

∆x for each grid point xi and corresponds tothe circulant matrix L with c0 = − a

∆x = −cN−1. So its eigenvalues verify

λk∆t = −a∆t

∆x(1− e

−2iπkN ).

Obviously, for any integer value of k, λk∆t is on a circle in the complex plane of radius α = a∆t∆x

centered at (−a∆t∆x , 0). The stability region of the explicit Euler method is the circle of radius 1

centred at (−1, 0), so that in this case we see again that the scheme is stable provided a∆t∆x ≤ 1.

The stability region for the explicit Euler scheme and the location of the eigenvalues of theupwind schemes for different values of α = a∆t

∆x are shown in Fig. 2.2.

-2 -1 0 1

-1.0

-0.5

0.0

0.5

1.0

Explicit Euler upwind scheme = 0.5 = 0.75 = 1.0

Figure 2.2: Stability region for the explicit Euler scheme and the location of the eigenvalues of theupwind schemes for α = a∆t

∆x = 0.5, 0.75, 1.0.

For the higher order schemes, the radius corresponding to the maximal stability can be foundby computing the second real root (in addition to 0) r2 of the equation |µ(λ∆t)| = 1, see Fig.2.3 for a graphical representation of the stability regions. Indeed, the stability regions aresymmetric with respect to the real axis and the eigenvalue corresponding to the maximummodulus is on the real axis. For the second order Taylor scheme

µ(z) = 1 + z + z2/2.

16

Page 18: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

The Stability limit is reached on the real axis for x ∈ R such |µ(x)| = 1. The first case µ(x) = 1corresponds to x(1 +x/2) = 0, which has the roots x = 0 and x = −2. For µ(x) = −1, we get2 + x+ x2/2 = (x+ 2)2 = 0. There is only one real root x = −2. So in this case the stabilityinterval on the real axis is [−2, 0]. The real parts of the eigenvalues of the upwind schemeverify Re(λk∆t) = −α(1− cos(2πk

N )), whose minimum value is −2α. So, all eigenvalues are inthe stability region if 0 ≤ α ≤ 1.

For the order 3 scheme the stability region corresponds to |µ(λ∆t)| ≤ 1 for

µ(z) = 1 + z + z2/2 + z3/6.

As previously the stability limit is reached on the real axis for |µ(x)| = 1. For µ(x) = 1 we findx(1+x/2+x2/6) = 0 whose only real root is x = 0. For µ(x) = −1 we get 2+x+x2/2+x3/6 = 0which has one real root r2 ≈ −2.5127. The same reasoning as before shows that the schemeis stable if 0 ≤ α ≤ r2/2 ≈ 1.25637.

In the same way, we find that the upwind scheme of order 5 in time is stable if α ≤ r2/2 ≈1.6085 and for the upwind scheme of order 6 in time if α ≤ r2/2 ≈ 1.7767.

The value of α corresponds to the diameter of the largest circle of eigenvalues that is stillcompletely enclosed in the stability region. We notice that the maximal stable time step islarger for the higher order time schemes. These results are displayed in Fig. 2.3.

-2 -1 0 1-3

-2

-1

0

1

2

3 = 0.75 = 1.0

-2 -1 0 1-3

-2

-1

0

1

2

3 = 0.75 = 1.25

-2 -1 0 1-3

-2

-1

0

1

2

3 = 0.75 = 1.39

Figure 2.3: Stability regions for Taylor time schemes of order 2, 3 and 4 (from left to right). Locationof eigenvalues (circles) of upwind scheme (N = 16) for different values of α = a∆t

∆x .

2. The centered scheme: dui(t)dt = −aui+1(t)−ui−1(t)

2∆x corresponds to the circulant matrix L withc1 = − a

2∆x = −cN−1. The corresponding eigenvalues are such that

λk∆t = − a∆t

2∆x(e

2 iπkN − e

−2 iπkN ) =

ia∆t

∆xsin

2πk

N.

Hence the eigenvalues are all purely imaginary and the modulus of the largest one is a∆t∆x .

Hence a fully discrete scheme will be stable if the chosen time scheme has a stability regionincluding a non empty interval on the imaginary axis. The stability regions of the first andsecond order schemes are strictly on the negative part of the complex plane with only theorigin z = 0 being in the stability region on the imaginary axis. See Fig. (2.4). So thecorresponding schemes are unstable for any ∆t > 0.

17

Page 19: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

-2 -1 0 1

-2

-1

0

1

2 = 1.0

-2 -1 0 1

-2

-1

0

1

2 = 1.5

Figure 2.4: Stability regions of Taylor schemes of order 1 and 2 and eigenvalues of centered scheme(circles) for N = 16.

The third order Taylor scheme is stable for values iy on the imaginary axis if |µ( iy)|2 ≤ 1.We have

|µ( iy)|2 − 1 =

∣∣∣∣1 + iy − y2

2− iy3

6

∣∣∣∣2 − 1 (2.26)

=1

12y4

(y2

3− 1

). (2.27)

Hence the scheme is stable for the centered discretization in space if α = a∆t∆x ≤

√3.

A similar computation shows that the fourth order Taylor scheme is stable for the centereddiscretization in space if α = a∆t

∆x ≤ 2√

2. These results are displayed in Fig. 2.5.

-3 -2 -1 0 1-3

-2

-1

0

1

2

3

Third order Taylor centered scheme = 1.732

-3 -2 -1 0 1-3

-2

-1

0

1

2

3

Fourth order Taylor centered scheme = 2.828

Figure 2.5: Stability regions of Taylor schemes of order 3 and 4 and eigenvalues of centered scheme(circles) for N = 16 and the largest stable value of α.

Let us conclude with the stability regions of the order 5 and 6 Taylor schemes in time. Bothtime schemes are stable for the upwind schemes with maximum values of α = a∆t

∆x of approx-imately 1.61 and 1.78 respectively.

As for the stability region on the imaginary axis needed for the centered scheme, the 5th orderscheme is peculiar as it indeed has a part of the stability region on the imaginary axis, but

18

Page 20: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

these intervals are not around 0. So that the order 5 scheme is unstable for the centeredscheme for all ∆t > 0. The order 6 Taylor scheme is also unstable for the centered scheme forall ∆t > 0, but its stability region does not contain any part of the imaginary axis.

These results are represented in Figures (2.6) and (2.7). The latter corresponds to a zoomaround the imaginary axis of the former one.

Remark 2. The instability of the 5th order Taylor scheme in time associated to the centeredscheme in space is peculiar as the zooms around the imaginary axis of Figure 2.7 tell us. Eventhough there is a part of the imaginary axis in the stability zone, there is also a part in theneighborhood of 0 which is not. Therefore the small eigenvalues of A will lead to instabilityon longer time scales unlike the usual case, where the largest eigenvalues are unstable. Thisis problematic, as unlike usual Courant condition instability problems which reveal themselvesvery fast, this leads to a small growth in time.

-4 -3 -2 -1 0 1-4

-2

0

2

4

order 5upwind: = 1.61centered: = 3.37

-4 -3 -2 -1 0 1-4

-2

0

2

4

order 6upwind: = 1.78centered: = 3.5

Figure 2.6: Stability regions of Taylor schemes of order 5 and 6 and eigenvalues of centered schemeand upwind scheme for N = 16.

2.1.8 The Cauchy-Kowalevski procedure

The Cauchy-Kowalevski procedure consists in writing a Taylor expansion in time to update thescheme from time tn to tn+1 and then to use the equation to replace the time derivatives in theTaylor expansion by spatial derivatives. This is particularly simple for the linear advection, but canbe used in principle (with more complicated computations) for any hyperbolic equation or system.Let us now apply this procedure for our 1D linear advection: (we denote as usual by uni = u(tn, xi))

un+1i = uni + ∆t

∂u

∂t(tn, xi) +

∆t2

2

∂2u

∂t2(tn, xi) +O(∆t3). (2.28)

Then using the equation ∂u∂t + a∂u∂x = 0 we get

∂u

∂t(tn, xi) = −a∂u

∂x(tn, xi),

∂2u

∂t2(tn, xi) =

∂t(−a∂u

∂x) = −a ∂

∂x

∂u

∂t= a2∂

2u

∂x2(tn, xi),

19

Page 21: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

-0.005 -0.004 -0.003 -0.002 -0.001 0.000 0.001-4

-2

0

2

4

order 5upwind: = 1.61centered: = 3.3

-0.005 -0.004 -0.003 -0.002 -0.001 0.000 0.001-4

-2

0

2

4

order 6upwind: = 1.78centered: = 3.0

Figure 2.7: Stability regions of Taylor schemes of order 5 and 6 and eigenvalues of centered schemeand upwind scheme for N = 16. Zoom around the imaginary axis

and now we use centered schemes for the first and second order spatial derivatives of u:

∂u

∂x(tn, xi) =

uni+1 − uni−1

2∆x+O(∆x2),

∂2u

∂x2(tn, xi) =

uni+1 − 2uni + uni−1

∆x2+O(∆x2).

Plugging this into the Taylor expansion (2.28), we get:

un+1i = uni −

a∆t

2∆x(uni+1 − uni−1) +

a2∆t2

2∆x2(uni+1 − 2uni + uni−1) + ∆tO(∆t2 + ∆x2),

which yields the numerical scheme

un+1i = uni −

a∆t

2∆x(uni+1 − uni−1) +

a2∆t2

2∆x2(uni+1 − 2uni + uni−1) (2.29)

This scheme, which is second order in space and time, is known as the Lax-Wendroff scheme.Let us perform the von Neumann stability analysis. We see that the transfer matrix is tridiagonal

circulant with c0 = 1− a2∆t2

∆x2, c1 = − a∆t

2∆x + a2∆t2

2∆x2, and cN−1 = a∆t

2∆x + a2∆t2

2∆x2. So its eigenvalues are

given by

λk = 1− a2∆t2

∆x2+ (

a2∆t2

2∆x2− a∆t

2∆x)e

2 iπkN + (

a∆t

2∆x+a2∆t2

2∆x2)e

−2 iπkN

= 1− a2∆t2

∆x2+a2∆t2

∆x2cos

2πk

N− i

a∆t

∆xsin

2πk

N.

We recognize that λk is on an ellipse oriented along the real and imaginary axes and centred at thepoint (1 − a2∆t2

∆x2, 0). Its diagonal on the real axis is 2a

2∆t2

∆x2and on the imaginary axis it is 2a∆t

∆x .

Note that the real parts of λk go from 1− 2a2∆t2

∆x2to 1. So a necessary condition for stability being

that the modulus of the real part is smaller than 1, we find that for this to be realized we needa2∆t2

∆x2≤ 1 or equivalently for a ≥ 0 that a∆t

∆x ≤ 1.

20

Page 22: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Conversely assuming that 0 ≤ a∆t∆x ≤ 1, we find

|λk| ≤ 1− a2∆t2

∆x2+∣∣a2∆t2

∆x2cos

2πjk

N− ia∆t

∆xsin

2πjk

N

∣∣ ≤ 1− a2∆t2

∆x2+a∆t

∆x≤ 1.

Finally the Lax-Wendroff scheme is stable under the same CFL condition as the upwind schemea∆t∆x ≤ 1.

2.1.9 Modified equation analysis

Another useful way to understand the properties of a numerical scheme in addition to its convergenceand stability properties as we have seen them up to now is to find a modified equation that thesolution of the numerical scheme satisfies exactly. This is widely used for the discretization ofHamiltonian systems for which some classes of numerical schemes, called symplectic, can be shownto be the exact solution of another hamiltonian system with a modified hamiltonian expressed asa infinite series, as discussed in [7]. This method is also widely used to get a better grasp at theproperties of numerical schemes for hyperbolic partial differential equations, which we are interestedin in this lecture. We will use consider the method only to get a qualitative insight on the behaviorof the solution of the numerical scheme. It can be made rigorous in different ways depending onthe precise feature that one is interested in. See [6] for a discussion about the scope of the method.

Starting from an approximation of a function u by its values unj at grid points xj and at discretetimes tn. We define a function u such that

u(tn, xj) = unj for j = 0, . . . , N − 1, n = 0, . . . ,M. (2.30)

Modified equation for the explicit upwind scheme

Let us consider the explicit Euler upwind scheme

un+1j = unj −

a∆t

∆x(unj − unj−1), (2.31)

and consider u verifying (2.30). Taylor expansions of u around (tn, xj) yield

u(tn+1, xj) = u(tn, xj) + ∆t∂u

∂t(tn, xj) +

∆t2

2

∂2u

∂t2(tn, xj) +

∑p≥3

∆tp

p!

∂pu

∂tp(tn, xj), (2.32)

u(tn, xj±1) = u(tn, xj)±∆x∂u

∂x(tn, xj) +

∆x2

2

∂2u

∂x2(tn, xj) +

∑p≥3

(±1)p∆xp

p!

∂pu

∂xp(tn, xj). (2.33)

The Taylor series might not converge, but we will only need a few terms. Using (2.31) divided by∆t we get

∂u

∂t+ a

∂u

∂x+

∆t

2

∂2u

∂t2− a∆x

2

∂2u

∂x2= O(∆x2). (2.34)

As ∆t and ∆x are related by the CFL number, we assume that they are of the same order. Moreover,we assume that u verifies this modified equation for all t and x. In order to remove the higher ordertime derivatives, we take the time derivative of (2.34) ∂2u

∂t2(t, x)

∂2u

∂t2+ a

∂2u

∂x∂t+

∆t

2

∂3u

∂t3− a∆x

2

∂3u

∂x2∂t= O(∆x2) (2.35)

and in the same way we take the x derivative of (2.34)

∂2u

∂t∂x+ a

∂2u

∂2x+

∆t

2

∂3u

∂t2∂x− a∆x

2

∂3u

∂x3= O(∆x2). (2.36)

21

Page 23: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Plugging the expression of ∂2u∂t∂x from (2.36) into (2.35), we find

∂2u

∂t2− a2∂

2u

∂x2= O(∆x). (2.37)

We can now plug this equation (2.37) into (2.34) to get the final modified equation

∂u

∂t+ a

∂u

∂x−(

1− a∆t

∆x

)a∆x

2

∂2u

∂x2= O(∆x2). (2.38)

We can observe that the dominating correction term corresponds to a diffusion term with coefficient(1− a∆t

∆x

)a∆x

2.

For the solution to be bounded, we need that a∆t∆x ≤ 1, which is again our CFL condition. There

is no diffusion when the CFL number is exactly equal to one and the diffusion coefficient becomeslarger when the CFL number gets closer to 0. Moreover the diffusion coefficient is proportional to∆x so that it gets smaller when the grid is refined as expected.

Modified equation for the Lax-Wendroff scheme

The Lax-Wendroff scheme (2.29) reads

un+1j = unj −

a∆t

2∆x(unj+1 − unj−1) +

a2∆t2

2∆x2(unj+1 − 2unj + unj−1) (2.39)

Using the Taylor expansions (2.32) and (2.33), we get

un+1j − unj

∆t=∂u

∂t+

∆t

2

∂2u

∂t2+

∆t2

6

∂3u

∂t3+O(∆t3), (2.40)

unj+1 − unj−1

2∆x=∂u

∂x+

∆x2

6

∂3u

∂x3+O(∆x3), (2.41)

unj+1 − 2unj + unj−1

∆x2=∂2u

∂x2+O(∆x2). (2.42)

Plugging these into the Lax-Wendroff scheme (2.39) divided by ∆t we get

∂u

∂t+

∆t

2

∂2u

∂t2+

∆t2

6

∂3u

∂t3+ a

∂u

∂x+a∆x2

6

∂3u

∂x3− a2∆t

2

∂2u

∂x2= O(∆x3) (2.43)

where we still assume that ∆t and ∆x are related by a constant factor so that O(∆x) = O(∆t). Asfor the upwind scheme, we now want to express the higher order time derivatives with respect tospace derivatives. Taking the time derivative of (2.43), multiplying by ∆t and putting the order 3terms on the right-hand-side we get

∆t∂2u

∂t2+

∆t2

2

∂3u

∂t3+ a∆t

∂2u

∂x∂t− a2∆t2

2

∂3u

∂x2∂t= O(∆x3). (2.44)

Taking another time derivative and multiplying again by ∆t

∆t2∂3u

∂t3+ a∆t2

∂3u

∂x∂t2= O(∆x3). (2.45)

Now subtracting 1/12 of (2.45) from 1/2 of (2.44) gives

∆t

2

∂2u

∂t2+

∆t2

6

∂3u

∂t3+a∆t

2

∂2u

∂x∂t− a2∆t2

4

∂3u

∂x2∂t− a∆t2

12

∂3u

∂x∂t2= O(∆x3). (2.46)

22

Page 24: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

We now need to express the mixed derivatives above with respect to spatial derivatives. Takingthe derivative in x of (2.43) and multiplying by a∆t yields

a∆t∂2u

∂x∂t+a∆t2

2

∂3u

∂x∂t2+ a2∆t

∂2u

∂x2− a3∆t2

2

∂3u

∂x3= O(∆x3), (2.47)

taking the x derivative of (2.47) and multiplying by a∆t yields

a2∆t2∂3u

∂x2∂t+ a3∆t2

∂3u

∂x3= O(∆x3). (2.48)

Finally, taking the t derivative of (2.47) and multiplying by ∆t yields

a∆t2∂3u

∂x∂t2+ a2∆t2

∂3u

∂x2∂t= O(∆x3), (2.49)

which implies, using (2.48) that

a∆t2∂3u

∂x∂t2− a3∆t2

∂3u

∂x3= O(∆x3). (2.50)

We now plug this expression into (2.47) to get

a∆t∂2u

∂x∂t+ a2∆t

∂2u

∂x2= O(∆x3). (2.51)

With this, we can express all the mixed derivatives with respect to spatial derivatives, which weplug into (2.46)

∆t

2

∂2u

∂t2+

∆t2

6

∂3u

∂t3− a2∆t2

2

∂2u

∂x2+a3∆t2

4

∂3u

∂x3− a3∆t2

12

∂3u

∂x3= O(∆x3). (2.52)

We can now plug this expression of the higher order time derivatives into (2.43) to get the followingmodified equation

∂u

∂t+ a

∂u

∂x+a∆x2

6

(1− a2∆t2

∆x2

)∂3u

∂x3= O(∆x3) (2.53)

We see here that the dominating error term in the modified equation is in ∆x2 as expected for asecond order scheme and it is in factor of a third order derivative, such that the error is dominatedby dispersion rather than dissipation, which we have for second order space derivatives as in themodified equation of the explicit upwind scheme (2.31).

Fourier analysis of linear evolution equations

In order to better understand the qualitative behavior of evolution partial differential equations withdifferent order spatial derivatives, let us now compute the exact solutions on a periodic domain asa Fourier series.

1. Pure advection equation∂u

∂t+ a

∂u

∂x= 0. (2.54)

An analytical solution for an initial condition u0 reads

u(t, x) = u0(x− at). (2.55)

23

Page 25: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

2. Addition of a second order partial derivative in space. This leads to the advection diffusionequation which reads in 1D:

∂u

∂t+ a

∂u

∂x− ν ∂

2u

∂x2= 0. (2.56)

Given an initial condition u0 and a periodic domain of length L the solution can be sought asa Fourier series:

u(t, x) =∑k∈Z

uk(t) e2 iπkxL (2.57)

with

uk =1

L

∫ L

0u(t, x) e

−2 iπkL dx (2.58)

Then applying the this relation defining the Fourier coefficients on (2.56) we get

dukdt

+

[a

2 iπk

L+ ν

(2πk

L

)2]uk = 0, (2.59)

whose solution isuk(t) = uk(0) e−

2 iπkL

at e−( 2πkL )

2νt. (2.60)

Plugging the expression of the Fourier coefficients back into the Fourier series (2.57), thesolution of (2.59) can be expressed as

u(t, x) =∑k∈Z

uk(0) e2 iπk(x−at)

L e−( 2πkL )

2νt. (2.61)

We observe that without diffusion, ν = 0, we get u(t, x) = u(0, x−at) = u0(x−at) as expected,and with diffusion the Fourier coefficients are damped by the factor(

2πk

L

)2

νt,

which becomes larger when |k| is larger. The highest modes corresponding to the shortestwavelengths are damped faster, which leads to a smoothing of the solution.

3. Addition of a third order partial derivative in space. This leads to a linear Korteweg–de Vries(KdV) type equation which reads in 1D:

∂u

∂t+ a

∂u

∂x+ ν

∂3u

∂x3= 0. (2.62)

Note that the classical non linear KdV equation reads in 1D

∂u

∂t+ 6u

∂u

∂x+∂3u

∂x3= 0. (2.63)

In the same way as for the advection-diffusion equation, the equation on the Fourier coefficientsreads for (2.56)

dukdt

+

[a

2 iπk

L− iν

(2πk

L

)3]uk = 0, (2.64)

whose solution isuk(t) = uk(0) e−

2 iπkL

at e i( 2πkL )

3νt. (2.65)

24

Page 26: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Plugging the expression of the Fourier coefficients back into the Fourier series (2.57), thesolution of (2.59) can be expressed as

u(t, x) =∑k∈Z

uk(0) e2 iπkL

[x−(a−( 2πk

L )2ν)t]. (2.66)

Here again, we observe that for ν = 0, we get as expected that u(t, x) = u0(t− ax), but nowfor ν 6= 0 there is no diffusion, the amplitude of each Fourier mode is conserved, but the phasevelocity (the velocity at which the wave is propagating), which is a for pure advection is nowdifferent for each Fourier mode, namely

a−(

2πk

L

)2

ν.

This phenomenon is called dispersion. So the wave is propagating slower for positive ν, allthe more that |k| is larger.

Remark 3. The computations performed above can be extended to partial derivatives of any order,and we can easily check that for any p ∈ N. The equation

∂u

∂t+ a

∂u

∂x− ν ∂

2pu

∂x2p= 0

is diffusive and the damping coefficient of the mode number k is(2πk

L

)2p

ν,

which implies that higher mode numbers are damped even faster for larger p. The equation

∂u

∂t+ a

∂u

∂x+ ν

∂2p+1u

∂x2p+1= 0

is dispersive and the new phase velocity for the mode number k is

a−(

2πk

L

)2p

ν.

Dominating error for odd and even order numerical schemes

We noticed in the modified equation that the main error term for the 1st order explicit upwindscheme was a second order partial derivative in x which has diffusive effects. This is similar for allodd order schemes with the corresponding even partial derivatives appearing as the first correctionin the modified equation.

On the other hand, for even order schemes, like the Lax-Wendroff scheme the dominating termin the modified equation corresponds to an odd order partial derivative which induces a dispersivebehavior of the errors.

Finally unstable schemes can be stabilized by adding a viscosity coefficient with a small partialderivative of even order (in factor of ∆x such that it vanishes when the grid is refined) in the spiritof the additional terms in the modified equation. In particular the Lax-Wendroff scheme can beviewed as stabilized centered scheme.

25

Page 27: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

2.2 The Finite Volume method

2.2.1 The first order Finite Volume schemes

Let us introduce the Finite Volume method on the generic scalar conservation law of the form

∂u

∂t+∂f(u)

∂x= 0. (2.67)

In the case of our linear advection equation, we have f(u) = au.In the Finite Volume method, the computational domain is divided into cells (intervals in 1D)

and the unknown quantity that is numerically computed is the cell average of u on each cell. Recallthat for Finite Differences the unknowns were the point values of u at the grid points. We need tonumber the cells. In 1D a convenient way to do it in order to avoid confusion with the grid points,is to assign half integers. Let us denote by

ui+ 12(t) =

1

xi+1 − xi

∫ xi+1

xi

u(t, x) dx.

The Finite Volume numerical scheme is then obtained by integrating the original equation oneach cell of the domain. As for the time scheme there are at least two classical ways, the first isto also integrate in time between tn and tn+1 and then use a quadrature formula to compute theintegral, for example, the left hand rectangle rule yields a first order explicit formula. The second isto use the method of lines and separate space discretization from time discretization. Then standardODE discretization schemes can be used. This is what we shall do mostly in this lecture.

So integrating (2.67) on the cell [xi, xi+1] and dividing by ∆xi+ 12

= xi+1 − xi yields

dui+ 12(t)

dt+

1

∆xi+ 12

(f(u(t, xi+1))− f(u(t, xi))) = 0.

Here we see that a second ingredient is needed in order to define the algorithm. We only knowthe cell averages of u, how do we define the value at u at the cell interfaces. The simplest scheme,which is first order accurate in space consists in assuming that u is constant on each cell and thusequal to its cell average. But it is not defined at the cell interface. In order to complete the FiniteVolume scheme we need to define a so called numerical flux at each cell interface denoted by gi thatneeds to be consistent with f(xi), i.e. gi = f(u(xi)) + O(∆xp) for some positive p. A numericalflux of order 2 is the centred flux gi = 1

2(f(ui− 12) + f(ui+ 1

2)). This yields the following scheme for

a uniform ∆x:dui+ 1

2(t)

dt+

(f(ui+ 32)− f(ui− 1

2))

2∆x= 0.

Coupling it with an explicit Euler scheme in time this becomes, and applying it to the linearadvection (f(u) = au) we get

un+1i+ 1

2

= uni+ 1

2

− a∆t

2∆x(uni+ 3

2

− uni− 1

2

). (2.68)

We recognize here the centred Finite Difference scheme shifted to the cell centres. Remember thatthis scheme is unstable, so that it cannot be used in practice. In order to get stable scheme, weneed to introduce the notion of upwinding like for Finite Differences. This can be done very easilyin the definition of the numerical flux by simply choosing the value of u in the upwind cell only todefine the numerical flux. We have ∂f(u)

∂x = f ′(u)∂u∂x . This means that locally at each cell interfacethe direction of the transport is defined by the sign of f ′(u) (in the case of the linear advection

26

Page 28: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

f ′(u) = a and the upwind direction is determined by the sign of a). So the upwind numerical fluxis defined by

gi =

∣∣∣∣∣∣ f(ui− 12) if f ′(

ui− 1

2+u

i+12

2 ) ≥ 0

f(ui+ 12) if f ′(

ui− 1

2+u

i+12

2 ) < 0

Again, combining the Finite Volume scheme with an upwind flux and an explicit Euler time dis-cretization yields for the linear advection with a > 0

un+1i+ 1

2

= uni+ 1

2

− a∆t

∆x(ui+ 1

2− ui− 1

2). (2.69)

We also recognize here the first order in time and space upwind scheme shifted to the cell centres.

Remark 4. Using the midpoint rule

ui+ 12

=1

∆x

∫ xi+1

xi

u(x) dx = u(xi+ 12) +O(∆x2).

The we can reinterpret the Finite Volume as a Finite Difference scheme at the cell centres, whichexplains that we get the same formulas. However this is not true for higher orders, for which FiniteVolume and Finite Difference schemes are genuinely different.

2.2.2 Higher order schemes

In order to get high order Finite Volume schemes, the idea is to reconstruct polynomials of somegiven degree from the cell averages that are obtained with the Finite Volume procedure. The mainidea for doing this is to construct an interpolation polynomial for the primitive of the polynomialwe are looking for.

At time step tn we know unj+ 1

2

known average value of un on cell [xj , xj+1] of length ∆xj+ 12

=

xj+1 − xj . We want to construct a polynomial pm(x) of degree m such that

1

∆xj+ 12

∫ xj+1

xj

pm(x) dx = unj+ 1

2

.

To this aim we look for pm(x) such that ddx pm(x) = pm(x). Then

∆xj+ 12unj+ 1

2

=

∫ xj+1

xj

pm(x) dx = pm(xj+1)− pm(xj).

Let W (x) =∫ xx0un(x) dx a primitive of the piecewise constant function un with value un

j+ 12

on

[xj , xj+1]. Then W (xj+1) =∑j

k=1 hk+ 12unk+ 1

2

and

W (xj+1)−W (xj) = ∆xj+ 12unj+ 1

2

= pm(xj+1)− pm(xj).

Then we take for pm an interpolating polynomial at points xj of W so that

1

∆xj+ 12

∫ xj+1

xj

pm(x) dx =1

∆xj+ 12

(pm(xj+1)− pm(xj))

=1

∆xj+ 12

(W (xj+1)−W (xj)) = unj+ 1

2

.

27

Page 29: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

There are many ways to choose an interpolating polynomial, one could use spline interpolation orHermite interpolation, but the simplest and most used choice is to use a Lagrange interpolationpolynomial. This being said, a Lagrange interpolating polynomial of degree k is defined with k+ 1interpolation points. So we need to use as many values in neighboring cells as needed.

In order to reconstruct a polynomial of a given degree in a given cell there are many possiblestencils, i.e. ensembles of cells, that can be used. For the reconstruction of a polynomial of degreek exactly k average values corresponding to k neighboring cells are needed. The only constraint isthat the value on the cell where the polynomial being reconstructed is used. High-order methods areprone to oscillations especially around discontinuities. So one good idea is to use the stencil whichminimizes the oscillations. This can be easily done by choosing automatically the stencil based onthe Newton divided differences which can be used to construct the interpolating polynomial. Thismethod is called ENO (Essentially Non Oscillatory).

The high order scheme is obtained by using a high order approximation of the numerical fluxobtained by evaluating the reconstructed polynomial pm,i+ 1

2at the cell interface. The reconstruc-

tion is done cell by cell. This means in particular, when computing the numerical flux gi thatpm,i+ 1

2(xi) 6= pm,i− 1

2(xi), where pm,i+ 1

2is the reconstructed polynomial on the cell [xi, xi+1]. The

difference is of the order of the scheme. The centered flux gi is then defined as the average ofpm,i+ 1

2(xi) and pm,i− 1

2(xi) and the upwind flux as the value coming from the upwind cell.

Newton’s divided differences interpolation formula Consider a function f for which wewant to construct an interpolation polynomial of degree k such at the points (xi, f(xi)), 0 ≤ i ≤ k.Newton’s divided differences are defined recursively as follows:

f [x0] = f(x0), f [x0, x1] =f [x1]− f [x0]

x1 − x0, . . . ,

f [x0, . . . , xk] =f [x1, . . . , xk]− f [x0, . . . , xk−1]

xk − x0(2.70)

The Lagrange interpolation polynomial of f at the points x0, . . . , xk can be defined using the divideddifferences:

pk(x) = f [x0] + (x− x0)f [x0, x1] + · · ·+ (x− x0) . . . (x− xk)f [x0, . . . , xk]

In the ENO method the stencil for the reconstruction polynomial pm is then constructed usingthe following algorithm

• start with constant value W (xi) = 0 , W [xi, xi+1] = uni+ 1

2

• compute W [xi−1, xi, xi+1] and W [xi, xi+1, xi+2]

– Extend stencil with xi−1 if |W [xi−1, xi]| < |W [xi, xi+1]|– Extend stencil with xi+1 else

• proceed in same way with next divided difference

See also [9] for a detailed description of the ENO method.The ENO method can be still improved by taking all possible stencils but putting a weight on

each of the polynomials obtained. This is called the WENO method (Weighted Essentially NonOscillatory). A good review of this technique is given in [10].

28

Page 30: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

2.3 The Finite Element method

The Finite Element method is mathematically more involved than the Finite Difference and FiniteVolume methods. The discretization idea is based on the Galerkin principle of approximating thefunction space in which the solution is defined by a finite dimensional subspace. It uses also a weak(or variational form of the equation). In order to obtain the weak form, the idea is to multiply bya smooth test function and integrate over the whole domain, with a possible integration by partsto eliminate the highest derivatives.

Let us describe it on the advection-diffusion problem (assuming periodic boundary conditionson the domain [0, L]):

∂u

∂t+ a

∂u

∂x− ν ∂

2u

∂x2= 0.

Multiplying by a test function v which does not depend on t and integrating, with an integrationby parts in the last integral and periodic boundary conditions, yields

d

dt

∫ L

0uv dx+ a

∫ L

0

∂u

∂xv dx+ ν

∫ L

0

∂u

∂x

∂v

∂xdx = 0.

The natural space in which this formulation is defined is

H1([0, L]) = u ∈ L2([0, L]) | ∂u∂x∈ L2([0, L]).

The variational problem thus reads Find u ∈ H1 such that

d

dt

∫ L

0uv dx+ a

∫ L

0

∂u

∂xv dx+ ν

∫ L

0

∂u

∂x

∂v

∂xdx = 0 ∀v ∈ H1([0, L]).

Now in order to define a Finite Element approximation, we need to construct a sequence of subspacesVh of H1([0, L]) which is dense in H1([0, L]) (in order to get convergence). One subspace is of courseenough to compute a numerical approximation. There are many ways to construct such subspaces.The classical Lagrange Finite Element method consists in building a mesh of the computationaldomain and to assume that the approximating function is polynomial say of degree k in each cell.For the piecewise polynomial function space to be a included in H1([0, L]) the only additionalrequirement is that the functions are continuous at the cell interfaces. So the subspace Vh on themesh x0 < x1 < · · · < xN−1 is defined by

Vh =vh ∈ C0([a, b]) | vh|[xi,xi+1] ∈ Pk([xi, xi+1])

.

In order to express a function vh ∈ Vh we need a basis of Vh. This can be constructed easilycombining bases of Pk([xi, xi+1]). In order to impose the continuity requirement at the cell interface,the simplest is to use a Lagrange basis Pk([xi, xi+1]) with interpolation points on the edge of theintervals. Given k + 1 interpolation points xi = y0 < y1 < · · · < yk = xi+1 the Lagrange basisfunctions of degree k denoted by `k,i, 0 ≤ i ≤ k, are the unique polynomials of degree k verifying`k,i(yj) = δi,j . Because of this property, any polynomial p(x) ∈ Pk([xi, xi+1]) can be expressed as

p(x) =∑k

j=0 p(yj)`k,j(x) and conversely any polynomial p(x) ∈ Pk([xi, xi+1]) is uniquely determinedby its values at the interpolation points yj , 0 ≤ j ≤ k. Hence in order to ensure the continuity ofthe piecewise polynomial at the cell interface xi it is enough that the values of the polynomials onboth sides of xi have the same value at xi. This constraint removes one degree of freedom in eachcell, so that the total dimension of Vh is Nk and the functions of Vh are uniquely defined in eachcell by their value at the interpolation points in all the cells. The basis functions denoted of Vhdenoted by (ϕi)0≤j≤Nk are such that their restriction on each cell is a Lagrange basis function.

29

Page 31: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Note that for k = 1, corresponding to P1 finite elements, the degrees of freedom are just thevalues at the grid points. For higher order finite elements internal degrees of freedom are needed.For stability and convenience issues these are most commonly taken to be the Gauss-Lobatto pointson each cell. The basis functions for P3 elements on a mesh of two cells is represented in Figure 2.8and the positions of the Gauss-Lobatto points and their weights are given in Table 2.1 for 1 ≤ k ≤ 4.

0

1

• • • • • • •

`0,0 `0,1 `0,2 `0,3 `1,0 `1,1 `1,2 `1,3

Figure 2.8: Graphical representation of the P3 basis functions on 2 elements.

k = 1 xGL,0 = −1 xGL,1 = 1

wGL,0 = 1 wGL,1 = 1

k = 2 xGL,0 = −1 xGL,1 = 0 xGL,2 = 1

wGL,0 = 13 wGL,1 = 4

3 wGL,2 = 13

k = 3 xGL,0 = −1 xGL,1 = −√

15 xGL,2 =

√15 xGL,3 = 1

wGL,0 = 16 wGL,1 = 5

6 wGL,2 = 56 wGL,3 = 1

6

k = 4 xGL,0 = −1 xGL,1 = −√

37 xGL,2 = 0 xGL,3 =

√37 xGL,4 = 1

wGL,0 = 110 wGL,1 = 49

90 wGL,2 = 3245 wGL,3 = 49

90 wGL,4 = 110

Table 2.1: Gauss-Lobatto points in interval [−1, 1]

In order to obtain a discrete problem that can be solved on a computer, the Galerkin procedureconsist in replacing H1 by Vh in the variational formulation. The discrete variational problem thusreads: Find uh ∈ Vh such that

d

dt

∫ L

0uhvh dx+ a

∫ L

0

∂uh∂x

vh dx+ ν

∫ L

0

∂uh∂x

∂vh∂x

dx = 0 ∀vh ∈ Vh.

Now expressing uh (and vh) in the basis of Vh as uh(t, x) =∑Nk−1

j=1 uj(t)ϕj(x), vh(x) =∑Nk−1

j=1 vj(t)ϕj(x)

and plugging these expressions into the variational formulation, denoting by U = (u0, u1, · · · , uNk−1)>

and similarly for V yields: Find U ∈ Rnk such that

d

dt

∑i,j

ujvi

∫ L

0ϕi(x)ϕj(x) dx+ a

∑i,j

ujvi

∫ L

0

∂ϕj(x)

∂xϕi(x) dx

+ ν∑i,j

ujvi

∫ L

0

∂ϕi(x)

∂x

∂ϕj(x)

∂xdx = 0 ∀V ∈ RNk,

30

Page 32: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

which can be expressed in matrix form

V >(MdU

dt+DU +AU) = 0 ∀V ∈ RNk,

which is equivalent to

MdU

dt+DU +AU = 0

where the square Nk ×Nk matrices are defined by

M =

(∫ L

0ϕj(x)ϕi(x) dx

)i,j

, D =

(∫ L

0

∂ϕj(x)

∂xϕi(x) dx

)i,j

,

A =

(∫ L

0

∂ϕi(x)

∂x

∂ϕj(x)

∂xdx

)i,j

. (2.71)

Note that these matrices can be computed exactly as they involve integration of polynomials oneach cell. Moreover because the Gauss-Lobatto quadrature rule is exact for polynomials of degreeup to 2k − 1, both A and D can be computed exactly with the Gauss-Lobatto quadrature rule.Moreover, approximating the mass matrix M with the Gauss-Lobatto rule introduces an error whichdoes not decrease the order of accuracy of the scheme [2] and has the big advantage of yielding adiagonal matrix. This is what is mostly done in practice.

Matrix Assembly. Usually for Finite Elements the matrices M , D and A are computed fromthe corresponding elementary matrices which are obtained by change of variables onto the referenceelement [−1, 1] for each cell. So∫ L

0ϕi(x)ϕj(x) dx =

N−1∑ν=0

∫ xν+1

ϕi(x)ϕj(x) dx,

and performing the change of variable x = xν+1−xν2 x+ xν+1+xν

2 , we get∫ xν+1

ϕi(x)ϕj(x) dx =xν+1 − xν

2

∫ 1

−1

ˆα(x)ˆ

β(x) dx,

where ˆα(x) = ϕi(

xν+1−xν2 x+ xν+1+xν

2 ). The local indices α on the reference element go from 0 to k

and the global numbers of the basis functions not vanishing on element ν are j = kν + α. The ˆα

are the Lagrange polynomials at the Gauss-Lobatto points in the interval [−1, 1].The mass matrix in Vh can be approximated with no loss of order of the finite element approx-

imation using the Gauss-Lobatto quadrature rule. Then because the products ˆα(x)ˆ

β(x) vanish

for α 6= β when x is a Gauss-Lobatto point by definition of the ˆα which are the Lagrange basis

functions at the Gauss-Lobatto points, the elementary matrix M is diagonal and we have∫ 1

−1

ˆα(x)2 dx ≈

k∑β=0

wGLβ ϕα(xβ)2 = wGLα

using the quadrature rule, where wGLα is the Gauss-Lobatto weight at Gauss-Lobatto point (xα) ∈[−1, 1]. So that finally M = diag(wGL0 , . . . wGLk ) is the matrix with k+ 1 lines and columns with theGauss-Lobatto weights on the diagonal.

Let us now compute the elements of D. As previously we go back to the interval [−1, 1] withthe change of variables x = xν+1−xν

2 x + xν+1+xν2 and we define ˆ

α(x) = ϕi(xν+1−xν

2 x + xν+1+xν2 ).

31

Page 33: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Note that a global basis function ϕi associated to a grid point has a support which overlaps twocells and is associated to two local basis functions. Thus one needs to be careful to add the twocontributions as needed in the final matrix.

We get ˆ′α(x) = xν+1−xν

2 ϕ′i(xν+1−xν

2 (x+ 1) + xν). It follows that∫ xν+1

ϕ′j(x)ϕi(x) dx =

∫ 1

−1

2

xν+1 − xνˆ′β(x)ˆ

α(x)xν+1 − xν

2dx =

∫ 1

−1

ˆ′β(x)ˆ

α(x) dx.

The polynomial ˆα(x) is of degree k so that ˆ′

β(x) is of degree k − 1 so that the Gauss-Lobattoquadrature rule with k + 1 points is exact for the product which is of order 2k − 1. Using this rule∫ 1

−1

ˆ′β(x)ˆ

α(x) dx =k∑

m=0

wGLmˆ′β(xm)ˆ

α(xm) = wGLαˆ′β(xα).

As before, because ˆα are the Lagrange polynomials at the Gauss-Lobatto points, only the value

at xα in the sum is one and the others are 0. On the other hand evaluating the derivatives of theLagrange polynomial at the Gauss-Lobatto points can be done using the formula

ˆ′α(xβ) =

pβ/pαxβ − xα

for β 6= α and ˆ′α(xα) = −

∑β 6=α

ˆ′β(xα),

where pα =∏β 6=α(xα − xβ). This formula is obtained straightforwardly by taking the derivative of

the explicit formula for the Lagrange polynomial

ˆα(x) =

∏β 6=α

(x− xβ)∏β 6=α

(xα − xβ)

and using this expression at the Gauss-Lobatto point xβ 6= xα. We refer to [1] for a detaileddescription.

We can now conclude with the computation of the stiffness matrix A. Having already computedthe expression of the change of variable of the derivatives we can quickly go to the result. We havein each element∫ xν+1

ϕ′j(x)ϕ′i(x) dx =

∫ 1

−1

(2

xν+1 − xν

)2ˆ′β(x)ˆ′

α(x)xν+1 − xν

2dx

=2

xν+1 − xν

∫ 1

−1

ˆ′β(x)ˆ′

α(x) dx =2

xν+1 − xν

k∑m=0

wGLmˆ′β(xm)ˆ′

α(xm).

As the polynomial being integrated is of degree 2(k− 1) = 2k− 2 the Gauss-Lobatto quadrature isexact. Here no simplifications occurs in the sum, which has to be computed. Still the expressionsof the derivatives at the Gauss-Lobatto points computed above can then be plugged in.

Time advance and stability. At the end we get as for the finite difference and finite volumemethods a system of differential equations that can be solved with any ODE solver. Let us make afew remarks concerning the stability of the scheme (once discretized in time). As we saw previouslythis depends on whether the eigenvalues of the matrix L is included in the stability zone of the ODEsolver. Here L = −M−1(D+A). Note that the matrices M and A are obviously symmetric and thushave only real eigenvalues. On the other hand, for periodic boundary conditions and integration by

32

Page 34: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

parts, yields that∫ ∂ϕj(x)

∂x ϕi(x) dx = −∫ϕj(x)∂ϕi(x)

∂x dx. Hence D is skew symmetric and has onlyimaginary eigenvalues. Remember that the stability zones of our explicit ODE solvers lie mostly onthe left-hand side of the imaginary axis in the complex plane, and that only the third and fourthorder schemes have a stability zone on the imaginary axis. Hence in the pure advection case ν = 0L has purely imaginary eigenvalues and the order one and two time schemes are always unstable.In order to stabilize the method a procedure that is often used with a finite element discretizationof a pure advection problem is to add a diffusive term that goes to 0 with the cell size, i.e takeν = α∆x, in this case a small negative real part is added to the eigenvalues which are thus pushedinto the left half of the complex plane and the stability zone is enhanced.

Stabilizing a Finite Element scheme is quite a bit more involved than straightforward upwindingas is done in Finite Volume schemes, even though good solutions exist, in particular by usinga Petrov-Galerkin method, which in contrast to the classical Galerkin method uses two differentspaces for the trial and test functions.

2.4 The Discontinuous Galerkin (DG) method

The DG method represents the unknowns like the Finite Element method by piecewise polynomialfunctions, but unlike Finite Element methods the polynomials are discontinuous at the cell interfacesand a numerical flux is defined at the cell interface in the same way as for Finite Volume methods.

So on each cell the discrete unknown uh is represented as a linear combination of well chosenbasis functions of the space of polynomials of degree k Pk. The dimension of this space is k + 1.As no continuity is enforced at the element interface, there is no constraint on the basis functionsand generally two kinds of basis functions are used: either the Legendre polynomials which forman orthogonal basis, we then speak of modal DG or one can use a Lagrange basis defined on aset of interpolation points within the cell we then speak of nodal DG. The interpolation points aregenerally chosen to be either the Gauss points or the Gauss-Lobatto points which are both veryconvenient as they allow to express the integrals appearing in the formulation exactly (for Gauss)or very accurately without loss of order in the DG method (for Gauss-Lobatto) using the associatedquadrature rule.

For the derivation of a DG scheme, the equation is multiplied by a polynomial test function oneach cell and and integration by parts is used so that a boundary term appears which will allow thecoupling between two neighboring cells. Let us apply it here to the conservation law

∂u

∂t+∂f(u)

∂x= 0.

We then get

d

dt

∫ xν+1

uv dx+

∫ xν+1

∂f(u)

∂xv dx

=d

dt

∫ xν+1

uv dx−∫ xν+1

f(u)∂v

∂xdx+ (f(u(xν+1))v(xν+1)− f(u(xν))v(xν)) = 0. (2.72)

The DG method has then two key ingredients.

1. Choose on each cell a finite dimensional representation, usually by a polynomial as said pre-viously.

2. Define a unique numerical flux denoted by gν = g(uL(xν), uR(xν))) at the cell interface whichis constructed from the two values coming from the cells sharing the interface on the left andon the right. Indeed the approximation of u being discontinuous at the cell interface, thevalues u(xν) and f(u(xν)) are not defined in a natural way and ingredient of the scheme is toapproximate the flux f(u(xν)) by the numerical flux gν

33

Page 35: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

At the interface between two cells xν , the Discontinuous Galerkin approximation provides twovalues of u(xν), uL coming from the approximation of u on the left of xν and uR corresponding tothe value at xν from the right-hand cell. The numerical flux at each cell interface gν needs to beconsistent with f(xν), i.e. gν = f(u(xν)) + O(∆xp) for some positive integer p. A numerical fluxof order 2 is the centred flux gν = 1

2(f(uL) + f(uR)). The centred flux amounts to projecting thediscontinuous approximation to a continuous Finite Element basis and with yield a skew symmetricderivative matrix. Thus this scheme is unstable for explicit time discretizations of order 1 and 2. Inorder to get stable scheme in this case, we need to introduce the notion of unwinding like for FiniteDifferences or Finite Volumes. This can be done very easily in the definition of the numerical fluxby simply choosing the value of u in the upwind cell only to define the numerical flux. We have∂f(u)∂x = f ′(u)∂u∂x . This means that locally at each cell interface the direction of the transport is

defined by the sign of f ′(u) (in the case of the linear advection f ′(u) = a and the upwind directionis determined by the sign of a). So the upwind numerical flux is defined by

gν = g(uL(xν), uR(xν))) =

∣∣∣∣∣∣ f(uL) if f ′(uL+uR2 ) ≥ 0,

f(uR) if f ′(uL+uR2 ) < 0.

0

1

• • • •

`0,0 `0,1 `0,2 `0,3

0

1

• • • •

`0,0 `0,1 `0,2 `0,3

Figure 2.9: Representation of the P3 basis functions on reference element [−1, 1] for Gauss points(left) and Gauss-Lobatto points (right).

Choosing as local representation for u and the test function v the Lagrange polynomials at theGauss-Lobatto points simplifies the computation of the fluxes, as in this case only the Lagrangepolynomial associated to the edge node does not vanish at the edge. This situation is differentwhen using Legendre polynomials or Lagrange polynomials at only interior nodes (like the Gausspoints). Note however that Legendre polynomials have the advantage of having exactly a diagonalmass matrix. This is obtained also with Lagrange polynomials at the Gauss-Lobatto points but inthis case at the price of a small quadrature error.

As opposite to the Finite Element method, only local matrices on each element, in practice onlythe elementary matrices on the [−1, 1] reference interval need to be assembled. The elementarymass matrix M on cell on the reference interval has the components

Mα,β =

∫ 1

−1

ˆα(x)ˆ

β(x) dx, 0 ≤ α, β ≤ k.

When the basis functions are the Legendre polynomials which form an orthonormal basis.The mass matrix in Vh can be approximated with no loss of order of the finite element approxi-

mation using the Gauss-Lobatto quadrature rule. Then because the products ˆα(x)ˆ

β(x) vanish for

α 6= β at the Gauss-Lobatto points by definition of the ˆα which are the Lagrange basis functions

34

Page 36: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

at these points, the elementary matrix M is diagonal and we have∫ 1

−1

ˆα(x)2 dx ≈

k∑β=0

wGLβ ϕα(xβ)2 = wGLα

using the quadrature rule, where wGLα is the Gauss-Lobatto weight at Gauss-Lobatto point (xα) ∈[−1, 1]. So that finally M = diag(wGL0 , . . . wGLk ) is the matrix with k + 1 lines and columns withthe Gauss-Lobatto weights on the diagonal. From this matrix, the local mass matrix Mν+ 1

2on cell

[xν , xν+1] can be expressed as

Mν+ 12

=xν+1 − xν

2M.

Let us denote by Kν+ 12

the local matrix containing the derivative of v. In order to get an expression

for the components of Kν+ 12

we introduce the local basis functions and compute using again the

affine change of variable to the reference interval [−1, 1]:∫ xν+1

f(u)∂ϕi∂x

dx =

∫ 1

−1f(u(x))

2

xν+1 − xνˆ′α(x)

xν+1 − xν2

dx =

∫ 1

−1f(u(x))ˆ′

α(x) dx.

Then using the Gauss-Lobatto quadrature rule this becomes∫ 1

−1f(u(x))ˆ′

α(x) dx ≈k∑

β=0

wGLβ f(u(xβ))ˆ′α(xβ) =

k∑β=0

wGLβ f(uβ)ˆ′α(xβ),

where uβ = u(xβ) is the βth component of u on the Lagrange basis. Denoting Uν+ 12

= (u0, u1, . . . , uk)

on the cell [xν , xν+1], thus defining the component of matrix Kν+ 12

at line α and column β as being

wGLβˆ′α(xβ), we get that

∫ 1

−1f(u(x))ˆ′

α(x) dx ≈k∑

β=0

wGLβ f(uβ)ˆ′α(xβ) = (Kν+ 1

2f(Uν+ 1

2))α,

where f(Uν+ 12) = (f(u0), f(u1), . . . , f(uk)).

Remark 5. The Gauss-Lobatto quadrature is exact for f(u) = au for some given constant a, wenotice that the matrix Kν+ 1

2is exactly the matrix associated to the components∫ xν+1

ϕj(x)∂ϕi∂x

dx =

∫ 1

−1ϕβ(x)ˆ′

α(x) dx = wGLβˆ′α(xβ).

We also notice that this matrix does not depend on the specific interval and is equal to the matrixon the reference element K = Kν+ 1

2for all ν.

Now plugging all this into the formula (2.72) we get on each cell

V >ν+ 1

2

Mν+ 12

dUν+ 12

dt= V >

ν+ 12

Kf(Uν+ 12)− (gν+1vk − gνv0).

Then introducing the vector Gν+ 12∈ Rk whose only non zero components are the first which is gν

and the last which is gν+1, we get the following system of ODE

xν+1 − xν2

MdUν+ 1

2

dt= Kf(Uν+ 1

2) +Gν+ 1

2.

35

Page 37: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

The numerical flux gν depends on values of u coming from the neighboring cell, this is where thecoupling between the cells takes place. The matrix M being diagonal there is no linear system tosolve. Simple examples of fluxes in the linear case f(u) = au are the same as for the finite volumemethod with the centred or upwind fluxes, the two values being used here are the values of u onthe interface coming from the two cells sharing the interface, this will be the local value of uk fromthe left cell and the local value of u0 from the right cell.

36

Page 38: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Chapter 3

Linear hyperbolic systems

Let us first consider linear systems of conservation laws in 1D. This can be written in the generalform

∂U

∂t+A

∂U

∂x= 0,

where U(t, x) is a vector in Rn and A a given matrix with constant coefficients. Our aim is to derivea numerical scheme for this system. We will focus in the following on the Discontinuous Galerkinmethod, which includes the first order Finite Volume method when polynomials of degree 0, i.e.constants are taken on each cell. For higher order finite volumes, high order polynomial approxi-mations of the unknowns can be reconstructed locally by proceeding component by component likein the scalar case.

3.1 The Riemann problem

The main numerical issue when constructing a Finite Volume or Discontinuous Galerkin scheme isto find a good numerical flux that is consistent (i.e. converges towards the exact flux when the cellsize goes to 0) and stable. As we saw previously in the linear scalar case enhanced stability is givenby upwinding. We now need to generalize the notion of upwinding to the case of systems.

The construction of a numerical flux is a local procedure at the interface between two cells,where a different value is given on the left hand side and on the right hand side from the polynomialapproximation (or reconstruction for Finite Volumes). In order to get information from the equationitself the idea is to solve it locally in the neighborhood of the interface using an initial conditionwhich is a step function. The corresponding initial value problem is called the Riemann problem

∂U

∂t+A

∂U

∂x= 0,

U(0, x) =

∣∣∣∣∣∣ UL if x < 0,

UR if x ≥ 0,

where UL and UR are two given constant vectors in Rn.The system being hyperbolic implies that A has real eigenvalues and can be diagonalized. Hence

A = PΛP−1, where Λ is the diagonal matrix containing the eigenvalues. Then introducing the so-called characteristic variables V = P−1U , and multiplying the system by P−1 on the left we get

P−1∂U

∂t+ P−1APP−1∂U

∂x=∂V

∂t+ Λ

∂V

∂x= 0.

So in the variable V the system is diagonal and reduces to the set of linear advection equations

∂vi∂t

+ λi∂vi∂x

= 0, 1 ≤ i ≤ n

37

Page 39: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

where the vi are the components of V and the λi the eigenvalues of A. The exact solution of theseequations is given by vi(t, x) = vi(0, x − λit), where the vi(0, x) are the components of the initialvector which takes the constant values VL = P−1UL if x < 0 and VR = P−1UR if x ≥ 0. In otherterms

vi(t, x) =

∣∣∣∣∣∣ vi,L if x < λit,

vi,R if x ≥ λit.

In practice we want to use the Riemann problem to determine the value of V (and U) at the cellinterface, corresponding to x = 0, the discontinuity point at any strictly positive time. And wededuce from the previous solution that

vi(t, 0) =

∣∣∣∣∣∣ vi,L if 0 < λi,

vi,R if 0 ≥ λi.

In order to get a vector expression, we introduce the diagonal matrices Λ+ where the negativeeigenvalues are replaced by 0 and Λ− where the positive eigenvalues are replaced by 0. ObviouslyΛ = Λ+ + Λ−. Then for t > 0 we have

ΛV (t, 0) = Λ+V (t, 0) + Λ−V (t, 0) = Λ+VL + Λ−VR,

as for all positive eigenvalues the corresponding component of V (t, 0) is vi,L and for all negativeeigenvalues the corresponding component of V (t, 0) is vi,R. Note that as V (t, 0) is multiplied by Λthe components of V (t, 0) corresponding to 0 eigenvalues do not need to be considered as they aremultiplied by 0 anyway. So the side where the strict inequality is used for the initial condition ofthe Riemann problem plays no role.

Denoting by A+ = PΛ+P−1 and A− = PΛ−P

−1 the flux AU(t, 0) associated to the solution ofthe Riemann problem at the cell interface can also be expressed conveniently directly in terms of U

AU(t, 0) = PΛ+V (t, 0) + PΛ−V (t, 0) = PΛ+VL + PΛ−VR = A+UL +A−UR.

This expression AU(t, 0) = A+UL + A−UR can be used to define the numerical flux at the cellinterface, using the value UL coming from the left-hand side of the interface and UR coming fromthe right-hand side of the interface. For actual computations, the matrices A+ and A− need tobe computed explicitly from the eigenvalues and eigenvectors of the matrix A. Notice that in thecase of a scalar equation the matrix A is reduced to the scalar a which is then obviously the onlyeigenvalue of the 1 × 1 matrix and if a > 0 we have A+ = a and A− = 0, so that the numericalflux becomes au(t, 0) = auL and the same way if a < 0 au(t, 0) = auR, so that the numerical fluxobtained from the solution of the Riemann problem reduces to the upwind flux.

Example. We consider the 1D Maxwell equations which can be written in dimensionless units:

∂E

∂t+∂B

∂x= 0,

∂B

∂t+∂E

∂x= 0.

This can be written in the form of a linear system

∂U

∂t+A

∂U

∂x= 0, with U =

EB

, A =

0 1

1 0

.

38

Page 40: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

The eigenvalues of A are the solutions of det(A − λI) = 0, i.e. λ2 = 1. So the eigenvalues areλ1 = −1 and λ2 = 1. They are real and distinct so that the system is strictly hyperbolic. Let Vibe a normalized eigenvector associated to the eigenvalue λi, i = 1, 2. We have AV1 = −V1 so thatV1 = 1√

2(1,−1)> and AV2 = V2 so that V2 = 1√

2(1, 1)>. We define P the matrix whose columns are

V1 and V2. P is obviously orthonormal, so that its inverse is its transpose. Then we have PA = ΛP .So that we can define:

A+ = PΛ+P> =

1

2

1 1

−1 1

0 0

0 1

1 −1

1 1

=1

2

1 1

1 1

,

A− = PΛ−P> =

1

2

1 1

−1 1

−1 0

0 0

1 −1

1 1

=1

2

−1 1

1 −1

Hence, the upwind flux is given by

AU(t, 0) = A+UL +A−UR =1

2

UL,1 + UL,2 + (−UR,1 + UR,2)

UL,1 + UL,2 + (UR,1 − UR,2)

.

Remark 6. As for the scalar problem, the numerical flux can be taken as a linear combination ofthe centred flux and the upwind flux (solution the Riemann problem):

Gj = µ1

2A(UL + UR) + (1− µ)(A+UL +A−UR), 0 ≤ µ ≤ 1

corresponding to partial upwinding. The pure upwind flux is obtained for µ = 0 and the centeredflux for µ = 1.

3.2 The discontinuous Galerkin method for linear systems

3.2.1 General formulation

The discontinuous Galerkin method can be generalized to a system in a straightforward manner.Each component of the approximate solution vector that we shall denote by Uh is defined locallyin each cell as a polynomial of degree k, i.e. an element of Pk[xν , xν+1]. Denoting by ϕ0, . . . , ϕk abasis of Pk[xν , xν+1], the restriction of Uh to the cell [xν , xν+1], that we shall denote by Uν

h can beexpressed as

Uνh(t, x) =

k∑j=0

ϕj(x)Uνj (t), with Uν

j (t) =

uνj,1(t)

...

uνj,n(t)

.

The unknown function Uh(t, x) is completely determined by Uνj (t). In order to determine those

we proceed like in the scalar case and plug this expression in the equation, multiply by each of thebasis functions ϕi and integrate the derivative term by parts to let the flux through the interfaceappear:

k∑j=0

(dUν

j (t)

dt

∫ xν+1

ϕi(x)ϕj(x) dx−∫ xν+1

AUνj (t)ϕ′i(x)ϕj(x) dx

)+ Gν+1ϕi(xν+1)−Gνϕi(xν) = 0.

39

Page 41: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

The numerical flux Gν is a consistent approximation of the real flux AUh(t, xν) at the cell interfacexν which is identical for both cells sharing xν .

Choice of the numerical flux: As in the scalar case, there are many possible choices of thenumerical flux.

1. Centered flux: Use an average from the fluxes coming from both cells

Gν =1

2A (Uν−1(t, xν) + Uν(t, xν)) .

2. Solution of the Riemann problem corresponding to UL = Uν−1(t, xν) and UR = Uν(t, xν).This is the generalization of the upwind flux to systems. Better stability properties but morediffusive.

3. Linear combination of the above to combine good stability properties of the latter and lowerdiffusion properties of former.

4. Generalized Lax-Friedrichs flux (also called Rusanov flux).

Gν =1

2[A (Uν−1(t, xν) + Uν(t, xν))− αν (Uν(t, xν)−Uν−1(t, xν))] ,

with αν = max |λk|, where the λk are the eigenvalues of A. This solver has good stabilityproperties without needing to solve the Riemann problem. Especially interesting in the nonlinear case when the Riemann problem is hard to solve.

3.2.2 Derivation of DG scheme for Maxwell’s equations

We consider the 1D Maxwell equations:

∂E

∂t+∂B

∂x= 0, (3.1)

∂B

∂t+∂E

∂x= 0. (3.2)

Rather than using abstract formalism, we treat separately each component. Both are expressedon same the basis in each cell, e.g. the Lagrange-Gauss-Lobatto basis

Eνh(t, x) =

k∑j=1

eνj (t)ϕνj (x), Bνh(t, x) =

k∑j=1

bνj (t)ϕνj (x)

Plug the expression of Eh and Bh into (3.1), multiply by the basis function ϕνi , 0 ≤ i ≤ k, andintegrate by parts the derivative term

k∑j=1

deνjdt

∫ xν+1

ϕνj (x)ϕνi (x) dx−k∑j=1

bνj (t)

∫ xν+1

ϕνj (x)()ϕνi )′(x) dx+bνk(t)ϕνi (xν+1)−bν0(t)ϕνi (xν) = 0.

(3.3)Note that the expression of the boundary is like that because we are using the Lagrange-Gauss-Lobatto basis functions for which only ϕν0(xν) = 1 does not vanish at xν and only ϕνk(xν+1) = 1does not vanish at xν+1. This term will be replaced in the second step of the DG scheme by thenumerical flux coupling the current cell with the neighboring cells.

We proceed in the same way for (3.2)

k∑j=1

dbνjdt

∫ xν+1

ϕνj (x)ϕνi (x) dx−k∑j=1

eνj (t)

∫ xν+1

ϕνj (x)()ϕνi )′(x) dx+eνk(t)ϕνi (xν+1)−eν0(t)ϕνi (xν) = 0.

(3.4)

40

Page 42: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

The cell mass and derivative matrices are computed on the reference cell [−1, 1] by the change ofvariable

x =xν+1 − xν

2x+

xν+1 + xν2

.

Then, denoting by Jν = xν+1−xν2 , the basis functions ϕνi on the cell [xν , xν+1] are defined with

respect to the Lagrange basis functions `i at the Gauss-Lobatto points in the reference cell by

ϕνi (x) = `i(x) and consequently (ϕνi )′(x) = `′i(x)/Jν .

Using this change of variables we find∫ xν+1

ϕj(x)ϕi(x) dx = Jν

∫ 1

−1`j(x)`i(x) dx,

∫ xν+1

ϕj(x)ϕ′i(x) dx =

∫ 1

−1`j(x)`′i(x) dx,

and so, denoting by eν = (eν0 , . . . , eνk)>, bν = (bν0 , . . . , b

νk)>, and by

M =

(∫ 1

−1`i(x)`j(x) dx

)0≤i,j≤k

, D =

(∫ 1

−1`′i(x)`j(x) dx

)0≤i,j≤k

the mass and derivative matrices on the reference element. Expressions (3.3) and (3.4) can berewritten in matrix form

JνMdeν

dt−Dbν + Gν+1

1 −Gν1 = 0 (3.5)

JνMdbν

dt−Deν + Gν+1

2 −Gν2 = 0 (3.6)

where Gν1 and Gν

2 are the two components of the numerical flux defined at the cell interface xν .Different options for the computations of this numerical flux, upwind, centered, partially upwindand Rusanov have been discussed. The expression of the upwind flux obtained by solving theRiemann problem has been given at the end of section (3.1).

3.3 The Discontinuous Galerkin method for linear systems in 2D

The DG method can be extended in a natural way to multiple dimensions. We shall describe it fora system of 2D generalized Maxwell equations, which includes as well gradient, curl and divergenceoperators. This system can be used when the sources ρ and J do not verify exactly the continuityequations ∂ρ

∂t + ∇ · J = 0, which can occur in a numerical scheme when Maxwell’s equations arecoupled with the Vlasov equation. The unknown p, which can be proved to be 0 at the continuouslevel if the continuity equation ∂ρ

∂t + div J = 0 is satisfied, has been added to absorb the numericalerrors occurring from the continuity equation only being satisfied approximately at the discretelevel. The γ factor in front of c2∇p enables to fix the velocity of the wave transporting p out of thecomputational domain. In general it is taken slightly larger than 1, so that this non physical wavepropagates a little bit faster than the electromagnetic waves.

The generalized Maxwell equations in 3D write:

∂E

∂t− c2∇×B + γc2∇p = − 1

ε0J, (3.7)

∂B

∂t+∇×E = 0, (3.8)

∂p

∂t+∇ ·E =

ρ

ε0. (3.9)

41

Page 43: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

In 2D when all the unknowns depend only on two variables (x, y) and not on z the Maxwell equa-tions decouple into two subsystems known as the transverse electric (TE) mode and the transversemagnetic (TM) mode.

The TE mode reads

∂E

∂t− c2curl B + γc2∇p = − 1

ε0J, (3.10)

∂B

∂t+ curl E = 0, (3.11)

∂p

∂t+ div E =

ρ

ε0. (3.12)

and for the TM mode we have

∂E

∂t− c2curl B = − 1

ε0J, (3.13)

∂B

∂t+ curl E = 0. (3.14)

with E = (Ex, Ey)>, E = Ez, B = (Bx, By)

>, B = Bz, curl Bz = (∂yBz,−∂xBz)>, curl E =∂xEy − ∂yEx, and div E = ∂xEx + ∂yEy.

Let us now describe in details the DG method for the TE mode of the 2D Maxwell equations.The DG method is most naturally expressed using hyperbolic conservation laws.

3.3.1 Derivation of the discrete equations

In order to define a Discontinuous Galerkin method, one needs a mesh of the computational domainconsisting of disjoint cells. Then the unknown is approximated on each cell in a finite dimen-sional linear space (generally polynomial) which could be different in each cell. We shall consideronly approximations based on (Pk)p for an unknown with values in Rp. In our case, for the two-dimensional Maxwell equations we consider polynomials of two variables with p = 3, the unknownbeing u = (Ex, Ey, Bz)

>. We denote by Pk the space of polynomials of degree less or equal to k in2D here: Pk = spanxnym, n+m ≤ k In two space dimensions where we work the dimension of Pkis (k+1)(k+2)

2 . On a given cell K we look for an approximation uh = (Eh,x, Eh,y, Bh,z)> ∈ (Pk(K))3.

Using the Galerkin principle we shall derive an equation on uh by multiplying the equations by atest function belonging to the same space. However in the Discontinuous Galerkin case, the integra-tion shall take place on one unique cell instead of the whole computational domain for the standardGalerkin method. We shall detail the derivation for the TE mode. It can be performed in a similarway for the TM mode.

The polynomial space Pk is the most natural when we consider a mesh of triangles. In a mesh ofquads, in particular for a cartesian grid, we would rather consider the space of tensor product of 1Dpolynomials generally denoted by Qk = spanxnym, n,m ≤ k. The derivation of the DG methodis identical in the two cases. An example of unstructured mesh and a schematic representation ofthe P3 Finite Element on the reference cell are show in Figure 3.1.

Remark 1. The specificity of the Discontinuous Galerkin method with respect to the standardGalerkin method is that the weak form is defined on each cell with no continuity constraint betweentwo neighboring cells. A definition of a unique numerical flux at the cell interface is needed totransfer the information from one cell to the other in a consistent manner. This numerical flux andthe cell approximation are the building blocks of a DG method.

Let us consider a test function vh = (Fh,x, Fh,y, Ch,z, qh)> ∈ (Pk(K)4, and take the dot productof the Ampere equation (3.10) with Fh = (Fh,x, Fh,y)

>, multiply the Faraday equation (3.11) by

42

Page 44: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35

0.0

0.1

0.2

0.3

0.4

We also end up with a total of 6 basis functions, with each basis having a value 1 at its assigned node and avalue of zero at all the other mesh nodes in the element.

Again this has the form

so we can easily determine the coefficients of all 6 basis functions in the quadratic case by inverting the matrixM. Each column of the inverted matrix is a set of coefficients for a basis function.

P3 Cubic ElementsP3 Cubic Elements

In the case of cubic finite elements, the basis functions are cubic polynomials of degree 3 with the designationP3

We now have 10 unknowns so we need a total of 10 node points on the triangle element to determine thecoefficients of the basis functions in the same manner as the P2 case.

Experiment 1Experiment 1In this experiment we will solve Poisson’s equation over a square region using Finite Elements with linear,quadratic and cubic elements and compare the results. We will solve

Figure 3.1: Triangle mesh (left) and P3 Finite Element (right)

Ch,z and the Gauss equation (3.12) by qh and integrate over K. We then obtain

d

dt

∫K

Eh · Fh − c2

∫K

curl Bh,z · Fh + γc2∫K∇ph · Fh = − 1

ε0

∫K

Jh · Fh,

d

dt

∫KBh,zCh,z +

∫K

curl EhCh,z = 0,

d

dt

∫Kphqh +

∫K

div Eh qh =1

ε0

∫Kρ qh.

In order to introduce the numerical flux which will link local solutions on neighboring cells, it isnecessary to integrate all those equations by parts in order to let a boundary term appear. To thisaim we shall need the following Green formulas:∫

KF · curlC −

∫K

curl FC =

∫∂K

(F · τ )C ∀F ∈ H(curl ,K), C ∈ H1(K), (3.15)∫K

F · ∇q +

∫K

div F q =

∫∂K

(F · n) q ∀F ∈ H(div,K), q ∈ H1(K), (3.16)

where τ = (ny,−nx)> is the tangent vector on the cell boundary ∂K, n = (nx, ny)> defining the

outbound normal vector. We thus obtain∫K

curl Bh,z · Fh =

∫KBh,zcurl Fh +

∫∂K

(Fh · τ )Bh,z,∫K

curl EhCh,z =

∫K

Eh · curl Ch,z −∫∂K

(Eh · τ )Ch,z,∫K∇ph · Fh = −

∫Kph div Eh +

∫∂K

ph (Fh · n),∫K

div Eh qh = −∫K

Eh · ∇qh +

∫∂K

(Eh · n) qh.

The unknowns being inherently discontinuous at the cell interfaces in the DG method, the boundaryterms are not well defined, at least not consistently on the left hand side and the right hand side of

43

Page 45: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

the interface. In order to specify the DG method a numerical approximation of these fluxes whichis identical on both sides of the interface needs to be defined. These are the numerical fluxes. Asimple an natural definition of the numerical flux consists in taking the average value of the lefthand side and the right hand side values. This yields a centered flux which has some advantages forMaxwell’s equations. This flux will lead to an exact energy conservation at the discrete level as isthe case for standard elements. In this case as we will see, the matrix form of the DG discretizationis identical to what we obtained for Finite Elements. However due to the discontinuities introducedin the DG formulation, it can be good idea to add a dissipation mechanism by considering upwindfluxes. In order to keep the freedom of specifying the numerical flux later, let us simply denote byBN , EN and pN the values of the approximate electromagnetic flux and of p defined by the specificnumerical flux. We then obtain the following discrete formulations on each element K:

d

dt

∫K

Eh · Fh − c2

∫KBh,z curl Fh − γc2

∫Kph div Fh

− c2

∫∂K

(Fh · τ )BN + γc2∫∂K

pN (Fh · n) = − 1

ε0

∫K

Jh · Fh, ∀Fh ∈ P2k, (3.17)

d

dt

∫KBh,z Ch,z +

∫K

Eh · curl Ch,z −∫∂K

(EN · τ )Ch,z = 0 ∀Ch,z ∈ Pk, (3.18)

d

dt

∫Kphqh −

∫K

Eh · ∇qh +

∫∂K

(EN · n) qh =1

ε0

∫Kρ qh ∀qh ∈ Pk. (3.19)

3.3.2 Matrix formulation of the discrete problem

Integrals over cells

A classical Finite Element is defined on a cell by a triple (K,P,Σ), where K is the cell, P a finitedimensional function space of dimension Nk on K (in our case Pk(K)) and Σ = σ1, . . . , σNk is aset of Nk linear forms enabling to identify uniquely an element of P . Thus to the linear forms ofΣ is associated a unique basis (ϕj)1≤j≤Nk of P such that σi(ϕj) = δi,j where δi,j is the Kroneckersymbol. We consider here only Lagrange Finite Elements where the linear forms (σi)1≤i≤Nk areassociated to interpolation points (xi)1≤i≤Nk in K. In this case we simply have for a functionGh ∈ P , σi(G) = G(xi). Other classical degrees of freedom are edge, face or volume integrals orpolynomial moments. Any element Gh of our finite dimensional function space P is thus defineduniquely by (σi(Gh))1≤i≤Nk and we have

Gh(x) =

Nk∑j=1

σj(Gh)ϕj(x) =

Nk∑j=1

Gh(xj)ϕj(x), (3.20)

the last equality holding for Lagrange Finite Elements. Let us denote by g = (σ1(Gh), . . . , σNk(Gh))>

the vector whose components are the degrees of freedom and the same for e, f ,b, c. In the case ofLagrange Elements we have g = (Gh(x1), . . . , Gh(xNk))>, where x1, . . . ,xNk are the interpolationpoints characterizing the Lagrange basis. As we are here in 2D, xi = (xi, yi) has two components.We then obtain a matrix expression of the relations (3.17)-(3.19) by plugging in the expression ofthe unknowns and test functions for each component separately in the basis, as in (3.20). We firsthave ∫

KEh · Fh dx =

∫K

(Eh,xFh,x + Eh,yFh,y) dx

=∑

1≤i,j≤Nk

σj(Eh,x)σi(Fh,x)

∫Kϕi ϕj dx +

∑1≤i,j≤Nk

σj(Eh,y)σi(Fh,y)

∫Kϕi ϕj dx

= f>x MKex + f>y MKey,

44

Page 46: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

where the mass matrix on element K is defined by

MK = ((

∫Kϕi ϕj dx))1≤i≤Nk,1≤j≤Nk .

In the same way∫KBh,zCh,z dx =

∑1≤i,j≤Nk

σj(Bh,z)σi(Ch,z)

∫Kϕi ϕj dx = c>zMKbz.

All the interior terms involving derivatives, can be expressed using the two derivative matricesin the x and y directions

DxK = ((

∫Kϕj ∂xϕi dx))1≤i≤Nk,1≤j≤Nk , Dy

K = ((

∫Kϕj ∂yϕi dx))1≤i≤Nk,1≤j≤Nk .

First the term involving the scalar curl can be written∫KBh,z curl Fh =

∫KBh,z(∂xFh,y − ∂yFh,x) dx

=∑

1≤i,j≤Nk

σj(Bh,z)σi(Fh,y)

∫Kϕj∂xϕi dx−

∑1≤i,j≤Nk

σj(Bh,z)σi(Fh,x)

∫Kϕj∂yϕi dx

= f>y DxKbz − f>x D

yKbz,

The term involving the vector curl on element K is∫K

Eh · curl Ch,z =

∫K

(Eh,x∂yCh,z − Eh,y∂xCh,z) dx

=∑

1≤i,j≤Nk

σi(Ch,z)σj(Eh,x)

∫Kϕj∂yϕi dx−

∑1≤i,j≤Nk

σi(Ch,z)σj(Eh,y)

∫Kϕj∂xϕi dx

= c>z DyKex − c>z D

xKey.

The term involving the divergence becomes∫Kph div Fh =

∫Kph(∂xFh,x + ∂yFh,y) dx

=∑

1≤i,j≤Nk

σj(ph)σi(Fh,x)

∫Kϕj∂xϕi dx +

∑1≤i,j≤Nk

σj(ph)σi(Fh,y)

∫Kϕj∂yϕi dx

= f>x DxKp + f>y D

yKp,

and finally the term involving the gradient can be written as∫K

Eh · ∇ qh =

∫K

(Eh,x∂xqh + Eh,y∂yqh) dx

=∑

1≤i,j≤Nk

σi(qh)σj(Eh,x)

∫Kϕj∂xϕi dx +

∑1≤i,j≤Nk

σi(qh)σj(Eh,y)

∫Kϕj∂yϕi dx

= q>DxKex + q>Dy

Key.

45

Page 47: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Integrals over cell boundaries

Let us now handle the flux terms. Let us denote by f an internal or external face of the mesh forwhich the tangent vector τ is constant and Nk, the number of degrees of freedom on the face. Then∫

f(Fh · τ )BN =

∫f(Fh,xτx + Fh,yτy)BN dσ

=∑

1≤i,j≤Nk

σj(BN )σi(Fh,x)τf,x

∫fϕiϕj dσ +

∑1≤i,j≤Nk

σj(BN )σi(Fh,y)τf,y

∫fϕiϕj dσ

= τf,xf>x MfbN + τf,yf

>y MfbN ,

where Mf =∫f ϕiϕj dσ is the mass matrix on face f . In the same way∫

f(EN · τ )Ch,z =

∫f(EN,xτx + EN,yτy)Ch,z dσ

= τf,xc>MfeNx + τf,yc

>MfeNy.

Remark 2. Let us notice that the matrix relation representing the terms interior to an elementonly involv the degrees of freedom of the considered element. The coupling between different elementsappears only in the flux terms. The notations BN and eN hide a coupling between the values of thetwo elements (in the case of a conforming mesh) sharing the face. For example in the case of acentered flux, on the face f , bN = 1

2(bK + bL) and eN = 12(eK + eL), where K and L denote the

two elements sharing face f .

We can thus write a matrix relation enabling to compute the degrees of freedom element byelement, knowing that there exists a coupling through the terms BN and eN . For conciseness weonly write the terms in E and B coming from the standard Maxwell equations, setting p = 0.Plugging the above formulations in (3.17)-(3.19) we get

d

dt(f>x MKex + f>y MKey)− c2(f>y D

xK − f>x D

yK)bz − c2

∑f∈∂K

(τf,xf>x + τy,f f

>y )MfbN

= − 1

ε0(f>x MKjx + f>y MKjy) ∀(fx, fy) ∈ R2Nk , (3.21)

d

dt(c>zMKbz) + c>z D

yKex − c>z D

xKey −

∑f∈∂K

c>zMf (eNxτf,x + eNyτy,f )) = 0 ∀cz ∈ RNk , (3.22)

which is equivalent toMK 0

0 MK

d

dt

ex

ey

− c2

−DyK

DxK

bz − c2∑f∈∂K

τf,xMf

τf,yMf

bN = − 1

ε0

MK 0

0 MK

jx

jy

(3.23)

MKd

dtbz +

(DyK −Dx

K

)ex

ey

− ∑f∈∂K

(τf,xMf τf,yMf

)eNx

eNy

= 0. (3.24)

In view of implementation, it is more convenient to rewrite this expression of the matrices onK using only integrals computed on a reference element K and a change of variables. We consider

46

Page 48: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

here a mesh of triangles and a reference element K with vertices (0, 0), (1, 0), (0, 1), and an arbitraryelement K with vertices (x1, y1), (x2, y2), (x3, y3), the affine transformation of the planex

y

7→ Axy

+ b,

where

A =

x2 − x1 x3 − x1

y2 − y1 y3 − y1

and b =

x1

y1

,

transforms the reference triangle K onto the triangle K. Using the corresponding change of variablesfor computing the integrals on K used in the definition of the matrices, we get only integrals on K.Thus ∫

Kϕi ϕj dx dy = det(A)

∫Kϕi ϕj dx dy,

and so MK = det(A)MK . For the integrals involving a derivative, we use the chain rule which

yields ∇ϕj = A>∇ϕj and so ∇ϕj = A−>∇ϕj where

A−> = (A−1)> =1

detA

y3 − y1 y1 − y2

x1 − x3 x2 − x1

.

Thus as detA of the jacobian cancels with the one from A−>, we have∫Kϕj ∂xϕi dx = (y3 − y1)

∫Kϕj ∂xϕi dxdy + (y1 − y2)

∫Kϕj ∂yϕi dxdy,

and ∫Kϕj ∂yϕi dx = (x1 − x3)

∫Kϕj ∂xϕi dxdy + (x2 − x1)

∫Kϕj ∂yϕi dxdy.

It follows that

DxK = (y3 − y1)Dx

K+ (y1 − y2)Dy

Kand Dy

K = (x1 − x3)DxK

+ (x2 − x1)Dy

K.

Finally the integrals on the faces are computed using the same principle by a change of variablesfor the mass matrix on a face: ∫

fϕi ϕj dσ = |f |

∫fϕi ϕj dσ

where |f | is the length of face f and Mf the mass matrix on the reference element of faces.

Plugging these expressions in the matrix formulation (3.23)-(3.24), we obtain a matrix formu-lation uniquely based on the elementary matrices on the reference element

det(A)

MK 0

0 MK

d

dt

ex

ey

− c2

−(x1 − x3)DxK

+ (x2 − x1)Dy

K

(y3 − y1)DxK

+ (y1 − y2)Dy

K

bz

− c2∑f∈∂K

|f |

τf,xMf

τf,yMf

bN = − 1

ε0det(A)

MK 0

0 MK

jx

jy

, (3.25)

47

Page 49: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

det(A)MK

d

dtbz +

((x1 − x3)Dx

K+ (x2 − x1)Dy

K−(y3 − y1)Dx

K+ (y1 − y2)Dy

K

)ex

ey

−∑f∈∂K

|f |(τf,xMf τf,yMf

)eNx

eNy

= 0. (3.26)

To conclude we need to give an expression of the 2D Lagrange basis functions that can be usedto compute the elementary matrices. For simplices, which are triangles in 2D and tetrahedra in 3D,it is convenient to used the barycentric coordinates associated to the vertices of the simplex. Weshall denote them by x0, . . . ,xn ∈ Rn. The barycentric coordinate, classically denoted by (λi)0≤i≤n,associated to the vertex xi is the affine function with value 1 at xi and 0 at the n other vertices.

In 2D on our reference element where x0 = (0, 0), x1 = (1, 0) and x0 = (0, 0), and x2 = (0, 1),the barycentric coordinates are

λ0(x) = 1− x− y, λ1(x) = x, λ2(y). (3.27)

The coefficients (αi,l)0≤l≤n being determined by the relations λi(aj) = δij .

The dimension of Pk is (k+1)(k+2)2 . Putting the Lagrange interpolation points on a lattice with

k + 1 points on the edges and then one point less at each level starting from one edge, we get(k+ 1) +k+ (k− 1) + · · ·+ 1 = (k+ 1)(k+ 2)/2 interpolation points and so also degrees of freedom,which is the same as the dimension of the space.

1. Lagrange P1: The dimension is 3 and the degrees of freedom are the vertices of the triangles.The Lagrange basis functions are then the barycentric coordinate.

2. Lagrange P2: The dimension is 6 and the degrees of freedom are the vertices of the trianglesand the midpoints of each edge. The Lagrange basis functions are obtained by factoring thelines where the basis functions should be 0 and then normalizing. The degrees of freedom arenumber starting from the bottom and left to right We then obtain

ϕ1 = 2λ0(λ0 −1

2) (3.28)

ϕ2 = 4λ1λ0 (3.29)

ϕ3 = 2λ1(λ1 −1

2) (3.30)

ϕ4 = 4λ2λ0 (3.31)

ϕ5 = 4λ1λ2 (3.32)

ϕ6 = 2λ2(λ2 −1

2) (3.33)

3. Lagrange P3: The dimension is 10. We can use as degrees of freedom the vertices, twoequispaced points on each edge and the barycenter of the triagle. Then we get

48

Page 50: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

•1

•2

•3

•4 • 5

•6

•1

•2

•3

•4

•5 •6

• 7

•8 • 9

•10

Figure 3.2: Graphical representation of the 2D P2 (left) and P3 (right) degrees of freedom.

4.

ϕ1 =9

2λ0(λ0 −

1

3)(λ0 −

2

3) (3.34)

ϕ2 =27

2λ0λ1(λ0 −

1

3) (3.35)

ϕ3 =27

2λ1λ0(λ1 −

1

3) (3.36)

ϕ4 =9

2λ1(λ1 −

1

3)(λ1 −

2

3) (3.37)

ϕ5 =27

2λ0λ2(λ0 −

1

3) (3.38)

ϕ6 = 27λ0λ1λ2 (3.39)

ϕ7 =27

2λ1λ2(λ1 −

1

3) (3.40)

ϕ8 =27

2λ2λ0(λ2 −

1

3) (3.41)

ϕ9 =27

2λ2λ1(λ2 −

1

3) (3.42)

ϕ10 =9

2λ2(λ2 −

1

3)(λ2 −

2

3) (3.43)

3.3.3 Computation of the fluxes

In a Discontinuous Galerkin method, the inter-element coupling occurs through the numerical fluxwhich corresponds to the boundary terms in equations (3.17)-(3.19). The discrete fields in theDiscontinuous Galerkin method being discontinuous at the inter-element interfaces, these boundaryterms could be expressed either using the values on one side of the boundary or on the other. Inthe case of a continuous solution, these values will obviously differ only by an error correspondingto the order of the method. A natural way to define these fluxes is to use the half sum of the termson both sides. This corresponds to the centered flux. On the other hand in order to stabilize themethod for long time computations it is often useful to use an upwind flux, which will introduce adissipation mechanism. This upwinding can be partial using a parameter α ∈ [1

2 , 1] which enables

49

Page 51: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

to build a variable amount of upwinding into the scheme.This flux will then be the centered forα = 1

2 and the fully upwind flux for α = 1.In order to determine the upwind direction, it is necessary to find the direction of propagation

of the flow in the vicinity of the interface. To this aim we need to separate the different wavespropagating in the direction of the normal vector n. To this aim we write the Maxwell equations(3.10)-(3.11) in the form of a hyperbolic system

∂u

∂t+Ax

∂u

∂x+Ay

∂u

∂y= 0.

with

u =

Ex

Ey

Bz

, Ax =

0 0 0

0 0 c2

0 1 0

, Ay =

0 0 −c2

0 0 0

−1 0 0

.

We decompose the flux in the direction n = (nx, ny)> in order to get the upwind flux using the

signs of the eigenvalues of the matrix An = nxAx + nyAy. This brings us back to the 1D Riemannproblem. The eigenvalues of An are here 0, c and −c. Denote by

P =

nxny−nyc nyc

1 nxc −nxc

0 1 1

the matrix whose columns are the eigenvectors. This will be the transformation matrix into thediagonalization basis. Its inverse is

P−1 =

nynx n2

y 0

−ny2c

nx2c

12

ny2c −nx

2c12

.

Denote by

Λ =

0 0 0

0 c 0

0 0 −c

the associated diagonal eigenvalue matrix. We then write Λ = Λ+ + Λ− the first matrix containingthe positive eigenvalues and the second one the negative. Denoting by uL and uR the values of theunknowns on the left hand side and the right hand side of the interface, the upwind flux is definedby

Anu∗ = A+

nuL +A−nuR,

with A+n = PΛ+P−1 and A−n = PΛ−P−1.

The partially upwind flux is then obtained thanks to the formula

Anu∗α = A+

n (αuL + (1− α)uR) +A−n (αuR + (1− α)uL).

50

Page 52: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Thus denoting for a quantity v, its average at the interface by v = 12(vR + vL) and its jump at

the boundary by [[v]] = vR − vL, the partially upwind flux for the Maxwell equations writes

Anu∗α =

−cny(cBz+ (α− 1

2)(ny[[Ex]]− nx[[Ey]])

cnx(cBz+ (α− 12)(ny[[Ex]]− nx[[Ey]])

nxEy − nyEx+ (α− 12)c[[Bz]]

.

And as we already mentioned we recover the centered flux for α = 12 and the standard upwind flux

for α = 1.

3.3.4 Semi-discrete energy conservation

Let us consider the homogeneous equations (3.17)-(3.18) with γ = 0 and indexing the differentelements and the discrete fields attached to the elements by the same index

d

dt

∫Ki

Eh,i · Fh − c2

∫Ki

Bh,z,i curl Fh − c2

∫∂Ki

(Fh · τ )BN = 0, ∀Fh ∈ P2k(Ki), (3.44)

d

dt

∫Ki

Bh,z,iCh,z +

∫Ki

Eh,i · curl Ch,z −∫∂Ki

(EN · τ )Ch,z = 0 ∀Ch,z ∈ Pk(Ki). (3.45)

Proposition 8. Assume periodic boundary conditions or E · τ = 0 on the boundary then the semi-discrete energy ∫

Ω(‖Eh‖2 + c2B2

h,z) dx

is conserved in time.

Proof. Take Fh = Eh,i and Ch,z = Bh,z,i and sum the contributions over all the cells consideringa centered flux, so that if Ki and Kj share an edge we have BN = 1

2(Bh,z,i + Bh,z,j) and EN =12(Eh,i + Eh,j) Note also that, as the tangent vector τ is linked to the outbound normal we haveτi = −τj on the face shared by Ki and Kj . We then get

∑i

d

dt(

∫Ki

‖Eh,i‖2 + c2

∫Ki

B2h,z,i)− c2

∫Ki

Bh,z,i curl Eh,i + c2

∫Ki

Eh,i · curl Bh,z,i

− c2

∫∂Ki

(Eh,i · τ i)BN − c2

∫∂Ki

(EN · τ i)Bh,z,i = 0.

Then using the Green formula (3.15)

1

2

∫Ki

Eh,i · curl Bh,z,i =

∫Ki

Bh,z,i curl Eh,i +

∫∂Ki

(Eh,i · τ i)Bh,z,i,

so that, putting in the centered fluxes, with index j denoting an arbitrary element sharing aninterface with Ki the boundary terms become

− 1

2

∫∂Ki

(Eh,i · τ i) (Bh,z,i +Bh,z,j)−1

2

∫∂Ki

(Eh,i + Eh,j) · τ iBh,z,i

+

∫∂Ki

(Eh,i · τ i)Bh,z,i = −1

2

∫∂Ki

(Eh,i · τ i)Bh,z,j −1

2

∫∂Ki

Eh,j · τ iBh,z,i

51

Page 53: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

so that

∑i

1

2

d

dt(

∫Ki

‖Eh,i‖2 + c2

∫Ki

B2h,z,i) −

c2

2

∫∂Ki

(Eh,i · τ i)Bk,z,j −c2

2

∫∂Ki

(Eh,j · τ i)Bh,z,i = 0.

Finally the remaining boundary terms vanish as for a shared boundary between Ki and Kj theyappear on both sides with an opposite sign as τi = −τj and on the domain boundary they vanishbecause of the boundary conditions (periodic or E · τ = 0). We thus get the desired result as theglobal square of the L2 norm on Ω is the sum of the square of the L2 norms on the elements.

3.3.5 A leap-frog time scheme

For the time discretization, we can use any scheme for an ODE. Let us consider here the classicalleap-frog scheme which computes the electrical field at integer time steps tn = n∆t and the magneticfield at half integer time steps tn+ 1

2= (n + 1

2)∆t. We notice that on each face τf,x = nf,y eand

τf,y = −nf,x. We then get from equations (3.23)-(3.24), the following time scheme:

MKen+1x = MKenx −∆t

(c2Dy

Kbn+ 1

2z

−∑f∈∂K

cnf,yMf

(cBn+ 1

2z + (α− 1

2)(nf,y[[E

nx ]]− nf,x[[Eny ]])

)+

1

ε0MKjx

(3.46)

MKen+1y = MKeny −∆t

(−c2Dx

Kbn+ 1

2z

+∑f∈∂K

cnf,xMf

(cBn+ 1

2z + (α− 1

2)(nf,y[[E

nx ]]− nf,x[[Eny ]])

)+

1

ε0MKjy

(3.47)

MKbn+ 3

2z = MKb

n+ 12

z −∆t(DyKen+1

x −DxKen+1

y

+∑f∈∂K

Mf

(nf,xEn+1

y − nf,yEn+1x + c(α− 1

2)[[B

n+ 12

z ]]

) . (3.48)

In order to keep a completely explicit time scheme, we have expressed the part of the flux involvingthe electric field in Ampere’s law at time tn and the part of the flux involving the magnetic fieldin Faraday’s law at time tn+ 1

2. This scheme is thus only first order when upwinding is performed.

These parts cancel for the centered flux in which case the scheme is of order 2 in time.

52

Page 54: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Chapter 4

Non linear conservation laws

4.1 Characteristics

We consider a generic scalar conservation law of the form

∂u

∂t+∂f(u)

∂x= 0, with the initial condition u(0, x) = u0(x).

Assuming f ∈ C1(R) and denoting by a(u) = f ′(u), u also verifies

∂u

∂t+ a(u)

∂u

∂x= 0.

We now define the characteristic curves (or characteristics) associated to the conservation lawthe solution of the differential equation

dX

dt= a(u(t,X)).

Then using the chain rule we have

d

dt(u(t,X(t)) =

∂u

∂t(t,X(t)) +

dX

dt

∂u

∂x(t,X(t))

=∂u

∂t(t,X(t)) + a(u(t,X(t))

∂u

∂x(t,X(t)) = 0,

if u is a solution of the equation. From this we deduce that u(t,X(t)) = u(0, X(0)) = u0(X(0))which is independent of t. It follows that the characteristic curves are the straight lines in the (t, x)plane of equation:

X(t) = X(0) + a(u0(X(0)))t.

And it follows that the solutions of the conservation law satisfy u(t,X(t)) = u0(X(0)). This allowsus to get the solution at a given point x and time t if the characteristic curve can be traced back inthe (t, x) plane to the line t = 0. This is not always the case when f is non linear.

Remark 7. In the linear case we have f(u) = au, then the characteristics are the parallel lines ofslope a. They obey the equation X(t) = X(0) + at. So they never cross and so taking X(t) = x, wehave X(0) = x− at, and we recover the classical solution of the linear advection equation

u(t, x) = u0(x− at).

53

Page 55: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Example. Burgers equation. It corresponds to f(u) = 12u

2, so that a(u) = f ′(u) = u. Thenthe characteristic X(t;x) such that X(0) = x satisfies X(t;x) = x + tu0(x). Hence if we considerx2 > x1, we have

X(t;x2)−X(t;x1) = x2 − x1 + t(u0(x2)− u0(x1)).

Then if u0 is non decreasing we have X(t;x2) > X(t;x1) for all positive times, but if u0 is strictlydecreasing then X(t;x2) = X(t;x1) for t∗ = x2−x1

u0(x1)−u0(x2) . So the characteristics can cross and inthis case the method of characteristics cannot be used to compute the solution which is then nomore C1.

4.2 Weak solutions

4.2.1 Definition

As we have seen in the case of Burgers equation, the characteristics associated to a non linearconservation law can cross, in which case the method of characteristics can non longer be used tofind a solution. Actually when this happens the solution is no longer of class C1 and can evenbecome discontinuous. We thus need another form of the equation ∂u

∂u + ∂f(u)∂x = 0 associated to the

initial condition u(0, x) = u0(x) to make it well defined for such absolution.Let us first recall the definition of a classical solution:

Definition 7. Let u0 ∈ C1(R), then u is called a classical solution if u ∈ C1(R+×R) and u satisfies

∂u

∂u+∂f(u)

∂x= 0, and U(0, x) = u0(x)

in the classical sense.

Now we can define the notion of weak solution:

Definition 8. Let u0 ∈ L∞(R), then u ∈ L∞(R+ × R) is called a weak solution of our scalarconservation law if u satisfies∫ >

0

∫ +∞

−∞u∂ϕ

∂t+ f(u)

∂ϕ

∂xdtdx+

∫ +∞

−∞u0(x)ϕ(0, x) dx = 0 ∀ϕ ∈ C1

c ([0, T [×R.

Multiplying the equation ∂u∂u + ∂f(u)

∂x = 0 by ϕ and integrating by parts, it is easy to verify that aclassical C1 solution is also a weak solution. So the notion of weak solutions generalizes the notionof classical solutions.

4.2.2 The Rankine-Hugoniot condition

In most physical cases the solution is actually piecewise C1 and there is only one (or a few) lines ofdiscontinuities in the space-time plane. The Rankine-Hugoniot condition gives a constraint on thediscontinuity along a line for the piecewise smooth solution to be a weak solution of the equation.

Theorem 2. Assume the half space R+ × R is split into two parts M1 and M2 by a smooth curveS parametrized by (t, σ(t)) with σ ∈ C1(R+). We also assume that u ∈ L∞(R+ × R) and thatu1 = u|M1

∈ C1(M1) and u2 = u|M2∈ C1(M2) with u1 and u2 two classical solutions of our

equation in respectively M1 and M2.Then u is a weak solution if and only if

[u1(t, σ(t))− u2(t, σ(t))]σ′(t) = f(u1(t, σ(t)))− f(u2(t, σ(t))) ∀t ∈ R∗+. (4.1)

54

Page 56: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Relation (4.1) is called the Rankine-Hugoniot condition. It is often written in the simplifiedmanner

(u1 − u2)s = f(u1)− f(u2),

where s = σ′(t) is the propagation speed of the discontinuity.

Proof. Assume u is a weak solution of our equation. Then by definition∫ >0

∫ +∞

−∞u∂ϕ

∂t+ f(u)

∂ϕ

∂xdtdx+

∫ +∞

−∞u0(x)ϕ(0, x) dx = 0 ∀ϕ ∈ C1

c ([0, T [×R.

Then we can split the first double integral into an integral on M1 and an integral on M2 andintegrate these integrals by parts as u is C1 on each of these domains. We then get using Green’sdivergence formula, with ν denoting the outward unit normal vector,∫

Ωψ∇ · v dx = −

∫Ω

v · ∇ψ dx

∫∂Ω

v · νψ ds

that ∫M1

u∂ϕ

∂t+ f(u)

∂ϕ

∂xdt dx = −

∫M1

(∂u

∂t+∂f(u)

∂x

)ϕdtdx+

∫∂M1

u

f(u)

· ν1ϕds

Because u = u1 is a classical solution in M1 the first term on the right hand side vanishes. Theboundary term is composed of a part on the t = 0 line which cancels with the part of the integralon the initial condition which is in M1 and a part that can be parametrized using σ. A tangentvector to the parametrized curve S is given by (1, σ′(t)). Hence the outward unit normal is givenby

ν1 =1√

1 + σ′(t)2

σ′(t)−1

.

Recall that the integral over a curve parametrized by γ : [a, b]→ Rn is defined by∫SF ds =

∫ b

aF (γ(t))‖γ(t)‖2 dt.

Thus the part of the boundary integral corresponding to the integral on S, which is parametrizedby γ(t) = (t, σ(t)) becomes

∫S

u1

f(u1)

· ν1ϕds =

∫ T

0

1√1 + σ′(t)2

[σ′(t)u1(t, σ(t))− f(u1(t, σ(t)))

]ϕ(t, σ(t))

√1 + σ′(t)2 dt,

=

∫ T

0

[σ′(t)u1(t, σ(t))− f(u1(t, σ(t)))

]ϕ(t, σ(t)) dt.

In the same way for the part on M2 for which the outward normal is ν2 = −ν1 we get

∫S

u1

f(u1)

· ν1ϕds =

∫ T

0

[−σ′(t)u2(t, σ(t)) + f(u2(t, σ(t)))

]ϕ(t, σ(t)) dt.

55

Page 57: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Adding the two pieces we find∫ T

0

[σ′(t)(u1(t, σ(t))− u2(t, σ(t))) + f(u2(t, σ(t)))− f(u1(t, σ(t)))

]ϕ(t, σ(t)) dt = 0.

This is true for all C1 functions ϕ, hence its factor in the integral vanishes. This corresponds to theRankine-Hugoniot relation.

Conversely, the same calculation proves that if the Rankine-Hugoniot relation is satisfied thenu is a weak solution.

Example: Consider the Burgers equation which corresponds to f(u) = u2

2 :

∂u

∂t+

1

2

∂u2

∂x= 0,

with the initial condition

u0(x) =

∣∣∣∣∣∣ 0 if x < 0,

1 if x ≥ 0.

1. Using the Rankine-Hugoniot relation let us see under what condition a piecewise constantsolution can be a weak solution of this problem. Because the characteristics of the Burgersequation are straight lines, it is natural to look for piecewise smooth solutions which areseparated by a straight line in the t− x plane. A straight line can be parametrized by (t, αt).Then the candidate piecewise solution writes

u(t, x) =

∣∣∣∣∣∣ 0 if x < αt,

1 if x ≥ αt.

As σ(t) = αt, we have s = σ′(t) = α and so the Rankine-Hugoniot condition (u1 − u2)s =f(u1)− f(u2) becomes

(0− 1)α =1

2(0− 1)

and thus the only weak solution consisting of two constant states is u corresponding to α = 12 .

Such a discontinuous solution is called a shock.

2. Let us now define

u(t, x) =

∣∣∣∣∣∣∣∣∣0 if x < 0,

x/t if 0 ≤ x < t,

1 if x ≥ t.

The two constant values are obviously classical solutions in their part of the domain. On theother hand u(t, x) = x/t verifies ∂u

∂t (t, x) = − xt2

and ∂u2

∂x (t, x) = 2xt2

so that

∂u

∂t(t, x) +

1

2

∂u2

∂x(t, x) = − x

t2+

1

2

2x

t2= 0

and u(t, x) = x/t is also a classical solution on its domain of definition. It is straightforwardto verify that this solution is continuous on the lines x = 0 and x = t, so that the Rankine-Hugoniot conditions are automatically verified (no jump) but not C1. This solution whichgoes continuously from one constant state to the other, but is not C1 on two lines is called ararefaction wave.

56

Page 58: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

So we proved that this is also a weak solution of the Burgers equation, which means that theequation we are considering in this example has at least two weak solutions. In practice it ispossible to construct other weak solutions with several constant states separated by a line ofdiscontinuity (see [5] for examples).

57

Page 59: Numerical methods for hyperbolic systems · 2020-06-14 · where ˆ, uand Eare the density, velocity and energy density of the gas and pis the pressure which is a known function of

Bibliography

[1] Jean-Paul Berrut and Lloyd N Trefethen. Barycentric lagrange interpolation. SIAM review,46(3):501–517, 2004.

[2] Gary Cohen. Higher-order numerical methods for transient wave equations. Springer Science& Business Media, 2013.

[3] Daniele Antonio Di Pietro and Alexandre Ern. Mathematical aspects of discontinuous Galerkinmethods, volume 69. Springer Science & Business Media, 2011.

[4] Alexandre Ern and Jean-Luc Guermond. Theory and practice of finite elements, volume 159.Springer Science & Business Media, 2013.

[5] Edwige Godlewski and Pierre-Arnaud Raviart. Numerical approximation of hyperbolic systemsof conservation laws, volume 118. Springer Science & Business Media, 2013.

[6] DF Griffiths and JM Sanz-Serna. On the scope of the method of modified equations. SIAMJournal on Scientific and Statistical Computing, 7(3):994–1008, 1986.

[7] Ernst Hairer, Christian Lubich, and Gerhard Wanner. Geometric numerical integration:structure-preserving algorithms for ordinary differential equations, volume 31. Springer Sci-ence & Business Media, 2006.

[8] Jan S Hesthaven and Tim Warburton. Nodal discontinuous Galerkin methods: algorithms,analysis, and applications. Springer Science & Business Media, 2007.

[9] Randall J LeVeque et al. Finite volume methods for hyperbolic problems, volume 31. Cambridgeuniversity press, 2002.

[10] Chi-Wang Shu. High order weighted essentially nonoscillatory schemes for convection domi-nated problems. SIAM review, 51(1):82–126, 2009.

58