Chapter 16
Chapter 16
2D Discontinuous Galerkin
Methods for Hyperbolic-Elliptic
Equations
16.1 Introduction
So far we have only discussed the implementation of discontinuous Galerkin methods
in one dimension for hyperbolic and elliptic equations and in two dimensions for
elliptic equations. In this chapter we extend all of the ideas that we have learned
in order to solve hyperbolic-elliptic equations in two-dimensions. Note that most of
these ideas can be extended to three-dimensions as well. Once again, for the sake of
simplicity, let us tackle two-dimensions.
231
232CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E
where f = (qu − ν∇q) and S(q) = q∇ · u. For the case that the velocity field is
divergence-free (∇ · u = 0) we obtain the conservation law
∂q
+ ∇ · f = 0. (16.4)
∂t
To simplify the discussion of the DG method we will assume that the velocity is
indeed divergence-free. In this chapter we will discuss the construction of the DG
method for the advection-diffusion equation in conservation form. The reason why
we use the conservation form and not the advection form is that DG requires the
equations in strict conservation form. The equations must be written in conservation
(also known as flux form) because only in this form do the fluxes make physical sense.
In other words, only in this form will the physically significant quantities (such as
mass, momentum, and energy fluxes) enter the numerical solution. Another reason
why it is important to discuss DG with the conservation form of the equations is
because only in this form can one expect the numerical solution to converge to the
physically correct solution when discontinuities (such as shocks) are present. Note
that this is true for either CG or DG and for any other numerical method. It is easy
to show that if one does not use the conservation form of the equations then one
cannot expect to converge to the correct solution.
with
MN
X
(e) (e)
uN (x) = ψj (x)uj
j=1
(e) (e) (e)
and fN = qN uN where u(x) = u(x)i + v(x)j is the velocity vector with u and v
components along i (x-direction) and j (y-direction). The integer MN is a function
of N which determines the number of points inside each element Ωe . For the case of
quadrilaterals (which we are assuming in this chapter) MN = (N + 1)2 .
(e) (e) (e)
Next, we substitute qN , uN , and f N into the PDE, multiply by a test function
and integrate within the local domain Ωe yielding the weak integral form: find q ∈ L2
such that
Z (e) Z Z
∂qN (∗,l) (e)
ψi dΩe + ψi n · f N dΓe − ∇ψi · f N dΩe = 0 ∀ψ ∈ L2
Ωe ∂t Γe Ωe
(∗,l) (∗,l)
where = f (∗,l) = f inv + f visc is the numerical flux function which we will assume to
be the Rusanov flux for the inviscid terms
(∗,l) 1 h (l) (e) i
f inv = f inv + f inv − | λ | n(e,l) q (l) − q (e)
2
16.4. 2D BASIS FUNCTIONS AND THE REFERENCE ELEMENT 233
and
M
∂qN (x, t) X
(e) N
∂ψj (x) (e)
= qj (t).
∂y j=1
∂y
Since we will perform all of our computations in the reference element with coordinates
(ξ, η) then we must transform the derivatives from (x, y) to (ξ, η).
Using the chain rule, we write the derivatives of the basis functions as
∂ψ(x(ξ, η), y(ξ, η)) ∂ψ(ξ, η) ∂ξ(x, y) ∂ψ(ξ, η) ∂η(x, y)
= +
∂x ∂ξ ∂x ∂η ∂x
234CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E
and
∂ψ(x(ξ, η), y(ξ, η)) ∂ψ(ξ, η) ∂ξ(x, y) ∂ψ(ξ, η) ∂η(x, y)
= +
∂y ∂ξ ∂y ∂η ∂y
∂ξ
where we must now define the derivatives ∂ψ and the metric terms ∂ x . We found all
∂ξ
of these metric terms in Ch. 13 which we reuse in this chapter.
This mapping now allows us to construct basis function derivatives in terms of
the reference element (ξ, η) as follows
∂ψ ∂ψ ∂ξ ∂ψ ∂η
= +
∂x ∂ξ ∂x ∂η ∂x
∂ξ 1 ∂y ∂ξ 1 ∂x ∂η 1 ∂y ∂η 1 ∂x
= , =− , =− , = .
∂x |J| ∂η ∂y |J| ∂η ∂x |J| ∂ξ ∂y |J| ∂ξ
The final step required to compute these metric terms is to approximate the deriva-
tives ∂∂x
η using the basis functions. Let us approximate the physical coordinates by
the basis function expansion
MN
X
x(ξ, η) = ψj (ξ, η)xj
j=1
X M
N
∂x ∂ψj
(ξ, η) = (ξ, η)xj .
∂ξ j=1
∂ξ
which can be solved for in a straightforward manner when ν = 0, that is, when the
equations are fully inviscid. When viscosity is present, we must consider the how to
handle the Laplacian operator. Recall from Ch. 14 that we handled the Laplacian
operator by virtue of the local discontinuous Galerkin method. Let us revisit how to
incorporate this method.
16.5. ELEMENT EQUATIONS ON A SINGLE ELEMENT: WEAK FORM 235
1. let Q = ∇q and
2. ∇ · Q = ∇2 q.
X4 T
Mij
(e) (e)
Qj · I 2 =
(e,l)
F ij
(∗,l) e (e) q (e)
qj I 2 − D ij j
l=1
where q (∗,l) = 21 q (l) + q (e) and the values of q used are those at the current time tn .
The variable Q obtained here is now used in the construction of the flux variable f
in the element equations.
is the mass matrix where wk and |Jk | are the quadrature weight and determinant of
the Jacobian evaluated at the quadrature point ξ k ;
Z Q
X
(e,l) (e,l) (l) (l) (e,l)
F ij = ψi ψj n dΓe = wk |Jl |ψik ψjk nk
Γe k=0
236CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E
is the flux matrix where the superscript (l) denotes the side/edge variables, and
Z MQ
X
e (e) =
D ∇ψi ψj dΩe = wk |Jk |∇ψik ψjk
ij
Ωe k=1
is the differentiation matrix, which is nothing more than the 2D version of the weak
form differentiation matrix we have already seen. There is no problem integrating
the above matrices exactly, except for the issue of having to deal with a non-diagonal
mass matrix. However, in the DG method having a non-diagonal mass matrix poses
very little difficulty since this matrix is small and local. Inverting the mass matrix
yields the final matrix problem
(e) X4 (e) T
∂qi (e,l) T (∗,l) b (e)
+ b
F ij fj − D e fj = 0
ij
∂t l=1
where −1
b (e,l) = M (e)
F
(e,l)
F kj
ij ik
are the flux and differentiation matrices premultiplied by the inverse mass matrix.
where changes in our matrix-vector problem from exact to inexact integration occur
in all the matrices. The mass matrix simplifies to
(e)
Mij = wi |Ji |δij ,
16.6. ELEMENT EQUATIONS ON A SINGLE ELEMENT: STRONG FORM 237
where in the last step we included the numerical flux function. Integrating by parts
one more time yields
Z Z Z
(e) (∗,l) (e) (e)
ψi ∇ · f N dΩe = ψi n · f N − f N dΓe + ψi ∇ · f N dΩe .
Ωe Γe Ωe
This is the form we shall use to solve the equations. Let us substitute this relation
into the element equations to get
Z (e) Z Z
∂qN (∗,l) (e) (e)
ψi dΩe + ψi n · f N − f N dΓe + ψi ∇ · f N dΩe = 0 ∀ψ ∈ L2 .
Ωe ∂t Γe Ωe
that the advection term is a 3N degree polynomial). This quadrature rule yields the
following matrix-vector problem
(e) 4
X T T
(e) ∂qj (e,l) (e) (e)
Mij + F ij f (∗,l) − f (e) + D ij fj = 0
∂t l=1
j
is the mass matrix where wk and |Jk | are the quadrature weight and determinant of
the Jacobian evaluated at the quadrature point ξ k ;
Z Q
X
(e,l) (l) (l) (e,l)
F ij = ψi ψj n(e,l) dΓe = wk |Jk |ψik ψjk nk
Γe k=0
is the flux matrix where the superscript (l) denotes the side/edge variables and
Z MQ
X
(e)
D ij = ψi ∇ψj dΩe = wk |Jk |ψik ∇ψjk
Ωe k=1
where −1
(e,l) (e) (e,l)
b
F ij = Mik F kj
and −1
b (e) = M (e)
D
(e)
D kj
ij ik
are the flux and differentiation matrices premultiplied by the inverse mass matrix.
where changes in our matrix-vector problem from exact to inexact integration occur
in all the matrices. The mass matrix simplifies to
(e)
Mij = wi |Ji |δij ,
the flux matrix becomes
(e,l) (l) (l) (e,l)
F ij = wi |Ji |ni δij ,
and the differentiation matrix is
(e)
D ij = wi |Ji |∇ψji .
Substituting these matrices into the element equation (Eq. (16.6) yields
(e)
∂qi X4 T
(l) (l) (e,l) (e)
wi |Ji | + wi |Ji | ni f (∗,l)
−f (e)
+ wi |Ji | (∇ψji )T f j = 0. (16.7)
∂t l=1
j
which looks like nothing more than a collocation method with a penalty term to
handle discontinuous fluxes.
with
∂x ∂y ∂y ∂x
−
|J| = .
∂ξ ∂η ∂ξ ∂η
To compute these terms, we expand the coordinates as follows:
MN
X
xN (ξ, η) = ψj (ξ, η)xj .
j=1
X N M
∂xN 1
(ξ, η) = ξj (1 + ηj η) xj .
∂ξ j=1
4
We still need to construct the flux matrix F and the weak form differentiation matrix
D.
Beginning with
Z Z
e (e,x) = ∂ψi (e,y) ∂ψi
D ij ψj dΩe Dij = ψj dΩe
Ωe ∂x Ωe ∂y
we find that
∂ψi ∂ψi ∂ξ ∂ψi ∂η
= + ,
∂x ∂ξ ∂x ∂η ∂x
∂ψi ∂ψi ∂ξ ∂ψi ∂η
= + ,
∂y ∂ξ ∂y ∂η ∂y
16.7. EXAMPLE OF 2D DG FOR LINEAR ELEMENTS 243
where, since we are assuming that x is along ξ and y is along y, we get the metric
terms
∂ξ 2 ∂η 2 ∂ξ ∂η
= = = =0
∂x ∆x ∂y ∆y ∂y ∂x
and |J| = ∆x∆y 4
. This now allows us to write the differentiation matrices in terms of
the reference element coordinates
Z +1 Z +1
e (e,x) 1 1 2 ∆x∆y
Dij = ξi (1 + ηi η) (1 + ξj ξ) (1 + ηj η) dξ dη
−1 −1 4 4 ∆x 4
Z +1 Z +1
e (e,y) = 1 1 2 ∆x∆y
D ij ηi (1 + ξi ξ) (1 + ξi ξ) (1 + ηi η) dξ dη.
−1 −1 4 4 ∆y 4
Simplifying and integrating yields
+1 +1
e (e,x) ∆y 1 2 1 2 1 3
D ij = ξi ξ + ξi ξj ξ η + (ηi + ηj )η + ηi ηj η
32 2 −1 2 3 −1
+1 +1
e (e,y) ∆x 1 2 1 2 1 3
Dij = ηi η + ηi ηj η ξ + (ξi + ξj )ξ + ξi ξj ξ .
32 2 −1 2 3 −1
Evaluating the matrices at the bounds of integration and simplifying yields the com-
pact form
De (e,x) = ∆y ξi (3 + ηi ηj ) e (e,y) = ∆x ηi (3 + ξi ξj ).
D
ij ij
24 24
Substituting for the values of the reference element coordinates (ξ, η) yields the matrix
form
−2 −2 −1 −1
1
e (e,x) = ∆y 2
D
2 −1
ij
12 −1 −1 −2 −2
1 1 2 2
and
−2 −1 −2 −1
e (e,y) ∆x
−1 −2 −1 −2 .
D =
ij
12 2 −1 2 1
1 2 1 2
where l is the side/edge neighbor of e and n(e,l) is the outward pointing unit nor-
mal vector of the side/edge shared by the elements e and l, pointing from e to
244CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E
l. Since we are assuming linear elements then our basis functions are ψi (ξ, η) =
1
4
((1 + ξi ξ) (1 + ηi η). Substituting this definition into the flux matrix yields
Z +1
(e,l) 1
F = (1 + ξi ξ) (1 + ηi η) (1 + ξj ξ) (1 + ηj η) |J(ξ, η)| ds
−1 16
where ds is either dξ or dη, depending on which of the four sides of the element e we
are evaluating. Let us use Fig. 16.1 to discuss the edge components of the flux.
3 4
l3
n
1 2
3 4 3 4 3 4
n e n l2
l4
1 2 1 2 1 2
3 4
n
l1
1 2
Figure 16.1: The element (e) and its four edge neighbors (l1), (l2), (l3), and (l4).
Side 1
Looking at Fig. 16.1 we see that for edge 1, the one shared by elements (e) and (l1),
the integral is along the ξ direction where η = −1 so that we get the following integral
Z +1
(e,1) 1 ∆x (e,1)
F = 1 + (ξi + ξj ) ξ + ξi ξj ξ 2 (1 − ηi ) (1 − ηj ) n dξ.
−1 16 2
Integrating yields
+1
(e,1) ∆x n(e,1) 1 2 1 3
F = ξ + (ξi + ξj ) ξ + ξi ξj ξ (1 − ηi ) (1 − ηj )
32 2 3 −1
16.7. EXAMPLE OF 2D DG FOR LINEAR ELEMENTS 245
∆x n(e,1)
F (e,1) = (3 + ξi ξj ) (1 − ηi ) (1 − ηj ) .
48
Substituting in the values of (ξ, η)i and (ξ, η)j yields the matrix
16 8 0 0
(e,1)
∆x n 8 16 0 0
F (e,1) = 0 0
48 0 0
0 0 0 0
which is nothing more than a 1D mass matrix for the edge (e, l1). For this edge,
its normal vector is defined as follows n(e,1) = 0i − 1j where i and j are the usual
Cartesian coordinate directional vectors.
Side 2
For edge 2, the one shared by elements (e) and (l2), the integral is along the η direction
where ξ = +1 so that we get
Z +1
(e,2) 1 ∆y (e,2)
F = (1 + ξi ) (1 + ξj ) 1 + (ηi + ηj ) η + ηi ηj η 2 n dη.
−1 16 2
Integrating yields
+1
(e,2) ∆y n(e,2) 1 2 1 3
F = (1 + ξi ) (1 + ξj ) η + (ηi + ηj ) η + ηi ηj η
32 2 3 −1
∆y n(e,2)
F (e,2) = (1 + ξi ) (1 + ξj ) (3 + ηi ηj ) .
48
Substituting the values for (ξ, η)i and (ξ, η)j yields the matrix
0 0 0 0
(e,2)
∆y n 0 2 0 1
F (e,2) = 0 0
6 0 0
0 1 0 2
Side 3
For edge 3, the one shared by elements (e) and (l3), the integral is along the ξ direction
where η = +1 so that we get the following integral
Z +1
(e,3) 1 ∆x (e,3)
F = [1 + (ξi + ξj ) ξ] (1 + ηi ) (1 + ηj ) n dξ.
−1 16 2
Integrating yields
+1
(e,3) ∆x n(e,3) 1 2 1 3
F = ξ + (ξi + ξj ) ξ + ξi ξj ξ (1 + ηi ) (1 + ηj )
32 2 3 −1
Side 4
Finally, for edge 4, the one shared by elements (e) and (l4), the integral is along the
η direction where ξ = −1 so that we get
Z +1
(e,4) 1 ∆y (e,4)
F = (1 − ξi ) (1 − ξj ) (1 + ηj η) [1 + (ηi + ηj ) η] n dη.
−1 16 2
Integrating yields
+1
(e,4) ∆y n(e,4) 1 2 1 3
F = (1 − ξi ) (1 − ξj ) η + (ηi + ηj ) η + ηi ηj η
32 2 3 −1
requires us to know what exactly is the value of the term f (∗,l) . Recall that we are
using the Rusanov flux which is defined as
(∗,l) 1 h (l) (e) (e,l) (l) (e)
i
f = f +f −|λ|n q −q .
2
To see the structure of the product
T
(e,l) (∗,l)
F ij fj
let us first extract the normal vector from the flux matrix and write this product as
follows
(e,l) (e,l) (∗,l)
Fij n · fj .
Side 1
For side 1 (see Fig. 16.1), we then have the following numerical flux function
1 h (e,1) (1) i
n(e,1) · f (∗,1) = n · f + f (e) − | λ | q (1) − q (e) .
2
More specifically, for j = 1, 2 we get
(∗,1) 1 h (e,1) (1) (e)
(e,1)
(1) (e)
i
n(e,1) · f 1 = n · f 3 + f 1 − | λ |1,3 q3 − q1 ,
2
(∗,1) 1 h (e,1) (1) (e)
(e,1)
(1) (e)
i
n(e,1) · f 2 = n · f 4 + f 2 − | λ |2,4 q4 − q2 ,
2
and for j = 3, 4 we do not need to define the flux function since it will be multiplied
by rows 3 and 4 of F (e,1) which are all zero.
Substituting the values for n(e,1) and f yields
(∗,1) 1h (1) (e)
(e,1)
(1) (e)
i
n(e,1) · f 1 = − (qv)3 + (qv)1 − v1,3 q3 − q1 ,
2
which, after simplifying, yields
(∗,1) (1)
n(e,1) · f 1 = −(qv)3 ,
and
(∗,1) (1)
n(e,1) · f 2 = −(qv)4
(e,1) (e,1) (e,1)
where we have taken | λ |1,3 =| n(e,1) ·u(e,1) |1,3 = v1,3 and | λ |2,4 =| n(e,1) ·u(e,1) |2,4 =
(e,1)
v2,4 and have assumed v to be continuous.
248CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E
Side 2
For side 2, we then have the following numerical flux function
and
(∗,2) (e)
n(e,2) · f 4 = (qu)4
(e,2) (e,2) (e,2)
where we have taken | λ |2,1 =| n(e,2) ·u(e,2) |2,1 = u2,1 and | λ |4,3 =| n(e,2) ·u(e,2) |4,3 =
(e,2)
u4,3 and have assumed u to be continuous.
Side 3
For side 3, we have the following numerical flux function
and
(∗,3) (e)
n(e,3) · f 4 = (qv)4
(e,3) (e,3) (e,3)
where we have taken | λ |3,1 =| n(e,3) ·u(e,3) |3,1 = v3,1 and | λ |4,2 =| n(e,3) ·u(e,3) |4,2 =
(e,3)
v4,2 and have assumed v to be continuous.
Side 4
For side 4, we get
1 h (e,4) (4) i
n(e,4) · f (∗,4) = n · f + f (e) − | λ | q (4) − q (e) .
2
For j = 1, 3 we get
and
(∗,4) (4)
n(e,4) · f 3 = −(qu)4
(e,4) (e,4) (e,4)
where we have taken | λ |1,2 =| n(e,4) ·u(e,4) |1,2 = u1,2 and | λ |3,4 =| n(e,4) ·u(e,4) |3,4 =
(e,4)
u3,4 and have assumed u to be continuous.
Remark 31 By going through the exercise of what the numerical flux function is
doing, it should become obvious that this function is doing nothing more than favoring
the upwind direction. For example, in Fig. 16.1, if we assume that the flow field in u is
moving from left to right and in v from bottom to top you will see that the Rusanov flux
function is merely favoring the upwind direction. This is the idea behind numerical
flux functions because, as we saw in Ch. 1, for hyperbolic equations using the upwind
direction to discretize the equations results in a very stable numerical method.
250CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E
which forms a velocity field that rotates fluid particles in a clockwise direction. Note
that this velocity field is divergence-free, that is, that the following condition is sat-
isfied
∇ · u = 0.
Clearly, this problem represents a 2D wave equation that is hyperbolic and is
thereby an initial value problem that requires an initial condition. Let that initial
condition be the Gaussian
where (xc , yc ) = (−0.5, 0) is the initial center of the Gaussian and σc = 81 controls
the shape (steepness) of the Gaussian wave. The analytic solution to this problem is
given as
q(x, y, t) = q(x − ut, y − vt, 0)
where periodicity is enforced at all four boundaries.
where Ne represents the number of elements and MN are the number of interpolation
points within each element Ωe and q numerical and q exact are the numerical and exact
solutions.
Solution Accuracy
Figure 16.2 shows the convergence rates for various polynomial orders, N , for a total
(x) (y)
number of gridpoints Np where, for 2D quadrilaterals, Np = (Ne (N + 1))(Ne (N +
(s)
1)), where Ne denotes the number of elements along the coordinate direction (s).
Figure 16.2 shows that there is little difference between exact and inexact integration
0 0
10 10
Normalized L Error
Normalized L2 Error
−1 −1
10 10
2
−2 −2
10 N=1 10 N=1
N=2 N=2
−3
N=4 −3 N=4
10 N=8 10 N=8
N=16 N=16
−4 −4
10 10
0 2000 4000 6000 8000 10000 0 2000 4000 6000 8000 10000
N N
P P
in terms of their rates of convergence. The main differences occur for low values of
N (≤ 4), however, as N increases (beyond N = 8) the difference between exact and
inexact integration all but disappear.
0 0
10 10
N=1
N=2
−1 N=4 −1
Normalized L Error
Normalized L2 Error
10 10 N=1
N=8
N=16 N=2
2
−2 −2 N=4
10 10
N=8
N=16
−3 −3
10 10
−4 −4
10 10
0 500 1000 1500 0 50 100 150 200 250
Wallclock Time (S) Wallclock Time (S)
0 0
10 10
Normalized L Error
−1 −1
Normalized L2 Error
10 10
2
−2 −2
10 N=1 10 N=1
N=2 N=2
−3
N=4 N=4
−3
10 N=8 10 N=8
N=16 N=16
−4 −4
10 10
0 2000 4000 6000 8000 10000 0 100 200 300 400 500
NP Wallclock Time (S)
is less than the exact integration Lobatto points but more than the inexact Lobatto
points.
To get a better sense of how costly high-order is, we now zoom into the wallclock
time plot. Figure 16.5 shows the computational cost (wallclock time in seconds) for
various polynomial orders, N . Figure 16.5 shows that the N = 8 achieves an error
accuracy of of 10−3 most efficiently with N = 16 a close second. For larger errors
(10−2 ), N = 8 is still the most efficient, but now N = 4 begins to compete with
N = 16.
16.8. EXAMPLE OF 2D HYPERBOLIC EQUATION PROBLEM 253
0
10
N=1
N=2
−1
Normalized L2 Error
10 N=4
N=8
N=16
−2
10
−3
10
−4
10
0 20 40 60 80 100
Wallclock Time (S)