The discontinuous Galerkin method with explicit Runge-Kutta time integration for hyperbolic and parabolic systems with source terms

Martien A. Hulsen

MEMT 19

Delft University of Technology Laboratory for Aero and Hydrodynamics Rotterdamseweg 145 2628 AL Delft The Netherlands

November 19, 1991 Copyright c 1991 Fakulteit der Werktuigbouwkunde en Maritieme Techniek, Technische Universiteit Delft. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted by any means, electronic, mechanical, pho- tocopying, recording, or otherwise, without the prior written permission of the author. ISBN 90-370-0061-4

ii Summary

In this report numerical methods are described that are capable of accurately solving hyperbolic and parabolic problems. The straightforward extension of these methods to include non-conservative systems is a very attractive feature, which is of high importance for the simulation of time-dependent viscoelastic fluid flows. The methods are based on the discontinuous Galerkin method and a mixed method for the space discretization and on Runge-Kutta methods for the discretization in time. In chapter 1 some background on the problem is given with respect to vis- coelastic fluid flow. However, the equations are given in a formal form, which makes the described methods applicable to a very wide range of physical prob- lems. In chapter 2 the discontinuous Galerkin method is introduced for an ordinary differential equation in order to get some feeling for this non-standard finite element method. In chapter 3 the method is extended to multidimensional unsteady hyper- bolic systems. Conservative and non-conservative systems are treated indepen- dently. A basic concept in the method is the characteristic decomposition which also determines the initial and boundary conditions that should be specified. The method is also compared to other finite element formulations. In chapter 4 some examples of hyperbolic problems are solved by the method, in particular a one- and two-dimensional scalar transport problem, one-di- mensional scalar transport with relaxation and a wave problem with two vari- ables and reflecting boundary conditions. In chapter 5 the method is extended to include diffusion (parabolic systems) by using a mixed formulation that introduces gradients as independent variables. Examples are given for the one-dimensional convection-diffusion equation. In chapter 6 some conclusions are given.

iii Contents

List of symbols vii

1 Introduction 1

2 The discontinuous Galerkin method for an ordinary differential equation 4 2.1 Introduction ...... 4 2.2 The DG method ...... 4 3 The DG method for hyperbolic systems 10 3.1 Preliminaries ...... 10 3.2 Conservative systems ...... 10 3.3 Non-conservative systems ...... 11 3.4 Characteristic decomposition and splitting ...... 13 3.5 Inversion of the mass matrix ...... 17 3.6 Initial and boundary conditions ...... 18 3.7 Time integration ...... 19 3.8 Comparison with other finite element formulations ...... 20 4 Examples of hyperbolic problems 24 4.1 One dimensional scalar transport ...... 24 4.1.1 Equations ...... 24 4.1.2 Stability ...... 26 4.1.3 Practical results ...... 28 4.2 Two-dimensional scalar transport ...... 33 4.2.1 Equations ...... 35 4.2.2 Stability ...... 36 4.2.3 Practical results ...... 37 4.3 One-dimensional transport of a scalar with relaxation ...... 44 4.3.1 Equations ...... 44 4.3.2 Stability ...... 44 4.3.3 Practical results ...... 50 4.4 A hyperbolic system ...... 50 4.4.1 Equations ...... 50 4.4.2 Stability ...... 52 4.4.3 Practical results ...... 53 5 The DG method combined with a mixed method for parabolic systems 57 5.1 A mixed formulation ...... 57 5.2 One-dimensional convection-diffusion equation ...... 59 5.2.1 Equations ...... 59 5.2.2 Stability ...... 61 5.3 Practical results ...... 63

v 6 Conclusions 67

References 68

vi List of symbols

Only symbols that are used in more than one chapter are listed. The first appearance of a symbol is indicated by the equation number in parenthesis or by the page number. Roman symbols First appearance

Ai coefficient matrix (1.1) C¯ (z) amplification factor (2.27) c wave speed (4.1) F (n) flux vector in the direction of ~n (3.2) ˜ F i flux vector in the xi-direction (1.2) f˜(u) source vector (1.1) ˜ f˜1 stability factor for convection terms (4.18) f2 stability factor for relaxation terms (4.44) G right-hand side (3.35) ˜ h, hj element size (4.13) Ij subinterval j 5 ` degree of the polynomial interpolation 5 m number of components in u 1 M (km), M mass matrix˜ (3.38) N ¯ number of subintervals 5 ne number of elements 10 nv number of variables 29 P`(Ij ) space of polynomials up to the degree ` 5 Sj coefficient matrix (4.10) t¯ time (1.1) [u]j jump of u at point xj (2.23) U discretized vector of unknowns (3.35) ˜ U j element unknowns of interval Ij (4.6) ˜ ∗ U j vector of unknowns (4.10) u˜ vector of unknown variables (1.1) ˜ ua, ub boundary values of u (2.2) uh, uh approximate functions of u and u 5, 10 V ˜ function space˜ (3.5) (e) Vh approximation space 10 wi characteristic variables 13 ~x position vector 1 x, xi co-ordinates (2.1), (1.1) Greek symbols α upwind parameter (2.17) ∆t time step (3.57) νij , ν diffusion coefficient matrices (1.4), (1.5) θ¯ ¯ relaxation time (4.40) φ(k) base function (3.36) Ω domain (1.1)

vii Ωe element domain 10 ∂Ωe boundary of an element (3.2)

viii Chapter 1 Introduction

The simulation of viscoelastic fluid flow has become an active research area during the last fifteen years (Crochet 1989). The majority of articles contain simulations of creeping steady flow, motivated by the importance of industrial processing of polymer melts. For polymer solutions however, it has become clear that inertia can have major influence on the flow behaviour (Joseph 1990). Simulations that include inertia to show these major effects have only recently beginning to appear (Hulsen 1990; Delvaux & Crochet 1990a, 1990b; Hu & Joseph 1990). The problems are still assumed to be steady. At higher flow rates the flow becomes unsteady or even chaotic. In order to study this behaviour time-dependent equations have to be solved. Phelan, Malone & Winter (1989) showed that allowing a weak compressibil- ity into the equations of viscoelastic flow makes these equations hyperbolic (see also Joseph 1990). In that case the equations can formally be written in the following form

d ∂u X ∂u ˜ + Ai(u) ˜ + f(u)=0 in (0,T) × Ω, (1.1) ∂t i=1 ¯ ˜ ∂xi ˜ ˜ ˜

d T where Ω is a bounded subdomain of R , d =1, 2or3,u =(u1,u2,...,um) , T ˜ f(u)=(f1,f2,...,fm) is a source term and the matrices Ai(u), i =1,...,d ˜ ˜ Pd ¯ ˜ are such that any linear combination i=1 ξiAi(u)hasm real eigenvalues and a complete set of eigenvectors. A system having¯ ˜ the latter property is called hyperbolic (Whitham 1974). An important application of hyperbolic systems is in gas dynamics. The equations (conservation of mass, momentum and ), are usually written in the so-called conservation form

d ∂u X ∂  ˜ + F i(u) + f(u)=0, (1.2) ∂t i=1 ∂xi ˜ ˜ ˜ ˜ ˜ where u is the vector of conserved variables (specific mass, momentum and ˜ energy) and F i, i =1,...,d are the flux vectors with respect to all co-ordinate directions. Comparing˜ (1.2)with(1.1)weseethat1

∂Fi Ai(u)= ˜ ,i=1,...,d. (1.3) ¯ ˜ ∂u ˜ The majority of numerical methods for hyperbolic systems have been developed with equation (1.2) in mind, including the possibility of shocks, i.e. discontinu- ous solutions satisfying the conservation laws in integral form (Whitham 1974).

1 We have assumed that Ai(u), F i(u), and f(u) are functions of u only. An explicit depen- dence on ~x presents no difficulty¯ ˜ in˜ the˜ following˜ ˜ as long as the dependence˜ is smooth.

1 Our main application will be visco-elastic fluid flow. Although of course mass, momentum and energy are still conserved, the full system including the stresses cannot be written in conservation form (Hulsen 1986). Whether discontinuous solutions are a physical reality for viscoelastic flows is far from a resolved prob- lem and we will assume that for the general non-conservative system (1.1)the solutions are smooth. To solve the equations numerically, Phelan, Malone & Winter (1989) apply a finite difference method that was originally developed for the Euler equa- tions but does not require a conservative form. Unfortunately their method is only a first-order upwinding method, which is known to be much too diffusive. Higher-order methods have been developed (see for example, Hirsch 1990), but typically within the frame of conservative systems. These schemes achieve to be of higher order by considering the variables in multiple neighbouring cells. A different approach towards higher-order methods is followed by Cockburn & Shu (1989). They use the discontinuous Galerkin method with higher-order polynomials. Although their work is still within the framework of conservative hyperbolic systems, we will show in this report that it is easily adaptable to non- conservative systems if we assume that the solutions are smooth. Advantages of this finite element approach are the flexibility in discretization of domains with complex boundaries and the easy implementation of boundary conditions. The method seems well suited for viscoelastic flow simulations. We should note, however, that the equations for viscoelastic flow in the usual form are not fully hyperbolic because a. The flow is assumed to be incompressible, i.e. the compression wave speed is assumed to be ∞. Only the introduction of a weak (artificial) compressibility resolves this. b. In many cases a solvent viscosity is present which introduces second order terms (diffusion) in the momentum equation. Both these problems need special attention and will be treated in a future report. In many physical problems molecular transport (of momentum, mass and energy) plays an important role. These problems cannot be described by hy- perbolic systems but by systems of the following form

d d ∂u X ∂u X ∂ ∂u ˜ + Ai(u) ˜ + f(u) − (νij (u) ˜ )=0, (1.4) ∂t i=1 ¯ ˜ ∂xi ˜ ˜ i,j=1 ∂xi ¯ ˜ ∂xj ˜ where νij , i, j =1,...,d are m × m matrices, the molecular transport coeffi- cients.¯ Such systems are called parabolic if the dm × dm matrix ν given by   ¯ ν11 ... ν1d ¯. . ¯.  ν =  . .. .  (1.5) ¯ . . νd1 ... νdd ¯ ¯ is positive definite. In practice we often encounter systems that are not parabolic but of a composite type where only part of the quantities are subject to diffusion. For example, if the medium consists of only one component there is no diffusion of mass. In the development of the theory we will assume that (1.4) is parabolic.

2 In Chapter 2 we will describe the discontinuous Galerkin method for an ordinary differential equation. In Chapter 3 we will extend this to hyperbolic systems and more dimensions. We will also compare the method to other fi- nite element formulations. In Chapter 4 we will apply the method to various systems in one space dimension and to the convection equation in two space dimensions. In Chapter 5 we will show how to handle diffusion terms within the discontinuous Galerkin method by mixed methods. In Chapter 6 we formulate some conclusions.

3 Chapter 2 The discontinuous Galerkin method for an ordinary differential equation

2.1 Introduction The discontinuous Galerkin (DG) method originates from Lesaint & Raviart (1974) who apply this method to the neutron transport equation. Various names exist for this method: discontinuous finite element method (Thomasset 1981), discontinuous Galerkin method (Johnson 1987), Lesaint-Raviart method (Fortin & Fortin 1989), upwinding by discontinuity (Pironneau 1989) and discontinuous Galerkin finite element method (Cockburn & Shu 1989). As a general reference to DG methods the book of Thomasset (1981) and Johnson (1987) and the original article of Lesaint & Raviart (1974) can be used. An error analysis of the method for linear problems is given by Johnson, N¨avert &Pitk¨aranta (1984) and Johnson & Pitk¨aranta (1986). The method has been in- troduced successfully into the field of viscoelastic flow by Fortin & Fortin (1989) for upwinding the advection term in the constitutive equation using quadratic elements. Basombr´ıo, Buscaglia & Dari (1991) use the same method with linear elements and find even better results. The DG method together with explicit Runge-Kutta methods for the time-discretization has been applied to conserva- tive hyperbolic systems by Cockburn and his coworkers (Cockburn & Shu 1989; Cockburn, Lin & Shu 1989; Cockburn, Hou & Shu 1990). They also introduce the concepts of local projection limiters for resolving sharp gradients, such as shocks, without oscillations, and characteristic decomposition and splitting of element boundary fluxes. In this report we will not consider limiters. Since sharp stress gradients are possible in viscoelastic flows (stress boundary layers, sharp corners) it may however appear to be necessary to introduce limiters for these problems too. Before discussing the DG method for a system it is instructive to introduce it for an ordinary differential equation. This is along the lines of the original article of Lesaint and Raviart (1974).

2.2 The DG method Consider the following ordinary differential equation on a finite interval [a, b]

du A(u) + f(u)=0,x∈ [a, b], ] (2.1) dx u(a)=ua (2.2)

4 where A(u) is a positive function1, which means that the ‘flow’ is in positive x-direction. With F 0(u)=A(u) we may also write dF (u) + f(u)=0,x∈ [a, b]. (2.3) dx Note the similarity with (1.1)and(1.2). We divide the interval [a, b] into subintervals Ij =[xj ,xj+1], j =0,...,N−1. From (2.3) we find for j =0,...,N − 1that Z x j+1 dF (u)  + f(u) v(x) dx =0, (2.4) xj dx for any test function v(x) defined on Ij.OnIj we approximate u by a function uh. We restrict the testfunctions v, denoted by vh, to the same function space as uh (Galerkin method). This space will be the space of polynomials on Ij of degree 6 `, denoted by P`(Ij ). We will say that the method is of (` +1)- order in space. Because of this specific choice the method will be called a finite element method. Other spaces may also be used, for example the ones used for constructing spectral elements (Canuto, Hussaini, Quarteroni & Zang 1988). Substituting uh and vh and partial integration of (2.4) yields

