Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 72

Building Virtual Models in Engineering

An Introduction to Finite Elements


Fred Vermolen and Domenico Lahaye
Delft University of Technology
Faculty of Electrical Engineering, Mathematics and Computer Science
Delft Institute for Applied Mathematics
November 2011
ii
Preface
Preface to the 2011-2012 Edition In our scientic endeavor we stand upon the shoulder of
giants. Early version of these notes were written under the supervision of Frederique le Magnique
and the master himself, who in turn learned the trade from the nite element pioneers at the TU
Delft. We thank Niel Budko for pointing to typos in previous versions of these notes, students at
the department for their help in further developing the laboratory sessions that make integral part
of this course and acknowlegde the help of all the support sta allowing this course to be continued.
Domenico Lahaye - 2011
Preface to Earlier Editions These lecture notes are used for the course Finite Elements (WI3098LR)
for BSc-students of the department of aerospace engineering with a minor in applied mathematics,
and for students visiting the Delft University of Technology in the framework of ATHENS. For the
interested student some references are given for further reading, but note that the literature survey
is far from complete.
The notes provide an introduction into the Finite Element method applied to Partial Dierential
Equations. The treated problems are classical. The treatment of the Finite Element Method is
mathematical, but without the concept of Hilbert and Sobolev spaces, which are fundamental in
a rigorous treatment of the Finite Element Method. Recently, a more detailed and comprehensive
treatment appeared by van Kan et al. [2006], which is available from the Delft University Press.
Further, we recommend all students of this course to attend the lectures since the lecture notes
do not aim at being complete.
We wish everybody good luck with the material and the course! Further, we would like to
thank Caroline van der Lee for the beautiful typesetting of this document. Finally, we thank Fons
Daalderop and Martin van Gijzen for their critical reading of these lecture notes and valuable
suggestions to improve it.
- Alfonzo e Martino, grazie!
Fred Vermolen and Domenico Lahaye - 2008 - 2011
iv Preface
Contents
Preface iii
1 Introduction 1
1.1 Stages in a FEM Modeling Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Motivating Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Classication of Second Order Partial Dierential Equations . . . . . . . . . . . . . . 4
1.4 Model Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Mathematical Preliminaries 9
2.1 The Geometry of R
3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Calculus of Functions of a Real Variable . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Calculus of Functions of Several Variables . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 Calculus of Vector Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3 Minimization Problems and Dierential Equations 15
3.1 Function Spaces, Dierential Operators and Functionals . . . . . . . . . . . . . . . . 15
3.1.1 Function Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.2 Dierential Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.3 Functionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.4 Minimization of Functionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2 Calculus of Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3 From Functionals to Dierential Equations . . . . . . . . . . . . . . . . . . . . . . . 21
3.3.1 Distance in Flat Land . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3.2 Abstract One-Dimensional Minimization Problem . . . . . . . . . . . . . . . 23
3.3.3 Two-Dimensional Self-Adjoint Problem . . . . . . . . . . . . . . . . . . . . . 26
3.4 From Dierential Equation to Minimization Problem . . . . . . . . . . . . . . . . . . 27
4 Variational Formulation and Dierential Equations 29
4.1 Weak forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 Which weak formulation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Mathematical considerations:existence and uniqueness . . . . . . . . . . . . . . . . . 34
vi CONTENTS
5 Galerkins Finite Element Method 37
5.1 The principle of Galerkins method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.2 Motivation of piecewise linear basis-functions . . . . . . . . . . . . . . . . . . . . . . 40
5.3 Evaluation of a one-dimensional example . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.4 Ritz method of nite elements by a simple example . . . . . . . . . . . . . . . . . . 44
5.5 The treatment of a non-homogeneous Dirichlet boundary conditions . . . . . . . . . 45
5.6 A time-dependent example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.7 The principle of element matrices and vectors . . . . . . . . . . . . . . . . . . . . . . 48
5.8 Numerical integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.9 Error considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6 Time Dependent Problems: Numerical Methods 55
6.1 Time-integration methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2 Accuracy of time-integration methods . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.3 Time-integration of PDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
6.3.1 The heat equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.3.2 The wave equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.4 Stability analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Bibliography 65
1
Introduction
In this chapter we aim at
describing ve stages that are typical in the application of a nite element method (FEM)
modeling procedure for solving engineering problems;
giving examples of how FEM is applied in the modeling of industrial furnaces and electrical
energy applications;
giving a list of so-called model problems that will be used in the remainder of this courses.
1.1 Stages in a FEM Modeling Procedure
Figure 1.1 shows ve dierent stages in the nite element method (FEM) modeling of the mechanical
deformation of a microchip caused by the Ohmic heat generated by an electrical current. The
following ve stages can be distinguished:
in Stage 1 a geometry model of the device under consideration is build. For this purpose a
computer aided design (CAD) software package is typically used;
in Stage 2 the governing physical processes are described in term of appropriate partial
dierential equations supplied with initial and boundary conditions. In the modeling of elec-
trical energy applications for instances, the Maxwell equations for the electric and magnetic
eld play a central role;
in Stage 3 the geometry is subdivided into small entities called elements. Dierent types of
mesh generation and mesh renement techniques exist. General references on this stage are
Farrashkhalvat and Miles [2003]; Frey and George [2000]; Liseikin [2010] (mesh generation)
and Ainsworth and Oden [2000] (adaptive renement). Mesh generation techniques are being
taught at the TU Delft as part of the Elements of Computational Fluid Dynamics course
(WI4011).
2 Introduction
in Stage 4 the governing partial dierential equations are discretized in space and time, a
time-stepping procedure is applied to the resulting system of ordinary dierential equations
and the emerging (non-)linear systems of equations are solved. General references on this
stage are Braess [1996]; Eriksson et al. [1996]; Morton and Mayers [1994]; Quarteroni and
Valli [1994]; Zienkiewics and Taylor [2000a,b] (general nite elements), Ascher and Petzold
[1998] (time-stepping methods), Dennis Jr. and Schnabel [1996]; Kelley [1995] (non-linear
system solvers) and Saad [1996]; Smith et al. [1996]; Trottenberg et al. [2001] (linear system
solvers). Reference to the mathematical theory underlying the nite element method are
for instance Brenner and Scott [2008]; Kreyszig [1989]; Atkinson and Han [2005]. Linear
system solvers are being at the TU Delft in the course Scientic Computing (WI4210). TU
Delft monographs on ordinary dierential equation and on the numerical treatment of partial
dierential equations are Vuik et al. [2007] and van Kan et al. [2006], respectively.
in Stage 5 the solution of the partial dierential equations and derived quantities are visu-
alized on the mesh employed for discretization in space and time.
These ve stages are typical in any FEM modeling procedure. Although the other stages are not
trivial and object of active research, this course mainly focussed on Stage 2 and Stage 4.
Figure 1.1: Stages in a FEM Modeling Procedure.
1.2 Motivating Examples
Industrial Furnace The simulation of ows through an enclosed surface is an often reoccuring
problem in computational uid dynamics. In Figure 1.2 a study case of the simulation of the ow
and temperature prole inside an industrial furnace is presented.
Fault current limiters Fault current limiters are expected to play an important role in the pro-
tection of future power grids. They are capable of preventing fault currents from reaching too high
1.2 Motivating Examples 3
(a) Schematic represention of an industrial furnace
(b) Mesh employed (c) Simulated temperature prole.
Figure 1.2: Numerical simulation of industrial furnaces.
levels and, therefore enhance the life time expectancy all power system components. Figure 1.3
shows two examples of fault-current limiters along with some nite element simulation results.


(a) Open core congu-
ration
A
C

w
i
n
d
i
n
g

A
C

w
i
n
d
i
n
g

D
C

w
i
n
d
i
n
g

D
C

w
i
n
d
i
n
g


(b) Three legged conguration
(c) Diusion coecient (d) Current with and without limiter
Figure 1.3: Numerical simulation of fault current limiters.
4 Introduction
1.3 Classication of Second Order Partial Differential Equations
In this section we classify second order linear partial dierential equations (PDEs) with constant
coecients according to their elliptic, parabolic and hyperbolic nature and give examples of PDEs
in each of these three classes.
Classication We consider an open two-dimensional domain (x, y) R
2
with boundary
= as the domain of the second order linear partial dierential equation (PDE) for the
unknown eld u = u(x, y) and the source function f(x, y) that can be written as
/(u) = f on (1.1)
where the operator / has constant coecients a
ij
, b
i
and c
/(u) = a
11

2
u(x, y)
x
2
+ 2a
12

2
u(x, y)
xy
+ a
22

2
u(x, y)
y
2
+ b
1
u(x, y)
x
+ b
2
u(x, y)
y
+ c u(x, y) . (1.2)
We classify these equation based on the sign of the determinant
D =

a
11
a
12
a
12
a
22

= a
11
a
22
a
2
12
. (1.3)
The dierential operator / is called
elliptic if D > 0
parabolic if D = 0
hyperbolic if D < 0
Prototypes in this classication are the elliptic Laplace equation u
xx
+ u
yy
= 0, parabolic heat
equation u
xx
u
y
= 0 and the hyperbolic wave equation u
xx
u
yy
= 0. In the case of xy-varying
coecients a
11
, a
22
and a
12
, the sign of D and therefore the type of the PDE may change with the
location in .
As FEM solvers for discretized hyperbolic PDEs are far less developed, we will only consider
elliptic and parabolic equations in this course. Elliptic equations are characterized by the fact
that changes in the data imposed on the boundary are felt instantaneously in the interior of .
Parabolic equations model the evolution of a system from initial to an stationary (time-independent)
equilibrium state.
Examples of Elliptic Partial Differential Equations We will consider the Poisson equation
u :=

2
u(x, y)
x
2


2
u(x, y)
y
2
= f (1.4)
as it plays a central role in engineering applications in which the eld u solved for plays the
role of a (electric, magnetic or gravitational) potential, temperature or displacement. The reason
for the minus sign in front of the Laplacian will be discussed together with the nite element
1.3 Classication of Second Order Partial Differential Equations 5
discretization. We will also consider two variants of (1.4). In the rst variant we introduce a small
positive parameter 0 < 1 to arrive at the anisotropic variant

2
u(x, y)
x
2


2
u(x, y)
y
2
= f (1.5)
that can be thought of as a simplied model to study the eect of local mesh renement required
to capture e.g. boundary layers or small geometrical details (such as for instance the air-gap in an
electrical machine). In the second variant we again incorporate more physical realism in (1.4) by
allowing the parameter c in


x
_
c
u(x, y)
x
_


y
_
c
u(x, y)
y
_
= f , (1.6)
to have a jump-discontinuity across the boundary of two subdomains (such as for instance the jump
in electrical conductivity across the interface between copper and air).
The Helmholtz and the convection-diusion equation are other examples of elliptic partial dif-
ferential equations. The former can be written as
u k
2
u =

2
u(x, y)
x
2


2
u(x, y)
y
2
k
2
u = f , (1.7)
and models the propagation of an acoustical or electromagnetic wave with wave number k. The
latter is a simplied model for the study of a ow with (dimensionless) velocity v = (1, 0) around
a body and can be written as
u +v u =

2
u(x, y)
x
2

2
u(x, y)
y
2
+
u(x, y)
x
= f , (1.8)
where is the inverse of the Peclet number (which plays the same role as the Reynolds number
in the Navier-Stokes equations). The verication that the equations introduced above are indeed
elliptic is left as an exercise.
The classication given above can be extended to systems of coupled partial dierential equa-
tions. The vector-valued double curl equation for example relates the vector potential U(x, y, z) =
(U
1
(x, y, z), U
2
(x, y, z), U
3
(x, y, z)) with the excitation vector eld F(x, y, z) and can be written as
(U) = F(x, y, z) , (1.9)
where as in (1.6) represents a material parameter. This model can be derived from the Maxwell
equations and plays a central role in the nite element modeling of electrical machines, wind turbines
and power transformers. In this setting F and U play the role of the applied current density and
the magnetic vector potential, respectively.
In order to guarantee uniqueness of the solution of the above elliptic partial dierential equa-
tions, appropriate (Dirichlet, Neumann or other) boundary conditions on = need to be
supplied.
Example of a Parabolic Partial Differential Equation In order to give examples of parabolic
partial dierential equations, we change the notation y into t and consider to be a rectangle
(x, t) = [0, L] [0, T]. The parabolic dierential equation with source term f(x, t)
u(x, t)
t
=

2
u(x, t)
x
2
+ f(x, t) (1.10)
6 Introduction
models the diusion of the quantity u(x, t) in time that reaches a time-independent equilibrium
state when
u(x,t)
t
is zero. All of the elliptic models introduced above can be extended to a parabolic
model by adding the allowing u to become time-dependent, that is u = u(x, y, t), and adding the
term
u(x,t)
t
. These models will be considered for instance when discussing the role of initial vectors
of iterative solution methods.
In order to guarantee uniqueness of the solution of parabolic partial dierential equations, both
boundary and initial conditions need to be supplied.
1.4 Model Problems
In this section we dene a sequence of model problems for future reference.
Elliptic Problem Problems
given the domain x = (a, b) R, given a positive diusion coecient c(x) > 0,
x (a, b), and given the boundary data g(x) or h(x), solve for u(x) the following ordi-
nary dierential equation

d
2
u(x)
dx
2
= f(x) on (1.11)
or

d
dx
_
c(x)
du(x)
dx
_
= f(x) on (1.12)
supplied with either Dirichlet boundary conditions
u(x) = g(x) on x = a and/or x = b (1.13)
or Neumann boundary conditions
d u(x)
dx
= h(x) on on x = a and/or x = b . (1.14)
In case that g(x) = 0 in (1.13) (h(x) = 0 in (1.14)) the Dirichlet (Neumann) boundary
conditions is called homogeneous.
given an open and bounded domain (x, y) R
2
with bounded by a close curve =
that can be subdivided as =
D

N
and has outward normal n, given a positive diusion
coecient c(x, y) > 0, (x, y) , and given the boundary data g(x, y) or h(x, y), solve for
u(x, y) the following partial dierential equation
u :=

2
u(x, y)
x
2


2
u(x, y)
y
2
= f(x, y) on , (1.15)
or


x
_
c(x, y)
u(x, y)
x
_


y
_
c(x, y)
u(x, y)
y
_
= f(x, y) on , (1.16)
supplied with either Dirichlet boundary conditions
u(x, y) = g(x, y) on
D
(1.17)
or Neumann boundary conditions
u(x, y)
n
= u(x, y) n = h(x, y) on
N
. (1.18)
1.4 Model Problems 7
given an open and bounded domain (x, y, z) R
3
bounded by a closed surface S =
that can be subdivided into S = S
S
S
N
and has outward normal n, given a positive coecient
(x, y, z) > 0, (x, y, z) , given a source function F(x, y, z) and given the boundary data
G(x, y, z) or H(x, y, z), solve for U(x, y, z) the following partial dierential
(U) = F(x, y, z) , (1.19)
supplied with either Dirichlet boundary conditions
U(x, y, z) = G(x, y, z) on S
D
, (1.20)
or conditions on the tangential derivatives of U
(U) n = G(x, y, z) on S
N
. (1.21)
Parabolic Model Problems
given the domain x = (a, b) R and the time time interval t [0, T], given a positive
diusion coecient c(x) > 0, x (a, b), given initial conditions u
0
(x) = u(x, t = 0) and given
the boundary data g(x) or h(x), solve for u(x, t) the following partial dierential equation
u(x, t)
t
=

