Finite Element Methods
for Partial Differential Equations
MAC-MIGS and SMSTC
Emmanuil (Manolis) Georgoulis
Department of Mathematics
School of Mathematical and Computer Sciences
Heriot-Watt University, UK
and
Department of Mathematics
School of Mathematical and Physical Sciences
National Technical University of Athens, Greece
email: [email protected]
Jan 2023
1
Why?
Problems of Partial Differential Equations (PDEs)
are abundant in mathematical modelling
ut − ∆u = f, in Ω := (0, Tf ] × D,
∂u
α + βu = g, in (0, Tf ] × ∂D,
∂n
u(0, ·) = u0 (·), in D̄,
Challenge
Given initial/boundary conditions compute temperature over time in lecture room
2
Finding the solution...
Grand Challenge
Finding exact solutions to PDE mathematical models is almost always impossible.
3
Approximating the solution...
Classical idea (1700s–today): Finite Difference Methods
Instead, approximate the solution by imitating the equation in a discrete fashion.
Guitar string (wave equation)
d2 u(t, x) d2 u(t, x)
2
=
dt dx2
“imitate” with divided differences • • • • • •
t u(t + τ, x)
du(t, x) u(t + 2 , x) − u(t − 2 , x)
τ τ
• • • • • •
≈
dt τ u(t, x)
• • • • • •
u(t, x − h) u(t, x + h)
d2 u(t, x) u(t + τ, x) − 2u(t, x) + u(t − τ, x) • • • • • •
≈ u(t − τ, x)
dt2 τ2
• • • • • •
d2 u(t, x) u(t, x + h) − 2u(t, x) + u(t, x − h) • • • • • •
2
≈ x
dx h2
4
Approximating the solution...
Shortcomings
Classic is sufficient for ‘simple’ settings...
5
Finite Elements: a different point of view
Find approximate solution from within a prescribed
family for (a version of) the exact problem.
6
Solving on a mesh: Finite Elements
1.5
0.5
Ω 0
−0.5
T
−1
0.6
0.4
0.2
−0.2
−0.4
0.6
0.4
0.2
0
−0.2
−0.4
−0.6
Key idea
Approximate solution is simple (e.g., linear, polynomial, etc.) on each element
7
Back to the lecture theatre...
Modelling assumption: suppose symmetry along the width of the lecture theatre
10
8
Subdivision
Domain filled with 838 ‘nice’ triangles.
9
Finer subdivision
Domain with 3352 ‘nice’ triangles.
10
Finer subdivision
Around 10 million calculations per time-step, about 2 billion in total, ≤ 5sec.
11
and finer...
Domain with 12,951 triangles. About 30 billion calculations in total, ≈ 10sec.
12
Outline
Introduction, weak derivatives and elliptic PDEs in weak form (1+ week)
warm-up: finite element methods for 1D boundary value problem (1 week)
FEM for elliptic PDE problems (2 weeks)
Implementation of FEM: assembly (1 week)
parabolic problems in weak form & FEM for parabolic problems (2 weeks)
A posteriori error analysis and adaptivity (1 week)
Weak formulation of first order/hyperbolic PDEs (1- week)
Discontinuous Galerkin methods for first order PDEs (1 week)
NB: Programming may be required for parts of the assessments.
13
Level
Desirable prerequisites
some knowledge of PDE theory
some real/functional analysis
numerical methods
MAC-MIGS/SMSTC related modules
Elliptic and Parabolic PDEs (alternatively Functional Analysis)
Numerical Methods
Some references
S. Brenner & R. Scott, The Mathematical Theory of Finite Element Methods.
Springer TAM, 3rd Edition, 2010
C. Johnson, Numerical Solution of Partial Differential Equations by the Finite
Element Method. CUP, 1990.
14
Poisson Problem and the Dirichlet Principle
Poisson PDE with homog. Dirichlet b.c.:
Find u : Ω → R s. t.
Ω ∂Ω
d
−∆u = f in Ω ⊂ R ,
u = 0 on ∂Ω.
for some f : L2 (Ω) → R known function.
??? Relation to: ????
Dirichlet Principle
Find u : Ω → R with u = 0 on ∂Ω, s. t. it minimises the integral
∫ ( )
1
I(v) := |∇v|2 − fv dx
Ω 2
viz., I(u) ≤ I(v) for all v ∈ V suitable family of functions.
15
From Dirichlet Principle...
Observe that v must have some regularity and integrability:
∫ ∫ ∫ (∫ ) 12 ( ∫ ) 12
1 1
|I(v)| ≤ |∇v|2 dx + |fv| dx ≤ |∇v|2 dx + f2 dx v2 dx ,
2 Ω Ω 2 Ω Ω Ω
from the Cauchy-Schwarz inequality.
In other words, for I(v) to be bounded, it is sufficient that f, v, |∇v| to be square
integrable, viz.,
(∫ ) 12
∥v∥L2 (Ω) := v2 dx < +∞, ∥f∥L2 (Ω) < +∞,
Ω
and
(∫ ) 12 (∑
d ∫ ) 12 (∑
d ) 12
2
∥∇v∥L2 (Ω) := |∇v| dx = v2xi dx = ∥vxi ∥2L2 (Ω) < +∞
Ω i=1 Ω i=1
Key observation
All terms are under integrals: whatever happens on K ⊂ Ω of (Lebesgue-)measure
zero is irrelevant!
16
From Dirichlet Principle...
Let V be a family of suitably regular and integrable functions v, s. t.
I(v) < +∞ and v|∂Ω = 0
(We will fully define a good such family of functions in a moment.)
Suppose that there exists such a (local, perhaps,) minimiser u, i.e.,
I(u) ≤ I(u + αv)
for any such function v and any 0 ̸= α ∈ R. Then,
∫ ( ∫ )
I(u + αv) − I(u) −1 1 2 1 2
=α |∇u + α∇v| − |∇u| dx − f (u + αv − u) dx
α Ω 2 2
∫ ∫ ∫ Ω
α 2
= ∇u · ∇v dx + |∇v| dx − fv dx.
Ω 2 Ω Ω
Suppose now that the limit as α → 0 is well defined. Then, we have
∫ ∫
I(u + αv) − I(u)
0 = lim = ∇u · ∇v dx − fv dx,
α→0 α Ω Ω
since u a minimiser.
17
From Dirichlet Principle ... to the Poisson Problem!
Thus, we conclude that, assuming “things are nice w.r.t. taking limits”, we have
∫ ∫
u minimiser =⇒ ∇u · ∇v dx = fv dx ∀v ∈ V (1)
Ω Ω
Assume, now that u is more regular, .e.g., u ∈ C2 (Ω̄). Integration by parts gives
∫ ∫ ∫
− ∇ · ∇uv dx + (∇u · n)v dS = fv dx ∀v ∈ V,
Ω ∂Ω Ω
with n denoting the unit outward normal to Ω.
Noting that v|∂Ω = 0 and that ∆ = ∇ · ∇, we get
∫
(∆u + f)v dx = 0 ∀v ∈ V.
Ω
Under certain conditions on the family V, we can conclude
−∆u = f in Ω, and u=0 on ∂Ω (2)
at least “almost everywhere (a.e.)”. So, u solves the Poisson Problem!
18
... and to Function Spaces
To fully determine a suitable family V, we need some advanced concepts.
We begin with some observations:
from (1) =⇒ (2), we must require more regularity on u
u only needs to be “differentiable under integrals”
V should have continuous functions as dense subspace
Definition
Let f : Ω → R, for Ω ⊂ Rd open. The support of f, denoted by supp(f) is defined
as the smallest closed set containing {x ∈ Ω : f(x) ̸= 0}.
Example
1 + x, for −1 < x < 0;
f:R→R with f(x) = 1 − x, for 0 < x < 1; Then, supp(f) = [−1, 1]
0, otherwise,
19
Functions with compact support
A very important class of functions is the following.
Definition
Let Ω ⊂ Rd open. We denote by C∞
c (Ω) the set of infinitely dimensional functions
ϕ : Ω → R which have compacta support in Ω.
aA set K ⊂ Rd is compact if closed and bounded.
C∞
c (Ω) is a vector space with the usual addition/scalar multiplication of functions.
But, is it non-trivial, i.e., do such functions exist?
Example
{ 1
f:R→R with f(x) = e x2 −1 , for −1 < x < 1·
0, otherwise.
Then, f ∈ C∞ (R) and supp(f) = [−1, 1] ✓
20
Weak derivatives
Using the family C∞
c (Ω), we can give a definition of a concept of derivative.
Definition
Let Ω ⊂ Rd open set and f : Ω → R. A function g : Ω → R is called a weak
partial derivative of f w.r.t. the xi -variable, i = 1, . . . , d, if
∫ ∫
g(x)ϕ(x) dx = − f(x)ϕxi (x) dx < +∞,
Ω Ω
for all ϕ ∈ C∞
c (Ω). The weak xi -derivative g will be denoted as Di f.
g appears only under the integral sign!
Thus, modifying its value on (Lebesgue-)measure zero sets does not affect g.
So, strictly speaking, g is unique up to a set of (Lebesgue-)measure zero.
Since ϕ compactly supported in Ω open, ϕ|∂Ω = 0. Thus, def. of weak partial
derivative is effectively the integration by parts formula for sufficiently smooth f!
21
Weak derivatives
In fact, we have the following, easy to prove, result.
Theorem
Let Ω ⊂ Rd , d ∈ N open and f : Ω → R. If f is xi -differentiable in Ω, then its weak
xi -derivative Di f is well defined and also Di f = fxi holds almost everywhere.
In other words, weak xi -derivative is a more general concept of differentiation.
(It is also known as distributional derivative.)
So, at points where the, henceforth, termed classical derivative is well defined, the
respective weak derivative will be identical.
From now on, due to the above, we will use the usual, classical notation for partial
derivatives to denote the respective weak derivatives. All partial derivatives below
will be understood as weak derivatives, unless explicitly stated.
22
Weak derivatives
Example
1 + x, for −1 < x < 0;
Let f(x) = 1 − x, for 0 < x < 1; Not differentiable at ±1, 0.
0, otherwise,
To compute its weak derivative, let ϕ ∈ C∞
c (R). Then,
∫ −∞ ∫ 0 ∫ 1
′ ′
− f(x)ϕ (x) dx = − (1 + x)ϕ (x) dx − (1 − x)ϕ′ (x) dx
−∞ −1 0
∫ 0 ∫ 1 ∫ 0 ∫ 1
= − ϕ(0)+ ϕ(x) dx+ϕ(0)+ (−1)ϕ(x) dx = ϕ(x) dx+ (−1)ϕ(x) dx.
−1 0 −1 0
∫ −∞ ∫ −∞
This, for every ϕ ∈ C∞ ′
c (R), we have − −∞ f(x)ϕ (x) dx = −∞ g(x)ϕ(x) dx
where
1, for −1 < x < 0;
g(x) = −1, for 0 < x < 1;
0, otherwise.
23
Function Spaces: Lebesgue Spaces
Definition
Let Ω ⊂ Rd , d ∈ N open. For every p ∈ [1, ∞], we define the set
{ }
Lp (Ω) := f : Ω → R : ∥f∥Lp (Ω) < +∞ ,
(∫ ) p1
whereby ∥f∥Lp (Ω) := p
|f| (x) dx .
Ω
for p ∈ [1, ∞) and ∥f∥L∞ (Ω) := ess supx∈Ω |f(x)|, for p = ∞. These sets are called
Lebesgue spaces. In particular, for p = 2, we have the well known space L2 (Ω).
Theorem
Let Ω ⊂ Rd , d ∈ N open. The pair (Lp (Ω), ∥ · ∥Lp (Ω) ) is a Banach space for every
p ∈ [1, ∞]. Moreover, for p = 2 the pair (L2 (Ω), ∥ · ∥L2 (Ω) ) is, in fact, a Hilbert
space with inner product given by
∫
(f, g)L2 (Ω) := f(x)g(x) dx ∀f, g ∈ L2 (Ω)
Ω
24
Function Spaces: Sobolev Spaces
Definition
Let Ω ⊂ Rd , d ∈ N, open. For every p ∈ [1, ∞], and for every k ∈ N0 , we define
the Sobolev space
{ }
Wkp (Ω) := f : Ω → R : ∥Dα f∥Lp (Ω) < +∞, |α| ≤ k ,
for a multi-index α ∈ Nd0 . Note that W0p (Ω) := Lp (Ω).
For p = 2, we use the symbols Hk (Ω) := Wk2 (Ω).
Theorem
For Ω ⊂ Rd , d ∈ N open, the pair (Wkp (Ω), ∥ · ∥Wkp (Ω) ), whereby
( ∑ ) p1
∥f∥Wkp (Ω) := ∥Dα f∥pLp (Ω)
α∈Nd0
|α|≤k
is a Banach space for every p ∈ [1, ∞].
25
Function Spaces: H1 (Ω), an important case
We now discuss further the important special case for which k = 1, p = 2, i.e.,
{ }
H1 (Ω) := f : Ω → R : ∥Dα f∥L2 (Ω) < +∞, |α| ≤ 1 ,
whereby
( ∑ ) 12 ( ∑
d ) 12
∥f∥H1 (Ω) := ∥D α
f∥pLp (Ω) = ∥f∥2L2 (Ω) + ∥Di f∥2L2 (Ω)
α∈Nd0 i=1
|α|≤1
The space H1 (Ω), just like every Hk (Ω), is a Hilbert space (the symbol “H” is a
bit of a giveaway) with inner product
∫ d ∫
∑
(f, g)H1 (Ω) := f(x)g(x) dx + Di f(x)Di g(x) dx ∀f, g ∈ L2 (Ω)
Ω i=1 Ω
26
Function Spaces: H1 (Ω), an important case
We now discuss further the important special case for which k = 1, p = 2, i.e.,
{ }
H1 (Ω) := f : Ω → R : ∥Dα f∥L2 (Ω) < +∞, |α| ≤ 1 ,
whereby
( ∑ ) 12 ( ) 12
∥f∥H1 (Ω) := ∥D α
f∥pLp (Ω) = ∥f∥2L2 (Ω) + ∥∇f∥2L2 (Ω)
α∈Nd0
|α|≤1
The space H1 (Ω), just like every Hk (Ω), is a Hilbert space (the symbol “H” is a
bit of a giveaway) with inner product
∫ ∫
(f, g)H1 (Ω) := f(x)g(x) dx + ∇f(x) · ∇g(x) dx ∀f, g ∈ L2 (Ω)
Ω Ω
27
Back to Dirichlet Principle
Recall
∫ (∫ ) 12 ( ∫ ) 12
1 2 2
|I(v)| ≤ |∇v| dx + f dx v2 dx
2 Ω Ω Ω
1 2
= ∥∇v∥L2 (Ω) + ∥f∥L2 (Ω) ∥v∥L2 (Ω)
2
1 1 1 1 1
≤ ∥∇v∥2L2 (Ω) + ∥f∥2L2 (Ω) + ∥v∥2L2 (Ω) = ∥v∥2H1 (Ω) + ∥f∥2L2 (Ω) < ∞
2 2 2 2 2
if v ∈ H1 (Ω) with v|∂Ω = 0 and f ∈ L2 (Ω)!
We encode the boundary condition in the following:
H10 (Ω) := {v ∈ H1 (Ω) : v|∂Ω = 0},
However, we need be careful with the correct sense of v|∂Ω = 0; we do that in the
sense of trace.
The space H10 (Ω) is a subspace of H1 and it turns out that it is the ideal
contender for the “family V” above.
28
From Dirichlet Principle to Poisson Problem: complete picture
Dirichlet Principle
Find u ∈ V := H10 (Ω) minimising the integral
∫ ( )
1
I(v) := |∇v|2 − fv dx v∈V
Ω 2
Poisson Problem in weak form
Find u ∈ V := H10 (Ω), such that
implies
∫ ∫
∇u · ∇v dx = fv dx ∀v ∈ V
Ω Ω
“Stong form” Poisson PDE
implies Find u : Ω → R such that
−∆u = f in Ω ⊂ Rd , and u=0 on ∂Ω.
29
Existence and uniqueness of weak solutions
Poisson Problem in weak form
Find u ∈ V := H10 (Ω), such that
∫ ∫
a(u, v) := ∇u · ∇v dx = fv dx =: ℓ(v) ∀v ∈ V
Ω Ω
for the above billinear form a : V × V → R and linear functional ℓ : V → R.
30
Existence and uniqueness of weak solutions
Theorem (Lax-Milgram)
Let (V, ∥·∥V ) Hilbert space, a(·, ·) : V × V → R bilinear form, and ℓ(·) : V → R
linear functional. If the following properties hold
1 the bilinear form a(·, ·) is coercive, i.e.,
C1 ∥w∥2V ≤ a(w, w), for all w ∈ V,
2 the bilinear form is continuous, i.e.,
|a(w, v)| ≤ C2 ∥w∥V ∥v∥V , for all w, v ∈ V,
3 the linear functional ℓ· is continuous, i.e.,
|ℓ(v)| ≤ C3 ∥v∥V , for all v ∈ V,
for C1 , C2 , C3 > 0 constants, independent of w, v ∈ V, then the problem: find
u ∈ V, such that
a(u, v) = ℓ(v) for all v ∈ V,
has a unique solution u ∈ V.
31
Apply L-M to Poisson Problem in weak form...
∫ ∫
a(w, v) = ∇w · ∇v dx and ℓ(v) = fv dx.
Ω Ω
Then ∫
a(w, w) = |∇w|2 dx = ∥∇w∥2L2 (Ω) ∀w ∈ H10 (Ω)
Ω
Also, ∫
|a(w, v)| ≤ |∇w||∇v| dx ≤ ∥∇w∥L2 (Ω) ∥∇v∥L2 (Ω) ,
Ω
Finally, ∫
|ℓ(v)| ≤ |f||v| dx ≤ ∥f∥L2 (Ω) ∥v∥L2 (Ω) .
Ω
Two questions:
Is ∥∇w∥L2 (Ω) a norm on H10 (Ω)?
Relationship between ∥w∥L2 (Ω) and ∥∇w∥L2 (Ω) on H10 (Ω)?
32
Poincaré-Friedrichs inequalities
Theorem (Poincaré-Friedrichs inequalities)
Let Ω ⊂ Rd open with p/w C1 boundary ∂Ω. Then, for every w ∈ H10 (Ω) we have
the Friedrichs’ inequality
∥w∥L2 (Ω) ≤ CF ∥∇w∥L2 (Ω) ,
for CF > 0 depending only on Ω.
For every w ∈ H1 (Ω) we have the Poincaré inequality
∥w − w̄∥L2 (Ω) ≤ CP ∥∇w∥L2 (Ω) ,
∫
with w̄ := |Ω|−1 Ω
w dx.
Thus, ∥v∥L2 (Ω) ≤ C∥∇v∥L2 (Ω) , i.e., it’s a norm in H10 (Ω), and, thus
(H10 (Ω), ∥∇ · ∥L2 (Ω) ) is a Hilbert space.
So, L-M applies to the Poisson Problem in (H10 (Ω), ∥∇ · ∥L2 (Ω) ).
33