0% found this document useful (0 votes)
38 views24 pages

Chapter 16

This chapter discusses extending discontinuous Galerkin methods to solve hyperbolic-elliptic equations in two dimensions. It begins by presenting the 2D advection-diffusion equation and writing it in both advection and conservation forms. It then derives the weak integral form and discusses constructing 2D basis functions on the reference element by taking the tensor product of 1D basis functions. Finally, it provides the mapping between physical and reference element derivatives needed to compute metric terms for the basis function derivatives.

Uploaded by

Pawan Negi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views24 pages

Chapter 16

This chapter discusses extending discontinuous Galerkin methods to solve hyperbolic-elliptic equations in two dimensions. It begins by presenting the 2D advection-diffusion equation and writing it in both advection and conservation forms. It then derives the weak integral form and discusses constructing 2D basis functions on the reference element by taking the tensor product of 1D basis functions. Finally, it provides the mapping between physical and reference element derivatives needed to compute metric terms for the basis function derivatives.

Uploaded by

Pawan Negi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

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.

16.2 2D Advection-Diffusion Equation


Let us begin our discussion with the two-dimensional advection-diffusion equation
which can be written in the following form
∂q
+ u · ∇q = ν∇2 q (16.1)
∂t
 
∂ ∂
where q = q(x, t) is our scalar solution variable, ∇ = ∂x i + ∂y j is the 2D gradient
operator, i and j are the directional unit vectors in 2D Cartesian space, and ν is the
viscosity which we assume, for the moment, to be a constant. The form described in
Eq. (16.1) is known as the advection or non-conservation form of the equation. The
alternate form
∂q
+ ∇ · (qu − ν∇q) = q∇ · u (16.2)
∂t
is known as the conservation form, where we have assumed ν is constant. Note that
we can now recast this equation in general form
∂q
+ ∇ · f = S(q) (16.3)
∂t

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.

16.3 Weak Integral Form


To construct the weak integral form, we begin by expanding the solution variable q
as follows
MN
X
(e) (e)
qN (x, t) = ψj (x)qj (t)
j=1

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 the average flux for the viscous terms


(∗,l) 1 h (l) (e)
i
f visc = f + f visc
2 visc
where the superscript (l) denotes the side/edge neighbor of (e), n(e,l) is the unit normal
vector of the edge shared by elements e and l, and λ is the maximum wave speed
of the system; for the advection-diffusion equation λ is just the maximum normal
velocity n · u|Γe .

16.4 2D Basis Functions and the Reference Ele-


ment
Once again, we construct the 2D basis functions on the reference elements as a tensor
product of the 1D basis functions such as
ψi (ξ, η) = hj (ξ) ⊗ hk (η)
where h are the 1D basis functions we have discussed already, ⊗ is the tensor product,
and the 1D indices vary as follows j, k = 0, ..., N with the 2D index varying as
i = 1, ..., MN where MN = (N + 1)2 . To get from the 1D local indices (j, k) to the
2D local index i requires the mapping i = k(N + 1) + j + 1.
With this definition in place, we can now expand the solution variable q as follows
MN
X
(e) (e)
qN (x, t) = ψj (x)qj (t)
j=1

which implies the approximation of the gradient operator to be


MN
X
(e) (e)
∇qN (x, t) = ∇ψj (x)qj (t)
j=1

where the partial derivatives are defined as follows


M
∂qN (x, t) X
(e) N
∂ψj (x) (e)
= qj (t)
∂x j=1
∂x

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

where the metric terms are in fact defined explicitly as

∂ξ 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

which then yields the derivatives

X M
N
∂x ∂ψj
(ξ, η) = (ξ, η)xj .
∂ξ j=1
∂ξ

16.5 Element Equations on a Single Element: Weak


Form
The equation that we need to solve is the element equation
Z (e) Z Z
∂qN (∗,e) (e)
ψi dΩe + ψi n · f N dΓe − ∇ψi · f N dΩe = 0 ∀ψ ∈ L2
Ωe ∂t Γe Ωe

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