x
_
c(x)
u(x, t)
x
_
+ f(x) on [0, T] (1.22)
supplied with either Dirichlet boundary conditions
u(x, t) = g(x) on x = a and/or x = b t [0, T] (1.23)
or Neumann boundary conditions
u(x, t)
x
= h(x) on on x = a and/or x = b t [0, T] (1.24)
and the initial condition
u(x, t = 0) = u
0
(x) x . (1.25)
8 Introduction
2
Mathematical Preliminaries
The goals and motivations of this chapter are to
generalize the concept of a primitive of a scalar function in a single real variable to vector-
valued functions resulting in the concept of a (scalar or vector) potential;
generalize the integration by parts formula for integrals of scalar functions to integrals of
vector-valued functions allowing to cast the strong form of a partial dierential equation
problem into its weak (or variational) form;
give the fundamental lemma of variational calculus as allowing to demonstrate the equivalence
of the strong and weak form of a partial dierential equation problem.
We refer to Stuart for details.
2.1 The Geometry of R
3
We denote a point in the three-dimensional Euclidean space R
3
by x = (x, y, z). We denote a
vector u in R
3
either by its components (u
1
, u
2
, u
3
) or by the (vectorial) sum of the components
times the respective unit vectors in x, y and z-direction, .i.e, u = u
1
i + u
2
j + u
3
k.
Inner product and norm We denote the inner product (or scalar product) of two vectors u =
(u
1
, u
2
, u
3
) and v = (v
1
, v
2
, v
3
) in R
3
by u v. The result of this product is a number (or scalar)
dened as
u v = u
1
v
1
+ u
2
v
2
+ u
3
v
3
. (2.1)
The norm of the vector u denoted as |u| is dened as
|u| =

u u =

u
1
u
1
+ u
2
u
2
+ u
3
u
3
. (2.2)
10 Mathematical Preliminaries
Outer product We denote the outer product (or vector product) of two vectors u = (u
1
, u
2
, u
3
)
and v = (v
1
, v
2
, v
3
) in R
3
by u v. The result of this product is a vector dened as
u v =

i j k
u
1
u
2
u
3
v
1
v
2
v
3

= [u
2
v
3
u
3
v
2
] i [u
1
v
3
u
3
v
1
] j + [u
1
v
2
u
2
v
1
] k. (2.3)
The triple product of three vectors u, v and w is dened as (u v) w and satises
(u v) w = u (v w) (2.4)
2.2 Calculus of Functions of a Real Variable
Assume f(x) to be a scalar function in a single real variable x. A point x
0
in the domain of f such
that
d f
dx
(x = x
0
) = f

(x
0
) = 0 is called a critical point of f(x). The function f(x) attains its (local)
minima and maxima in its rst order critical points (though not all rst order critical points are
minima or maxima of f(x)). The Fundamental theorem of Calculus states that, given a function
f(x) in a single real variables with primitive F(x), the integral
_
b
a
f(x) dx can be computed as
_
b
a
f(x) dx = F(b) F(a) . (2.5)
The following integration by parts formula holds
_
b
a
f(x) g

(x) dx = [f(x)g(x)]
b
a

_
b
a
f

(x) g(x) dx. (2.6)


2.3 Calculus of Functions of Several Variables
Assume u(x) = u(x, y, z) to be be a function on R
3
, i.e., u(x) : R
3
R. Assume furthermore x
0
to be point in the domain of u(x) and s a unit vector, respectively.
Directional Derivative The derivative of u(x) in the direction s in the point x
0
is denoted as
D
s
u(x
0
) and dened as
D
s
u(x
0
) = lim
0
u(x
0
+ s) u(x
0
)

