You are on page 1of 22

Finite element method

Origins: structural mechanics, calculus of variations for elliptic BVPs


Boundary value problem

Lu = f
in

u=g
on 0
0

n u = g1
on 1

n u + u = g on
2

Minimization problem

Given a functional J : V R
find u V such that
J(u) J(w),

w V

subject to the imposed BC

the functional contains derivatives of lower order


solutions from a broader class of functions are admissible
boundary conditions for complex domains can be handled easily
sometimes there is no functional associated with the original BVP
Modern FEM: weighted residuals formulation (weak form of the PDE)

Theory: 1D minimization problem


Minimize

J(w) =

R x1
x0


x, w, dw
dx dx

over

w V = C 2 ([x0 , x1 ])

subject to the boundary condition w(x0 ) = g0


w

Find u V such that J(u) J(w) for all admissible w


w(x) = u(x) + v(x),
Z
J(u + v) =

R, v V0 = {v V : v(x0 ) = 0}


x1
du
dv
x, u + v,
dx = I()
+
dx
dx
x0

By construction

w(x) = u(x)

I(0) I(),

for = 0

Necessary condition of an extremum




d
def
J(u, v) =
= 0,
J(u + v)
d
=0

so that

dI
= 0,
d =0

v V0

u +v
u

x0

v V0

the first variation of the


functional must vanish

x1

Necessary condition of an extremum


Chain rule for the function
d
d

dx
x d

dw
w d

= (x, w, w ),

dw
w d ,

where

w =
dx
d

dw
dx

= 0,

dw
d

dw
d

= v,

First variation of the functional




Z x1 

dv
d

=
dx = 0,
J(u + v)
v+
dx
d
w
w
x0
=0

v V0

Integration by parts using the boundary condition v(x0 ) = 0 yields




Z x1 

v
dx
+

(x1 )v(x1 ) = 0,
v V0

w
dx
w
w
x0



d
including v V = {v V0 : v(x1 ) = 0} w dx w = 0
Substitution

w (x1 )

v(x1 ) = 0,
| {z }

arbitrary

v V0

w (x1 )

=0

dv
dx

Du Bois Reymond lemma


Lemma.
Z

Let f C([a, b]) be a continuous function and assume that


b

f (x)v(x) dx = 0,

v V = {v C 2 ([a, b]) : v(a) = v(b) = 0}

Then

f (x) = 0,

x [a, b].

Proof. Suppose x0 (a, b) such that f (x0 ) 6= 0,


f is continuous

Let v(x) =

v V

but

f (x) = 0,

exp
0
Rb
a

f (x) > 0,

1
2 (xx
2
0)

f (x)v(x) dx =

x (a, b)

e.g. f (x0 ) > 0

x (x0 , x0 + ) (a, b)


if |x x0 | <
if |x x0 |

R x0 +
x0

f (x) exp

f C([a, b])

x0

1
2 (xx
2
0)

f 0

x0

x0

dx > 0

in [a, b]

Example: 1D Poisson equation


Constraints imposed on the solution w = u of the minimization problem



Euler-Lagrange equation

w dx w = 0

u(x0 ) = g0

essential boundary condition

w (x1 )

natural boundary condition

=0

u Vg = {v C 2 ([0, 1]) : v(0) = g0 }


#
2
Z 1" 
1 dw
J(w) =
f w dx, w Vg
2
dx
0

Poisson equation: the solution


minimizes the functional
1
(x, w, w ) =
2

dw

=
,
w
dx

dw
dx

2

d
dx

f w,

= f
w
d2 w
=
dx2

d2 u

in (0, 1)

dx2 = f

u(0) = g0 Dirichlet BC

du
dx (1) = 0 Neumann BC

Example: 2D Poisson equation