16.5.1 Local Discontinuous Galerkin Method for the Diffu-


sion Operator
To insure that the DG discrete form of the Laplacian operator is consistent requires
us to use the two-step approach:

1. let Q = ∇q and

2. ∇ · Q = ∇2 q.

For time-dependent problems, the construction of the LDG operators is much


more straightforward because we can compute the auxiliary variable Q as follows

  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.

16.5.2 Matrix-Vector Problem Resulting from Exact Inte-


gration
At this point we have to decide whether or not we are going to evaluate the integrals
using co-located quadrature (which results in inexact integration) or non-colocated
quadrature (that, for a specific number of quadrature points, results in exact integra-
tion). Let us first see what happens when we use exact integration. Let MQ = (Q+1)2
where Q = 23 N + 12 will integrate 3N polynomials exactly (note that the advection
term is a 3N degree polynomial). This quadrature rule yields the following matrix-
vector problem
(e) 4 
X T  (e) T
(e) ∂qj (e,l) (∗,l) e (e)
Mij + F ij fj − D ij fj = 0
∂t l=1

where the above matrices are defined as follows:


Z MQ
X
(e)
Mij = ψi ψj dΩe = wk |Jk |ψik ψjk
Ωe k=1

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

and  −1 (e)


(e)
b
e = M (e) e
D ij ik D kj

are the flux and differentiation matrices premultiplied by the inverse mass matrix.

16.5.3 Matrix-Vector Problem Resulting from Inexact Inte-


gration
Looking at the mass, flux, and differentiation matrices we see that they represent
the integrals of polynomials of degree: 2N for mass and flux matrices and 3N for
the differentiation matrix. Note that the differentiation matrix is written above as
a 2N polynomial but in reality, due to the nonlinear nature of the flux f we end up
with a 3N polynomial matrix; however, this is of little importance in the following
discussion as we shall concentrate on the effects of inexact integration on the mass
and flux matrices.
If we use inexact integration, that is, 2N-1 integration, we only commit a small
numerical crime for the mass and flux matrices; for the differentiation matrix, this
crime is a bit larger, however. Let us now use inexact integration and see what the
resulting matrix-vector problem looks like. In this case, we let MQ = (Q + 1)2 = MN
where Q = N to get the following matrix-vector problem
(e) 4 
X T  (e) T
(e) ∂qj (e,l) (∗,l) e (e)
Mij + F ij fj − D ij fj = 0 (16.5)
∂t l=1

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

the flux matrix becomes


(e,l) (l) (l) (e,l)
F ij = wi |Ji |ni δij
where the flux matrix only affects the boundary of the element, and the differentiation
matrix is
MN
X
(e)
e
D ij = wk |Jk |∇ψik ψjk .
k=1

16.6 Element Equations on a Single Element: Strong


Form
Let us now explore the strong form of the DG method. To construct the strong form
with DG, we apply integration by parts twice as follows: let
 
(e) (e) (e)
∇ · ψi f N = ∇ψi · f N + ψi ∇ · f N

which, after integration, yields


Z   Z Z
(e) (e) (e)
ψi n · f N dΓe = ∇ψi · fN dΩe + ψi ∇ · f N dΩe
Γe Ωe Ωe

and rearranging gives


Z Z   Z
(e) (∗,l) (e)
ψi ∇ · f N dΩe = ψi n · f N dΓe − ∇ψi · f N dΩe
Ωe Γe Ωe

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

16.6.1 Matrix-Vector Problem Resulting from Exact Inte-