=
d
d
[u(x
0
+ s)] [
=0
. (2.7)
This derivative gives the rate of change u(x) = u(x, y, z) in the direction of s at the point x
0
.
Gradient The gradient of u denoted as grad u = u is vector function that is dened as
u =
_
u
x
,
u
y
,
u
z
_
=
u
x
i +
u
y
j +
u
z
k = u
x
i + u
y
j + u
z
k. (2.8)
The gradient of u is allows to compute the directional derivative of u in the direction of s. We indeed
have that D
s
u(x
0
) = u(x
0
) s. This identity will be useful in formulating necessary conditions for
rst order critical points of u(x). In a physical context and in case that u is e.g. the temperature,
u is proportional to the heat ux.
2.4 Calculus of Vector Functions 11
First Order Critical Points The point x
0
is a rst order critical point of u(x
0
) i u(x
0
) =
0 in R
3
. The latter condition can be stated equivalently as
d
d
[u(x
0
+ s)] [
=0
= 0 ( in R) s R
3
with |s| = 1 . (2.9)
This condition will be allow to dene rst order critical point of functionals on innite dimensional
vector spaces in the next chapter.
2.4 Calculus of Vector Functions
Assume F(x) = (F
1
(x), F
2
(x), F
3
(x)) to be a vector function on R
3
, i.e., F(x) : R
3
R
3
.
Divergence and curl The divergence of F denoted as div F = F is a scalar function that is
dened as
F =
F
1
x
+
F
2
y
+
F
3
z
. (2.10)
The curl (or rotation) of F denoted as curl F = F is a vector function that is dened as
F =
_
_
_
F
3
y

F
2
z

F
3
x
+
F
1
z
F
2
x

F
1
y
_
_
_
=
_
F
3
y

F
2
z
_
i
_
F
3
x

F
1
z
_
j +
_
F
2
x

F
1
y
_
k. (2.11)
The divergence of the vector eld F evaluated at a particular point x is the extent to which the
vector eld behaves like a source or a sink at a given point. If the divergence is nonzero at some
point then there must be a source or sink at that position. The curl of a vector eld F describes
an innitesimal rotation of F.
Example 2.4.1. Insert examples as in previous version of the ATHENS notes here.
Example 2.4.2. Assume c(x) and u(x) to be two scalar functions. Then c u is a vector function
whose divergence is equal to
(c u) =

x
_
c
u
x
_
+

y
_
c
u
y
_
+

z
_
c
u
z
_
. (2.12)
If in particular c = 1 (i.e. c(x) = 1 for all x), then
u = =

2
u
x
2
+

2
u
y
2
+

2
u
z
2
, (2.13)
where u denotes the Laplacian of u. This dierential operator is generalized to vector-valued
functions F(x) by the double-curl operator as (cF).
Proposition 2.4.1. From the above denitions immediately follows that for any scalar function u
and for any vector function F that
(u) = 0 (in R
3
) (2.14)
(F) = 0 (in R) . (2.15)
We will see below that scalar functions u that satisfy u = 0 and vector functions F that satisfy
F = 0 play a special role as they generalize the notion of a constant function f(x) for which
f

(x) = 0.
12 Mathematical Preliminaries
Proposition 2.4.2. Let c, u and v be scalar functions and let F, G and U be vector functions.
By applying the product rule for dierentiation, the following properties can be derived
(vF) = v F +v F (2.16)
(F G) = (F) G+ (G) F. (2.17)
Setting in the former equality F = c (u), yields
[(c u)v] = [ (c u)] v + c u v . (2.18)
while putting in the latter equality F = c (U), yields
[c (U) G] = [(cU)] G+ (G) (cU) . (2.19)
Flux and rst integration theorem Assume S to be an oriented surface in R
3
with unit outward
normal n. We will denote by S the surface that coincides with S and has opposite orientation.
The normal derivative on S of the function u denoted as u
n
is dened as u
n
= u n. The ux of
F through S denoted as is dened as the surface integral
=
_
S
F dS =
_
S
F ndS . (2.20)
Assume the surface S to be closed and enclosing a volume V . We make this relation explicit by
writing S = S(V ). The Gauss integration theorem states that
_
S(V )
F dS =
_
V
FdV . (2.21)
Proposition 2.4.3. Assume as in Proposition 2.4.2 c, u and v to be scalar functions and F, G
and U to be vector functions. Applying Gauss Theorem to the vector function v F and using (2.16)
to expand the right-hand side yields
_
S(V )
Fv dS =
_
V
[Fv] dV =
_
V
v FdV +
_
V
v FdV . (2.22)
Setting F = c (u) yields
_
S(V )
[c (u)] v dS =
_
V
v [c (u)] dV +
_
V
v [c (u)] dV . (2.23)
Using the notation u
n
= u n for the normal derivative, one can write the integrand in the left-
hand side as [c (u)] v dS = [c (u)] v ndS = c u
n
v dS. After rearranging terms, we obtain the
following integration by parts formula
_
V
[ (c u)] v dV =
_
S(V )
c u
n
v dS
_
V
c u v dV . (2.24)
Applying Gauss Theorem to the vector function F G and using (2.17) to expand the right-hand
side yields
_
S(V )
F G dS =
_
V
(F G) dV =
_
V
(F) GdV +
_
V
(G) FdV . (2.25)
2.4 Calculus of Vector Functions 13
We use the identify (2.4) to rewrite the integrand in the left-hand side as FGdS = (FG)ndS =
F (Gn) dS. Setting F = c (U) and rearranging terms then yields
_
V
[(c U)] GdV =
_
S(V )
c (U) (Gn) dS
_
V
(c U) (G) dV . (2.26)
In subsequent chapters, we will extensively use a two-dimensional variant of (2.24) in which
an oriented surface with outward normal n in R
2
(that later we will later call a computational
domain) is bounded by a boundary = . In this case we the following integration by parts
formula
_

[ (c u)] v d =
_
()
c u
n
v d
_

c u v d, (2.27)
Divergence-Free Vector Fields and Existence of Vector Potentials A vector function F is
called divergence-free (or solenoidal) on R
3
if and only if F(x) = 0 (in R) for all x .
Unless stated dierently, we will call in these notes a vector function F divergence-free if and only
if it is divergence-free on = R
3
.
Gauss theorem implies that the ux of a divergence-free vector eld through a closed surface
S is zero. Decomposing S as S = S
+
+ (S

), the ux of a divergence-free F through S


+
and
S

can then be seen to be equal. Given that S was chosen arbitrarily, the ux of a divergence-free
vector in surface independent. This surface-independent property allows in turn to demonstrate
that for divergence-free vector elds a vector potential A must exist such that
F = A , (2.28)
or component-wise
F
1
=
_
A
3
y

A
2
z
_
, F
2
=
_

A
3
x
+
A
1
z
_
and F
3
=
_
A
2
x

A
1
y
_
. (2.29)
Circulation and second integration theorem Assume to be a closed oriented curve in R
3
with unit tangential vector t. We will denote by the curve that coincides with and has
opposite orientation. The tangential derivative along of the function u denoted as u
t
is dened
as u
t
= u t. The circulation of F along denoted as ( is dened as the line integral
( =
_

F d =
_

F t d. (2.30)
Assume that the curve encloses a surface S and that this relation in written as (S). The Stokes
integration theorem states that
_
(S)
F d =
_
S
(F) dS. (2.31)
Curl-Free Vector Fields and Existence of Scalar Potentials A vector function F is called curl-
free (or irrotational) on R
3
if and only if F(x) = 0(in R
3
) for all x . Unless stated
dierently, we will call in these notes a vector function F curl-free if and only if it is curl-free on
= R
3
.
14 Mathematical Preliminaries
Stokes theorem implies that the circulation of a curl-free vector eld along a closed curve is
zero. Decomposing as =
+
+ (

), the line integral of a divergence-free F along


+
and

can then be seen to be equal. Given that was chosen arbitrarily, the circulation of a curl-free
vector is path independent. This path-independent property allows in turn to demonstrate that for
curl-free vector elds a scalar potential u must exist such that
F = u , (2.32)
or component-wise
F
1
=
u
x
, F
2
=
u
y
and F
3
=
u
z
. (2.33)
3
Minimization Problems and Differential
Equations
A physical system evolves in such a way to minimize their internal energy. Newtons apple falls due
to gravitation. The thermal or magnetic ux passes by preference through regions of high (thermal
or magnetic) conductivity. Partial dierential equations are derived from this principle. Instead
of solving the dierential problem directly it might therefore be more advantegeous to consider an
equivalent energy minimization problem. In this chapter we put the equivalence between partial
dierential equations and minimization problems in a more formal setting as it will serve as a tool
to explain FEM to solve the former. In this chapter we aim at
[1] give the fundamental lemma of variational calculus known as du Bois-Reymonds lemma;
[2] derive the Euler-Lagrange equation whose solution describes a stationary point for a func-
tional to be minimized;
[3] use the above two ingredients to show how partial dierential equations can be derived from
a minimization problem;
[4] show under which conditions a partial dierential dierential can be derived from a mini-
mization problem.
3.1 Function Spaces, Differential Operators and Functionals
In this section we introduce ingredients allowing to describe minimization problems formally. We
seek to describe that the orbit that the falling apple describes is an orbit that minimizes its energy.
3.1.1 Function Spaces
In the following we will denote as open and bounded domain in R, R
2
or R
3
that we will refer
to as the computational domain. As is open, it does not contain its boundary. The union of
16 Minimization Problems and Differential Equations
and its boundary is called the closure of and denoted as .
We recall that a space V is a vector space i V is closed for linear combinations, i c
1
, c
2
R
and v
1
, v
2
V implies that c
1
v
1
+ c
2
v
2
V .
Denition 3.1.1. (Function space) Given an open and bounded domain (in R, R
2
or R
3
), a
function space V () is a vector space of functions (in one, two or three variables) on that satisfy
some smoothness requirements and possibly boundary conditions.
The set V () is e.g. the set of all imaginable orbits of the Newtons apple. We impose sucient
smoothness conditions to allow to take derivatives of elements in V (). If additionally boundary
conditions are imposed, elements V () can be viewed as solutions of a partial dierential equation
supplied with boundary conditions. More formally, we can give the following examples:
Example 3.1.1. (One-Dimensional Domain) Given the open interval = (a, b) R, we will
denote by L
2
() the set of square integrable functions on , i.e., u L
2
() i
_
b
a
u
2
(x) dx < and
by H
1
() the set of square integrable function with square integrable rst derivative, i.e, u H
1
()
i
_
b
a
u
2
(x) dx < and
_
b
a
_
du
dx
_
2
dx < . Clearly H
1
() L
2
(). We will denote by ( () the
function that are continuous on . If u ( (), than u is bounded (as continuous function function
on a compact set) and therefore square integrable, i.e., ( () L
2
(). We will denote by (
1
() and
(
2
() the functions u(x) with a continuous rst derivative u

(x) and continuous second derivative


u

(x) on , respectively.
Assume that x
0
(a, b) and > 0 such that both x

= x
0
(a, b) and x

= x
0
+
(a, b). We dene the functions v
1
(x), v
2
(x) and v
3
(x) as piecewise constant, linear and quadratic
polynomials follows
v
1
(x) =
_
0 if [x x

[ >
1 if [x x

[
(3.1)
v
2
(x) =
_

_
0 if [x x

[ >
(x x

)/(x
0
x

) if x

x x
0
(x

x)/(x

x
0
) if x
0
x x

(3.2)
v
3
(x) =
_

_
0 if [x x

[ >
(x x

)
2
/(x
0
x

)
2
if x

x x
0
(x

x)
2
/(x

x
0
)
2
if x
0
x x

(3.3)
Then v
1
(x) has a jump discontinuity in both x = x

and x = x

, and therefore v
1
(x) / ( ().
The function v
2
(x) is continuous, but its derivative has a jump discontinuity in x = x

, x = x
0
and x = x

, and therefore v
2
(x) ( () (
1
(). The function v
3
(x) is continuous and has a
continuous rst derivative, but its second derivative has a jump discontinuity in x = x

, x = x
0
and x = x

, and therefore v
3
(x) (
1
() (
2
(). The function v
2
(x) is informly referred to as the
hat-function, and will play a central role in the application of the FEM method.
We denote the subset (
0
() = u ( () [ u(a) = 0 = u(b) of functions satisfying homoge-
neous Dirichlet boundary conditions. The space (
1
0
() and (
2
0
() are dened similarly.
Example 3.1.2. (Two-Dimensional Domain) In problems on two-dimensional domain, we will
denote by R
2
an open and bounded domain with boundary = that can be partioned into
distinct parts
D
and
N
, i.e., =
D

N
. We associate with
D
and
N
that part of the boundary
on which (possibly non-homogeneous) Dirichlet and Neumann (or Robin) boundary conditions are
3.1 Function Spaces, Differential Operators and Functionals 17
imposed, respectively. We will denote by (
1
() the functions u(x, y) with a continuous rst order
partial derivatives u
x
and u
y
. We will denote the subset (
1
0
() =
_
u (
1
() [ u
|
D
= 0
_
.
Treatment of boundary conditions The presence of the Neumann boundary conditions is not
reected in the above denition of (
1
0
(). The condition u
|
D
= 0 is imposed even in case of
non-homogenous Dirichlet boundary conditions. Only with the latter condition the above function
spaces are vector space (closed for linear combinations) of innite dimensions. These vector spaces
can be endowed with a inner-product, thus becoming therefore Hilbert spaces.
3.1.2 Differential Operators
Assume that / is a second order dierential operator acting on elements of V () and let u = 0,
i.e., u(x) = 0 x , denote the zero element of V (). It is obvious that /u = 0. This trivial
situation is excluded in the following denition.
Denition 3.1.2. (Positivity) The dierential operatore / is positive on V () i
_

v (/v) d > 0 v V () 0 . (3.4)


Observe that in the above denition the boundary conditions are taken into account by incor-
porating in the denition of V () and requiring that v V ().
Example 3.1.3. The dierential operator /v =
d
2
v
dx
2
= v

(x) is positive on (
1
0
((a, b)). Indeed,
using integration by parts and the homogeneous Dirichtlet boundary conditions we have that
_

v (/v) d =
_
b
a
v(x) v

(x) dx =
_
v(x) v

(x)

b
a
. .
=0
+
_
b
a
v

(x) v

(x) dx > 0 . (3.5)


Example 3.1.4. Given on open and bounded subset R
2
and the coecient c(x) > 0 x ,
the dierential operator /v = (cv) is positive on (
1
0
().
Denition 3.1.3. (Self-adjointness) The dierential operator / is called self-adjoint (or sym-
metric) on V () i
_

v (/u) d =
_

u(/v) d u, v V () . (3.6)
Example 3.1.5. The dierential operator /v =
d
2
v
dx
2
is self-adjoint on (
1
0
((a, b)). This can be
seen by integrating by parts twice and using the homogeneous boundary conditions.
Example 3.1.6. Given an open and bounded subset R
2
and the coecient c(x) > 0 x ,
the dierential operator /v = (cv) is self-adjoint on (
1
0
().
3.1.3 Functionals
Denition 3.1.4. (Functional) Given a function space V (), a functional L is a mapping from
V () onto R, i.e., L : V () R.
18 Minimization Problems and Differential Equations
If u V () is an orbits of Newtons apple, then L(u) can for instance represent the length of
the orbit. If u V () is a temperature distribution in a region, then can for instance represent
the average of the temperature. In the modeling of electrical machines the function u typically
represents the (scalar or vector) magnetic potential and the force, torque, resistive heat and eddy
current are examples of functionals in u. More formal examples are given below.
Example 3.1.7. (Distance in Flat Land) Let V () be the set of dierentiable functions on the
open interval (a, b) supplied with the additional conditions that u(x = a) = u
a
and u(x = b) = u
b
.
The graph of each element of V () is a path between the points (a, u
a
) and (b, u
b
) in R
2
. The length
L(u) of each of these path can be computed by the line integral
L(u) =
_
ds (3.7)
where, given that dy = u

(x) dx,
ds
2
= dx
2
+ dy
2
=
_
1 + u

(x)
2

dx
2
ds =
_
1 + u

(x)
2
dx, (3.8)
and therefore
L(u) =
_
b
a
_
1 + u

(x)
2
dx. (3.9)
Example 3.1.8. (Mass-Spring System) Let V () be the set of dierentiable functions on the
open interval (a, b) describing the motion of a point (apple) with mass m vertically attached to a
wall with a spring constant k (the independent variable x (a, b) thus denotes time here). The
instantaneous energy E [u(x)] of the mass is the sum of the kinetic and potential energy T [u(x)] =
1
/2 mu

(x)
2
and V [u(x)] =
1
/2 k u(x)
2
, i.e, E [u(x)] = T [u(x)] V [u(x)]. The total energy is the
functional L(u) dened on V () as
L(u) =
_
b
a
_
T [u(x)] V [u(x)]

dx =
_
b
a
_
1
/2 mu

(x)
2

1
/2 k u(x)
2

dx. (3.10)
Example 3.1.9. (Abstract One-Dimensional Example) The previous example can be put in
a more abstract setting by allowing f(x, u, u

) to be a function in three variables mapping from


(a, b) V () V () to R with suciently smooth partial derivatives. Given such a function f, we
dene the functional on V () as
L(u) =
_
b
a
f(x, u, u

) dx. (3.11)
In the next example we establish the link we dierential equations. In this example the function
f represents the source term in the dierential equation, the current in the modeling of fault-current
limiter or the burner in the industrial furnace example. The function c and h will turn out later to
be the diusion coecient and the non-homogeneous term in the Neumann boundary conditions,
respectively.
Example 3.1.10. (Two-Dimensional Self-Adjoint Dierential Equation) Given R
2
an
open and bounded two-dimensional domain with boundary =
D

N
, given c a positive function
3.1 Function Spaces, Differential Operators and Functionals 19
Figure 3.1: A smooth curve in R
2
that connects the points (a, u
a
) and (b, u
b
)
20 Minimization Problems and Differential Equations
on , given f a continuous function on and given h a function on
N
, a functional on C
1
()
can be dened by
L(u) =
_

_
1
/2 u (cu) fu
_
d +
_

N
h(x, y) ud. (3.12)
In turns out in the last example L is linear and bounded (and therefore continuous).
3.1.4 Minimization of Functionals
In this subsection we seek to minimize functionals over the corresponding function space, i.e., to
nd arguments u V () that minimize L or
nd u V () such that L( u) L(u) u V () . (3.13)
Solving this problem is generally hard, if not impossible at all. Local and global minimizers might
be hard to distinguish and the global optimum might be non-unique. We therefore aim towards the
less ambitious goal of seeking rst order critical points of L. These points are dened for functionals
in the same way as for functions in several variables. The point u is a rst order critical point of
L i the directional derivative of L in u is zero in all possible directions.
For the denition of rst order critical point to have sense, it is important that the space
of possible directions used in the denition forms a vector space, i.e., that this space is closed
for linear combinations. This requires the proper treatment of the non-homogeneous Dirichlet
boundary conditions. Indeed, any linear combination of two functions u
1
and u
2
satisfying the non-
homogeneous Dirichlet boundary conditions no longer satises them. This motivates the following
denition of the subspace V
0
() of V ()
V
0
() = v V ()[v[

D
= 0 . (3.14)
In case that non-homogeneous Dirichlet boundary conditions are imposed the space V
0
() forms a
vector space, while V () does not.
The problem of nding (local) minimizers of L now reduces to
nd u V () such that
d
d
_
L( u + v)

[
=0
= 0 v V
0
() . (3.15)
Note that u and v not necessarily belong to the same space. We will refer to V
0
() as the space
of test functions. Only if L is convex, there is only one critical point that coincides in the global
minimizer of L.
3.2 Calculus of Variations
For future reference we recall here a classical result from variational calculus, which we will refer
to as the du Bois-Reymond Lemma (after Paul David Gustav du Bois-Reymond (Germany, 1831 -
1889) (details can be found in e.g. the monographs van Kan et al. [2006]; Strang and Fix [1973]).
Lemma 3.2.1. (One-dimensional du Bois-Reymonds Lemma) Assume = (a, b) and let
V
0
() denote a function space of suciently smooth function on that vanish on the boundary of
3.3 From Functionals to Differential Equations 21
. Assume f(x) be continuous over , i.e., f C() and suppose that
b
_
a
f(x) v(x) dx = 0, v V
0
() . (3.16)
Then
f(x) = 0 on . (3.17)
The equality (3.19) states that f(x) is zero in variational or weak form, while (3.20) states that
f(x) is zero is strong form. Two functions f(x) and g(x) as said to be equal in weak form if their
dierence is zero in weak from. The lemma states that for continuous functions the notion on weak
and strong form of being zero on interior of the domain coincide. No information on the behavior
of f(x) on the boundary of is deduced. In this context the space V
0
() is called the space of
test functions. The practical value of this lemma increases as the space V
0
() can be kept small,
in such a way to require to test with as few as function v V
0
() as possible. Indeed, if the lemma
holds for a given V
0
() it will automatically be valid for a larger space Z
0
() (as a subset of test
functions v V
0
() Z
0
() already suces to draw the conclusion).
Proof. We will prove the lemma for V
0
() = C
1
0
() (and therefore by the previous argument
also for V
0
() = C
0
()). We argue by contradiction. Suppose that f(x
0
) > 0 for any x
0
(a, b)
(note that the case f(x
0
) < 0 can be treated similarly) then since f(x) is continuous, there exists
a > 0 such that
f(x) > 0 whenever [x x
0
[ < .
Now we choose v(x) = v
3
(x) dened by Equation 3.3. Then v(x) C
1
0
(), v(x) > 0 on (x
0
, x
0
+)
and
b
_
a
f(x) v(x) dx =
x
0
+
_
x
0

f(x)
..
>0
v(x)
..
>0
dx > 0. (3.18)
This violates the hypothesis (3.19). As x
0
was chosen arbitrarily, we have proven that f(x) = 0 on
.
The du Bois-Reymonds Lemma also holds in higher dimensions.
Lemma 3.2.2. (Higher-dimensional du Bois-Reymonds Lemma) Assume to be an open
and bounded domain in R
2
and let V
0
() denote a function space of suciently smooth function
on that vanish on the boundary of . Assume f(x, y) be continuous over , i.e., f C() and
suppose that
_

f(x, y) v(x, y) d = 0, v V
0
() . (3.19)
Then
f(x, y) = 0 on . (3.20)
3.3 From Functionals to Differential Equations
In this section we illustrate how dierential equations can be obtained by the minimizing of func-
tionals. Given a functional L, we will carry out the following three-step procedure:
22 Minimization Problems and Differential Equations
[1] assume that u is a rst-order critical point of L and express that u satises the condition
(3.15);
[2] integrate integrate-by-parts and exploit the homogeneous Dirichlet boundary conditions of
v V
0
();
[3] apply du-Bois Reymonds Lemma to derive the dierential equation for u supplied with
boundary conditions.
In what follows we illustrate the above procedure using the examples of functionals given above.
3.3.1 Distance in Flat Land
In this subsection we illustrate the above procedure using the functional introduced in Exam-
ple 3.1.7. Given = (a, b), and given the function space V () and V
0
() where
V () = u(x)[u

(x) continuous on , u(x = a) = u


a
and u(x = b) = u
b
(3.21)
and
V
0
() = v(x)[v

(x) continuous on , v(x = a) = 0 and v(x = b) = 0 , (3.22)


we seek to minimize L(u) =
_
b
a
_
1 + u

(x)
2
dx over V (). The motivation for the requirement of
u

(x) to be continuous will become clear in the following. We begin by recalling the notation
d
d
( u + v) = ( u + v)

= u

+ v

. (3.23)
Next we compute the left-hand side of (3.15)
d
d
_
L( u + v)

=
d
d
_
_
b
a
_
1 + ( u

+ v

)
2
dx

(3.24)
=
_
b
a
d
d
_
1 + ( u

+ v

)
2
dx
=
_
b
a
( u

+ v

) v

_
1 + ( u

+ v

)
2
dx.
Therefore
d
d
_
L( u + v)

[
=0
=
_
b
a
u

_
1 + ( u

)
2
dx, (3.25)
and using by integration by parts and the homogeneous Dirichlet boundary conditions on v we
obtain
d
d
_
L( u + v)

[
=0
=
_
u

v
_
1 + ( u

)
2
_
x=b
x=a
. .
=0

_
b
a
d
dx
_
u

_
1 + ( u

)
2
_
v dx. (3.26)
3.3 From Functionals to Differential Equations 23
We expand the integrand in the right-hand side as
d
dx
_
u

_
1 + ( u

)
2
_
=
d
d u

_
u

_
1 + ( u

)
2
_
d u

dx
(3.27)
=
_
1
_
1 + ( u

)
2
_
u

+ u

d
d u

_
(1 + ( u

)
2
)
1/2
_
u

=
_
1 + ( u

)
2
[1 + ( u

)
2
]
3/2
_
u

_
( u

)
2
[1 + ( u

)
2
]
3/2
_
u

=
u

[1 + ( u

)
2
]
3/2
,
and therefore
d
d
_
L( u + v)

[
=0
=
_
b
a
_
u

[1 + ( u

)
2
]
3/2
_
v dx. (3.28)
The condition (3.15) that u is a critical point is therefore equivalent to
_
b
a
_
u

[1 + ( u

)
2
]
3/2
_
v dx = 0 v V
0
() . (3.29)
If u(x) V (), then u

(x) is continuous and therefore also the function u

/[1 + ( u

)
2
]
3/2
in the
integrand in the left-hand side of the above equality. By du-Bois Reymonds Lemma we can then
assert that
u

[1 + ( u

)
2
]
3/2
= 0 on (a, b) u

= 0 on (a, b) , (3.30)
which is the dierential equation for u sought for.
This example is suciently simple to allow for an analytical solution for u. Indeed, the dif-
ferential equation u

= 0 on (a, b) supplied with the boundary conditions u(x = a) = u


a
and
u(x = b) = u
b
yields the solution
u(x) = u
a
+
u
b
u
a
b a
(x b) , (3.31)
which is a straight line interval in R
2
between the points (a, u
a
) and (b, u
b
). More important than
the solution is to observe the fact that the dierential equation for u can be obtained by minimizing
a functional.
3.3.2 Abstract One-Dimensional Minimization Problem
In this subsection we apply the same procedure as before on the functional L described in Exam-
ple 3.1.9. Given as before = (a, b), and given the function space V () and V
0
() where
V () = u(x)[u

(x) continuous on , u(x = a) = u


a
(3.32)
and
V
0
() = v(x)[v

(x) continuous on , v(x = a) = 0 , (3.33)


we seek to minimize L(u) =
_
b
a
f(x, u, u

) dx over V (). For reasons that will become clear in the


following, we require the partial derivative f/u to be continuous and the partial derivative f/u

24 Minimization Problems and Differential Equations


to be continuously dierentiable with respect to x, i.e., we require the derivative d(f/u

)/dx to
be continuous. Notice the absence of conditions at the end point of in the denition of both
V () and V
0
(). In our derivation we will also make use of the function space W
0
() V
0
()
where
W
0
() = v(x)[v

(x) continuous on , v(x = a) = 0 and v(x = b) = 0 . (3.34)


We begin by computing the left-hand side of (3.15)
d
d
_
L( u + v)

=
d
d
_
_
b
a
f(x, u + v, u

+ v

) dx

(3.35)
=
_
b
a
d
d
f(x, u + v, u

+ v

) dx.
The derivative in the integrand on the right-hand side can be computed via the chain rule, i.e.,
d
d
f(x, u + v, u + v) =
f
u
(x, u + v, u

+ v

)
d( u + v)
d
+ (3.36)
f
u

(x, u + v, u

+ v

)
d( u

+ v

)
d
=
f
u
(x, u + v, u

+ v

) v +
f
u

(x, u + v, u

+ v

) v

.
Substituting this result into the integral and splitting the integral into two parts, one obtains
d
d
_
L( u + v)

=
_
b
a
f
u
(x, u + v, u

+ v

) v dx +
_
b
a
f
u

(x, u + v, u

+ v

) v

dx. (3.37)
Therefore
d
d
_
L( u + v)

[
=0
=
_
b
a
f
u
(x, u, u

) v dx +
_
b
a
f
u

(x, u, u

) v

dx. (3.38)
and using by integration by parts and the homogeneous Dirichlet boundary conditions in x = a on
v we obtain
d
d
_
L( u + v)

[
=0
=
_
b
a
f
u
(x, u, u

) v dx +
_
f
u

(x, u, u

) v
_
x=b
x=a
. .
=0 in x=a only

_
b
a
d
dx
_
f
u

(x, u, u

)
_
v dx (3.39)
=
_
b
a
f
u
(x, u, u

) v dx +
f
u

(x = b, u, u

) v(x = b)
_
b
a
d
dx
_
f
u

(x, u, u

)
_
v dx.
The condition (3.15) is then seen to be equivalent to
_
b
a
_
f
u

d
dx
_
f
u

__
v dx =
f
u

(x = b, u, u

) v(x = b) v V
0
() . (3.40)
The smoothness requirements on the partial derivatives of f(x, u, u

) are such that the functions


f/u d(f/u

)/dx and f/u

are continuous functions in x allowing us to apply du-Bois


Reymonds Lemma. We will in fact apply this lemma twice. The above condition should in
particular hold for v W
0
() V
0
() for which v(x = b) = 0 and therefore
_
b
a
_
f
u

d
dx
_
f
u

__
v dx = 0 v W
0
() , (3.41)
3.3 From Functionals to Differential Equations 25
and therefore by du-Bois Reymonds Lemma
f
u

d
dx
_
f
u

_
= 0 on (a, b) . (3.42)
To treat the boundary condition at x = b we return to larger space V
0
() and to the relation (3.40)
knowing now that the left-hand side is zero, i.e.,
f
u

(x = b, u, u

) v(x = b) = 0 v V
0
() , (3.43)
and therefore we necessarily have that by du-Bois Reymonds Lemma
f
u

(x = b, u, u

) = 0 . (3.44)
Summarizing, we can state that the solution of the dierential equation (3.42) supplied with the
boundary conditions u(x = a) = u
a
and (3.44) minimizes L(u) =
_
b
a
f(x, u, u

) dx over V
0
(). The
minimization of a functional is seen to give raise to a partial dierential equation with boundary
conditions guaranteeing the latter to have an unique solution.
The equation (3.42) is called the Euler-Lagrange equation. It plays an important role in various
elds of physics such as geometrical optics, classical and quantum mechanics and cosmology as it
allows to derive the governing equations starting from a functional describing the total energy of the
system. It allows to derive that the shortest path between e.g. two points on the lateral surface of
a cylinder is a helix. The Maxwell equations are derived following an energy minimization principle
in ?]. The use of the Euler-Lagrange in deriving the equation of motion for Newtons apple is
illustrated in the next example.
Newtons Apple In Example 3.1.8 the function f(x, u, u

) is seen to be
f(x, u, u

) =
1
/2 mu

(x)
2

1
/2 k u(x)
2
. (3.45)
Therefore
f
u

= mu

(x) (3.46)
d
dx
_
f
u

_
= mu

(x)
f
u
= k u(x) .
The Euler-Lagrange equation is therefore seen to simplify
mu

(x) = k u(x) , (3.47)


which corresponds to the governing equation for a mass-spring system.
26 Minimization Problems and Differential Equations
3.3.3 Two-Dimensional Self-Adjoint Problem
In this subsection we seek to minimize the functional L(u) introduced in Example 3.1.10. Given
R
2
an open and bounded two-dimensional domain with boundary =
D

N
, given c a
positive function on , given a continuous function f on , given g a function on
D
and h a
continuous function on
N
, and given the function spaces V () and V
0
() where
V () = u(x, y)[ (cu) continuous over , u[

D
= g (3.48)
V
0
() = v(x, y)[ (cv) continuous over , v[

D
= 0 . (3.49)
Notice that the functions in V
0
() are forced to be zero on
D
only and the imposed smoothness
requirements on u(x, y) and v(x, y) coincide with those of the previous one-dimensional example in
case that c(x, y) = 1. We seek to minimize L(u), where
L(u) =
_

_
1
/2 u (cu) fu
_
d +
_

N
h(x, y) ud (3.50)
over V (). In doing so, we will also make use of the space W
0
() V
0
() in which the functions
are forced to be zero on the whole boundary, i.e.,
W
0
() = v(x, y)[ (cv) continuous over , v[

= 0 . (3.51)
In this example the left-hand side of (3.15) can be computed as
L( u + v) =
_

_
1
/2 ( u + v)
_
c( u + v)

f( u + v)
_
d + (3.52)
_

N
h(x, y) ( u + v) d
=
_

_
1
/2 u (c u) f u
_
d +
_

N
h(x, y) ud +

_
_

_
v (c u) f v
_
d +
_

N
h(x, y) v d
_
+
2
_

1
/2 v (cv) d.
Therefore
L( u + v)[
=0
=
_

_
v (c u) f v
_
d +
_

N
h(x, y) v d (3.53)
and using integration by parts and the homogeneous boundary conditions of v on
D
L( u + v)[
=0
=
_

v (c u) v d
_

f v d +
_

N
h(x, y) v d (3.54)
=
_

(c u) v d
_

f v d +
_

c u
n
v d
. .
v=0 on
D
+
_

N
h(x, y) v d
=
_

_
(c u) f
_
v d +
_

N
_
h(x, y) c u
n

v d
3.4 From Differential Equation to Minimization Problem 27
The condition (3.15) can thus be equivalently written as
_

_
(c u) f
_
v d +
_

N
_
h(x, y) c u
n

v d = 0 v V
0
() . (3.55)
The imposed smoothness requirements on u(x, y), f(x, y) and h(x, y) are such that we can apply
du-Bois Reymonds Lemma. The above condition should in particular hold for v W
0
() V
0
()
for which v[

= 0 and therefore
_

_
(c u) f
_
v d = 0 v V
0
() , (3.56)
and by du-Bois Reymond Lemmas therefore
(c u) = f on . (3.57)
To treat the boundary condition on
N
we return to larger space V
0
() and to the relation (3.55)
knowing now that the left-hand side is zero, i.e.,
_

N
_
h(x, y) c u
n

v d = 0 v V
0
() , (3.58)
and therefore we necessarily have that by du-Bois Reymonds Lemma
c u n = c u
n
= h on . (3.59)
Summarizing we can state the solution of the partial dierential (3.57) supplied with the bound-
ary conditions u = g on
D
and c u
n
= h on
N
minimizes the functional (3.50) over V
0
(). The
minimization of a functional over a function space is again seen to give raise to a partial dierential
supplied with boundary conditions ensuring the latter to have a unique solution.
3.4 From Differential Equation to Minimization Problem
In the previous section we saw how starting from a minimization problem, a partial dierential
equation could be derived. In this section we discuss under which conditions a minimization
problems can be derived for a given partial dierential equation.
The next theorem states that in case that the dierential operator is positive and self-adjoint,
solving the dierential equation is equivalent to minimizing a functional over a function space.
Theorem 3.4.1. Assume that is an open and bounded domain in R, R
2
or R
3
, that V () is a
space of functions on that are zero on and that f is continuous function on . Suppose that
/ is a positive and self-adjoint dierential operator on V () and that u
0
V () is the unique
solution to the dierential equation
/u = f (3.60)
supplied with Dirichlet boundary conditions. Then u
0
minimizes the functional
L(u) =
_

_
1
/2 u(/u) f u
_
d, (3.61)
meaning that
L(u
0
) L(u) u V () . (3.62)
28 Minimization Problems and Differential Equations
Proof. Consider u V (), u ,= u
0
. Then as 0 ,= uu
0
V (), we have due to / being positive
on V () that
1
/2
_

(u u
0
) (/(u u
0
)) d > 0 . (3.63)
Expanding the left-hand side of the previous expression, we obtain
1
/2
_

(u u
0
) (/(u u
0
)) d =
1
/2
_

u(/u) d
1
/2
_

u(/u
0
) d (3.64)

1
/2
_

u
0
(/u) d +
1
/2
_

u
0
(/u
0
) d
Using the fact that / is self-adjoint and the /u
0
= f, we have that
1
/2
_

(u u
0
) (/(u u
0
)) d =
1
/2
_

u(/u) d
_

u(/u
0
) d (3.65)

1
/2
_

u
0
(/u
0
) d +
_

f u
0
d
=
1
/2
_

u(/u) d
_

f ud (3.66)

1
/2
_

u
0
(/u
0
) d +
_

f u
0
d
Given the left-hand side must is positive, we have in fact that
_

_
1
/2 u
0
(/u
0
) f u
0
_
d
_

_
1
/2 u(/u) f u
_
d (3.67)
which is equivalent to what we set out to prove.
The importance of this above theorem resides in the fact that solving the dierential equations
we are interested in this course (e.g. /u = (cu)) supplied with appropriate boundary conditions
to ensure uniqueness is completely equivalent to solving minimizing a functional over a suitable
function space. This insight will be useful in treating the Ritz and Galerkin nite elements methods
in the next chapters.
4
Variational Formulation and Differential
Equations
In the previous chapter we saw the relation between minimization problems and (partial) dier-
ential equations. It was demonstrated that if the dierential operator is positive and self-adjoint,
then, such an associated minimization problem exist. Ritz nite element method is based on the
numerical solution of a minimization problem. To solve problems with dierential operators that
do not satisfy these requirements, the so-called weak form is introduced. The dierential equation
is written as a weak form and then a numerical solution to this weak form is determined. This
method is more generally applicable and it is the backbone of Galerkins nite element method.
4.1 Weak forms
Consider the following minimization problem on domain with boundaries =
1

2
:
minimization:
_

_
Find u smooth, such that u[

1
= g, and
J( u) J(u) for all smooth u with u[

1
= g,
where J(u) :=
1
2
_

u|
2
dA.
(4.1)
Using u = u + v for all smooth v with v[

1
= 0, it follows that the solution of equation (4.1)
coincides with:
weak form:
_
_
_
Find u smooth, such that u[

1
= g, and
_

u.

vdA = 0 for all smooth v with v[

1
= 0.
(4.2)
It can be demonstrated that the solution of the above exists and that it is unique. We suppose
that the boundary of is given by
1

2
. The problems (4.1) and (4.2) have the same solution.
30 Variational Formulation and Differential Equations
The product rule for dierentiation applied to
_

u

vdA gives:
_

[v

u]dA
_

vudA = 0 v with v[

1
= 0, (4.3)
or
_

1
v
u
n
ds +
_

2
v
u
n
ds =
_

vudA v[

1
= 0 (with v smooth), (4.4)
with v[

1
= 0, follows
_

2
v
u
n
dS =
_

vudA v[

1
= 0 with v smooth. (4.5)
Suppose that v[

2
= 0 besides v[

1
= 0, then du Bois-Reymond Lemma gives u = 0 on . When
we do away with the condition v[

2
= 0 and use u = 0 on , we obtain the following natural
boundary condition
u
n
[

2
= 0. Hence smooth solutions of (4.1) and (4.2) satisfy:
PDE:
_

_
u = 0,
u[

1
= g,
u
n
[

2
= 0.
(4.6)
When u exists within , then the solutions of equations (4.1), (4.2) and (4.6) are the equal. (4.6)
contains a PDE, (4.1) is its corresponding minimization problem and (4.2) is called a variational
formulation or a weak form of PDE (4.6).
So far we went from a weak form to a problem with a PDE. In practice, one often goes the
other way around. Since nite element methods are based on either the solution of a minimization
problem (such as (4.1)) or a weak form (as in (4.2)), we would like to go from a PDE to a weak
from. Further, the condition v[

1
= 0 because of u[

1
= g and hence prescribed, originates from
the use of a minimization problem.
Solving of (4.6) by a numerical solution of the representation of (4.2) is referred to as Galerkins
method. Whereas, aquiring the numerical solution of a representation of (4.1) is called Ritz method.
Galerkins method is most general: it can always be applied. It doesnt matter whether dierential
operators are self-adjoint or positive. Therefore, this method will be treated in more detail. The
study of minimization problems was needed to motivate the condition v = 0 on locations where u
is prescribed (by an essential condition).
A major advantage of the weak form (4.2) is the fact it is easier to prove existence and uniqueness
for (4.2) than for (4.6). It is clear that a solution of (4.6) always is always a solution of (4.2). A
solution of the PDE (4.6) always needs the second order derivatives to exist, whereas in the solution
of (4.2) only the integrals have to exist. For the solutions of the weak form, it may be possible
that the second order derivatives do not exist at all. For that reason, the term weak form or weak
solution is used for the problem and its solution respectively.
The function v is commonly referred to as a test function. Lets go from (4.6) to (4.2). Given
u = 0 vu = 0 for all v[

1
= 0 (reason is that u[

1
= g is prescribed!) then
4.1 Weak forms 31
_

vudA = 0, (4.7)
_

[v

u]dA
_

u

vdA = 0 v[

1
= 0. (4.8)
The product rule for dierentiation was used here. Using the Divergence Theorem, this gives (since
v[

1
= 0)
_

2
v
u
n
ds
_

u

vdA = 0 v[

1
= 0. (4.9)
Since in (4.6) it is required that
u
n
[

2
= 0 , we obtain
_

2
v
u
n
ds = 0, (4.10)
and hence,
_

u

vdA = 0 v[

1
= 0 smooth. (4.11)
Hence (4.6) is equivalent to (4.2), if we are not bothered by the smoothness considerations:
_

_
Find u smooth, such that u[

1
= g, and
_

u

vdA = 0 for all smooth v with v[

1
= 0.
(4.12)
Here (4.2) is also sometimes referred to as the nite element formulation of (4.6). The same principle
may be applied to
_

_
u
t
= u + f,
u[

1
= g,
u
n
[

2
= h,
u(x, y, 0) = 0, t = 0 (x, y) .
(4.13)
In the above problem the boundary of the domain of computation is given by
1

2
. The
question is now to nd a nite element formulation for (4.13). We multiply the PDE with a
testfunction v, that satises v[

1
= 0, since u[

1
= g is prescribed, to obtain, after integration over
,
_

u
t
vdA =
_

vudA +
_

fvdA v [

1
= 0, (4.14)
(v smooth). Using the product rule for dierentiation, we obtain
_

u
t
vdA =
_

[v

u]dA
_

u

vdA +
_

fvdA, v [

1
= 0. (4.15)
32 Variational Formulation and Differential Equations
The Divergence Theorem implies:
_

u
t
vdA =
_

1
u
n
vds +
_

2
u
n
vds
_

u

vdA +
_

fvdA, v [

1
= 0. (4.16)
Since
u
n
= h on
2
and v [

1
= 0, we obtain: Find u with u [
t=0
= 0, u [

1
= g such that
_

u
t
vdA =
_

2
hvds
_

u

vdA +
_

fvdA, v [

1
= 0. (4.17)
Equation (4.17) is the variational form or nite element form of (4.13). Note that the Neumann
BC is changed into a line-integral over
2
. Of course, it is easy to show that (4.13) can be derived,
once only (4.17) is given:
_

_
u
t
f
_
vdA =
_

2
hvds
_

[v

u]dA +
_

vudA, v [

1
= 0. (4.18)
Using v [

1
= 0, this gives
_

_
u
t
u f
_
vdA =
_

2
_
h
u
n
_
vds v [

1
= 0. (4.19)
If we set v [

2
= 0 besides v [

1
= 0, we obtain from du Bois-Reymond
_

_
u
t
c f
_
vdA = 0
u
t
u f = 0 on . (4.20)
This implies after releasing v [

2
= 0 that h
u
n
= 0 on
2
(again from du Bois-Reymond). We
see that (4.17) corresponds with (4.13), since we require u [

1
= g and u [
t=0
= 0 for both (4.13)
and (4.17). Note that for the derivation of the weak form, we always multiply the PDE with a
test-function v, which must satisfy v = 0 on a boundary with a Dirichlet condition (i.e. an essential
condition). Subsequently we integrate over the domain of computation.
4.2 Which weak formulation? 33
Exercise 4.1.1. Suppose that we have been given the following problem:
_

_
u
t
= u on ,
u [

1
= g on
1
,
u [

2
+
u
n
[

2
= h on
2
,
u(x, y, 0) = 0 for t = 0 on .
(4.21)
Show that a weak form of the above problem is given by:
Find u smooth, subject to u [

1
= g and u [
t=0
= 0, such that
_

u
t
vdA =
_

u

vdA +
_

2
(h u) vds v [

1
= 0. (4.22)
v smooth.
The above weak form (4.22) is used to solve (4.21) by the use of nite elements. Note that the
Robin-condition is a natural boundary condition, which is contained in the weak form in the second
term of the right-hand of the (4.22).
4.2 Which weak formulation?
When we considered
_
u = f on ,
u [

= 0,
(4.23)
then we saw that a weak form is given by (??)
_

_
Find u [

= 0 such that,

u vdA =
_

fvdA for all v [

= 0.
(4.24)
The above problem is a weak form, but the following problem is also a weak form:
_

_
Find u [

= 0 such that,
_

vudA =
_

fvdA for all v [

= 0,
(4.25)
or even
_

_
Find u [

= 0 such that,

uvdA =
_

fvdA for all v [

= 0.
(4.26)
Forms (4.24),(4.25) and (4.26) are all possible weak forms of (4.23). However, in the nite element
calculations, (4.25) and (4.26) are not common. This is due to the reduction of order of the
derivatives in the rst form (4.24). Here only the rst derivatives are used and this will give an
34 Variational Formulation and Differential Equations
advantage for the implementation of the FEM, which we will see later. A more important advantage
is that for a minimized order of derivatives in the weak form, the class of allowable solutions is
largest, in the sense that solutions that are less smooth are allowable. As a rule of thumb, now, we
mention that when we derive a weak form, then we should try to minimize the highest order of the
derivatives that occur in the integrals.
Example:
_

_
u

= f f on x (0, 1),
u(0) = 0,
u

(0) = 0,
u(1) = 0,
u

(1) = 0.
(4.27)
We derive a weak form with the lowest order for the derivatives.
1
_
0
u

vdx =
1
_
0
fvdx for all v(0) = 0 = v

(0) = v(1) = v

(1), (4.28)
partial integration gives
_
u

1
0

1
_
0
u

dx =
1
_
0
fvdx for all v(0) = 0 = v

(0) = v(1) = v

(1), (4.29)
with the condition v(0) = 0 = v(1) follows

1
_
0
u

dx =
1
_
0
fvdx for all v(0) = 0 = v

(0) = v(1) = v

(1). (4.30)
Partial integration, again, gives (with v

(1) = 0 = v

(0))
1
_
0
u

dx =
1
_
0
fvdx for all v(0) = 0 = v

(0) = v(1) = v

(1). (4.31)
Now we stop, because, another partial integration would increase the maximum order of the deriva-
tives again to obtain
1
_
0
u

dx =
1
_
0
fvdx for all v(0) = 0 = v

(0) = v(1) = v

(1). (4.32)
We do not use (4.32) but (4.31) as the weak form for the nite element method.
4.3 Mathematical considerations:existence and uniqueness
This section is intended for the interested reader and it is not necessary for the understanding of
the implementation of the nite element method. Consider the following Poisson problem
u = f(x), for x ,
u = g(x), for x .
(4.33)
4.3 Mathematical considerations:existence and uniqueness 35
Here we assume that f(x) and g(x) are given continuous functions. Let = be the closure
of , then the following assertion can be demonstrated:
Theorem 4.3.1. If f(x) and g(x) are continuous and if the boundary curve is (piecewise) smooth,
then problem (4.33) has one and only one solution such that u C
2
()C
1
() (that is the solution
has continuous partial derivatives up to at least the second order over the open domain and at
least continuous rst order partial derivatives on the boundary).
We will not prove this result for the existence and uniqueness of a classical solution to problem
(4.33). The proof of the above theorem is far from trivial, the interested reader is referred to the
monograph Evans [1999] for instance. The fact that the second order partial derivatives need to
be continuous is a rather strong requirement.
The nite element representation of the above problem is given by
Find u H
1
(), subject to u = g on , such that
_

u d =
_

fd, for all H


1
().
(4.34)
In the above problem, the notation H
1
() has been used, this concerns the set of functions for which
the integral over of the square of the function and its gradient is nite. Informally speaking, this
is
u H
1
()
_

u
2
d < and
_

[[u[[
2
d < . (4.35)
This set of functions represents a Hilbert space and is commonly referred to as a Sobolev space.
Using the fact that each function that is in H
1
() is also continuous on , that is H
1
() C
0
(),
the following claim can be proved
Theorem 4.3.2. The problem (5.86) has one and only one solution u, such that u H
1
().
The proof of the above theorem resides on the Lax-Milgram Theorem (see for instance the book
by Kreyszig [1989]):
Theorem 4.3.3. Let V be a Hilbert space and a(, ) a bilinear form on V, which is
[1] bounded: [a(u, v)[ C|u||v| and
[2] coercive: a(u, u) c|u|
2
.
Then, for any linear bounded functional f V

, there is a unique solution u V to the equation
a(u, v) = f(v), for all v V. (4.36)
The proof takes into account the fact that the linear operator is positive (more exactly speak-
ing coercive, which is
_

[[u[[
2
d
_

u
2
d for some > 0) and continuous. Further, the
right hand side represents a bounded linear functional. These issues constitute the hypotheses
under which the Lax-Milgram theorem holds and hence have to be demonstrated. In this text the
(straighforward) proof is omitted and a full proof of the above theorem can be found in van Kan
et al. [2006] for instance.
The most important lesson that we learn here, is that the solution to the weak form exists and
that it is uniquely dened. Further, the weak form allows a larger class of functions as solutions
than the PDE does.
36 Variational Formulation and Differential Equations
Smooth Solution In this paragraph we study the convergence of the FEM method in case that
the solution and its derivative are smooth. As exact solution we use the function u(x) = x
2
sin(x)
on the interval 0 x 1. Figure ?? shows the theoretically predicted convergence behavior.
(a) Solution (b) Derivative
(c) Accurarcy versus mesh size (d) Accuracy versus problem size
Figure 4.1: Convergence study for a smooth problem.
Solution with Discontinuous Derivative In paragraph we study the convergence of the FEM
method in case that diusion coecient c(x) has a jump-discontinuity. We take = (0, 2), and set
c(x) =
_
c
1
if 0 x 1
c
2
if 1 < x 2
, (4.37)
and
u(x) =
_
1
42
x
7

1
42(c
1
+c
2
)
(7 c
1
+ 79 c
2
)x if 0 x 1
1
42
x
7

1
42(c
1
+c
2
)
(79 c
1
+ 7 c
2
)x +
12
7
c
1
c
2
c
1
+c
2
if 1 < x 2
, (4.38)
5
Galerkins Finite Element Method
In this chapter we treat the nite element method, which was proposed by Galerkin. The method is
based on the weak form of the PDE. This Galerkin method is more general than the Ritz method,
which is based on the solution of a minimization problem and, hence, is only suitable whenever the
dierential operator is positive and self-adjoint.
5.1 The principle of Galerkins method
Given the following weak form:
_

_
Find u [

= 0 such that,
_

u

v dA =
_

f v dA for all v [

= 0.
(5.1)
Here is a general simply connected domain in R
1
or R
2
or R
3
. A crucial principle for the FEM
is that we write u as a sum of basis-functions
i
(x, y), which satisfy

i
(x, y) [

= 0, (5.2)
i.e. hence
u(x, y) =

j=1
c
j

j
(x, y). (5.3)
Since, we cannot do calculations with an innite number of terms, we truncate this series such that
we only take the rst n terms into account, then
u(x, y) =
n

j=1
c
j

j
(x, y), (5.4)
38 Galerkins Finite Element Method
where u denotes the approximation of the solution of (5.1). As an example for
i
one might take
powers, sines, cosines (viz. Fourier) and so on. We will assume here that
u(x, y) =
n

j=1
c
j

j
(x, y) u(x, y) as n , (5.5)
note that u(x, y) represents the approximated solution of (5.1) and u(x, y) the exact solution of
(5.1) respectively. There is a lot of mathematical theory needed to prove that u u as n for
a specic set of basis-functions
i
(x, y). The Finite Element representation of weak form (5.1) is:
_

_
Find the set of constants c
1
, . . . , c
n
such that,
n

j=1
_

c
j

j
(x, y)

i
(x, y) dA =
_

f
i
dA for all i 1, . . . , n.
(5.6)
Note that we assume here that all functions v [

= 0 are represented by (linear combinations of)


the set
i
(x, y), i 1, . . . , n. We will use this assumption and skip the mathematical proof (see
Strang and Fix [1973], Cuvelier et al. [1986] and Braess [1996] for instance for a proof). Further,
in (5.6), we will make a choice for the functions
i
(x, y) and hence they are known in the Finite
Element calculations. It turns out that the choice of the basis-functions
i
(x, y) inuences the
accuracy and speed of computations. The accuracy is a dicult subject, which we will treat without
detail. The speed of computation is easier to deal with. Note that u [

= 0 due to
i
(x, y) [

= 0,
i 1, . . . , n. (5.6) implies a set of linear equations of c
i
:
c
1

1
dA + c
2

1
dA + c
3

1
dA + + c
n

1
dA =

f
1
dA,
c
1

2
dA + c
2

2
dA + c
3

2
dA + + c
n

2
dA =

f
2
dA
.
.
.
.
.
.
c
1

n
dA + c
2

n
dA + c
3

n
dA + + c
n

n
dA =

f
n
dA,
(5.7)
The discretization matrix here is refered to as the stiness matrix, its elements are
A
ij
=
_

j
dA (5.8)
Exercise 5.1.1. Show that A is symmetric, i.e. a
ij
= a
ji
.
For a fast solution of the system of linear equations, one would like A to be as sparse as possible
(i.e. A should contain as many zeros as possible). When
i
are orthogonal over the

, then
_

j
dA = 0 when i ,= j. (5.9)
This would be ideal: the c
j
then follows very easily from solving a linear system with diagonal
coecient matrix:
c
j
=
_

f
j
dA
_

j
dA
, . (5.10)
5.1 The principle of Galerkins method 39
In practice it is not always possible to choose a set of orthogonal basis-functions, but we try
to choose a set that is almost orthogonal. This means that A consists of zeroes mainly (i.e. A
is a sparse matrix). We will choose basis-functions
i
(x, y) that are piecewise linear. Suppose
that the domain of computation is divided into a set of gridnodes, see below, with numbers for the
unknowns (gure 5.1).
6
8
10
11
12
12
14
17
15
19
20 25
24
23
22
21 16
18
7
9
5
4
3
2
1
Figure 5.1: An example of a domain divided into a Finite Element mesh
Then, we will choose
i
(x, y) to be piecewise (bi-)linear, such that

i
(x
j
, y
j
) =
_
1, for (x
j
, y
j
) = (x
i
, y
i
),
0, for (x
j
, y
j
) ,= (x
i
, y
i
).
(5.11)
The reason for this choice will be motivated by the use of a one-dimensional example. It is clear
that for this case the integrals of,
_

i

j
dA, (5.12)
only do not vanish when i and j are equal or when i and j are neighboring gridpoints, due to
piecewise linearity of the basis-functions
i
. This implies that the basis-functions have a compact
support and hence, the stiness-matrix will be sparse. First we motivate the choice of piecewise
linear basis functions by the use of a one dimensional example.
40 Galerkins Finite Element Method
Figure 5.2: The function u(x) at gridnodes x
i

5.2 Motivation of piecewise linear basis-functions


Given any function u = u(x) and a division of gridnodes, see gure 5.2. For [x
i1
, x
i
], we approxi-
mate u(x) by the use of linear interpolation:
u(x) = u(x
i1
) +
u(x
i
) u(x
i1
)
x
i
x
i1
(x x
i1
) for x [x
i1
, x
i
], (5.13)
or with u
i
= u(x
i
), we obtain (gure 5.3)
u(x) = u
i1
+
u
i
u
i1
x
i
x
i1
(x x
i1
),
= u
i1
_
1 +
x
i1
x
x
i
x
i1
_
+ u
i
_
x x
i1
x
i
x
i1
_
,
= u
i1
x
i
x
x
i
x
i1
+ u
i
x x
i1
x
i
x
i1
=: u
i1
l
i1
(x) + u
i
l
i
(x). (5.14)
Hence
u(x) = u
i1
l
i1
(x) + u
i
l
i
(x) for x [x
i1
, x
i
]. (5.15)
We do the same for x [x
i
, x
i+1
] (see Figure 5.3), to obtain:
u(x) = u
i
l
i
(x) + u
i+1
l
i+1
(x) on x [x
i
, x
i+1
]. (5.16)
5.2 Motivation of piecewise linear basis-functions 41
Figure 5.3: The piecewise linear functions l
i
(x)
Therewith, we write for the approximation u(x) of u(x):
u(x) =
n

j=1
u
j

j
(x), (5.17)
where

i
(x) =
_

_
x x
i1
x
i
x
i1
, for x [x
i1
, x
i
],
x x
i+1
x
i
x
i+1
, for x [x
i
, x
i+1
],
0, for x / [x
i1
, x
i+1
].
(5.18)
Hence
i
(x) is piecewise linear, see Figure 5.4, where

i
(x
j
) =
_
0, i ,= j,
1, i = j.
(5.19)
In the nite element method we put in the functions
i
(x) and we determine u
i
. Therewith,
we obtain the solution.
42 Galerkins Finite Element Method
Figure 5.4: The piecewise linear function
i
(x)
5.3 Evaluation of a one-dimensional example
Now we treat procedures to approximate the integrals. For this set of basis-functions we solve:
Find u(x) such that u(0) = 0 and

1
_
0
u

(x)v

(x)dx =
_
1
0
f(x)v(x)dx, for all v(0) = 0. (5.20)
Exercise 5.3.1. Find the dierential equation for u with all boundary conditions that corresponds
to (5.20) with u(0) = 0.
The approximation u(x) =
n

j=1
u
j

j
(x) (where u u as n is assumed) leads to the fol-
lowing Finite Element formation:
Find coecient u
i
, in u(x) =
n

j=1
u
j

j
(x), with

i
(x
j
) =
_
0, i ,= j,
1, i = j,
(5.21)
5.3 Evaluation of a one-dimensional example 43
such that

1
_
0
n

j=1
u
j

j
(x)

i
(x)dx =
_
1
0
f(x)
i
(x)dx i 1, . . . , n. (5.22)
The computation of
1
_
0

i
(x)

j
(x)dx is simple, since
i
are piecewise linear functions
1
_
0

i1
(x)

i
(x)dx =
x
i
_
x
i1
1
x
i1
x
i
1
x
i
x
i1
dx =
1
x
i
x
i1
, (5.23)
1
_
0

i
(x)

i
(x)dx =
1
x
i
x
i1
+
1
x
i+1
x
i
, (5.24)
1
_
0

i
(x)

i+2
(x)dx = 0, (5.25)
(why?). Of course, given any function f(x) whose product with
i
(x) is integrable, the integral
1
_
0
f(x)
i
(x)dx may be evaluated. For some cases it is even possible to nd an anti-derivative for

i
(x)f(x). However, for many cases this isnt possible. We then evaluate the integral numerically.
Standard FE-packages use the Newton-Cotes formulas, which read as
1
_
0
f(x)
i
(x)dx f(x
i
)
1
_
0

i
(x)dx
= f(x
i
)
x
i+1
_
x
i1

i
(x)dx
= f(x
i
)
1
2
(x
i+1
x
i1
) for i 1, 2, . . . , n 1. (5.26)
For i = n we use
1
_
0
f(x)
n
(x)dx
x
n
_
x
n1
f(x
n
)
n
(x)dx = f(x
n
)
1
2
(x
n
x
n1
), (5.27)
or better
1
2
f
_
x
n
+ x
n1
2
_
(x
n
x
n1
). (5.28)
Evaluation of all integrals in (5.22) gives a system of linear equations in u
i
. We also know that
u

(1) = 0 results from (5.20) as a natural boundary condition. This condition should also follow
44 Galerkins Finite Element Method
from (5.22):
1
_
0

n1

n
dx =
1
x
n
x
n1
, (5.29)
1
_
0

n
dx =
1
x
n
x
n1
, (5.30)

1
x
n
x
n1
u
n1
+
1
x
n
x
n1
u
n
= f( x
n
)
1
2
(x
n
x
n1
), (5.31)
where x
n
=
x
n
+ x
n1
2
can be chosen (or just x
n
= x
n
). Further f( x
n
) = u

( x
n
) (see exercise
5.3.1). Implies
u
n
u
n1
x
n
x
n1
=
1
2
f( x
n
)(x
n
x
n1
)
=
1
2
u

( x
n
)(x
n
x
n1
). (5.32)
This implies that
u
n
u
n1
x
n
x
n1
0 as n (x
n
x
n1
0). Hence the natural boundary condition
is recovered.
5.4 Ritz method of nite elements by a simple example
Suppose that we have the following minimization problem:
min
uU
J(u), with J(u) =
1
2
1
_
0
_
du
dx
_
2
dx, (5.33)
where U := u smooth: u(0) = 0. Then this problem corresponds to the solution of
_

_
d
2
u
dx
2
= 0 on (0, 1),
u(0) = 0,
du
dx
(1) = 0.
(5.34)
Note that the solution is given by u = 0. Now we use Ritz FEM to solve the minimization problem.
Let the approximate solution be given by (Figure 5.4)
u
n
(x) =
n

j=1
u
j

j
(x), (5.35)
where we assume that u
n
(x) u(x) on x [0, 1] as n . Then we look for constants
u
1
, u
2
, . . . , u
n
such that J(u) is minimal. In other words:

u
i
J(u) = 0 i 1, 2, 3, . . . , n. (5.36)
5.5 The treatment of a non-homogeneous Dirichlet boundary conditions 45
Substitution of
n

j=1
u
j

j
(x) = u
n
(x) into J(u) gives:
J(u) =
1
2
1
_
0
n

i=1
u
i

i
(x)
n

j=1
u
j

j
(x)dx. (5.37)
Hence

u
i
J(u) = 0
n

j=1
1
_
0
u
j

j
(x)

i
(x)dx = 0 i 1, . . . , n. (5.38)
This gives exactly the same equations as in (5.22). Note the similarity with the result obtained by
the use of Galerkins method. Since Galerkins method is applicable for more general cases, we do
not treat this method further.
5.5 The treatment of a non-homogeneous Dirichlet boundary conditions
Suppose that we have to solve the following variational problem:
Find u(x), subject to u(0) = u
0
, such that

1
_
0
u

(x)v

(x)dx =
1
_
0
f(x)v(x)dx v(0) = 0. (5.39)
Now the essential condition is non-zero (when u
0
,= 0), where u
0
is given. The treatment is
similar to the case where u
0
= 0, but now we set
u
n
(x) =
n

j=0
u
j

j
(x) = u
0

0
(x) +
n

j=1
u
j

j
(x). (5.40)
Note that u
0
is from the Dirichlet condition. Again, we use piecewise linear basis-functions
i
(x),
where

i
(x
j
) =
_
1 i = j,
0, i ,= j,
and
i
(x) is piecewise linear. (5.41)
For
0
(x) we have:
0
(x
0
) =
0
(0) = 1. For the functions v(x) we set
i
(x) where i 1, . . . , n
(note that
i
(0) = 0 since v(0) = 0). Then, we obtain the following problem:
Find u
1
, u
2
, . . . , u
n
such that

1
_
0
n

j=0
u
j

j
(x)

i
(x)dx =
1
_
0
f(x)
i
(x)dx, (5.42)
for all
i
(x)
n
i=1
, i.e. i 1, . . . , n.
46 Galerkins Finite Element Method
Figure 5.5: The piecewise linear functions
i
(x) and
0
(x)
For the functions
i
(x) we use the sketches from Figure 5.5. For
1
(x), where j = 1, follows
(where u
0
is prescribed):

1
_
0
u
0

1
dx
1
_
0
u
1

1
dx
1
_
0
u
2

1
dx =
1
_
0
f(x)
1
dx, (5.43)
_

1
x
1
x
0

1
x
2
x
1
_
u
1
+
1
x
2
x
1
u
2
=
u
0
x
1
x 0
+ f(x
1
)
1
2
(x
2
x
0
). (5.44)
Observe that u
0
appears in the right-hand side of the equation for j = 1. The integrals can also
be evaluated for the other values of j. The same equations follow as in the example where u
0
= 0.
Again, we will have that u

n
(1) 0 as n . For more dimensional problems, the same occurs:
Suppose that we search u, subject to u [

2
= g, such that
_

u

vdA = 0 v [

= 0. (5.45)
Let n be the number of gridnodes that are inside (gure 5.5) or on boundary
2
, (but not on

1
), and let n + 1, . . . , n + m be the gridnodes on boundary
1
, then we set
u(x, y)
n

j=1
u
j

j
(x, y) +
n+m

j=n+1
g(x
j
, y
j
)
j
(x, y). (5.46)
5.6 A time-dependent example 47
Here we take

j
(x
i
, y
i
) =
_
1, for j = i,
0, for j ,= i,
(5.47)
where
j
(x, y) are taken to be piecewise linear. Expression (5.46) is substituted into the weak form
to obtain a system of linear equations.
5.6 A time-dependent example
Consider the following problem:
_

_
c
t
=

2
c
x
2
on x (0, 1), t > 0,
c(0, t) = 1 t > 0,
c
x
(1, t) = 0 t > 0,
c(x, 0) = 0 on x (0, 1).
(5.48)
First we search a weak form for (5.48): Search c, c(0, t) = 1, c(x, 0) = 0,
1
_
0
c
t
vdx =
1
_
0

2
c
x
2
vdx v(0, t) = 0. (5.49)
To reduce the order of the derivative, we integrate by parts:
1
_
0
c
t
vdx =
_
c
x
v
_
1
0

1
_
0
c
x
v
x
dx =
1
_
0
c
x
v
x
dx, (5.50)
since v(0, t) = 0 and
c
x
(1, t) = 0. Then, we obtain the following weak form
_

_
Find c, subject to c(0, t) = 1, c(x, 0) = 0, such that
1
_
0
c
t
vdx =
1
_
0
c
x
v
x
dx v(0) = 0.
(5.51)
We solve (5.51) by use of the Galerkin FEM. Again, we use piecewise linear basis-functions

i
(x)
n
i=0
as before on the n gridnodes, with

i
(x
j
) =
_
1, j = i,
0, j ,= i.
(5.52)
Then, we approximate c(x, t) by
c
n
(x, t) =
n

j=0
c
j
(t)
j
(x) =
0
(x) +
n

j=1

j
(x)c
j
(t). (5.53)
48 Galerkins Finite Element Method
Note that c
j
should be functions of x and t since c(x, t) is a function of t and
j
(x) is a function
of x only. Substitution into (5.51) gives
_

_
Find c
i
(t)
n
i=1
such that
1
_
0
n

j=1
c

j
(t)
j
(x)
i
(x)dx
=
1
_
0
_
_
_

0
(x) +
n

j=1

j
(x)c
j
(t)
_
_
_

i
(x)dx i 1, . . . , n.
(5.54)
The above problem represents a system of linear ordinary dierential equations. Note that c

j
(t)
c
j
(t + t) c
j
(t)
t
.
We will deal with the solution of the time-dependent problem in the next chapter.
Exercise 5.6.1. Extend the above derivation to a boundary value problem with time-dependent
Robin boundary conditions imposed on the boundary x = 1 (cfr. Exercise 4.1.1)
5.7 The principle of element matrices and vectors
We briey treat the concept of element matrices, which is not a mathematical feature but only a
convenient programming trick. This trick is used in most of the implementations of Finite Elements
software.
For the treatment we treat a simple one-dimensional example:
_

_
u

= f,
u(0) = u
0
,
u

(1) = 0.
(5.55)
A weak form is then obtained by
u

v = fv
1
_
0
u

vdx =
1
_
0
fvdx

_
u

1
0
+
1
_
0
u

dx =
1
_
0
fvdx

1
_
0
u

dx =
1
_
0
fvdx. (5.56)
We use Galerkins method on n gridpoints for the unknowns:
u(x) =
n

j=1
u
j

j
(x) + u
0

0
(x). (5.57)
5.7 The principle of element matrices and vectors 49
Substitution into the weak form, with

j
(x
i
) =
_
1, j = i,
0, j ,= i,
(5.58)
piecewise linear, gives
1
_
0
n

j=0
u
j

j
(x)

i
(x)dx =
1
_
0
f(x)
i
(x)dx, i 1, . . . , n, (5.59)
or
n

j=1
u
j
1
_
0

j
(x)

i
(x)dx =
1
_
0
f(x)
i
(x)dx u
0
1
_
0

0
(x)

i
(x)dx i 1, . . . , n. (5.60)
In other words:
u
1
1
_
0

1
dx + u
2
1
_
0

1
dx + + u
n
1
_
0

1
dx =
1
_
0
f
1
u
0
1
_
0

1
dx,
u
1
1
_
0

2
dx + u
2
1
_
0

2
dx + + u
n
1
_
0

2
dx =
1
_
0
f
2
u
0
1
_
0

2
dx,
.
.
.
For simplicity we take n=3; then,
u
1
1
_
0

1
dx + u
2
1
_
0

1
dx + u
3
1
_
0

1
dx =
1
_
0
f
1
u
0
1
_
0

1
dx,
u
1
1
_
0

2
dx + u
2
1
_
0

2
dx + u
3
1
_
0

2
dx =
1
_
0
f
2
u
0
1
_
0

2
dx,
u
1
1
_
0

3
dx + u
2
1
_
0

3
dx + u
3
1
_
0

3
dx =
1
_
0
f
3
u
0
1
_
0

3
dx.
(5.61)
We take piecewise linear basis-functions. Note that we have
1
_
0

3
dx = 0 (the basis-functions are
called nearly orthogonal) for instance and that only contributions from neighbouring elements are
non-zero. Next, we will introduce the concept element as an interval between adjacent meshpoint:
e
i
:= [x
i1
, x
i
]. Hence, using the fact that the basis-functions are nearly orthogonal, we write the
50 Galerkins Finite Element Method
above equations as follows:
u
1
_
e
1
e
2

1
dx + u
2
_
e
2

2
dx =
_
e
1
e
2
f
1
dx u
0
_
e
1

1
dx,
u
1
_
e
2

1
dx + u
2
_
e
2
e
3

2
dx + u
3
_
e
3

3
dx =
_
e
2
e
3
f
2
dx,
u
2
_
e
3

3
dx + u
3
_
e
3

3
dx =
_
e
3
f
3
dx. (5.62)
Note further that
_

_
_
e
i
e
i+1

i
dx =
_
e
i

i
dx +
_
e
i+1

i
dx
_
e
i
e
i+1
f
i
dx =
_
e
i
f
i
dx +
_
e
i+1
f
i
dx
(5.63)
Now we show a computer procedure to generate the sti-ness matrix (discretization matrix) by use
of element-matrices: start with,
A
0
=
_
_
_
0 0 0
0 0 0
0 0 0
_
_
_
, (5.64)
we nish with
A =
_
_
_
_
_
_
_
e
1

1
+
_
e
2

1
_
e
2

2
0
_
e
2

1
_
e
2

2
+
_
e
3

2
_
e
3

3
0
_
e
3

3
_
e
3

3
_
_
_
_
_
_
. (5.65)
Now we introduce the concept of element-matrices:
s
e
i
=
_

_
_
e
i

i1

i1
dx
_
e
i

i1

i
dx
_
e
i

i1
dx
_
e
i

i
dx
_

_
. (5.66)
Contributions for essential boundary conditions do not occur in the stiness-matrix, hence for e
1
we obtain:
s
e
1
=
_
_
_
e
1

1
dx
_
_
, (5.67)
and for e
2
and e
3
:
s
e
2
=
_

_
_
e
2

1
dx
_
e
2

2
dx
_
e
2

1
dx
_
e
2

2
dx
_

_
, (5.68)
s
e
3
=
_

_
_
e
3

2
dx
_
e
3

3
dx
_
e
3

2
dx
_
e
3

3
dx
_

_
. (5.69)
5.7 The principle of element matrices and vectors 51
The matrices s
e
1
, s
e
2
and s
e
3
are the element-matrices of elements e
1
, e
2
and e
3
. We will put these
matrices into A
0
and add them to obtain A. The position of the element-matrices is such that
s
e
1
[1, 1] = A
0
[1, 1], hence:
A
1
=
_
_
_
_
_
e
1

1
dx 0 0
0 0 0
0 0 0
_
_
_
_
. (5.70)
Subsequently we add s
e
2
to A
1
such that s
e
2
[2, 2] = A
0
[2, 2]:
A
2
=
_
_
_
_
_
e
1

1
dx 0 0
0 0 0
0 0 0
_
_
_
_
+
_
_
_
_
_
_
e
2

1
dx
_
e
2

2
dx 0
_
e
2

1
dx
_
e
2

2
dx 0
0 0 0
_
_
_
_
_
=
_
_
_
_
_
_
e
1

1
dx +
_
e
2

1
dx
_
e
2

2
dx 0
_
e
2

1
dx
_
e
2

2
dx 0
0 0 0
_
_
_
_
_
. (5.71)
Subsequently we add s
e
3
to A
2
such that s
e
3
[2, 2] = A
0
[3, 3] to obtain A
3
:
A
3
=
_
_
_
_
_
_
e
1

1
dx +
_
e
2

1
dx
_
e
2

2
dx 0
_
e
2

1
dx
_
e
2

2
dx 0
0 0 0
_
_
_
_
_
+
_
_
_
_
_
0 0 0
0
_
e
3

2
dx
_
e
3

3
dx
0
_
e
3

2
dx
_
e
3

3
dx
_
_
_
_
_
=
_
_
_
_
_
_
_
e
1

1
dx +
_
e
2

1
dx
_
e
2

2
dx 0
_
e
2

1
dx
_
e
2

2
dx +
_
e
3

2
dx
_
e
3

3
dx
0
_
e
3

2
dx
_
e
3

3
dx
_
_
_
_
_
_
. (5.72)
Now, the stiness-matrix has been built. The same principle is carried out with the element-vectors
to generate the right-hand side vector. The same principle gives
f
e
i
=
_

_
_
e
i
f(x)
i1
(x)dx
_
e
i
f(x)
i
(x)dx
_

_
. (5.73)
This is called the element-vector of element e
i
.
f
e
1
=
_
_
_
e
1
f(x)
1
(x)dx
_
_
f
1
=
_
_
_
_
_
e
1
f(x)
1
(x)dx
0
0
_
_
_
_
. (5.74)
52 Galerkins Finite Element Method
subsequently
f
e
2
=
_

_
_
e
2
f(x)
1
(x)dx
_
e
2
f(x)
2
(x)dx
_

_
(5.75)
f
2
= f
1
+
_
_
_
_
_
_
e
2
f(x)
1
(x)dx
_
e
2
f(x)
2
(x)dx
0
_
_
_
_
_
(5.76)
=
_
_
_
_
_
_
e
1
f(x)
1
(x)dx +
_
e
2
f(x)
1
(x)dx
_
e
2
f(x)
2
(x)dx
0
_
_
_
_
_
. (5.77)
Subsequently
f
e
3
=
_

_
_
e
3
f(x)
2
(x)dx
_
e
3
f(x)
3
(x)dx
_

_
f
3
=
_
_
_
_
_
_
_
e
1
e
2
f(x)
1
(x)dx
_
e
2
e
3
f(x)
2
(x)dx
_
e
3
f(x)
3
(x)dx
_
_
_
_
_
_
. (5.78)
Now we have the right-handside if we take the essential condition into account for element e
1
:
_
u
0
_
e
1

1
dx
_
at f

3
, to obtain:
f =
_
_
_
_
_
_
_
e
1
e
2
f(x)
1
(x)dx u
0
_
e
1

1
dx
_
e
2
e
3
f(x)
2
(x)dx
_
e
3
f(x)
3
(x)dx
_
_
_
_
_
_
. (5.79)
The principle of element-matrices and vectors should be seen as a convenient programming trick.
This trick allows constitutes the gateway for the implementation of the nite element method for
problems with odd-shaped domains, local mesh renement, unstructured grids, jumps in coecients
or problems requiring the use of parallel computing.
5.8 Numerical integration
Consider the following weak form
Find u(x), subject to u(0) = u
0
, such that

1
_
0
u

(x)v

(x)dx =
1
_
0
f(x)v(x)dx v(0) = 0. (5.80)
5.9 Error considerations 53
Sometimes, the right-hand side contains a complicated integrand that cannot be integrated in
terms of an elementary function. Since one uses the concept of element vectors and element ma-
trices, one has to integrate the functions over an element. Many numerical integration methods
are available, such as the midpoint rule, the trapezoidal rule, the Simpson rule and so on. A very
common numerical integration rule based on the expression of a function in terms of a linear com-
bination of basis-function is the Newton-Cotes integration Rule. In this section, we will consider
Newton-Cotes integration with piecewise linear basis-functions. This rule is based on the following:
Consider a function g(x) to be integrated over an element e
i
:= [x
i1
, x
i
]:
_
e
i
g(x)dx, (5.81)
then we express g(x) as a linear combination of basis-functions with the characteristics as mentioned
before on the nodes x
i1
and x
i
:
g(x) g(x
i1
)
i1
(x) + g(x
i
)
i
(x). (5.82)
Then the integration over the interval zero-one, gives:
_
e
i
g(x)dx g(x
i1
)
_
e
i

i1
(x)dx + g(x
i
)
_
e
i

i
(x)dx =
g(x
i1
) + g(x
i
)
2
(x
i
x
i1
). (5.83)
Note that the above integration formula represents the Trapezoidal Rule for numerical integration.
The same is done with the right-hand of the above weak form:
_
e
i
f(x)
k
(x)dx
i

j=i1
f(x
j
)
k
(x
j
)
_
e
i

j
(x)dx =
1
2
f(x
k
)(x
k+1
x
k1
), (5.84)
for k i 1, i, note that
k
(x
i
) = 1 if i = k and else
k
(x
i
) = 0. This integration rule is easily
extended to more dimensional problems. This is beyond the scope of the present course. As an
alternative, Gauss integration formulas can be used. This is not treated in this course.
5.9 Error considerations
This section is not necessary to understand the implementation of the nite element method. It
is intended for the interested reader. The treatment of the error of the nite element solution will
not be mathematical, but it will give an idea of what the error is and what issues are important
for the derivation of the error. Suppose that we solve the equation in the following weak form of
Poissons equation
Find u H
1
(), subject to u = g on , such that
_

u d =
_

fd, for all H


1
().
(5.85)
To solve this problem using Galerkins method, we approximate the solution by u(x) u
h
(x) =

n
j=1
u
j

j
(x), where
j
(x) = 0 on . Here u(x) represents the exact solution and u
j
represents
54 Galerkins Finite Element Method
the approximate solution at the nodal points. For the approximate solution u
h
, we have
Find u
h
H
1
h
(), subject to u
h
= g on , such that
_

u
h

h
d =
_

h
fd, for all
h
H
1
h
(),
(5.86)
where H
1
h
() represents the set of solutions for the approximate solution u
h
. Note that H
1
h
()
H
1
(). Let u(x) be the approximate solution with the exact values of the solution u(x), that is
u(x) =
n

j=1
u(x
j
)
j
(x).
Note that the dierence between the exact solution u(x) and the above solution u(x) is only
determined by the interpolation method that is used. Then it can be proved (see Braess [1996] for
instance) that
_

[[(u u
h
[[
2
d
_

[[(u u)[[
2
d. (5.87)
The above integrals represent errors in the energy-norm. The left-hand side of the above inequality
gives the total error of the nite element solution with respect to the exact solution in the so-called
energy norm. This total error basically has two sources:
[1] A nite set of basis functions (based on the nite number of meshpoints) is chosen, and hence
the summation only concerns a nite number of terms;
[2] Using interpolation functions for the basis functions, this gives an interpolation error, which
depends on the order of the interpolation functions
j
(x).
The right-hand side of the above inequality only concerns the interpolation error. The inequality
(5.87) is very convenient since it says in the energy norm that the total error is bounded from above
by the interpolation error. This last mentioned error depends on the polynomial order. If linear
elements are used, then it can be demonstrated that the energy norm of the interpolational error
is of order O(h) where h represents the largest side of the element. The actual error u u
h
is one
order higher, that is O(h
2
). The reader should realize that many statements in this section have
been made while omitting some subtle mathematical issues.
As a rule of thumb, we use that if the interpolational error is of order O(h
p
), then the order
of the error, that is the dierence between the nite element solution and the exact solution is of
order O(h
p+1
). It should be mentioned that this fact only holds if the elements are not degenerate
(the vertices of the triangle are not located on a line in the case of triangular elements).
6
Time Dependent Problems: Numerical Methods
In many cases the mathematical models are time-dependent, by which we mean that their solution
depends on time. Typical examples are
c
t
+ q

c = c (convection-diusion) (6.1)
c
t
c = 0 (transient diusion) (6.2)

2
c
t
2
= c (wave transmission) (6.3)
c
t
+

x
f(c) = 0 (Buckley-Leverett in 2-plane ow) (6.4)
In this chapter we will treat some time-integration methods in relation to Finite Dirences and
Finite Elements. Important subjects will be consistency (convergence), accuracy and stability.
6.1 Time-integration methods
First we consider an ODE (Ordinary Dierential Equation) to illustrate some time-integration
methods. Subsequently, we will apply these methods to PDEs. Consider the following problem:
_
y(0) = y
0
t = 0,
y

(t) = f(y, t) t > 0.


(6.5)
Let T
end
be the end-time of the numerical simulation t =
T
end
m
, m= number of timesteps, then we
introduce the notation y
n
= y(t
n
) = y(nt) and u
n
for the exact solution evaluated in the discrete
time steps and its numerical approximation, respectively. At t = 0 the relation u
0
= y
0
holds. We
will formulate some classical time-integration methods:
56 Time Dependent Problems: Numerical Methods
[1] Eulers forward time integration method (explicit):
u
n+1
= u
n
+ tf(u
n
, t
n
) n 0 n 0, . . . , m1 (6.6)
[2] Heuns (or improved Eulers) time integration method
_
u
n+1
= u
n
+ tf(u
n
, t
n
) (predictor)
u
n+1
= u
n
+
t
2
_
f(u
n
, t
n
) + f( u
n+1
, t
n+1
)

(corrector)
(6.7)
[3] Eulers backward time integration method (implicit)
u
n+1
= u
n
+ tf(u
n+1
, t
n+1
) (6.8)
(Note that we have to solve a non-linear equation whenever f is non-linear in u)
[4] Crank-Nicholsons time integration method
u
n+1
= u
n
+
t
2
_
f(u
n
, t
n
) + f(u
n+1
, t
n+1
)

(6.9)
(Here again a non-linear problem has to be solved when f is nonlinear in u)
More methods for time-integration can be found in e.g. Burden and Faires [2001]; Vuik et al.
[2007]. The four methods listed are the most common and we will analyse them. We also note
that the modied Euler method falls within the class of the so-called multi-step methods (due
to Runge-Kutta). These methods can be adjusted such that always the desired accuracy can be
obtained.
6.2 Accuracy of time-integration methods
We rst analyse the local truncation error, i.e., the error made in a single time step, of the Eulers
forward method. Given, again
_
y(0) = y
0
t = 0,
y

(t) = f(y, t) t > 0,


(6.10)
then by Taylor series expansion
y
n+1
= y(t
n+1
)
= y(t
n
+ t)
= y(t
n
) + t y

(t
n
) +
t
2
2
y

(t
n
) +
t
3
6
y

(t
n
) +O(t
4
). (6.11)
To analyse the local truncation, we assume the computed solution u
n
at time step n has no error,
i.e., u
n
= y
n
. This implies that for the next time step
u
n+1
= u
n
+ t f(u
n
, t
n
) (Euler forward)
= y
n
+ t f(y
n
, t
n
) (u
n
= y
n
)
= y
n
+ t y

(t
n
) . (y

(t) = f(y, t) t > 0) (6.12)


6.2 Accuracy of time-integration methods 57
Subtracting (6.12) from equation (6.11) then yields
y
n+1
u
n+1
=
t
2
2
y

(t
n
) = O(t
2
). (6.13)
Herewith, the local truncation error at step n + 1 is given by:

n+1
(t) =
y
n+1
u
n+1
t
(6.14)
=
t
2
y

(t
n
) = O(t) (6.15)
where the factor 1/t in (6.14) is introduced to compensate for the fact that the scheme (6.6)
integrated the ODE times t. Hence the local truncation error for the Eulers forward method is
order of t. Similar analysis shows that the local truncation error for the Eulers backward method
is also order of t.
Next we analyse the modied Euler method:
_

_
u
n+1
= u
n
+ tf(u
n
, t
n
),
u
n+1
= u
n
+
t
2
_
f(u
n
, t
n
) + f( u
n+1
, t
n+1
)

= u
n
+
t
2
[f(u
n
, t
n
)] +
t
2
[f(u
n
+ t f(u
n
, t
n
), t
n
+ t)]
(6.16)
By expanding f in a rst order Taylor sequence in both arguments, the last term in the right-hand
side of the above expression can be written as
f(u
n
+ t f(u
n
, t
n
), t
n
+ t) = f(u
n
, t
n
) + t f(u
n
, t
n
)
f
u
(u
n
, t
n
)
+t
f
t
(u
n
, t
n
) +O(t
2
) (6.17)
After collecting terms in f(u
n
, t
n
), u
n+1
can then be written as
u
n+1
= u
n
+ tf(u
n
, t
n
) +
t
2
2
f
u
(u
n
, t
n
)f(u
n
, t
n
) +
t
2
2
f
t
(u
n
, t
n
)
+O(t
3
) (6.18)
As before, we investigate the error made in a single time step and assume that u
n
= y
n
. This
implies that (6.18) reduces
u
n+1
= y
n
+ tf(y
n
, t
n
) +
t
2
2
f
y
(y
n
, t
n
)f(y
n
, t
n
) +
t
2
2
f
t
(y
n
, t
n
)
+O(t
3
) (6.19)
from which f can be eliminated using
f(y
n
, t
n
) = y

(t
n
)
f
y
(y
n
, t
n
)f(y
n
, t
n
) +
f
t
(y
n
, t
n
) =
f
y
(y
n
, t
n
) y

(t
n
) +
f
t
(y
n
, t
n
)
=
df
dt
(y
n
, t
n
) (chain rule)
= y

(t
n
) (6.20)
58 Time Dependent Problems: Numerical Methods
resulting in
u
n+1
= y
n
+ t y

(t
n
) +
t
2
2
y

(t
n
) +O(t
3
) . (6.21)
Herewith, the local truncation error is given by:

n+1
(t) =
y
n+1
u
n+1
t
= O(t
2
). (6.22)
Hence the Modied Euler method has a local truncation error of order t
2
.
Exercise 6.2.1. Use an analysis as above to show that the local truncation error of the Crank-
Nicholson scheme is O(t
2
).
Next we analyse the global error, i.e, the error accumulated by integrating from t = 0 to t = T
end
.
This error is computed by summing up the contributions y
n
u
n
at each time step. If the interval
[0, T
end
] is divided into m steps, then m = T
end
/t = O(t
1
). If therefore the local contribution
y
n
u
n
is O(t
2
) (Eulers forward or backward) and O(t
3
) (Modied Euler or Crank-Nicolson),
then the global error is O(t) (Eulers forward or backward) and O(t
2
) (Modied Euler or
Crank-Nicholson).
6.3 Time-integration of PDEs
The time integration method for PDEs is analogous to ODEs. Suppose that the following problem
is given:
_

_
u
t
= /(u),
u(x, 0) = u
0
,
with appropriate (BC),
, (6.23)
where /(u) represents a linear space dierential operator; example:
/(u) = u (diusion), or, (6.24)
/(u) = u q

u (convection-dion). (6.25)
and so on... (6.26)
The time discretization part
u
t
is done (for instance) by:
u
t
=
u
n+1
i,j
u
n
i,j
t
, (6.27)
where u
n
i,j
denotes u(x
i
, y
j
, t
n
). Then we give the following example:
_

_
u
n+1
i,j
= u
n
i,j
+ t/(u
n
) Forward( Explicit) Euler,
u
n+1
i,j
= u
n
i,j
+ t/(u
n+1
) Backward (Implicit) Euler,
u
n+1
i,j
= u
n
i,j
+
t
2
_
/(u
n+1
) +/(u
n
)
_
Crank-Nicholson,
_
u
n+1
i,j
= u
n
i,j
+ t/(u
n
) Modied Euler (predictor-corrector),
u
n+1
i,j
= u
n
i,j
+
t
2
_
/(u
n
) +/( u
n+1
)
_
.
(6.28)
6.3 Time-integration of PDEs 59
The global errors are O(t), O(t), O(t
2
) and O(t
2
), respectively. This can be shown by
the use of similar procedures as in Section 6.2. Now we consider the application to a diusion
equation as our example. We will illustrate the use of nite dierences and nite ements for a
one-dimensional diusion problem and a 1-dimensional wave equation.
6.3.1 The heat equation
We consider the discretization of the heat equation
u
t
=

2
u
x
2
, 0 < x < 1, t > 0
+ Dirichlet boundary conditions + initial condition.
(6.29)
[1] Finite Dierences
u
t
=
u
i+1
2u
i
+ u
i1
x
2
, (6.30)
u
n+1
i
u
n
i
t
=
u
n
i+1
2u
n
i
+ u
n
i1
x
2
(Forward Euler), (6.31)
u
n+1
i
u
n
i
t
=
u
n+1
i+1
2u
n+1
i
+ u
n+1
i1
x
2
(Backward Euler). (6.32)
[2] Finite Elements for (6.29) Weak form:
_

u
t
vdx =
_

2
u
x
2
vdx =
_

u
x
v
x
dx, (6.33)
where we took v [

= 0. Find u, subject to u(0) = u


0
, u(1) = u
1
, such that
1
_
0
u
t
vdx =
1
_
0
u
x
v
x
dx v(0) = 0 = v(1) , (6.34)
provided that the above integral exist. Further take basis-functions (piecewise linear),
i
(0) =
0 =
i
(1) for i 1, . . . , m1,
u(x, t) =
m1

j=1
[c
j
(t)
j
(x)] + u
0

0
(x) + u
1

m
(x). (6.35)
Take for simplicity u
0
= 0 = u
1
then
m1

j=1
c

j
(t)
1
_
0

j
(x)
i
(x)dx =
m1

j=1
c
j
(t)
1
_
0

j
(x)

i
(x)dx i 1, . . . , m1. (6.36)
For forward Euler, one obtains:
m1

j=1
c
n+1
j
c
n
j
t
1
_
0

j
(x)
i
(x)dx =
m1

j=1
c
n
j
1
_
0

j
(x)

i
(x)dx i 1, . . . , m1, (6.37)
60 Time Dependent Problems: Numerical Methods
where we call M
ij
=
1
_
0

i
(x)
j
(x)dx the entries of the mass-matrix and S
ij
=
1
_
0

i
(x)

j
(x)dx
the entries of the stines-matrix. Elementwise, we obtain for i 1, .., m1
c
n+1
i1
c
n
i1
t
_
e
i

i1
dx +
c
n+1
i
c
n
i
t
_
e
i
e
i+1
(
i
)
2
dx +
c
n+1
i+1
c
n
i+1
t
_
e
i+1

i+1
dx
= c
n
i1
_
e
i

i1
dx c
n
i
_
e
i
e
i+1

i
dx c
n
i+1
_
e
i+1

i+1
dx.
(6.38)
All the integrals can be computed. The discretization method for FEM looks very dierent. For
the case of an equidistant grid, it can be shown that the result becomes identical to the nite
dierence (and nite volume) method. For backward Euler, one obtains similarly:
c
n+1
i1
c
n
i1
t
_
e
i

i1
dx +
c
n+1
i
c
n
i
t
_
e
i
e
i+1
(
i
)
2
dx +
c
n+1
i+1
c
n
i+1
t
_
e
i+1

i+1
dx
= c
n+1
i1
_
e
i

i1
dx c
n+1
i
_
e
i
e
i+1

i
dx c
n+1
i+1
_
e
i+1

i+1
dx
for i 1, .., m1. (6.39)
All these expressions can be adjusted to Crank-Nicholson or a two-step method (Runge-Kutta 2 or
Modied Euler). Later we will consider the stability of numerical methods.
We remark further that the above nite element discretization of the heat problem can be written
in matrix-form as
M
dc
dt
= Sc, (6.40)
where M
ij
=
1
_
0

i
(x)
j
(x)dx, S
ij
=
1
_
0

i
(x)

j
(x)dx and c = [c
1
. . . c
n
]
T
. Of course, the Euler,
modied Euler etc. can be written similarly as before. As an example the Euler-forward time
integration method can be written by:
Mc
n+1
= Mc
n
+ tSc
n
. (6.41)
For the case that M is not a diagonal matrix, a linear system of equations has to be solved also for
the Euler-forward method.
Exercise 6.3.1. Write down the corresponding time-integration methods for the backward Euler,
Modied Euler and Crank-Nicholson methods.
6.3 Time-integration of PDEs 61
6.3.2 The wave equation
We consider the discretization of the wave equation

2
u
t
2
= c
2

2
u
x
2
, 0 < x < 1, t > 0,
+ Dirichlet boundary conditions + initial conditions for u and u
t
.
(6.42)
Here c represents the given wave-speed, which is assumed to be constant in the text. The weak
form of the above equation is obtained after multiplication by a test-function, to obtain
_

2
u
t
2
vdx = c
2
_

2
u
x
2
vdx = c
2
_

u
x
v
x
dx, (6.43)
where we took v [

= 0. Find u, subject to u(0) = u


0
, u(1) = u
1
, such that
1
_
0

2
u
t
2
vdx = c
2
1
_
0
u
x
v
x
dx v(0) = 0 = v(1) , (6.44)
provided that the above integrals exist. Further take basis-functions (piecewise linear),
i
(0) = 0 =

i
(1) for i 1, . . . , m1,
u(x, t) =
m1

j=1
[c
j
(t)
j
(x)] + u
0

0
(x) + u
1

m
(x). (6.45)
Take for simplicity u
0
= 0 = u
1
then
m1

j=1
c

j
(t)
1
_
0

j
(x)
i
(x)dx = c
2
m1

j=1
c
j
(t)
1
_
0

j
(x)

i
(x)dx i 1, . . . , m1. (6.46)
where we call M
ij
=
1
_
0

i
(x)
j
(x)dx the entries of the mass-matrix and S
ij
=
1
_
0

i
(x)

j
(x)dx the
entries of the stines-matrix. Hence, we obtain
M
d
2
c
dt
2
= c
2
Sc, (6.47)
One possibility to integrate the above equation in time is to write it as system of rst-order dier-
ential equations in time for c and w:
dc
dt
= w,
M
dw
dt
2
= c
2
Sc,
with initial conditions for c and w.
(6.48)
62 Time Dependent Problems: Numerical Methods
Now, we can apply the Forward Euler method to the above problem:
c
n+1
= c
n
+ tw
n
;
Mw
n+1
= Mw
n
+ tc
2
Sc
n
.
(6.49)
Exercise 6.3.2. Write down the corresponding time-integration methods for the backward Euler,
Modied Euler and Crank-Nicholson methods.
Exercise 6.3.3. In case of an uniform grid, compute all integrals and show that the FEM and
nite dierence discretization do coincide.
It can be shown that the numerical integration of the above equation gives rise to dissipation (c
n
0
as n ). The amount of dissipation can be decreased when a Runge-Kutta method is used.
Further one can use a direct time-integration of the second-order system of dierential equations.
This is not treated any further.
6.4 Stability analysis
In general after discretization we obtain a system of ordinary dierential equation in the form
M
du
dt
= Su
du
dt
= M
1
Su. (6.50)
For the stability the eigenvalues of the above matrix M
1
S are crucial. First, for the analytical
asymptotic stability we require
(M
1
S) < 0, and if / R we have 1(M
1
S) < 0. (6.51)
Exercise 6.4.1. Derive stability criteria for the eigenvalues of M
1
S for the Forward Euler,
Modied Euler, Backward Euler and Trapezoidal time integration methods.
Hence, it is crucially important to have some knowledge on the eigenvalues of the matrix M
1
S. For
large matrices it is not easy to compute the eigenvalues. Fortunately, Gershgorins Theorem gives a
often very usefull estimate of the eigenvalues. For many cases the mass matrix M is diagonal as a re-
sult of numerical integration by use of the Rule of Newton-Cotes. This is commonly called lumping.
Exercise 6.4.2. Show by the numerical integration of Newton-Cotes that
m
ji
=
_
1
0

i
(x)
j
(x)dx =
_

_
x
i+1
x
i1
2
, if j = i,
0, else.
(6.52)
6.4 Stability analysis 63
For this case the Theorem reads as follows:
Theorem 6.4.1. Let M be diagonal, then, for all eigenvalues of M
1
S holds:
[[ sup
k
1
[m
kk
[
n

i=1
[s
ki
[. (6.53)
Note that the eigenvalues may be complex if S is not symmetric. Then the areas in which the eigen-
values are allowed to be in, consist of circles in the complex plane.
Proof 6.4.1. Let be an eigenvalue of the generalized eigenvalue problem with correspoding eigen-
vector v, then,
Sv = Mv. (6.54)
This immplies that for each component k:
n

i=1
s
ki
v
i
= m
kk
v
k
. (6.55)
Let v
j
be the component of v with the largest modulus, then, we have for this index j:
=
1
m
jj
n

i=1
s
ji
v
i
v
j
, (6.56)
and since [v
i
/v
j
[ 1, we get
[[
1
[m
kk
[
n

i=1
[s
ki
[. (6.57)
This proves the assertion.
We illustrate the use of Gershgorins Theorem by the following example.
Example: Suppose we use Finite Dierences, then M = I. Let h be the stepsize and t be the
time-step. Further in one dimension, we have s
ii
= 2/h
2
and s
ii1
= 1/h
2
= s
ii+1
. From this, we
obtain 4/h
2
. Hence we obtain for the Forward Euler method: t h
2
/2.
The analysis of stability of time-integration methods for Partial Dierential Equations can also be
done by the use of the Von Neumann analysis, which is based on Fourier analysis. This is omitted
in the present course.
64 Time Dependent Problems: Numerical Methods
Bibliography
M. Ainsworth and J.T. Oden. A posteriori error estimation in nite element analysis. Pure and
applied mathematics. John Wiley, 2000. ISBN 9780471294115.
U.M. Ascher and L.R. Petzold. Computer methods for ordinary dierential equations and
dierential-algebraic equations. Miscellaneous Titles in Applied Mathematics Series. Society for
Industrial and Applied Mathematics, 1998. ISBN 9780898714128.
K. E. Atkinson and W. Han. Theoretical Numerical Analysis: A Functional Analysis Framwork.
Number 39 in Texts in Applied Mathematics. Springer, second edition, 2005.
D. Braess. Finite Elements. Cambridge University Press, 1996.
S. C. Brenner and L. R. Scott. The Mathematical Theory of Finite Element Method, volume 15 of
Texts in Applied Mathematics. Springer, third edition, 2008.
R.L. Burden and J.D. Faires. Numerical Analysis. Brooks-Cole publishing company, seventh
edition, 2001.
C. Cuvelier, A. Segal, and A.A. van Steenhoven. Finite Element Methods and Navier-Stokes Equa-
tions. D. Reidel Publising Company, Dordrecht, 1986.
J. E. Dennis Jr. and R. B. Schnabel. Numerical Methods for Unconstrained Optimization and
Nonlinear Equations, volume 16 of Classics in Applied Mathematics. SIAM, Philadelphia, PA,
1996.
K. Eriksson, D. Estep, P. Hansbo, and C. Johnson. Computational Dierential Equations. The
Press Syndicate of the University of Cambridge, 1996.
L.C. Evans. Partial Dierential Equations. AMS, third edition edition, 1999.
M. Farrashkhalvat and J. P Miles. Basic Structured Grid Generation with Introduction to Unstruc-
tured Grid Generation. Butterworth-Heinemann, 2003.
P. J. Frey and P. L. George. Mesh Generation. Hermes Science Publishing, Oxford, 2000.
66 Bibliography
G.H. Golub and C.F. Van Loan. Matrix computations. Johns Hopkins University Press, Baltimore,
third edition, 1996.
C. T. Kelley. Iteratieve Methods for Linear and Nonlinear Equations, volume 16 of Frontiers in
Applied Mathematics. SIAM, Philadelphia, PA, 1995. ISBN 0-89871-352-8.
E. Kreyszig. Introductory functional analysis with applications. Wiley, New York, 1989.
V. D. Liseikin. Grid Generation Methods. Springer-Verlag, Berlin, 2010.
K. W. Morton and D. F. Mayers. Numerical Solution of Partial Dierential Equations. Cambridge
University Press, 1994. ISBN 0-521-42922-6.
A. Quarteroni and A. Valli. Numerical Approximation of Partial Dierential Equations. Springer-
Verlag, Berlin, 1994.
Y. Saad. Iterative Methods for Sparse Linear Systems. PWS Publishing Company, Boston, MA,
1996. ISBN 0-534-94776-X.
B. F. Smith, P. O. Bjrstad, and W. D. Gropp. Domain Decompostion: Parallel Multilevel Methods
for Elliptic Partial Dierential Equations. Cambridge University Press, 1996.
G. Strang and G.J. Fix. An analysis of the Finite Element Method. Prentice-Hall Series, Englewood
Clis, N.J, 1973.
U. Trottenberg, C. Oosterlee, and A. Sch uller. Multigrid. Academic Press, San Diego, 2001.
H. A. van der Vorst. Iterative Krylov Methods for Large Linear Systems, volume 13 of Cambridge
Monographs on Applied and Computational Mathematics. Cambridge University Press, 2003.
J. van Kan, A. Segal, and F.J. Vermolen. Numerical methods in scientic computing. Delftse
Uitgevers Maatschappij, 2006.
C. Vuik, P. van Beek, F. Vermolen, and J. van Kan. Numerical Methods for Ordinary Dierential
Equations. Delftse Uitgevers Maatschappij, 2007.
O. C. Zienkiewics and R. L. Taylor. The Finite Element Method: Volume 1 The Basics.
Butterworth-Heinemann, fth edition edition, 2000a.
O. C. Zienkiewics and R. L. Taylor. The Finite Element Method: Volume 2 Solid Mechanics.
Butterworth-Heinemann, fth edition edition, 2000b.

You might also like