: v| = g0 } that minimizes the functional
Find u Vg = {v C 2 () C()
0
J(w) =

Z 

where


Z
Z
Z
1

g2 w ds +
g1 w ds
w2 ds,
|w|2 f w dx
2
2 2
2
1

f = f (x),

g0 = g0 (x),

Admissible functions

g1 = g1 (x),

w = u + v,

2
|w|


w 2
x

[u v f v] dx

w
y

2 

: v| = 0}
v V0 = {v C 2 () C()
0
d
d J(u

Necessary condition of an extremum




g2 = g2 (x),

w Vg

=2

g1 v ds


+ v) =0 = 0,

w v
x x

w v
y y

g2 v ds +

v V0

= 2w v

uv ds = 0,

v V0

Example: 2D Poisson equation


Integration by parts using Greens formula
Z
Z
Z
[u f ]v dx +
(n u)v ds

1 2

g1 v ds

: v| = 0
v V0 including v C 2 () C()

g2 v ds +

uv ds = 0

[u f ]v dx = 0

Du Bois Reymond lemma: u = f in


Euler-Lagrange equation
Z
Z
[n u g1 ]v ds +
[n u + u g2 ]v ds = 0, v V0
1

= 0, n u + u = g2
Consider v C () C() : v|0 1 = 0
2
R
= 0, n u = g1 and the following BVP
Substitution yields
1

u = f
in
2D Poisson equation

u=g
on 0
Dirichlet BC (essential)
0

n u = g1
on 1
Neumann BC (natural)

n u + u = g on
Robin BC (natural)
2

Rayleigh-Ritz method
Approximate solution

Exact solution
uV :

u = 0 +

cj j

uh Vh :

uh = 0 +

j=1

0
j

N
X

cj j

j=1

an arbitrary function satisfying 0 = g0 on 0


basis functions vanishing on the boundary part 0
Discrete problem

Continuous problem
Find u V such that

Find uh Vh such that

J(u) J(w),

J(uh ) J(wh ),

w V

J(c1 , . . . , cN ) = min J(wh )


wh Vh

Linear system:

Ac = b,

A RN N ,

J
= 0,
ci
b RN ,

wh Vh

i = 1, . . . , N
c = [c1 , . . . , cN ]T

Example: 1D Poisson equation


Find the coefficients c1 , . . . , cN that minimize the functional
#
2
Z 1" 
N
X
1 dwh
J(wh ) =
f wh dx,
wh =
cj j
2
dx
0
j=1

Necessary condition of an extremum

Z 1
Z
N
N
X
J
1 1 X dj

cj j dx = 0
dx
f
cj
=

ci
ci 2 0
dx
0
j=1
j=1
Z

Z 1
N
di X dj
cj
dx =
f i dx,
dx j=1 dx
0

i = 1, . . . , N

This is a linear system of the form Ac = b with coefficients


aij =

di dj
dx,
dx dx

bi =

f i dx,

c = [c1 , . . . , cN ]T

Example: poor choice of the basis functions


Consider the polynomial basis
uh (x) =

N
X

cj x ,

j=1

A=

1 4/3

6/4

1 6/4

9/5

1 8/5

12/6

0 = 0,
Z

i = xi ,

i = 1, . . . , N

ij
aij =
ij xi+j2 dx =
,
i
+
j

1
0

8/5 2N/(N + 1)

12/6 3N/(N + 2)

, b =

16/7 4N/(N + 3)

N 2 /(2N 1)

bi =

f xi dx

b1

b2

b3

,
b4

bN

c=

c1

c2

c3

c4

cN

A is known as the Hilbert matrix which is SPD but full and ill-conditioned
so that the solution is expensive and corrupted by round-off errors.
for A to be sparse, the basis functions should have a compact support

Fundamentals of the FEM


The Finite Element Method is a systematic approach to generating
piecewise-polynomial basis functions with favorable properties
The computational domain is subdivided into many
=S
small subdomains K called elements:
KTh K.
The triangulation Th is admissible if the intersection of
any two elements is either an empty set or a common
vertex / edge / face of the mesh.

Figure
Two nodal
functions for the polygonal
domain example
The finite element subspace
Vh4:consists
of basis
piecewise-polynomial
functions.
Typically, Vh = {v C m () : v|K Pk , K Th }.
comprising the right hand side as well as the entries

Any function v Vh is uniquely determined by Za finite number of degrees


a = a( ;at )certain
= rpoints
 r dx;
i; jnodes).
= 1; : : : N;
of freedom (function values or derivatives
called

i;j

(12)

of the
element system
matrixone
A. degree
This is where
the advantage
Each basis function
i nite
accommodates
exactly
of freedom
and of the nodal basis
function
becomes
apparent: the
above integrals
reduce to integrals over supp( ) in the
has a small support
so that
the resulting
matrices
are sparse.
i

rst case and supp( ) \ supp( ) in the second. The supports of two nodal basis functions
for linear triangles consists of all those triangles of which the corresponding node is a
vertex. The supports of two basis functions in our example are shown in Figure 5.
i

Finite element approximation


The finite element is a triple (K, P, ), where

K is a closed subset of
P is the polynomial space for the shape functions
is the set of local degrees of freedom
Basis functions possess the property

1 if i = j
j (xi ) = ij =
0 if i 6= j
uh (x) =

N
X
j=1

uj j (x)

x i1

x0

uh (xi ) =

N
X
j=1

xi

uj j (xi ) =

x i+1

N
X

xN

uj ij = ui

j=1

Approximate solution: the nodal values u1 , . . . , uN can be computed by the


Ritz method provided that there exists an equivalent minimization problem

Example: 1D Poisson equation


Find the nodal values u1 , . . . , uN that minimize the functional
#
2
Z 1" 
N
X
1 dwh
J(wh ) =
f wh dx,
wh =
u j j
2
dx
0
j=1
'

Local basis functions for ei = [xi1 , xi ]


i1 (x) =

xi x
,
xi xi1

i (x) =

Approximate solution for x ei


uh (x)

'

x xi1
xi xi1
x

N
X

u1

ui 1

uN 1 uN

uj j = ui1 i1 + ui i
0

j=1

= ui1 +

x xi1
(ui ui1 )
xi xi1

x0

x1

xi 1

xi

xi+1

xN 1 xN

ui+1

continuous, piecewise-linear

Example: 1D Poisson equation


The Ritz method yields a linear system of the form Au = F , where
aij =

N Z
X

k=1

ek

di dj
dx,
dx dx

Fi =

N Z
X

k=1

f i dx

ek

These integrals can be evaluated exactly or numerically (using a quadrature rule)


Stiffness matrix and load vector for a uniform mesh with x = N1 and f 1

2 1
1

2 1

A=
,
F =

2
(x)

1
2 1

1
1
1
1/2
This is the same linear system as the one obtained for the finite difference method!

Existence of a minimization problem


Sufficient conditions for an elliptic PDE

Lu = f

in ,

u| = 0

to be the Euler-Lagrange equation of a variational problem read


the operator L is linear
the operator L is self-adjoint (symmetric)
R
R
vLu
dx
=
uLv dx
for all admissible u, v

the operator L is positive definite


R

uLu dx 0 for all admissible u;

u0

if

uLu dx = 0

In this case, the unique solution u minimizes the functional


Z
Z
1
wLw dx
f w dx
J(w) =
2

over the set of admissible functions. Non-homogeneous BC modify this set


and/or give rise to additional terms in the functional to be minimized

Example: 1D Poisson equation


Laplace operator
Z

d
L = dx
2

vLu dx

is linear and self-adjoint


Z

du
dx

d u
v dx =
dx2

u 0 since u(0) = 0

Functional for the minimization problem


#
2
Z 1" 
1 dw
J(w) =
f w dx,
2
dx
0
du
dx (1)

= g1

1

du dv
du
dx
v
dx
dx
dx
0
0
0
1 Z 1

Z 1 2
dv
d v
=
=
u 2 dx + u
uLv dx
dx
dx
0
0
0
R 1 du 2
R 1 d2 u
R1
uLu dx = 0 u dx2 dx = 0 dx dx 0
0
=

Positive-definiteness:
2
R1
If 0 du
dx = 0 then
dx

Non-homogeneous BC

w(0) = 0

u(0) = g0 w(0) = g0
(essential)
i
R 1 h 1 dw 2
J(w) = 0 2 dx f w dx g1 w(1) (natural)

Least-squares method
Idea: minimize the residual of the PDE
R(w) = Lw f
Least-squares functional

such that
J(w) =

R(u) = 0

(Lw f )2 dx

Lu = f
always exists

Necessary condition of an extremum



Z


d
d
J(u + v)
=
(L(u + v) f )2 dx
=0
d
d

=0
=0

Integration by parts:

Euler-Lagrange equation

(Lu f )Lv dx =

L Lu = L f

L (Lu f )v dx

[. . .] ds = 0

where L is the adjoint operator

corresponds to a derivative of the original PDE


requires additional boundary conditions and extra smoothness
it makes sense to rewrite a high-order PDE as a first-order system
Advantage: the matrices for a least-squares discretization are symmetric

Weighted residuals formulation


Idea: render the residual orthogonal to a space of test functions

Lu = f in

P
j j V0 be the solution of
Let u =
u=0
j=1
on

Residual is zero if its projection onto each basis function equals zero
Lu f = 0

Test functions

v=

j j

(Lu f )i dx = 0

j=1

(Lu f )v dx = 0,

Weak formulation: find u V0 such that


where a(u, v) =

i = 1, 2, . . .

a(u, v) = l(v)

Lu v dx is a bilinear form and l(v) =

Integration by parts: Lu = g(u)

v V0

a(u, v) =

v V0

f v dx

g(u) v dx

Finite element discretization


Continuous problem

Discrete problem

Find u V0 such that

Find uh Vh V0 such that

a(u, v) = l(v),

a(uh , vh ) = l(vh ),

v V0

FEM approximations:

uh =

N
X

u j j V h ,

vh =

j=1

N
X

vh Vh

vj j Vh

j=1

where Vh = span{1 , . . . , N } and Vh = span{1 , . . . , N } may differ


(Bubnov-)Galerkin method

Vh = Vh

a(u, i ) = l(i ),

i = i

Petrov-Galerkin method

Vh 6= Vh

a(u, i ) = l(i ),

i 6= i

Linear algebraic system

N
X

a(j , i )uj = l(i ),

i = 1, . . . , N

j=1

Matrix form

Au = F

with coefficients

aij = a(j , i ),

Fi = l(i )

Example: 1D Poisson equation


Boundary value problem

d2 u = f in (0, 1)
dx2
u(0) = 0, du (1) = 0
dx

Weak formulation
u V0

Z 1 2
d u
2 f v dx = 0, v V0
dx
0

Integration by parts yields


1

Z 1 2
Z 1
d u
du dv
du

v dx =
dx
v
2
dx
dx
dx
dx
0
0
0
Continuous problem

a(u, v) = l(v),

Discrete problem

a(uh , i ) = l(i ),

Approximate solution
uh (x) =

N
X

uj j (x)

j=1

a(u, v) =

R1

du dv
0 dx dx

i = 1, . . . , N

dx,

l(v) =

R1
0

f v dx

(Galerkin method)

This is a (sparse) linear system of the form Au = F , where


aij =

di dj
dx,
dx dx

Fi =

f i dx,

u = [u1 , . . . , uN ]T

The Galerkin and Ritz methods are equivalent if the minimization problem exists

Example: 2D Poisson equation


Boundary value problem

u = f
in

u=g
on 0
0

n u = g1
on 1

n u + u = g on
2

Weak formulation
u Vg
Z
[u f ]v dx = 0, v V0

Vg = {v V : v|0 = g0 }
V0 = {v V : v|0 = 0}

Integration by parts using Greens formula


Z
Z
Z
u v dx (n u)v ds =
f v dx,

= 0 1 2

(n u)v ds = 0 since v = 0 on 0
Boundary conditions
0
R
R
R
R
R
(n u)v ds = 1 g1 v ds,
(n u)v ds = 2 g2 v ds 2 uv ds
1
2
Approximate solution

uh (x) = 0 +

N
P

j=1

uj j (x),

0 |0 = g0

Example: 2D Poisson equation


R
R
a(u, v) = l(v) + 1 g1 v ds + 2 g2 v ds, v V0
Z
Z
Z
a(u, v) =
u v dx +
uv ds,
l(v) =
f v dx

Continuous problem

Discrete problem

a(uh , i ) = l(i ) +

Piecewise-linear basis functions


satisfying

i (xj ) = ij ,

g1 i ds +

i C(),

g2 i ds,

i = 1, . . . , N

i |K P1 , K Th

i, j = 1, . . . , N

Linear system Au = F where


Z
Z
aij =
i j dx +
ui ds

2
Z
Z
Z
Fi =
f i dx +
g1 i ds +
g2 i ds

The matrix A is SPD, sparse and banded for a proper node numbering

Figure 4: Two nodal basis functions for the pol

comprising the right hand side as well as the entries

You might also like