gration
Once again, let us consider the differences in the difference stencils when we evaluate
the integrals using co-located quadrature (which results in inexact integration) or
non-colocated quadrature (that, for a specific number of quadrature points, results
in exact integration). Let us first see what happens when we use exact integration.
Let MQ = (Q + 1)2 where Q = 23 N + 12 will integrate 3N polynomials exactly (note
238CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC 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

where the above matrices are defined as follows:


Z MQ
X
(e)
Mij = ψi ψj dΩe = wk |Jk |ψik ψjk
Ωe k=1

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

is the strong form differentiation matrix.


Inverting the mass matrix yields the final matrix problem
(e) X4  T    (e) T
∂qi b (e,l) (∗,l) (e) b (e)
+ F ij f − f + D ij fj = 0
∂t l=1
j

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.

16.6.2 Matrix-Vector Problem Resulting from Inexact Inte-


gration
Looking at the mass, flux, and differentiation matrices we see that they represent
the integrals of polynomials of degree: 2N for mass and flux matrices and 3N for
the differentiation matrix. Note that the differentiation matrix is written above as
a 2N polynomial but in reality, due to the nonlinear nature of the flux f we end up
with a 3N polynomial matrix; however, this is of little importance in the following
16.7. EXAMPLE OF 2D DG FOR LINEAR ELEMENTS 239

discussion as we shall concentrate on the effects of inexact integration on the mass


and flux matrices.
If we use inexact integration, that is, 2N-1 integration, we only commit a small
numerical crime for the mass and flux matrices; for the differentiation matrix, this
crime is a bit larger, however. Let us now inexact integration and see what the
resulting matrix-vector problem looks like. In this case, we let MQ = (Q + 1)2 = MN
where Q = N to get 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 (16.6)
∂t l=1
j

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

Dividing by wi |Ji | yields

wi |Ji |  (e,l) T  (∗,l) 


(e) X4 (l) (l)
∂qi (e)
+ ni f − f (e) + (∇ψji )T f j = 0 (16.8)
∂t l=1
w |J
i i | j

which looks like nothing more than a collocation method with a penalty term to
handle discontinuous fluxes.

16.7 Example of 2D DG for Linear Elements


Let us construct the matrix problem for the 2D advection-diffusion equation using
linear elements N = 1. To simplify the discussion, let us assume that the viscosity ν
is zero, and let us look at the weak form of DG. We make this assumption in order
to simplify the discussion of the local matrix problem
(e) 4 
X T  (e) T
(e) ∂qj (e,l) (∗,l) e (e)
Mij + F ij fj − D ij fj = 0
∂t l=1

where f = qu instead of being f = qu − ν∇q which then complicates the solution


strategy by having to involve the local discontinuous Galerkin method for the viscous
terms.
240CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E

16.7.1 2D Basis Functions


Recall that for linear elements, the 1D basis function defined at the element grid point
“i” is
1
hi (ξ) = (1 + ξi ξ)
2
where ξ ∈ [−1, +1]. In a similar vane we can define
1
hi (η) = (1 + ηi η)
2
where η ∈ [−1, +1]. In these two expressions the index is defined as follows: i =
1, ..., N + 1. If we wish to use the 1D basis functions to construct 2D functions, then
we take the the tensor product which amounts to just defining i = 1, ..., (N + 1)2
where we now have to define ξi and ηi not just at two grid points as in 1D but now
four points in 2D. These four points are the vertices (corners) of the quadrilateral
reference element. At this point we can now define the 2D basis functions as
1 1
ψi (ξ, η) = (1 + ξi ξ) (1 + ηi η)
2 2
or, more compactly as
1
ψi (ξ, η) = (1 + ξi ξ) (1 + ηi η) .
4
From this expression we can now define the derivatives as follows
∂ψi 1
(ξ, η) = ξi (1 + ηi η)
∂ξ 4
and
∂ψi 1
(ξ, η) = ηi (1 + ξi ξ) .
∂η 4

16.7.2 Metric Terms


We need the metric terms in order to represent the derivatives in the reference element
to the physical derivatives. In other words, we need representations of the following
derivatives This mapping now allows us to construct basis function derivatives in
terms of the reference element (ξ, η) as follows
∂ψi ∂ψi ∂ξ ∂ψi ∂η
= +
∂x ∂ξ ∂x ∂η ∂x
and
∂ψi ∂ψi ∂ξ ∂ψi ∂η
= +
∂y ∂ξ ∂y ∂η ∂y
where the metric terms are defined as
∂ξ 1 ∂y ∂ξ 1 ∂x ∂η 1 ∂y ∂η 1 ∂x
= , =− , =− , = .
∂x |J| ∂η ∂y |J| ∂η ∂x |J| ∂ξ ∂y |J| ∂ξ
16.7. EXAMPLE OF 2D DG FOR LINEAR ELEMENTS 241

with
∂x ∂y ∂y ∂x

|J| = .
∂ξ ∂η ∂ξ ∂η
To compute these terms, we expand the coordinates as follows:
MN
X
xN (ξ, η) = ψj (ξ, η)xj .
j=1

Taking the derivative yields:


X N M
∂xN ∂ψj
(ξ, η) = (ξ, η)xj
∂ξ j=1
∂ξ
∂ψ
where, substituting ∂ξ
yields

X N M
∂xN 1
(ξ, η) = ξj (1 + ηj η) xj .
∂ξ j=1
4

For linear elements we have


∂xN 1
(ξ, η) = (ξ1 (1 + η1 η) x1 + ξ2 (1 + η2 η) x2 )
∂ξ 4
1
+ (ξ3 (1 + η3 η) x3 + ξ4 (1 + η4 η) x4 ) .
4
Let us assume that x is along the ξ direction and y is along η. This means that
since ξi = (−1, +1, −1, +1) and ηi = (−1, −1, +1, +1) then x1 = x3 and x2 = x4 and
similarly y1 = y2 and y3 = y4 . Let us call x1 = xo and x2 = xo + ∆x. We can now
show that ∂x∂ξ
is
∂xN 1
(ξ, η) = (− (1 − η) xo + (1 − η) (xo + ∆x))
∂ξ 4
1
+ (− (1 + η) xo + (1 + η) (xo + ∆x))
4
which simplifies to
∂xN ∆x
= .
∂ξ 2
If we did this for the other terms we would find that
∂xN ∂yN
= =0
∂η ∂ξ
and
∂yN ∆y
= .
∂η 2
With these terms known, we can now evaluate the determinant of the Jacobian to
yield
∂x ∂y ∂x ∂y ∆x∆y
|J| = − = .
∂ξ ∂η ∂η ∂ξ 4
242CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E

16.7.3 Derivatives in Physical Space


The derivatives in physical coordinates are defined as
∂ψi ∂ψi ∂ξ ∂ψi ∂η
= +
∂x ∂ξ ∂x ∂η ∂x
and
∂ψi ∂ψi ∂ξ ∂ψi ∂η
= +
∂y ∂ξ ∂y ∂η ∂y
where, when we substitute the metric terms and the derivatives of the basis functions
in the reference element yield
∂ψi 1 2
= ξi (1 + ηi η)
∂x 4 ∆x
and
∂ψi 1 2
= ηi (1 + ξi ξ) .
∂y 4 ∆y

16.7.4 Mass Matrix


From Ch. 14 we found that the mass matrix is
 
4 2 2 1
∆x∆y  2 
(e)
Mij =  2 4 1 .
36  2 1 4 2 
1 2 2 4

We still need to construct the flux matrix F and the weak form differentiation matrix
D.

16.7.5 Differentiation Matrix


The weak form differentiation matrix is written as
Z
(e)
e =
D ∇ψi ψj dΩe .
ij
Ωe

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

16.7.6 Flux Matrix


Recall that the flux matrix is defined as
Z
(e,l)
F = ψi ψj n(e,l) dΓe
Γe

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

which, upon evaluating at the bounds of integration, yields

∆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 simplified to its final form


 
2 1 0 0
∆x n(e,1)  1 2 0 0 
F (e,1) =  
6  0 0 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

which we then evaluate to yield

∆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

where the normal vector here is defined as n(e,2) = 1i + 0j.


246CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E

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

which, upon evaluating at the bounds of integration, yields


∆x n(e,3)
F (e,3) = (3 + ξi ξj ) (1 + ηi ) (1 + ηj ) .
48
Substituting in the values of (ξ, η)i and (ξ, η)j yields the matrix
 
0 0 0 0
∆x n(e,3)  0 0 0 0 

F (e,3) =  0 0 2 1 
6
0 0 1 2
where the normal vector here is defined as n(e,3) = 0i + 1j.

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

which we then evaluate to yield


∆y n(e,4)
F (e,4) = (1 − ξi ) (1 − ξj ) (3 + ηi ηj ) .
48
Substituting the values for (ξ, η)i and (ξ, η)j yields the matrix
 
2 0 1 0
(e,4) 
∆y n  0 0 0 0 

F (e,4) =  1 0
6 2 0 
0 0 0 0
where the normal vector here is defined as n(e,4) = −1i + 0j.
16.7. EXAMPLE OF 2D DG FOR LINEAR ELEMENTS 247

16.7.7 Numerical Flux Function


In order to solve the weak form local matrix problem written as follows:
(e) 4 
X T  (e) T
(e) ∂qj (e,l) (∗,l) e (e)
Mij + F ij fj − D ij fj = 0
∂t l=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

(e,2) (∗,2) 1 h (e,2)  (2) (e)



(2) (e)
i
n ·f = n · f +f −|λ| q −q .
2
For j = 2, 4 we get

(e,2) (∗,2) 1 h (e,2)  (2) (e)



(e,2)

(2) (e)
i
n · f2 = n · f 1 + f 2 − | λ |2,1 q1 − q2 ,
2
(∗,2) 1 h (e,2)  (2) (e)

(e,2)

(2) (e)
i
n(e,2) · f 4 = n · f 3 + f 4 − | λ |4,3 q3 − q4 ,
2
and for j = 1, 3 we do not need to define the flux function since it will be multiplied
by rows 1 and 3 of F (e,2) which are all zero.
Substituting the values for n(e,2) and f yields

(e,2) (∗,1) 1 h (2) (e)



(e,2)

(2) (e)
i
n · f2 = (qu)1 + (qu)2 − u2,1 q1 − q2 ,
2
which, after simplifying, yields
(∗,2) (e)
n(e,2) · f 2 = (qu)2 ,

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

(e,3) (∗,3) 1 h (e,3)  (3) (e)



(3) (e)
i
n ·f = n · f +f −|λ| q −q .
2
For j = 3, 4 we get

(e,3) (∗,3) 1 h (e,3)  (3) (e)



(e,3)

(3) (e)
i
n · f3 = n · f 1 + f 3 − | λ |3,1 q1 − q3 ,
2
(∗,3) 1 h (e,3)  (3) (e)

(e,3)

(3) (e)
i
n(e,3) · f 4 = n · f 2 + f 4 − | λ |4,2 q2 − q4 ,
2
and for j = 1, 2 we do not need to define the flux function since it will be multiplied
by rows 1 and 2 of F (e,3) which are all zero.
Substituting the values for n(e,3) and f yields

(∗,3) 1 h (3) (e)



(e,3)

(3) (e)
i
n(e,3) · f 3 = (qv)1 + (qv)3 − v3,1 q1 − q3 ,
2
16.7. EXAMPLE OF 2D DG FOR LINEAR ELEMENTS 249

which, after simplifying, yields


(∗,3) (e)
n(e,3) · f 3 = (qv)3 ,

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

(e,4) (∗,4) 1 h (e,4)  (4) (e)



(e,4)

(4) (e)
i
n · f1 = n · f 2 + f 1 − | λ |1,2 q2 − q1 ,
2
(∗,4) 1 h (e,4)  (4) (e)

(e,4)

(4) (e)
i
n(e,4) · f 3 = n · f 4 + f 3 − | λ |3,4 q4 − q3 ,
2
and for j = 2, 4 we do not need to define the flux function since it will be multiplied
by rows 2 and 4 of F (e,4) which are all zero.
Substituting the values for n(e,4) and f yields

(∗,4) 1h  (4) (e)



(e,4)

(4) (e)
i
n(e,4) · f 1 = − (qu)2 + (qv)1 − u1,2 q2 − q1 ,
2
which, after simplifying, yields
(∗,4) (4)
n(e,4) · f 1 = −(qu)2 ,

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

16.8 Example of 2D Hyperbolic Equation Problem


Suppose we wish to solve the continuous first order differential equation
∂q
+ u · ∇q = 0 ∀(x, y) ∈ [−1, 1]2
∂t
where q = q(x, y, t) and u = u(x, y) with u = (u, v)T . Let the velocity field be

u(x, y) = y and v(x, y) = −x

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

q(x, y, 0) = e−[(x−xc ) ]/(2σc2 )


2 +(y−y 2
c)

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.

16.8.1 Error Norm


We define the broken normalized L2 error norm as follows
v
u PNe PMN numerical 
exact 2
u e=1 i=1 qe,i − q
L =t
2 e,i
PNe PMN exact 2 (16.9)
e=1 i=1 qe,i

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.

16.8.2 Lobatto Points


In this section, we use N th order Lobatto points for interpolation and the Lobatto
points Q = N (inexact) and Q = N + 1 (exact) for integration. Note that one could
also use Q = N Legendre points that would yield exact integration; however, since
the interpolation (Lobatto) points and the integration (Legendre) points are not co-
located, we would not obtain a diagonal mass matrix. To simplify the exposition, we
shall only explore Lobatto points in this section for both interpolation and integration.
16.8. EXAMPLE OF 2D HYPERBOLIC EQUATION PROBLEM 251

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

a) Exact Integration b) Inexact Integration