F (uh(xj+1))vh(xj+1) − F (uh(xj))vh(xj ) Z xj+1 dvh  (2.5) + −F (uh) + fvh dx =0. xj dx

We allow uh to be discontinuous at the boundaries of the interval Ij . Hence, we define the following two values of uh at xj + uj = lim uh(x), (2.6) x↓xj − uj = lim uh(x). (2.7) x↑xj

We note that the discretized solution uh is discontinuous at the points xj,j= 1,...,N − 1 only and that the solution u and the functions F (u)andf(u) are assumed to be smooth. The equation (2.5) only contains variables defined within the interval Ij . There is no coupling with other intervals. In the DG method the coupling is achieved by applying natural (weak) boundary conditions on the one-element system given by (2.5). The natural boundary conditions consist of specifying F (uh(xj)) at the upstream boundary. In the DG method the following expression is used − F (uh(xj )) = F (uj ), (2.8)

− i.e. we substitute the ‘upstream’ value outside Ij .Forx0 = a we take u0 = ua, i.e. the boundary condition given by (2.2). Now we find the following discretized problem. Find uh ∈ P`(Ij ), j =0,...,N − 1 such that

− F (uh(xj+1))vh(xj+1) − F (u )vh(xj ) Z j xj+1 dvh  + −F (uh) + fvh dx =0 ∀vh ∈ P`(Ij ). (2.9) xj dx

1Lesaint & Raviart (1974) used A(u)=1.

5 − The solution process is as follows. We start at x = a and thus u0 = ua.With − (2.9)forj = 0 we compute uh on I0. This gives us u1 . Next we compute uh on − I1 and then find u2 , etc. until we have found uh on all intervals. The boundary condition for an element (2.8) is satisfied weakly. This may be seen more easily if we invert the partial integration of (2.9)  + − F (u ) − F (u ) vh(xj ) j Zj xj+1 dF (uh)  + + f(uh) vh(x) dx =0 ∀vh ∈ P`(Ij ). (2.10) xj dx

If we do not restrict uh and vh to the approximating space P`(Ij ) but allow them to be as ‘smooth’ as necessary, equation (2.10) is equivalent to