Figure 16.2: Convergence rates of DG (Lobatto Points) for the 2D hyperbolic equation
for polynomial orders N = 1, N = 2, N = 4, N = 8, and N = 16 using a total number
of gridpoints Np for a) exact integration (Q = N + 1) and b) inexact integration
(Q = N ).

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.

Computational Cost of High-Order


Let us see if high-order is indeed worthwhile to pursue. Figure 16.3 shows the com-
putational cost (wallclock time in seconds) for various polynomial orders, N . Figure
16.3 shows that for exact integration, the highest order N = 16 is far too expensive.
For exact integration, we see that N = 8 achieves an error accuracy of of 10−3 most
efficiently with N = 4 a close second. However, if we insist on more accuracy, then
we see that N = 8 easily wins. This conclusion is more obvious in the case of inexact
integration where N = 8 and N = 16 win even at accuracies near 10−2 .

16.8.3 Legendre Points


In this section, we use N th order Legendre points for interpolation and integration;
note that Q = N Legendre points yield exact integration.
Figure 16.4 shows the convergence rates for various polynomial orders, N , for
(x)
a total number of gridpoints Np where, for 2D quadrilaterals, Np = (Ne (N +
(y) (s)
1))(Ne (N + 1)), where Ne denotes the number of elements along the coordinate
direction (s). Figure 16.4 shows that the Legendre points give accuracies similar to
those for the Lobatto points with exact integration. The cost of the Legendre points
252CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E

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)

a) Exact Integration b) Inexact Integration


Figure 16.3: Convergence rates as a function of wallclock time (in seconds) of DG
(Lobatto Points) for the 2D hyperbolic equation for polynomial orders N = 1, N = 2,
N = 4, N = 8, and N = 16 using a total number of gridpoints Np for a) exact
integration (Q = N + 1) and b) inexact integration (Q = N ).

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)

a) Error versus Np b) Error versus Wallclock Time


Figure 16.4: Convergence rates of DG (Legendre Points) for the 2D hyperbolic equa-
tion for polynomial orders N = 1, N = 2, N = 4, N = 8, and N = 16 using a total
number of gridpoints Np for a) error versus number of points and b) error versus
wallclock time.

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)

Figure 16.5: Convergence rates as a function of wallclock time (in seconds) of DG


(Legendre Points) for the 2D hyperbolic equation for polynomial orders N = 1, N = 2,
N = 4, N = 8, and N = 16.
254CHAPTER 16. 2D DISCONTINUOUS GALERKIN METHODS FOR HYPERBOLIC-ELLIPTIC E

You might also like