+ − F (uj ) − F (uj )=0 forx = xj , (2.11) dF (u) + f(u)=0 forx ∈ (xj ,xj+1). (2.12) dx + − Note that (2.11)leadstouj = uj for monotone F (u). A second interpretation of the DG method is given by Cockburn, Lin & Shu (1989), which is based on equation (2.5). The function F (u) is called a flux. Similar to the finite volume method they replace F (uh(xj )) (and F (uh(xj+1)) − + − + by some flux expression h(uj ,uj )(andh(uj+1,uj+1)), which for consistency has to satisfy h(u, u)=F (u). Other conditions of monotonicity are required which we will not discuss here. Various flux expressions may be used. For equation (2.9) we have actually used

− + − h(uj ,uj )=F (uj ), (2.13) or in words: the flux at the element boundaries is equal to the flux of the upstream element. A third interpretation is as follows. We integrate (2.3), multiplied by a test function v(x), on the interval [a, b]

Z b dF (u)  + f(u) v(x) dx =0. (2.14) a dx

For a convenient notation we extend [a, b] with the interval I−1 =[x−1,x0]= [x−1,a]. We note that I−1 will not be used in the integrals. Since uh is discon- tinuous at xj, j =0, 1,...,N − 1, and the test functions are defined element wise, we have to split the integral in (2.14) as follows

N−1 Z x X j+1 dF (u)  + f(u) v(x) dx j=0 xj dx (2.15) NX−1 Z x+ j dF (u) + v(x) dx =0. − dx j=0 xj

6 Substitution of uh and vh and integration of the boundary integrals gives

N−1 Z X xj+1 dF (uh)  + f(uh) vh(x) dx j=0 xj dx (2.16) NX−1  + − + F (uj ) − F (uj ) vh(xj )=0. j=0

The values vh(xj), j =0, 1,...,N− 1 are still undefined since the test functions are only defined elementwise and need not be continuous at the boundaries. We define vh(xj ) as follows

+ − vh(xj)=αvj +(1− α)vj , (2.17) where α = 1 is the standard case, which represents one-sided upwinding. Sub- stituting (2.17)intoequation(2.16)gives

N−1Z X xj+1 dF (uh)  + f(uh) vh(x) dx j=0 xj dx  + α F (u+) − F (u−) v+ j j j   + − − +(1− α) F (uj+1) − F (uj+1) vj+1 =0, (2.18) where we have the following conditions

− u0 = ua, (2.19) + − uN = uN . (2.20)

− The first condition is the boundary conditions at x = a and also leads to v0 =0. The second condition is necessary to include the last interval into the sum if α =6 1. Since all terms are now independent we may drop the sum and find for j =0, 1,...,N − 1 Z xj+1 dF (uh)  + f(uh) vh(x) dx x dx j  + − + α F (u ) − F (u ) vh(xj ) j j  + − +(1− α) F (uj+1) − F (uj+1) vh(xj+1)=0, (2.21) where vh(x) is now defined internal to the interval and the conditions (2.19) and (2.20) are still valid. We see that for α = 1 we find equation (2.10). Partial integration of the integral in (2.21) and comparing the result with (2.5) we find that the flux expression in this case is given by

− + − + h(uj ,uj )=αF (uj )+(1− α)F (uj ). (2.22)

Summarizing, we have given three interpretations of the DG method based on the ‘conservative’ expression (2.3): a Galerkin method with (i) elementwise weakly imposed boundary conditions,

7 (ii) boundary flux expressions on element boundaries, (iii) extra terms accounting for the jumps across element boundaries. For items (i)and(ii) we have to integrate partially. For item (iii) this was not required. If we have equations in non-conservative form or if a conservative form does not exist (for a system of equations) it is not clear how to perform partial integration of the equations (‘there is no flux’). In that case interpretation (iii) will be used to develop a DG method for such equations. Before discussing systems of equations we rewrite (2.21)intermsofA(u) instead of the flux F (u). We may write

Z + uj + − F (uj ) − F (uj )= A(u) du − uj Z 1 (2.23) 2  1 + − =[u]j A [u]jτ + 2 (uj + uj ) dτ, 1 − 2

+ − where [u]j = uj − uj , the jump across the element boundary. Since we assume that u is a smooth function and [u]j is small we may numerically approximate the integral, for example by a mid-point rule

Z 1 2   1 + − 1 + − 2 A [u]jτ + 2 (uj + uj ) dτ = A 2 (uj + uj ) + O([u]j ), (2.24) 1 − 2 which is exact for linear A(u). Substituting this into (2.21) we find Z xj+1 duh  A(uh) + f(uh) vh(x) dx x dx j  1 + − + αA (u + u ) [u]jvh(xj) 2 j  j 1 + − 3 +(1− α)A 2 (uj+1 + uj+1) [u]j+1vh(xj+1)+O([u]j )=0, (2.25) wherewehaveuseddF (u)/dx = A(u)du/dx. Although we cannot prove it, we assume that for smooth functions we may discard terms of O([u]p), p ≥ 2inthe Galerkin equation without affecting the order of the method. Hence we have the method: Find for j =0, 1,...,N − 1, uh ∈ P`(Ij ) such that Z xj+1 duh  A(uh) + f(uh) vh(x) dx x dx j  1 + − + αA (u + u ) [u]jvh(xj) 2 j j 1 + − +(1− α)A 2 (uj+1 + uj+1) [u]j+1vh(xj+1)=0 ∀vh ∈ P`(Ij ), (2.26)

− + − with u0 = ua and uN = uN . This is the one-dimensional form of the method we will use for non-conservative systems.

Remark 2.1: The approximation which leads to (2.26) does not affect the con- sistency of the method, i.e. the exact (smooth) solution satisfies (2.26).

8 Remark 2.2: Lesaint & Raviart (1974) analyse a DG method for equation (2.2) with A(u) = 1 and with the upwinding parameter α =1anduh ∈ P`(Ij ). They show that the method is equivalent to a strongly A-stable one-step implicit Runge-Kutta method of the order 2` + 1. Strongly A-stable means that

|C(z)| < 1forRe(z) < 0, (2.27) |C(z)|→0forRe(z) →−∞, (2.28) where C(z) is the amplification factor of the linear stability analysis and z = (∂f/∂u)∆x.

Remark 2.3: According to Cockburn & Shu (1989), numerical evaluation of the integrals requires rules that integrate polynomials up to the order 2` exactly.

9 Chapter 3 The DG method for hyperbolic systems

3.1 Preliminaries The extension of the DG method to more dimensions and more unknowns will be discussed in this chapter. We will follow a similar approach as in the previous chapter where we made a distinction between conservative and non-conservative equations. The distinction was somewhat artificial because any non-conservative form could always be written in a conservative form. However, for systems this is not true. We will derive different DG methods for these two systems. Although the conservative systems may be written in a non-conservative form it is believed that the special method for conservative systems is preferred because of the conservation properties of the discretized system. If shocks are present these conservation properties are essential to correctly predict shock wave speeds. The inclusion of the time is a natural extension within the DG method (Johnson 1987). This involves discontinuous approximation in time. We will not do that here, because it leads to implicit Runge-Kutta type schemes. For the discretization of the time-axis we will use standard explicit Runge-Kutta schemes. ne In the following we divide Ω into finite elements Ω = ∪e=1Ωe.Oneach element Ωe we approximate u by uh, which consists of polynomials of the order `. ˜ ˜ The approximation uh is allowed to be discontinuous across element boundaries. ˜ (e) (e) 2 m We will denote this space by Vh .NotethatVh ⊂ (L (Ω)) . 3.2 Conservative systems The system is given by (1.2). Multiplying this equation by a test function (e) vh ∈ Vh and integration over an element domain Ωe gives ˜ Z Xd  T ∂uh ∂Fi(uh) (e) vh ˜ + ˜ ˜ + f(uh) dΩ=0 ∀vh ∈ Vh . (3.1) i Ωe ˜ ∂t i=1 ∂x ˜ ˜ ˜ Partial integration of the flux term gives Z Xd T  T ∂uh ∂vh T vh ˜ − ˜ F i(uh)+vh f(uh) dΩ Ωe ˜ ∂t ∂xi ˜ ˜ ˜ ˜ i=1 Z ˜ T (n) (e) + vh F (uh) dγ =0 ∀vh ∈ Vh , (3.2) ∂Ωe ˜ ˜ ˜ ˜ where the normal flux vector F (n) is given by ˜ Xd (n) F = niF i, (3.3) ˜ i=1 ˜

10 and ~n =(n1,...,nd) is the outward unit normal vector on ∂Ωe. The coupling between the elements consists of a weak form of boundary conditions for the normal fluxes, which may also be interpreted as specifying a flux expression of the following form

F (n) = h(n)(u−,u+), (3.4) ˜ ˜ ˜ ˜ where we have used the convention that the indices − and + denote at the ‘backside’ and ‘frontside’ of the vector ~n. This convention will be used through- out this chapter. Since in (3.2) the vector ~n is the outward normal on ∂Ωe,in this case it means that − is at the inside and + at the outside of the element considered. Before giving flux expressions we have to define the characteristic decomposition of a vector. This will be postponed until section 3.4 after treating the non-conservative systems first.

3.3 Non-conservative systems For the system (1.1) we cannot perform a partial integration to weakly impose boundary conditions. Hence we use the third interpretation of the DG method given in the previous chapter. Multiplying (1.1) by a test function v(~x), and integration over the domain Ω gives ˜ Z Xd  T ∂u ∂u v ˜ + Ai(u) ˜ + f(u) dΩ=0 ∀v ∈ V, (3.5) Ω ˜ ∂t i=1 ¯ ˜ ∂xi ˜ ˜ ˜ where V is a suitable function space for both u and v, for example (H1(Ω))m. (e) ˜ (e)˜ We approximate the space V by Vh .NotethatVh is only an approximation of the space V on element level1. Substituting the approximation into (3.5) requires the integral to be splitted into a sum over element integrals and a sum over element boundary integrals. The latter terms appear, because on the element boundaries the normal component of ∂uh/∂xi, i =1,...,d,givenby ˜ Xd ∂u ∂uh ˜ = ni ˜ , (3.6) ∂n i=1 ∂xi is infinite2. We find Z ! Z Xne Xd  T ∂uh ∂uh T vh ˜ + Ai(uh) ˜ − f(uh) dΩ + vh ∆n dγ =0, (3.7) i e=1 Ωe ˜ ∂t i=1 ¯ ˜ ∂x ˜ ˜ γh ˜ ˜

1 (e) (e) Vh is not a real approximating space of V since Vh is not a subspace of V .Thespace (e) 2 m Vh is an approximating space of (L (Ω)) . 2The tangential derivatives of u are finite, although they may jump across the element boundary. ˜

11 ne 3 where γh = ∪e=1∂Ωe, which consists of all element boundaries ,and∆n is given by ˜

Z n+ Xd Z n+ Xd ∂uh ∂uh ∆n = Ai(uh) ˜ dn = Ai(uh)ni ˜ dn − − ˜ n i=1 ¯ ˜ ∂xi n i=1 ¯ ˜ ∂n (3.8) Z u+ Xd Z u+ ˜ ˜ = niAi(u) du = Kn(u) du, u− ¯ ˜ ˜ u− ¯ ˜ ˜ ˜ i=1 ˜ 4 with n a coordinate in the direction of the unit normal vector ~n =(n1,n2,n3) on γh; again the indices − and + denote at the ‘backside’ and ‘frontside’ of the vector ~n and the matrix Kn is given by ¯ Xd Kn(u)= niAi(u). (3.9) ¯ ˜ i=1 ¯ ˜

Note that in (3.7) vh is still undefined on γh. ˜ If Ai(u)=∂Fi(u)/∂xi (i.e. the system is derivable from a conservative system)¯ we˜ find that˜ ˜

Z + Xd n Xd  + − ∆n = ni dF i(u)= ni F i(u ) − F i(u ) . (3.10) − ˜ i=1 n ˜ ˜ i=1 ˜ ˜ ˜ ˜

5 − + For non-conservative systems ∆n depends on the path of u : u → u .How- ever, since we have assumed that˜ the solution u is smooth, and˜ ˜ thus [u˜] → 0 for h → 0, we can always approximate the integral˜ by ˜ ˜

− + 2 ∆n = Hn(u ,u )[u]+O([u] ), (3.11) ˜ ¯ ˜ ˜ ˜ ˜ + − where Hn(a,a)=Kn(a)and[u]=u − u . An obvious choice is ¯ ˜ ˜ ¯ ˜ ˜ ˜ ˜  1 Hn(a,b)=Kn 2 (a + b) , (3.12) ¯ ˜ ˜ ¯ ˜ ˜ but others are possible. Note that for the conservative system this choice would 3 2 be O([u] ) and exact for linear Kn(u). We drop the term O([u] ), which gives ˜ ¯ ˜ ˜ Z ! Xne Xd  T ∂uh ∂uh vh ˜ + Ai(uh) ˜ + f(uh) dΩ Ωe ˜ ∂t ¯ ˜ ∂xi ˜ e=1 i=1 ˜Z T − + + vh Hn(u ,u )[u]dγ =0, (3.13) γh ˜ ¯ ˜ ˜ ˜

Another way of evaluating ∆n is by choosing a path, e.g. ˜ 1 − + 1 1 u =[u]τ + 2 (u + u ),τ∈ [− 2 , 2 ]. (3.14) ˜ ˜ ˜ ˜ 3If an element boundary is internal to the domain Ω, i.e. it is connected to an element on both sides, it is considered only once in the integral over γh. 4 The vector ~n is not unique. It may point to either side of γh. 5 d

We mean the path in u-space and not Ê . ˜

12 which leads to (3.13)with

Z 1 2  − + 1 + − Hn(u ,u )= Kn [u]τ + 2 (u + u ) dτ. (3.15) 1 ¯ ˜ ˜ − 2 ¯ ˜ ˜ ˜

If Kn(u) is linear or if the integral is approximated by a mid-point rule (3.15) leads¯ to˜ (3.12). We may also apply higher-order integration rules but we will not do that. Our method will be based on (3.13)with(3.12) but we still have to choose vh − +˜ on γh. This choice will be based on characteristic decomposition of Hn(u ,u ). ¯ ˜ ˜ 3.4 Characteristic decomposition and splitting We define for i =1, 2,...,m − + λi : eigenvalues of Hn(u ,u ), ¯ ˜ ˜ − + ri : right eigenvectors of Hn(u ,u ), ˜ ¯ −˜ +˜ li : left eigenvectors of Hn(u ,u ), ˜ ¯ ˜ ˜ − + where Hn(u ,u )isgivenby(3.12). The eigenvectors ri and li can be chosen such that¯ 6 ˜(Hirsch˜ 1990) ˜ ˜ T li rj =0 fori =6 j. (3.16) ˜ ˜ We can write any vector a as a linear combination of the right eigenvectors ri ˜ ˜ Xm T (r) (r) li a a = ai ri, with ai = ˜T ˜ , (3.17) ˜ ˜ li ri i=1 ˜ ˜ or as a linear combination of the left eigenvectors li ˜ Xm T (l) (l) a ri a = ai li, with ai = ˜T ˜ . (3.18) ˜ ˜ li ri i=1 ˜ ˜ This defines the characteristic decomposition of a vector a with respect to the right and left eigenvectors respectively. ˜

Remark 3.1: If the system (1.1) represents a physical system and the variables have consistent physical dimensions, the right eigenvectors ri can be scaled such that the dimension of each component of these vectors correspond˜ to the dimensions of the vector u. Therefore it is most natural to decompose the (n) ˜ vectors u and F i (u) with respect to the ri base. ˜ ˜ ˜ ˜ T The left eigenvectors li can be scaled such that all m components wi = li u ˜ ˜ ˜ have identical dimensions. The variables wi will be called characteristic variables with respect to the direction ~n.

Remark 3.2: If we normalize the vector bases ri and li such that ˜ ˜ T li ri =1,i=1,...,m, (3.19) ˜ ˜ we see with (3.16) that they are dual vector bases, similar to the dual bases in (r) (l) tensor analysis. The components ai and ai may be called the contravariant and covariant components of the vector a, respectively. ˜ 6 The matrix Hn should be non-defective, which is identical to the system being hyperbolic. ¯

13 Conservative systems For a conservative system we decompose the boundary normal flux vector with respect to the ri base and perform a splitting of the sum ˜ Xm T (n) (n) li F (uh) F = ˜ ˜ T ˜ ri ˜ li ri ˜ i=1 ˜ ˜ X T (n) X T (n) (3.20) li F (uh) li F (uh) = ˜ ˜ T ˜ ri + ˜ ˜ T ˜ ri, li ri ˜ li ri ˜ (in) ˜ ˜ (out) ˜ ˜ where X =sumoveralli with λi < 0, (3.21) (in) X =sumoveralli with λi > 0, (3.22) (out)

Equation (3.21) corresponds to ‘incoming fluxes’ and (3.22) to ‘outgoing fluxes’. In the finite volume literature a splitting of this kind is known as ‘flux splitting’. Since we will also apply this to non-conservative systems, we prefer to call it characteristic splitting. Now we choose the following flux expression h(n) as given in equation (3.4) ˜ ( (n) + (n) − (n) − + αF (u )+(1− α)F (u )ifλi < 0, h (u ,u )= ˜ (n) ˜− ˜ (n) ˜+ (3.23) ˜ ˜ ˜ αF (u )+(1− α)F (u )ifλi > 0. ˜ ˜ ˜ ˜ The standard case is α = 1, which means that the flux is taken at the upstream side of the element boundary. The DG method for conservative systems can now be written as follows Z Xd T  T ∂uh ∂vh T vh ˜ − ˜ F i(uh)+vh f(uh) dΩ i Ωe ˜ ∂t i=1 ∂x ˜ ˜ ˜ ˜ ˜ Z X T (n) + (n) − T li (αF (u )+(1− α)F (u )) + vh ri˜ ˜ ˜ T ˜ ˜ dγ i (in) ∂Ωe ˜ ˜ li r Z ˜ ˜ X T (n) − (n) + T li (αF (u )+(1− α)F (u )) + vh ri ˜ ˜ ˜ T ˜ ˜ dγ =0. (3.24) ∂Ωe ˜ ˜ li ri (out) ˜ ˜ For the standard case α = 1 this reduces to Z Xd T  T ∂uh ∂vh T vh ˜ − ˜ F i(uh)+vh f(uh) dΩ i Ωe ˜ ∂t i=1 ∂x ˜ ˜ ˜ ˜ ˜ Z Z X T (n) + X T (n) − T li F (u ) T li F (u ) + vh ri˜ ˜ T ˜ dγ + vh ri˜ ˜ T ˜ dγ =0. (3.25) ∂Ωe ˜ ˜ li ri ∂Ωe ˜ ˜ li ri (in) ˜ ˜ (out) ˜ ˜ Non-conservative systems For non-conservative systems we decompose [u] into characteristic components ˜ Xm T li [u] [u]= ˜T ˜ ri. (3.26) ˜ li ri ˜ i=1 ˜ ˜

14 − + Substitution of (3.26)into(3.13) and using Hn(u ,u )ri = λiri yields for the integral on the boundary ¯ ˜ ˜ ˜ ˜ Z Z Xm T T − + T li [u] vh Hn(u ,u )[u] dγ = vh ˜T ˜ λiri dγ γ ˜ ¯ ˜ ˜ ˜ γ ˜ li ri ˜ h h i=1 ˜ ˜ Z Xm (3.27) (l) T = vih li [u]λi dγ, γh i=1 ˜ ˜

(l) where vih is the characteristic component with respect to the li base of vh.Now we take ˜ ˜ ( (l)− (l)+ (l) αvih +(1− α)vih , if λi < 0, vih = (l)+ (l)− (3.28) αvih +(1− α)vih , if λi > 0.

Reorganizing (3.13)with(3.27)and(3.28) into a sum over elements and consid- ering each element independently yields the method: find for e =1, 2,...,ne, (e) uh ∈ Vh such that ˜ Z Xd  T ∂uh ∂uh vh ˜ + Ai(uh) ˜ − f(u) dΩ i Ωe ˜ ∂t i=1 ¯ ˜ ∂x ˜ ˜ Z X T T li [u] + α vh ˜T ˜ λiri dγ i (in) ∂Ωe ˜ li r ˜ Z ˜ ˜ X T − T li [u] ∀ ∈ (e) +(1 α) vh ˜T ˜ λiri dγ =0 vh Vh , (3.29) ∂Ωe ˜ li ri ˜ ˜ (out) ˜ ˜ where again X =sumoveralli with λi < 0, (3.30) (in) X =sumoveralli with λi > 0. (3.31) (out) and ~n, which is needed to define [u] and the positive direction for Kn and λi, 7 ˜ ¯ is the outward normal on ∂Ωe.

Remark 3.3: If the bases are scaled such that we have (3.19), the innerproduct of two vectors a and b may be written as ˜ ˜ Xm T (l) (r) a b = ai bi . (3.32) ˜ ˜ i=1

The characteristic splitting of the boundary integrals given above is based on (n) this sum where a = vh and b = F or Kn[u]. ˜ ˜ ˜ ˜ ¯ ˜

7In (3.13) ~n is inward to one element and outward to the other element sharing the same side. In the change to the ‘per element’ formulation (3.29), we choose the outward normal and thus ~n is opposite in the two elements.

15 Remark 3.4: The conservation form given in equation (3.24) may also be writ- ten as Z Xd  T ∂uh ∂Fi(uh) vh ˜ + ˜ ˜ + f(uh) dΩ i Ωe ˜ ∂t i=1 ∂x ˜ ˜ Z X T (n) + (n) − T li (F (u ) − F (u )) + α vh ri˜ ˜ ˜ T ˜ ˜ dγ i (in) ∂Ωe ˜ ˜ li r Z ˜ ˜ X T (n) + − (n) − − T li (F (u ) F (u )) +(1 α) vh ri˜ ˜ ˜ T ˜ ˜ dγ =0. (3.33) ∂Ω ˜ ˜ li ri (out) e ˜ ˜ Comparing (3.29)and(3.33)weseethat(3.29) is found by the approximation  (n) + (n) − 1 + − F (u ) − F (u ) ≈ Kn 2 (u + u ) [u], (3.34) ˜ ˜ ˜ ˜ ¯ ˜ ˜ ˜ which is allowed only if the solution u does not contain jumps or if Kn is linear in u in which case the approximation˜ is exact. Although (3.33)and(¯ 3.24) are ˜ equivalent, (3.24) is preferred for implementation because of the ∂Fi(uh)/∂xi term in (3.33). ˜ ˜

Remark 3.5: The coupling between elements only exists through the boundary integral terms. This means that the mass matrices that appear in (3.29) because of the ∂u/∂t-term are decoupled. The mass matrices can be inverted on element level and˜ the system may be explicitly written as

U˙ = G(U,t), (3.35) ˜ ˜ ˜ where U is the vector containing all unknowns. ˜

Remark 3.6: The structure of the system differs from standard finite elements and implementation in existing packages is not straightforward, even if (3.35) is solved by explicit time integration methods. Note that [u] on the boundary contains information from neighbouring elements. ˜

Remark 3.7: According to Cockburn, Hou & Shu (1990), the volume integrals and boundary integrals have to be evaluated by rules that integrate polynomials up to the order 2` and 2` + 1 exactly, respectively, where ` is the order of the polynomial used for u. ˜

Remark 3.8: Johnson (1987) extends the concept of the discontinuous Galerkin approach even to the time dimension since there is no mathematical difference between the time and space axes. Such elements are called space-time elements. The schemes resemble implicit Runge-Kutta type schemes. Mesh refinement in both time and space is possible. Space-time elements also are a natural way to deal with moving meshes and moving boundaries. The addition and removal of elements is part of the method and is not based on some ad-hoc interpolation procedure.

16 3.5 Inversion of the mass matrix The functions uh and vh may be written as follows on an element ˜ X˜ X (k) (k) (k) (k) uh = u φ (~x),vh = v φ (~x), (3.36) ˜ k ˜ ˜ k ˜ where φ(k)(~x) are the base functions and v(k) are arbitrary. Substituting this into (3.29) leads to a system of the following˜ form X M (km)u˙ (m) = ..., (3.37) m ˜ where M (km) is the element mass matrix given by Z M (km) = φ(k)φ(m) dΩ. (3.38) Ωe

To arrive at an explicit form foru ˙ (m), the mass matrix M (km) has to be inverted ˜ (km) on element level. If we assume Q` type elements the size of M is given in the following table

1D 2D 3D ` =0 1 × 11× 11× 1 1 2 × 24× 48× 8 2 3 × 39× 927× 27 3 4 × 416× 16 64 × 64

Hence for higher-order elements and more dimensions we can save a lot of com- puting time if the integration and the inversion can be performed analytically. In 1D this is no problem and can be done by a computer algebra program. In more dimensions it can be done rather easily if the elements are of Q` type and of a rectangular shape. For example in 2D we may write

(k) (p) (q) φ (x, y)=φx (x)φy (y) p, q =0,...,`, (3.39)

(p) (q) where φx and φy are the base functions in 1D. Notice that we change from a 2D numbering k =1,...,(` +1)2 toa1D×1D numbering p, q =0,...,`.In Figure 3.1 the numbering of the nodal points has been illustrated for ` =3.The mass matrix according to (3.38) now becomes Z Z (pqrs) (p) (r) (q) (s) M = φx (x)φx (x) dx φy (y)φy (y) dy x y (3.40) (pr) (qs) = Mx My p, q, r, s =0,...,`, where the k and m numbers are replaced by an appropriate p, q, r, s numbering. The matrices M x and M y are the 1D mass matrices with respect to the x and y direction respectively.¯ The¯ inverse of M (pqrs) is now easily computed from the inverses of the one-dimensional matrices.

17 (0, 3) rrr r (3, 3) rr rr q ↑ r r r r rr rr (0, 0) (3, 0) p →

Figure 3.1: Nodal numbering of an element for ` =3.

3.6 Initial and boundary conditions System (1.1) should be supplemented with proper initial and boundary condi- tions. The initial condition is given by

u(~x, 0) = u0(~x),~x ∈ Ω, (3.41) ˜ ˜ where u0(~x) is a function that makes sense with respect to the physical system investigated.˜ For example if a component of u is the density, the corresponding component of u(~x) should be positive. For˜ other systems the conditions may not be so obvious.˜ For t ∈ (0,T) boundary conditions have to be given on ∂Ω. We assume that the boundary conditions for u may be derived from the system with Ai(u), ˜ ¯ ˜ i =1,...,d constant. Consider the matrix Kn(u)on∂Ωasgivenby(3.9) ¯ ˜ with ~n the outward normal. We define again λi, ri and li, i =1,...,m as the ˜ ˜ eigenvalues, right and left eigenvectors of Kn(u). If at point ~xp on the boundary ¯ ˜ λ1 6 ···6 λs < 0 <λs+1 6 ···6 λm, (3.42) then proper boundary conditions at ~xp are given by (Cockburn, Lin & Shu 1989)     w1(~xp,t) ws+1(~xp,t)  .   .   .  = B(~xp,t)  .  + g(~xp,t), (3.43) ¯ ˜ ws(~xp,t) wm(~xp,t) where B is a s × (m − s) matrix, g a vector of length s and the characteristic ¯ variables wi are given by ˜ T wi = li u,i=1,...,m. (3.44) ˜ ˜ Implementation of (3.43) in our scheme (3.29) is easy and given by Cockburn, Lin & Shu (1989) for a one-dimensional system but equally applies to more- dimensional systems as well. We define + T + − T − wi = li u ,wi = li u , (3.45) ˜ ˜ ˜ ˜ and implement (3.43) as follows     + + w1 ws+1  .   .   .  = B  .  + g, (3.46) + ¯ + ˜ ws wm + − wi = wi , for i = s +1,...,m. (3.47)

18 Note that (3.47) means that the plus signs in the right-hand side of (3.46)may + + be changed to a minus sign. From wi we easily find u by ˜ Xm + + wi u = T ri, (3.48) ˜ li ri ˜ i=1 ˜ ˜ + − andwith[u]=u − u we see that if ∂Ωe in (3.29) coincides with ∂Ωthe ˜ ˜ ˜ T boundary integral vanishes because [wi]=li [u] = 0 for the ‘out’ eigenvalues. This is similar to the one-dimensional condition˜ ˜ (2.20). In the following we will encounter also periodic boundary conditions, where the values on one boundary are connected to the values of another boundary. We give an example with help of Figure 3.2 in which we require that

6 ~n3 (0,b) (a, b) ∂Ω3

~n4 ~n2  - ∂Ω4 Ω ∂Ω2

∂Ω1 (0, 0) (a, 0) y ~n1 6- ? x Figure 3.2: A square domain Ω.

u(x, 0) = u(x, b), (3.49) ˜ ˜ u(0,y)=u(a, y). (3.50) ˜ ˜ These conditions are implemented as

u+(x, 0) = u−(x, b), (3.51) ˜ ˜ u+(x, b)=u−(x, 0), (3.52) ˜ ˜ u+(0,y)=u−(a, y), (3.53) ˜ ˜ u+(a, y)=u−(0,y), (3.54) ˜ ˜ which may also be written as

[u](x, 0) = −[u](x, b)=u−(x, b) − u−(x, 0), (3.55) ˜ ˜ ˜ ˜ [u](0,y)=−[u](a, y)=u−(a, y) − u−(0,y). (3.56) ˜ ˜ ˜ ˜ 3.7 Time integration It is possible to use space-time elements (see Remark 3.8) and use basically the same method in both time and space. This leads to implicit methods. Since the

19 DG method in space leads to non-standard explicit structures we want to use explicit methods whenever feasible. Following Cockburn & Shu (1989) we have chosen to use explicit Runge-Kutta (RK) methods. We will use the following standard RK methods (see Ralston & Rabinowitz 1978) for a system of the form (3.35). first-order

U n+1 = U n +∆tG(U n,tn) (=Euler Forward), (3.57) ˜ ˜ ˜ ˜ second-order

k1 =∆tG(U n,tn), ˜ ˜ ˜ k2 =∆tG(U n + k1,tn +∆t), ˜ ˜ ˜1 ˜ U n+1 = U n + 2 (k1 + k2) (=Heun’s method), (3.58) ˜ ˜ ˜ ˜ third-order

k1 =∆tG(U n,tn), ˜ ˜ ˜ 1 1 k2 =∆tG(U n + 2 k1,tn + 2 ∆t), ˜ ˜ ˜ ˜ k3 =∆tG(U n − k1 +2k2,tn +∆t), ˜ ˜ ˜1 ˜ ˜ U n+1 = U n + 6 (k1 +4k2 + k3), (3.59) ˜ ˜ ˜ ˜ ˜ fourth-order

k1 =∆tG(U n,tn), ˜ ˜ ˜ 1 1 k2 =∆tG(U n + 2 k1,tn + 2 ∆t), ˜ ˜ ˜ 1 ˜ 1 k3 =∆tG(U n + 2 k2,tn + 2 ∆t), ˜ ˜ ˜ ˜ k4 =∆tG(U n + k3,tn +∆t), ˜ ˜ ˜1 ˜ U n+1 = U n + 6 (k1 +2k2 +2k3 + k4), (3.60) ˜ ˜ ˜ ˜ ˜ ˜ where ∆t is the time-step. These are not the only RK methods, many others are possible, but if the system is linear all RK methods of the same order are identical. We will use an RK-method of the same order in time as the order of the space discretization.

Remark 3.9: Since the RK methods are explicit the time step ∆t has to satisfy a CFL (Courant-Friedrich-Lewy) condition for stability. In section 4.1.1 we will see that using a RK-method of an order that is lower than the spatial order leads to severe stability requirements (small time steps).

Remark 3.10: Cockburn and his coworkers use so-called Total Variation Di- minishing (TVD) RK-methods suitable for oscillation free shock transitions.

3.8 Comparison with other finite element formulations Numerical methods for time-dependent hyperbolic problems within a finite ele- ment context that are both stable and accurate fall into the following categories (Johnson 1987; Pironneau 1989)

20 a. Characteristic Galerkin (CG) method, b. Taylor-Galerkin (TG) method, c. Streamline upwind Petrov Galerkin (SUPG) method, d. Discontinuous Galerkin (DG) method. In the following we given some arguments why the first three methods seem less suitable for viscoelastic flow. CG-method This method combines characteristic methods with the Galerkin finite element method. It is difficult to implement this method because characteristics have to be computed and integrations over domains that cross element boundaries have to be performed. Furthermore it is far from obvious how these methods should incorporate source terms and how multi-dimensional systems should be handled if Ai, i =1,...,d are not simultaneously diagonizable (i.e. if characteristics¯ are not of a simple advective nature). TG-method This method is based on a Taylor expansion in time before dis- cretization

2 ∂u 1 2 ∂ u O 3 u(t +∆t)=u(t)+∆t ˜ + ∆t 2˜ + (∆t ). ˜ ˜ ∂t t 2 ∂t t

Now ∂u/∂t|t is substituted from the original equations. The value of 2 ˜2 ∂ u/∂t |t is found by differentiating the equations with respect to time and ˜ substituting again the original equations for ∂u/∂t|t. Now the expansion only contains spatial derivatives and is discretized˜ by a Galerkin finite element method. The method resembles classical Lax-Wendroff schemes. The method is only rather simple if there are no source terms and the equations can be written in a conservation form. Otherwise the expression 2 2 for ∂ u/∂t |t becomes very complicated and the attractiveness of the TG- method˜ is lost. SUPG-method This method is developed by Hughes and his coworkers. The method is based on a modified test function (hence the name Petrov- Galerkin). The method is very well developed for advection type hyper- bolic equations. Also for multi-dimensional Friedrich systems (i.e. sym- metric Ai, i =1,...,d), such as the Euler equations, SUPG methods have been developed.¯ The modified test function is rather complicated in multi- dimensional systems. Note that all the terms including the ∂u/∂t-term and the source terms have to be weighted by the modified test function˜ to obtain a higher order method. The author is not aware of SUPG methods for non-Friedrich systems which we encounter in viscoelastic fluid flow. Compared to the methods given above the DG method has some very attractive advantages • The ‘upwinding’ is achieved through element boundary integrals that only involve the spatial derivative terms in the equations. Inside the elements all terms are treated by the standard Galerkin method leading to clas- sical symmetric mass matrices and standard treatment of source terms.

21 Higher-order methods are obtained simply by increasing the order of the polynomials (or other functions if spectral methods are used). The boundary integral expressions do not change (although they have to be integrated with a higher-order integration rule). The decoupling of the ‘upwinding’ of the hyperbolic terms and the other terms is a very attrac- tive feature of the DG method.

• Whatever the space dimension or the number of unknowns, the method is basically the same and no special features need to be introduced. There is also no tuning parameter. Although α may be considered as such, the method works fine for α = 1 (one-sided upwinding) and may not be compared to the parameter τ in the SUPG method which is an essential part of that method. • The coupling between element variables is achieved through the boundary integrals only. This means that ∂u/∂t and the source terms are fully de- coupled between elements. The mass˜ matrices can be inverted on element level rendering the vector U˙ explicit as given by equation (3.35). ˜ • The treatment of correct boundary conditions is relatively easy due to the characteristic decomposition. • Using an explicit time integration method, the implementation is rather straightforward, although the boundary integrals need information from adjacent elements which requires a modification of standard finite element codes. • According to Johnson (1987) the method performs very well, somewhat better than the SUPG method for advection type problems. Even for linear elements the method performs remarkably well and he mentions that “we know of no (linear) finite difference method that is better”. DG method also have some drawbacks • Compared with finite elements using continuous basis functions the num- ber of variables is larger at an identical number of elements (Hughes 1987). Using linear polynomials (` = 1) on ‘brick’-type elements the ratios are 1D: 2 2D: 4 3D: 8. For ‘tetrahedral’ type elements the ratios are even larger 1D: 2 2D: 6 3D: 20. But we think this is not a fair comparison and methods should be com- pared using the same number of unknowns. Remember that in 3D a factor 8 only means a two times smaller grid size and a factor 20 a 2.7 times smaller grid size. Although we cannot prove this, we think that the DG method is competitive to SUPG when comparing at the same number of unknowns due to the higher accuracy of the first although the order of the error estimate is the same. • The structure of the equations is non-standard which may present serious difficulties when implemented in standard finite element programs.

22 • Since the basis and test functions are discontinuous across element bound- aries, second order spatial terms (diffusion) need to be handled by mixed methods which enlarges the number of unknowns, and affects the solution method. This is a serious drawback compared to the continuous methods where elliptic operators are handled relatively easy. In Chapter 5 we will give an example of a mixed method that can be used to discretize diffusion terms.

23 Chapter 4 Examples of hyperbolic problems

4.1 One dimensional scalar transport 4.1.1 Equations On an interval [a, b] we have the one-dimensional convection equation ∂u ∂u + c =0,c>0,x∈ [a, b],t>0. (4.1) ∂t ∂x Withthenotationasusedinchapter2 equation (3.29) becomes Z ∂uh ∂uh vh( + c ) dx + αc[u]jvh(xj )+(1− α)c[u]j+1vh(xj+1) = 0 (4.2) Ij ∂t ∂x for j =0,...,N − 1. Introduction of the element base functions φ(k)(x)as follows X` X` (k) (k) (k) (k) uh(x)= u φ (x),vh(x)= v φ (x), (4.3) k=0 k=0 leads to X` X` (km) (m) (km) (m) Mj u˙ + c Lj u m=0 m=1 (k) (k) + αc[u]jφ (xj )+(1− α)c[u]j+1φ (xj+1)=0, (4.4) for k =0,...,l and j =0,...,N− 1. The (` +1)× (` + 1) matrices M j and Lj are defined by ¯ ¯

Z Z (m) (km) (k) (m) (km) (k) dφ Mj = φ φ dx, Lj = φ dx. (4.5) Ij Ij dx In matrix notation we can write this equation as follows     (0) (0) φ (xj) φ (xj+1)  (1)   (1)  φ (xj) φ (xj+1) M jU˙ j + cLjU j + αc[u]j  .  +(1− α)c[u]j+1  .  =0, ¯ ˜ ¯ ˜  .   .  ˜ (`) (`) φ (xj ) φ (xj+1) (4.6) for j =0,...,N − 1. The mass matrices can be inverted on element level and we find

U˙ j + KjU j + α[u]jθj1 +(1− α)[u]j+1θj2 =0, (4.7) ˜ ¯ ˜ ˜ ˜ ˜

24 where     (0) (0) φ (xj ) φ (xj+1)  (1)   (1)  −1 −1 φ (xj ) −1 φ (xj+1) Kj = M j Lj,θj1 = cM j  .  ,θj2 = cM j  .  . ¯ ¯ ¯ ˜ ¯  .  ˜ ¯  .  (`) (`) φ (xj) φ (xj+1) (4.8) Assuming that the base functions in (4.3) are such that 0 ` uh(xj )=uj ,uh(xj+1)=uj, (4.9) the system (4.7) may be written as follows ∗ U˙ j + SjU j +(α − 1)([u]jθj1 − [u]j+1θj2)=0, (4.10) ˜ ¯ ˜ ˜ ˜ ˜ where Sj is a (` +1)× (` + 2) matrix representing the one-sided upwinding (α =1)and¯   (`) uj−1  (0)     u  (`) ∗  j  uj−1 U j =  .  = . (4.11) ˜  .  U j (`) ˜ uj For α = 1, the standard case, we have ∗ U˙ j + SjU j =0,j=0,...,N − 1. (4.12) ˜ ¯ ˜ ˜ We give two examples of Sj, θj1 and θj2 ¯ ˜ ˜ c c c ` =0: Sj = (−1, 1),θj1 = ,θj2 = , (4.13) hj hj hj ¯       c −431 c 4 c −2 ` =1: Sj = ,θj1 = ,θj2 = , ¯ hj 2 −31 ˜ hj −2 ˜ hj 4 (4.14) where hj = xj+1 − xj. Matrices for the higher-order schemes ` =2, 3 have been derived with the computer algebra program Maple V but will not be given here. 1 For α = 2 we find

U˙ j + SˆjUˆ j =0,j=0,...,N − 1. (4.15) ˜ ¯ ˜ ˜ ∗ 0 T where Sˆj is a (` +1)× (` + 3) matrix and Uˆ j =(U j ,uj+1) . We give the matrices¯ for ` =0and1 ˜ ˜ ˆ c 1 1 ` =0: Sj = (− 2 , 0, 2 ), (4.16) hj ¯   c −21 2−1 ` =1: Sˆj = . (4.17) ¯ hj 1 −2 −12 1 The schemes for α = 2 are called central schemes. Remark 4.1: If we consider the mesh point in an element for ` =0tobeat the center of the interval, we find from (4.13)and(4.16) that for equidistant intervals we have the classical first-order for α =1andthe 1 central difference scheme for α = 2 .

25 4.1.2 Stability We will only consider the stability for α = 1 and an equidistant mesh. Since we want to use explicit Runge-Kutta schemes of the same order in time as the order in space (` + 1), we have a CFL condition for linear stability of the form

c∆t 6 f1, (4.18) h wherewehaveassumedhj = h, j =1,...,N−1. Cockburn & Shu (1989) claim that for ` =1, 2 1 f1 = . (4.19) 2` +1 For ` = 1 they refer to a report we have no access to, and for ` = 2 there is no reference at all. They suggest that for ` = 3 expression (4.19)maybetrue also. Note that (4.19) is also true for ` = 0, which is the classical CFL condition for a first-order upwind scheme combined with forward Euler discretization in time. The computations in the following have shown that (4.19) gives at least practical values for ` =0, 1, 2and3. A method for finding the stability limit is computing the eigenvalues of the system matrix and requiring that each eigenvalue satisfies the stability limit of the RK method. It is very easy to compute these eigenvalues due to the structure of the matrix, but it does not lead to the correct values of f1. The reason for this is that the system matrix is defective; the dimension of the eigenspace is only ` +1. Another method used in finite differences is the Fourier method, where the solution is decomposed into discrete Fourier components. In order to apply a Fourier method to (4.12) the variables must first be transformed to function values at equidistant intervals of length h/(` + 1). Even when this is done it is not possible to perform a discrete Fourier analysis because a spectral component disperses into more than one spectral components. The correct way to follow is possibly a combination of the matrix method and the Fourier method. However we will follow a heuristic approach to give at least some basis for (4.19). The most unstable modes are likely to be the ‘highest frequency’ or ‘shortest wavelength’ modes. We assume that it is sufficient to consider a one-element system (4.12)atj with appropriate boundary conditions ` for uj−1 for which we choose

` ` periodic uj−1 = uj, (4.20) ` ` alternating uj−1 = −uj. (4.21)

In either case the element system is of the form c U˙ j = BU j, (4.22) ˜ h ¯ ˜ (p) where B is a (` +1)× (` + 1) matrix. The eigenvalues of B denoted by λi or (a) ¯ ¯ λi , i =0,...,` for periodic and alternating conditions respectively, determine

26 the stability of system (4.22). These eigenvalues are

(p) ` =0 λ0 =0, (a) λ0 = −2, (p) (p) ` =1 λ0 =0,λ1 = −6, (a) √ λ0,1 = −1  i 11, (p) (p) ` =2 λ0 =0,λ1,2 ≈−3  7.1414i, (a) (a) λ0 ≈−11.842,λ1,2 ≈−0.078822  3.1823i, (p) (p) ` =3 λ0 =0,λ1 ≈−19.157, (p) λ2,3 ≈−0.42156  6.6084i, (a) λ0,1 ≈−5.9956  6.6084i, (a) λ2,3 ≈−0.0044343  3.1435i.

The linear stability is given by c∆t |C(z)| 6 1withz = λ, (4.23) h where λ is any of the eigenvalues given above and C(z) is the amplification factor of the RK method given by

first-order C(z)=1+z, (4.24) 1 2 second-order C(z)=1+z + 2 z , (4.25) 1 2 1 3 third-order C(z)=1+z + 2 z + 6 z , (4.26) 1 2 1 3 1 4 fourth-order C(z)=1+z + 2 z + 6 z + 24 z . (4.27)

The stability requirement leads to a CFL condition of the form (4.18). If we choose the order of the RK method identical to the spatial order we find

(a) ` =0: f1 =1,λ0 , 1 (p) ` =1: f1 = 3 ,λ1 , (a) ` =2: f1 ≈ 0.2122,λ0 , (p) ` =3: f1 ≈ 0.1454,λ1 , where we have also given the most critical eigenvalues. Notice that the latter correspond to the most negative real eigenvalues, which supports our assump- tions (4.20)and(4.21) that the most critical eigenmodes are real. Comparing the values of f1 with (4.19)weseethatfor` =0and` = 1 the values are identical and for ` =2and` = 3 they are only little larger. In our practical computations we could not decide which were the correct ones, only that they both seem good practical limits although of course (4.19) is the safest. Our analysis of the eigenvalues also indicates that it makes not much sense to try to save computing time by choosing a RK method that is of lower order than the spatial order. In that case the complex eigenvalues determine the stability. These are close to the imaginary axis. For example if we choose a first-order

27 RK method (forward Euler) we find

(a) ` =0: f1 =1,λ0 , 1 (a) ` =1: f1 = 6 ,λ0,1, (a) ` =2: f1 ≈ 0.01556,λ1,2, (a) ` =3: f1 ≈ 0.0008975,λ2,3,

We should note however that a choice of real conditions (4.20)and(4.21)isnot likely to be valid if complex eigenvalues are critical, it only supports the practical experience that choosing a lower-order RK method requires a time step that is much lower to find a stable solution. Cockburn & Shu (1989) even claim that using a first-order method to solve a higher-order scheme is unconditionally unstable for any fixed time step. Practical computations with ` =1showthat 1 f1 = 6 is certainly not the stability limit which is at least much lower if not zero. Resuming our stability results we find that the one-dimensional convection equation (4.1) discretized by the DG method should be integrated in time by a RK method that is of the order ` + 1 (=spatial order). This also seems an obvious choice from accuracy reasons, since for hyperbolic problems there is no fundamental difference between the time and space axes. The CFL condition given by (4.18)and(4.19) is a good practical limit. In the following we have tacitly assumed that the RK method is of the order ` + 1 if not given otherwise.

Remark 4.2: Although f1 reduces for higher-order methods we can also take a larger h for these methods. For example if we assume an identical number `+1 of unknowns, we have h` =(` +1)h0, ` ≥ 1 and thus ∆t` = 2`+1 ∆t0.Inthe 2 following we will give an example showing that taking h` =(` +1) h0 does not (`+1)2 sacrifice accuracy and thus we can take ∆t` = 2`+1 ∆t0. Hence, in that case we can take even larger time steps and using less unknowns without sacrificing accuracy. However, remember that RK methods need ` + 1 function evaluations per time step.

Remark 4.3: Practical experience shows that for α =6 1 the critical time step is smaller. In some cases it is even necessary to choose a method of higher order. 1 For example the central schemes given by α = 2 have imaginary eigenvalues. To solve such systems by RK methods at least third order is necessary otherwise the imaginary axis is not in the stability region. 4.1.3 Practical results Our test problem (A) will be

∂u ∂u + =0,x∈ [0, 1],t>0, (4.28) ∂t ∂x with periodic boundary conditions and initial conditions given by ( 1 1forx ∈ (0, 4 ), u0(x)= (4.29) 0 otherwise.

28 Figure 4.1: Results of problem A for t =0.5; nv = 192.

We take an equidistant mesh, α = 1 for the upwinding parameter1 and consider ` =0, 1, 2 and 3 for the number of variables nv = 192. The discretization pa- rameters are given in the following table

` 0123 nv 192 192 192 192 ne 192 96 64 48 ∆t 0.6 × 10−3 1.2 × 10−3 1.8 × 10−3 2.4 × 10−3

where ne is the number of elements. The values of ∆t aretakensuchthat the number of function evaluations in the time integration are the same. In the Figures 4.1–4.3 results are given for t =0.5, 5.5 and 25.5. Note that in the latter case the block has crossed the domain 25 times! All results are drawn with solid lines to see the details of the oscillations. We want to make the following remarks following from these figures that are typical of the DG method

1If not specified otherwise, all computations in this chapter are for an equidistant mesh andanupwindparameterα =1.

29 Figure 4.2: Results of problem A for t =5.5; nv = 192.

• The method is stable and very accurate for ` ≥ 1. There is both little diffusion and dispersion. Increasing the order of the method at the same number of unknowns increases the accuracy. • The first-order method (` = 0) is very diffusive and going to the second order method (` = 1) is a large improvement in that respect. • The higher order methods ` ≥ 1 show oscillating behaviour locally at sharp gradients. The over/undershoots are approximately 8%. These oscillations do not spread globally into the domain. Non-linear methods have to be used to remove these oscillations (Cockburn & Shu 1989). • The higher the order of the method the better it describes large gradients. We also experimented with the accuracy of the time integration for ` =1. The stability limit is given by ∆t =3.47 × 10−3. In the figures 4.4 and 4.5 we have given the results for four different time steps ∆t =0.4 × 10−3,1.2 × 10−3, 2.5 × 10−3 and 3.4 × 10−3 at the times t =0.5andt =25.5. We clearly see that the overshoots and undershoots at sharp gradients depend on the time step.

30 Figure 4.3: Results of problem A for t =25.5; nv = 192.

The time step should be smaller than approximately one-third of the stability limit to obtain an 8% overshoot and undershoot. Decreasing the overshoot and undershoot below 8% is not possible. In Figure 4.6 results are given for ` =1,nv = 192, t =0.5 and various values of α. The following table applies

α 0.511.52 10 ∆t 2.5 × 10−3 2.5 × 10−3 10−3 10−3 10−4 order of RK 42222

1 We have used a fourth-order RK method to integrate the equations for α = 2 (see Remark 4.3). Furthermore, we have to take smaller time steps when α is increased. We make the following remarks with respect to taking α =16 1 • The case α = 2 shows the typical global oscillating behaviour of central schemes. • There seems to be an optimal α ≈ 1.5 that minimizes over/undershoots.

31 Figure 4.4: Results of problem A for t =0.5; ` =1;∆t =0.4×10−3,1.2×10−3, 2.5 × 10−3 and 3.4 × 10−3. The overshoots and undershoots decrease for smaller time steps.

• The advantages of taking α =6 1 are small and goes at the expense of smaller time steps which have to be found by trial and error. • Taking α =6 1 is more expensive because of the smaller times steps but also the building the system of equations requires the ‘outflow’ boundaries to be taken into account. In Remark 4.2 we already mentioned that higher-order methods can do with less unknowns and larger time steps to obtain the same accuracy. This is shown for the following discretization parameters

` 0123 nv 192 96 63 48 ne 192 48 21 12 ∆t 2.5 × 10−3 5 × 10−3 7.5 × 10−3 10−2

The results for t =0.5, 5.5 and 25.5 are given in the Figures 4.7–4.9.Wesee

32 Figure 4.5: Results of problem A for t =25.5; ` =1;∆t =0.4×10−3,1.2×10−3, 2.5 × 10−3 and 3.4 × 10−3. The overshoots and undershoots decrease for smaller time steps. that the results for ` = 1, 2 and 3 are comparable and that these are still much better than the first-order method (` =0). Finally we also test the method for a non-equidistant grid. We take ` =3and a grid where hj+1 = fhj. By taking f =1.06824, ne = 22 we find h0 ≈ 0.02085 and h21 ≈ 0.08340, which means that the elementsizes at x =0andx = 1 are approximately equal to the fine grid (ne = 48) and the coarse grid (ne = 12) −3 used above, respectively. The time step ∆t =2.5 × 10 and nv =4ne = 88. The results for t =0.5, 5.5 and 25.5 are given in Figure 4.10. Comparing the results with the Figures 4.1–4.3 and Figures 4.7–4.9 for ` = 3 we see that the accuracy is worse than the fine grid but better than the coarse grid.

4.2 Two-dimensional scalar transport

33 Figure 4.6: Results of problem A for various α and t =0.5.

34 Figure 4.7: Results of problem A for t =0.5; coarse mesh for ` ≥ 1.

4.2.1 Equations On a rectangular domain Ω = [a, b] × [c, d] we consider the convection equation ∂u ∂u ∂u + cx + cy =0,cx,cy ≥ 0. (4.30) ∂t ∂x ∂y We divide the domain into rectangular elements and use the 1D numbering as introduced in section 3.5. Without going into detail it is rather straightforward to show that because of equation (3.39) the various integrals in (3.29)canbe written as products of matrices that are already known in the 1D form of sec- tion 4.1.1, similar arguments apply to the factorization of the mass matrix in (3.40). Inverting the mass matrix leads to the following scheme (α =1) X` X` (pq) (pr) (rq) (qs) (ps) u˙ + Kx u + Ky u r=0 s=0 (q) (p) (p) (q) +[u]x θ1x +[u]y θ1y =0,p,q=0,...,`, (4.31) where Kx, Ky, θ1x and θ1y are identical to the one-dimensional matrices already ¯ ¯ ˜ ˜ found in (4.7)withc replaced by cx, cy and h by hx, hy.Thejumps[u]x and

35 Figure 4.8: Results of problem A for t =5.5; coarse mesh for ` ≥ 1.

[u]y are at the left side and at the bottom side of an element respectively. The scheme is a superposition of one-dimensional schemes in the x and y directions. This makes it easy to implement. Remember that this is only possible because of the rectangular structure of the grid. 4.2.2 Stability Practical computations show that the eigenvalues of the one-dimensional schemes in the x and y direction can be added so that the stability is given by

cx cy |C(z)| 6 1withz =∆t( + )λ, (4.32) hx hy where λ is as given in the 1D case. Hence we have instead of (4.18) the CFL condition

cx cy ( + )∆t 6 f1. (4.33) hx hy

36 Figure 4.9: Results of problem A for t =25.5; coarse mesh for ` ≥ 1.

4.2.3 Practical results Our test problem (B) will be ∂u ∂u ∂u + + =0, (x, y) ∈ [0, 1] × [0, 1],t>0, (4.34) ∂t ∂x ∂y with periodic boundary conditions and initial conditions ( 1 1 1for(x, y) ∈ (0, 4 ) × (0, 4 ), u0(x, y)= (4.35) 0 otherwise.

We consider the following discretization ` 0123 2 2 2 2 nv 96 96 96 96 2 2 2 2 ne 96 48 32 24 ∆t 2.5 × 10−3 2.5 × 10−3 2.5 × 10−3 2.5 × 10−3 Results are given in the Figures 4.11–4.18 for t =0.5andt =5.5. Note that in the latter case the block has crossed the domain 5 times.

37 Figure 4.10: Results of problem A for t =0.5, t =5.5andt =25.5; non- equidistant grid for ` =3.

38 Figure 4.11: Results of problem B for t =0.5; ` =0.

39 Figure 4.12: Results of problem B for t =0.5; ` =1.

40 Figure 4.13: Results of problem B for t =0.5; ` =2.

41 Figure 4.14: Results of problem B for t =0.5; ` =3.

42 Figure 4.15: Results of problem B for t =5.5; ` =0.

43 We see that the results are very good for the higher-order methods and that the same remarks apply as given in section 4.1.3 for the one-dimensional case. In order to show that the method works equally well if the convection angle ◦ is not 45 , we have shown in Figure 4.19 the results for cx =1,cy =0.5and otherwise identical data to the problem in Figure 4.17 (problem B0). We also solved the convection problem with cx =1,cy =0.5 with initial conditions u = 0 and with boundary conditions for t>0 (problem B00)

u(0,y)=1, (4.36) u(x, 0) = 0, (4.37) u(1,y)=0, (4.38) u(x, 1) = 0. (4.39)

In Figure 4.20 the results are shown for t =0.75. We see similar results for the skew discontinuity as for the discontinuities parallel to the co-ordinate axis in the convection of a block, i.e. overshoots and undershoots of approximately 8%. There is however an exception for one boundary point close to (0, 0) where the undershoot is 30%.

4.3 One-dimensional transport of a scalar with relaxation 4.3.1 Equations We consider the system ∂u ∂u u + c + =0,c,θ>0,x∈ [a, b],t>0, (4.40) ∂t ∂x θ where θ is a relaxation time. From (3.29) we find that we have to add to equation (4.4) the following term

Z X` Z uh 1 φ(k) dx = φ(k)φ(m) dx u(m) Ij θ θ m=0 Ij ` (4.41) 1 X = M (km)u(m). θ m=0

This means that to equation (4.6)wehavetoaddU j/θ. ˜ 4.3.2 Stability The discretized system may be written as follows 1 U˙ =(Ac − I)U, (4.42) ˜ ¯ θ ¯ ˜ where Ac is the convection part and I is the identity matrix. In section 4.1.2 we ¯ ¯ have seen that the most critical mode of Ac has a (negative) real eigenvalue and a real eigenvector. The eigenvalue of the¯ second matrix is −1/θ. We assume that we may add the eigenvalues to find a stability limit. Hence we find c 1 |C(z)| 6 1withz =∆t( λ − ), (4.43) h θ

44 Figure 4.16: Results of problem B for t =5.5; ` =1.

45 Figure 4.17: Results of problem B for t =5.5; ` =2.

46 Figure 4.18: Results of problem B for t =5.5; ` =3.

47 0 Figure 4.19: Results for problem B with cx =1andcy =0.5; t =5.5, ` =3.

48 00 Figure 4.20: Results for problem B with cx =1andcy =0.5; t =0.75, ` =3.

49 where λ is as given in section 4.1.2. Instead of (4.18) we have the following CFL condition c 1 ( + )∆t<1, (4.44) f1h f2θ with f1 as given in section 4.1.2 and f2 is given in the following table

` 01 2 3 f2 222.5127 2.7852 4.3.3 Practical results Our test problem (C) will be

∂u ∂u + +2u =0,x∈ [0, 1],t>0, (4.45) ∂t ∂x with initial conditions u0(x) = 0 and boundary conditions

u(0,t)=cos(6πt),t>0. (4.46)

The solution of problem C is given by ( e−2x cos(6π(t − x)) for 0 t.

The discretization parameters are identical to the case nv = 192 of section 4.1.3, except that the time step ∆t =2.5×10−3 for all four cases. In the Figures 4.21– 4.23 results are given for t =0.5, 1 and 2. Note that the front hits x =1at t = 1. Again we see the large diffusivity for ` = 0. Away form the sharp front in the smooth region we cannot discriminate the solutions for ` =1,2and3.

4.4 A hyperbolic system 4.4.1 Equations On an interval [a, b] we consider the system

∂u 1 ∂p + =0,ρ>0, (4.48) ∂t ρ ∂x ∂p ∂u + µ =0,µ>0, (4.49) ∂t ∂x which may also be written as     ∂u ∂u 01/ρ u ˜ + A ˜ =0, with A = , u = . (4.50) ∂t ¯ ∂x ˜ ¯ µ 0 ˜ p The eigenvalues and eigenvectors of A are given by  ¯   ρc c λ1 = c, l1 = ,r1 = , (4.51) 1 µ ˜   ˜   −ρc −c λ2 = −c, l2 = ,r2 = , (4.52) ˜ 1 ˜ µ

50 Figure 4.21: Results of problem C for t =0.5.

p where c = µ/ρ is the wave speed. The characteristic variables are given by

T w1 = l1 u = ρcu + p, (4.53) ˜T ˜ w2 = l2 u = −ρcu + p. (4.54) ˜ ˜ T Multiplying the system (4.50)byli , i =1, 2 we find that ˜ ∂w1 ∂w1 + c =0, (4.55) ∂t ∂x ∂w2 ∂w2 − c =0. (4.56) ∂t ∂x

The variable w1 is transported in positive direction with speed c and w2 in negative direction with speed c. We will consider reflecting boundary conditions given by

x = a : w1 = w2, (4.57) x = b : w2 = w1, (4.58)

51 Figure 4.22: Results of problem C for t =1. which means that in (3.43)wetake B(a, t)=B(b, t)=1,g(a, t)=g(b, t)=0. (4.59) All ‘outgoing’ characteristic variables are fully transformed to the ‘ingoing’ char- acteristic variables, hence the name reflecting boundary conditions. Considering (4.53)and(4.54) we see that these boundary conditions also mean u(a)=0and u(b) = 0 in terms of the primitive variables u and p. We will not give a discretized form of the equations. This follows directly from (3.29). 4.4.2 Stability The system written in the characteristic variables w1 and w2 given by (4.55) and (4.56) consists of two convection equations . Hence the stability limit is given by the CFL condition c∆t

52 Figure 4.23: Results of problem C for t =2.

4.4.3 Practical results We consider problem D, which consists of (4.51)and(4.52) on the interval [0, 1] with ρ =2andµ = 2, reflecting boundary conditions and initial conditions ( 1for0.4

In terms of the characteristic variables w1 and w2 this may be written as follows ( 4for0.4

w2(x)=0 x ∈ (0, 1). (4.64)

The analytical solution has been given in Figure 4.24

53 B 1.6 @@ 1.5 C @ A 1.4 @ @@ @ A: u =0,p =0, @ @ B: u =1,p =2, @ @ C: u =0,p =4, @ @ @ @ D: u = −1, p =2, @ D @ @ @ 6 @ @ @ @ t @ @ @ @ @ 0.6 A @ C 0.5 @ 0.4

B A

0 - 01x

Figure 4.24: Solution of Problem D.

−3 The discretization parameters are ` =2,ne =40and∆t =1× 10 .In Figure 4.25 and Figure 4.26 results are given for u and p at the times t =0, 0.4, 0.5, 0.6, 1.4, 1.5 and 1.6. Note that at t =0.5 the solution u = 0 is well approximated.

54 Figure 4.25: Results of problem D for u.

55 Figure 4.26: Results of problem D for p.

56 Chapter 5 The DG method combined with a mixed method for parabolic systems

5.1 A mixed formulation The system of equations for parabolic systems is given by (1.4). We want to discretize the first-order terms by the DG method and thus uh and vh are discontinuous across element boundaries. This means that we cannot˜ discretize˜ the second-order terms by the standard Galerkin method, which requires uh 1 ˜ and vh to be continuous . We can resolve this by considering the gradients of u as˜ independent variables. Formulations where the derivative of a variable is treated˜ independently from the variable itself are called mixed formulations.As a general reference to mixed methods we refer to Roberts & Thomas (1991) and the references therein. We introduce the variables pi as follows ˜ d X ∂u pi = νij ˜ ,i=1,...,d. (5.1) ˜ j=1 ¯ ∂xj

Since the matrix ν given in (1.5) is positive definite, we may invert (5.1) leading to ¯ d ∂u X ˜ = κij pj, (5.2) ∂xi j=1 ¯ ˜ where κij , i, j =1,...,d are the matrices given by ¯   κ11 ... κ1d ¯. . ¯.  −1  . .. .  = ν . (5.3) . . ¯ κd1 ... κdd ¯ ¯ With (5.1)and(5.2) the system of equations may now be written as follows

d X ∂u 0 = κij pj − ˜ ,i=1,...,d, (5.4) ˜ j=1 ¯ ˜ ∂xi Xd Xd ∂u ∂u ∂pi ˜ + Ai ˜ + f = ˜ . (5.5) ∂t i=1 ¯ ∂xi ˜ i=1 ∂xi In order to find a weak formulation we multiply (5.4)and(5.5) by testfunctions qi, i =1,...,d and v respectively and integrate over the domain Ω. In order ˜ ˜ 1 1 m More precisely: uh,vh ∈ (H (Ω)) . ˜ ˜

57 to allow u to be discontinuous we perform a partial integration on the ∂u/∂xi term in the˜ integrated form of (5.4). The weak form may now be written˜ as follows Xd Z Xd Z Xd Z T T T ∂qi niqi u dΓ= qi κij pj dΩ+ ˜ u dΩ, ∀qi ∈ Q, (5.6) i=1 ∂Ω ˜ ˜ i,j=1 Ω ˜ ¯ ˜ i=1 Ω ∂xi ˜ ˜ Z Xd Xd Z T ∂u ∂u T ∂pi v ( ˜ + Ai ˜ + f) dΩ= v ˜ dΩ, ∀v ∈ V, (5.7) Ω ˜ ∂t i=1 ¯ ∂xi ˜ i=1 Ω ˜ ∂xi ˜ where Q and V are suitable spaces for pi, qi and u, v respectively. According to Roberts & Thomas (1991) the formulation˜ ˜ given˜ above˜ is called the dual mixed formulation, which allows the primary variable u to be discontinuous2. A discrete approximation of (5.6)and(5.7) is˜ found by choosing approximate spaces Qh ⊂ Q and Vh ⊂ V . However the approximate spaces Qh and Vh cannot be chosen independently. The spaces have to satisfy a compatibility relation that is known as the discrete Ladyzhenskaya-Babuˇska-Brezzi (LBB) condition. A necessary condition for the LBB condition to hold is

dim Vh 6 dim Qh, (5.8) which means that the gradient space Qh has to be ‘richer’ than the primary space Vh. We refer to Roberts & Thomas (1991) for a complete treatment of the LBB condition. (e) For the approximating space Vh we choose Vh as given in chapter 3.The hyperbolic part of the equations is treated by the DG method as described in chapter 3.

Remark 5.1: Thomas (1987) proves that for the stationary convection-diffusion equation a mixed method based on the so-called Raviart-Thomas-Nedelec space for approximating (Q, V ) combined with the DG method3 for the convection term leads to a unique solution. He also proves an error-estimate for this case.

Remark 5.2: It seems straightforward to substitute (5.2) also for the convective term in (5.5). However Thomas (1987) shows that for the convection-diffusion equation this only works for small P´eclet numbers, i.e. diffusion-dominated prob- lems.

After discretization of (5.6)and(5.7) the structure of the equations is as follows

CU = NP + BT U, (5.9) ¯ ˜ ¯ ˜ ¯ ˜ MU˙ − G∗(U,t)=BP , (5.10) ¯ ˜ ˜ ˜ ¯ ˜ where U and P are the discrete u and pi vectors respectively, N is a positive definite˜ matrix,˜ C is a matrix accounting˜ ˜ for the boundary integral,¯ B is a ¯ ¯ 2If we consider the case that u is a scalar and p~ =gradu is a vector, then we have V = L2(Ω) and Q = H(div; Ω). The latter space is a vector space where each element belongs to (L2(Ω))d but also div p~ ∈ L2(Ω). 3He calls it Lesaint-Raviart upwinding.

58 matrix that connects the vectors U and P , G∗ = MG,whereG is given in (3.35)andM is the mass matrix as˜ treated˜ in˜ section¯3.5˜ .Notethat˜ M can be inverted on¯ element level. As in the previous chapters we want to apply¯ explicit time integration methods as long as feasible. Therefore we want U˙ as a function of U. From (5.9)wecansolveP as a function of U and substitute˜ the results in (˜5.10). After inversion of the˜ matrix M we find˜ that ¯ U˙ = G(U,t)+M −1BN −1(C − BT )U. (5.11) ˜ ˜ ˜ ¯ ¯ ¯ ¯ ¯ ˜ This equation can now be used to apply the RK methods described in section 3.7.

Remark 5.3: Notice that the right-hand-sides of (5.4)and(5.5) form the usual symmetric system of a mixed method    N BT P ···= ¯ ¯ ˜ . (5.12) B 0 U ¯ ¯ ˜

Remark 5.4: It is obvious that we will never compute N −1 explicitly, but solve (5.9) by a direct linear equation solver or an .¯ After computa- tion of P we find U˙ from ˜ ˜ U˙ = G(U,t)+M −1BP . (5.13) ˜ ˜ ˜ ¯ ¯ ˜ Since solving linear systems is rather time consuming it may be advantageous to lump4 the matrix N. In the one-dimensional example of the following section we will see that lumping¯ also leads to larger stable time steps. However, it is unclear how lumping affects the accuracy. Remember that lumping is identical to an inaccurate numerical integration by a Newton-Cotes rule. There is also the possibility of zeros on the diagonal, for example in the case of the quadratic triangle.

Remark 5.5: If the diffusion terms are dominant and severely restrict the step size ∆t, it may be useful to apply implicit methods, at least for the diffusion terms.

In the next section we will apply the general theory to a one-dimensional example.

5.2 One-dimensional convection-diffusion equation 5.2.1 Equations Instead of (4.1) we have the following equation

∂u ∂u ∂2u + c = ν ,c,ν>0,x∈ [a, b],t>0. (5.14) ∂t ∂x ∂x2 We introduce the variable p as follows ∂u ∂u p = ν or = κp, (5.15) ∂x ∂x 4Lumping: diagonalizing a matrix by summation of all row elements.

59 with κ = ν−1. Substituting this into (5.14) leads to the following system ∂u 0=κp − , (5.16) ∂x ∂u ∂u ∂p + c = . (5.17) ∂t ∂x ∂x Introducing the test functions q and v leads to the following weak form similar to (5.6)and(5.7) Z b ∂q q(b)u(b) − q(a)u(a)= (κqp + u) dx, ∀q ∈ Q, (5.18) ∂x Z a Z b ∂u ∂u b ∂p v( + c ) dx = v dx, ∀v ∈ V. (5.19) a ∂t ∂x a ∂x A discretized solution is found by restricting the functions to finite dimensional spaces Qh and Vh. We choose discontinuous functions for Vh such that on an element Ij we have uh,vh ∈ P`(Ij ). In order to satisfy the LBB condition we have to choose Qh = P`+1(Ij )onIj but continuous across element boundaries (Thomasset 1981). We find for the discretized form NX−1 Z ∂qh qh(b)uh(b) − qh(a)uh(a)= (κqhph + uh) dx, ∀qh ∈ Qh, (5.20) j=0 Ij ∂x Z Z b ∂uh ∂uh ∂ph vh( + c ) dx + c[u]jvh(xj )= vh dx , ∀vh ∈ Vh, (5.21) Ij ∂t ∂x a ∂x for j =0,...,N−1. We have used the DG method with α = 1 for the discretiza- tion of the convection term. Additional to (4.3) we also introduce element base functions for the space Qh X` (k) (k) ph(x)= p ψ (x). (5.22) k=0

From (5.20)and(5.21) we find that additional to the matrices M j and Lj,as defined in (4.5), we have the following (element) matrices ¯ ¯

Z Z (m) (km) (k) (m) (km) (k) ∂ψ Nj = κ ψ ψ dx, Bj = φ dx. (5.23) Ij Ij ∂x Assuming Dirichlet boundary conditions for u at x = a and x = b

u(a)=ua u(b)=ub, (5.24) the system given by (5.20)and(5.21) may be written as   −ua    0     .  = NP + BT U, (5.25)  .  ¯ ˜ ¯ ˜  0  ub ∗ −1 U˙ j + SjU j = M j BjP j,j=0....,N − 1, (5.26) ˜ ¯ ˜ ¯ ¯ ˜

60 where N and B are assembled N j and Bj matrices respectively, and P j is the ¯ ¯ ¯ ¯ ∗˜ part of the P vector confined to element Ij. The vectors U j and U j and the ˜ ˜ ˜ matrix Sj have already been defined in section 4.1.1. ¯ Remark 5.6: If we consider an equidistant mesh for ` =0,itiseasytoshow that (5.25)and(5.26)withalumped matrix N corresponds to the ‘scheme’ ¯ ui − ui−1 ui+1 − 2ui + ui−1 u˙ i + c = ν . (5.27) h h2 For a full system it is not possible to derive a ‘local’ scheme since N −1 is a full matrix. ¯ 5.2.2 Stability The system is solved by a RK method of the order ` + 1. For this explicit method we have to find U˙ as a function of U.FirstP is solved from (5.25)and then substituted into (5.26˜ ) which gives the˜ expression˜ for U˙ . Practical computations show that the stability limit of˜ system (5.25)and (5.26)forc = 0, i.e. diffusion only, is determined by the stability of a one- element system with homogeneous boundary conditions (ua = ub =0).We have confirmed this result for ` =0, 1, 2, 3 both for full and lumped N.Forsuch a one-element system we have the following equation ¯

−1 −1 T ν U˙ j = −M j BjN j Bj U j = RjU j. (5.28) ˜ ¯ ¯ ¯ ¯ ˜ h2 ¯ ˜

The eigenvalues of Rj are real and negative. The largest negative eigenvalue determines the stability.¯ These eigenvalues are given in the following table for both the full and lumped N. ¯ ` λ (lumped) λ (full) 0 −4 −12 1 −24 −60 2 −69.633 −170.125 3 −257.481 −380.235

The values for λ have been computed with Maple V. The linear stability is given by ν |C(z)| 6 1withz =∆t λ, (5.29) h2 where λ is given in the table above and C(z) in the equations (4.24)to(4.27). This leads to the following stability requirement (diffusion only) ν∆t

` f3 (lumped) f3 (full) 1 1 0 2 6 1 1 1 12 30 2 0.03609 0.01478 3 0.01082 0.007326

61 Notice that the full system has a more severe stability requirement than the lumped system. For the system including the convection we assume that the critical eigenval- ues may be added as we have done in section 4.3.2. This leads to the following stability requirement5. c ν ( + 2 )∆t<1. (5.31) f1h f3h where f1 is given in section 4.1.2.

Remark 5.7: Convection and diffusion contribute equally to the stability re- quirement if

ch f1 Peh = = , (5.32) ν f3 where Peh is the ‘mesh-P´eclet number’. If Peh is larger (smaller) than given by (5.32) convection (diffusion) dominates.

Remark 5.8: Because of the fast decrease of the factor f3 for increasing ` it seems that the stability condition becomes very unattractive for larger `.How- ever, one should note that h is the length of an element and not the ‘distance’ between grid points. If we compare the schemes for the same heff = h/(` +1), i.e. for a similar distance between grid points we find

ν∆t 2 (eff) 2 < (` +1) f3 = f3 . (5.33) heff

(eff) The factor f3 is given in the following table

(eff) (eff) ` f3 (lumped) f3 (full) 1 1 0 2 6 1 2 1 3 15 2 0.3248 0.1329 3 0.1731 0.1172 and the situation becomes more favourable for the higher order schemes. Even more so if we assume that we can use larger elements for obtaining a similar accuracy (see also remark 4.2).

Remark 5.9: Periodic boundary conditions need special attention. If these conditions are implemented as given in section 3.6, i.e.

− + ua = u (b),ub = u (a), (5.34)

5If we include relaxation in (5.14) we find c ν 1 t< . ( + + 2 )∆ 1 f1h f2θ f3h

62 Figure 5.1: Results of problem E for t =0.5, ` = 1 and three values of ν:0, 1.25 × 10−4 and 5 × 10−4. we find that the stable time step is lower than given above. This can be resolved by implementing these conditions as follows

1 + − ua = ub = 2 (u (a)+u (b)). (5.35)

In this case numerical experiments show that the stability limits are identical to the case where ua and ub are imposed (Dirichlet conditions for u).

5.3 Practical results We consider problem E, which consists of (5.14)withc =1ontheinterval[0, 1]. The initial conditions are given by (4.29)andua = ub =0.Wetake` =1, −3 ne =96and∆t =1× 10 . In the figures 5.1 results are given for t =0.5for three different values of ν:0,1.25 × 10−4 and 5 × 10−4. We see that due to the diffusion the over and undershoots disappear for ν =5× 10−4. The results are for the full system, but the results for the lumped system are almost identical. The next problem (F) is given by (5.14)withc = 1 on an interval [0, 1] and boundary conditions ua =0,ub = 1. We consider six different values of ν

63 according to the following table, where Pe = c(b − a)/ν = ν−1 has also been given.

1 1 1 1 1 1 ν 96 48 24 12 6 3 Pe 96 48 24 12 6 3

We only look at the steady solution which is given by

1 − ex/ν u(x)= ,x∈ [0, 1]. (5.36) 1 − e1/ν The discretization is according to the following table

` 0123 ne 12 6 4 3 and thus nv =(` +1)ne = 12 for all four cases. The steady solution is found by integration in time with a time step ∆t = 1 × 10−3 up to t = 1. In the figures 5.2 and 5.3 the results are shown for a lumped and a full system. With respect to these results we make the following comments • Only the lumped first-order method does not show any oscillations if the boundary layer is not resolved. However this method is also very inaccu- rate even when the boundary layer is resolved. • For the full system the oscillations are larger than for the lumped system. • If the boundary layer is not resolved by the mesh the oscillations are confined to one element and do not propagate into the domain. • For ` = 2 and 3 the results of the full system are more accurate than the lumped system if the boundary layer is resolved.

Remark 5.10: In the figures 5.2 and 5.3 only the nodal values should be con- sidered. The interpolation by straight lines does not represent the real accuracy of the schemes between the nodal points.

Remark 5.11: Due to the fact that the Dirichlet condition for ub = 1 is im- posed weakly the values of u at x = 1 need not necessarily be close to 1 if the approximation is not good due to a coarse mesh.

64 Figure 5.2: Results of problem F for six values of Pe: 3, 6, 12, 24, 48 and 64; lumped system. The dotted lines are exact solutions. (a) ` =0;(b)` =1;(c) ` =2;(d)` =3.

65 Figure 5.3: Results of problem F for six values of Pe: 3, 6, 12, 24, 48 and 64; full system. The dotted lines are exact solutions. (a) ` =0;(b)` =1;(c)` =2; (d) ` =3.

66 Chapter 6 Conclusions

In this report we have shown that the discontinuous Galerkin method is capable of very accurately solving hyperbolic problems. If a mixed method is used, this also applies to parabolic problems. The time integration by Runge-Kutta methods seems to fit in rather well with the discontinuous Galerkin method. Compared to other finite element methods for solving hyperbolic problems (e.g. SUPG), an attractive feature of the discontinuous Galerkin method is that it still uses the basic Galerkin method for the volume integrals, although this is extended by element boundary integrals to achieve the ‘upwinding’. Because of the simple concept of the method it is basically the same for any space dimension. The treatment of boundary conditions is also relatively easy. Disadvantages of the method include the non-standard structure of the equa- tions and the use of expensive mixed methods to include diffusion. However, we believe that the advantages far outweigh the disadvantages for time dependent problems where the hyperbolic part is dominant.

67 References

Basombr´ıo, F.G. & Buscaglia, G.C. & Dari, E.A. 1991 Simulation of highly elastic fluid flows without additional numerical diffusivity. J. of Non-Newtonian Fluid Mech. 39, 189-206. Canuto, C., Hussaini, M.Y., Quarteroni, A. & Zang, T.A. 1988 Spectral Methods in Fluid Dynamics. Springer-Verlag, New York. Crochet, M.J. 1989 Numerical simulation of viscoelastic flow: A review. Rubber Chem. Techn. 62, 426-455. Cockburn, B. & Shu, C.W. 1989 TVB Runge-Kutta local projection discontinuous Galer- kin finite element method for conservation laws II: General Framework. Math. Comp. 52, 411-435. Cockburn, B., Lin, S.Y. & Shu, C.W. 1989 TVB Runge-Kutta local projection discontin- uous Galerkin finite element method for conservation laws III: One-dimensional systems. J. Comput. Phys. 84, 90-113. Cockburn, B., Hou, S. & Shu, C.W. 1990 The Runge-Kutta local projection discontinuous Galerkin finite element method for conservation laws IV: The multidimensional case. Math. Comp. 54, 545-581. Delvaux, V. & Crochet, M.J. 1990a Numerical simulation of delayed die swell. Rheol. Acta 29, 1-10. Delvaux, V. & Crochet, M.J. 1990b Numerical prediction of anomalous transport prop- erties in viscoelastic flow. J. of Non-Newtonian Fluid Mech. 37, 297-315. Fortin, M. & Fortin, A. 1989 A new approach for the fem simulation of viscoelastic flows. J. Non-Newtonian Fluid Mech. 32, 295-310. Hirsch, C. 1990 Numerical Computation of Internal and External Flows, Volume 2. John Wiley & Sons, New York. Hu, H.H. & Joseph, D.D. 1990 Numerical simulation of viscoelastic flow past a cylinder. J. Non-Newtonian Fluid Mech. 37, 347-377. Hulsen, M.A. 1986 Analysis of the equations for viscoelastic flow: type, boundary condi- tions and discontinuities. Delft University of Technology, Dept. Mech. Eng. & Marine Tech., WTHD report no. 185. Hulsen, M.A. 1990 A Numerical Method for Solving Steady 2D and Axisymmetrical Vis- coelastic Flow Problems with an Application to Inertia Effects in Contraction Flows. Delft University of Technology, Dept. of Mech. Eng. and Marine Techn., MEMT11. Hughes, T.J.R. 1987 Recent progress in the development and understanding of SUPG methods with special reference to the compressible Euler and Navier-Stokes equations. Int. J. Numer. Methods Fluids 7, 1261-1275. Joseph, D.D. 1990 Fluid Dynamics of Viscoelastic Liquids. Springer-Verlag, New York. Johnson, C. 1987 Numerical Solution of Partial Differential Equations by the Finite Ele- ment Method. Cambridge University Press, Cambridge. Johnson, C., Navart¨ U. & Pitkaranta,¨ J. 1984 Finite element methods for linear hyper- bolic problems. Comput. Meths. Appl. Mech. Engrg. 45, 285-312. Johnson, C., & Pitkaranta,¨ J. 1986 An Analysis of the discontinuous Galerkin method for a scalar hyperbolic equation. Math. Comp. 46, 1-26. Lesaint, P. & Raviart, P.A. 1974 On a finite element method for solving the neutron transport equation. In Mathematical Aspects of Finite Elements in Partial Differential Equations (ed. C. de Boor). Academic Press, New York. Phelan, F.R., Malone, M.F. & Winter, H.H. 1989 A purely hyperbolic model for un- steady viscoelastic flow. J. Non-Newtonian Fluid Mech. 32, 197-224. Pironneau, O. 1989 Finite Element methods for Fluids. John Wiley & Sons, New York. Ralston, A. & Rabinowitz, P. 1978 A First Course in . McGraw-Hill,

68 London. Roberts, J.E. & Thomas, J.-M. 1991 Mixed and Hybrid Methods. In Handbook of Nu- merical Analysis (eds. P.G. Ciarlet & J.L. Lions), North-Holland, Amsterdam. Thomasset, F. 1981 Implementation of Finite Element Methods for Navier-Stokes Equa- tions. Springer-Verlag, New York. Thomas, J.-M. 1987 Mixed finite element methods for convection-diffusion problems. In Numerical Approximation of Partial Differential Equations (ed. E.L. Ortiz). North- Holland, Amsterdam. Whitham, G.B. 1974 Linear and Nonlinear Waves. John Wiley & Sons, New-York.

69