Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

Lehrstuhl Informatik V

Scientific Computing I
Module 7: An Introduction to Finite Element Methods
Tobias Neckel
Winter 2015/2016

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Part I: Introduction to Finite Element Methods


The Model Problem
FEM Main Ingredients
Weak Forms and Weak Solutions
Test and Shape Functions
Assembling the System of Equations
Example Problem: 1D Poisson
Stiffness Matrix for Linear Nodal Basis Functions
A Road to Theory
Time-Dependent Problems

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

The Model Problem: Poisson Equation


2D Poisson Equation on unit square:

2
2
u(x,
y)
+
u(x, y ) = f (x, y )
x 2
y 2

in = (0, 1)2

Dirichlet boundary conditions:

u(x, y) = g(x, y)

on

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

The Model Problem: Poisson Equation


2D Poisson Equation on unit square:

2
2
u(x,
y)
+
u(x, y ) = f (x, y )
x 2
y 2

in = (0, 1)2

Dirichlet boundary conditions:

u(x, y) = g(x, y)

on

for general operator L instead of : similar concept

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

The Model Problem: Poisson Equation


2D Poisson Equation on unit square:

2
2
u(x,
y)
+
u(x, y ) = f (x, y )
x 2
y 2

in = (0, 1)2

Dirichlet boundary conditions:

u(x, y) = g(x, y)

on

for general operator L instead of : similar concept


new for FEM: compute a function to approximate u(x, y )

(instead of approximate values at certain grid points)

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Finite Elements Main Ingredients


1. solve weak form of PDE to reduce regularity properties
Z
Z
00
0 0
u = f
v u dx = vf dx
allows additional weak solutions

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Finite Elements Main Ingredients


1. solve weak form of PDE to reduce regularity properties
Z
Z
00
0 0
u = f
v u dx = vf dx
allows additional weak solutions
2. compute a function as numerical solution
search in a function space Wh :
X
uh =
uj j (x),
span{1 , . . . , J } = Wh
j

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Finite Elements Main Ingredients


1. solve weak form of PDE to reduce regularity properties
Z
Z
00
0 0
u = f
v u dx = vf dx
allows additional weak solutions
2. compute a function as numerical solution
search in a function space Wh :
X
uh =
uj j (x),
span{1 , . . . , J } = Wh
j

3. find weak solutions of simple form:


for example piecewise linear functions and choose basis
functions with local support (hat functions)
leads to system of linear equations
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form and Weak Solutions


The weak form is obtained by 3 steps:
integrate over the domain

from infinetly many equations (strong form has to hold on


every point (x, y)), only one new is obtained

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form and Weak Solutions


The weak form is obtained by 3 steps:
integrate over the domain

from infinetly many equations (strong form has to hold on


every point (x, y)), only one new is obtained
multiply with (any) test function v (from a certain function space

V)
again, infinitely many equations

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form and Weak Solutions


The weak form is obtained by 3 steps:
integrate over the domain

from infinetly many equations (strong form has to hold on


every point (x, y)), only one new is obtained
multiply with (any) test function v (from a certain function space

V)
again, infinitely many equations
do integration by parts (i.e. use divergence theorem) to play

derivatives from solution u to test functions v


reduce smoothness assumptions on u

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form and Weak Solutions


The weak form is obtained by 3 steps:
integrate over the domain

from infinetly many equations (strong form has to hold on


every point (x, y)), only one new is obtained
multiply with (any) test function v (from a certain function space

V)
again, infinitely many equations
do integration by parts (i.e. use divergence theorem) to play

derivatives from solution u to test functions v


reduce smoothness assumptions on u
real solution u also solves the weak form
however, additional, weak solutions are now allowed

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form of the Poisson Equation


Poisson equation with Dirichlet conditions:

u = f

in , u = 0

on

weak form:

Z
u v d =

f v d

v V

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form of the Poisson Equation


Poisson equation with Dirichlet conditions:

u = f

in , u = 0

on

weak form:

Z
u v d =

f v d

v V

apply divergence theorem:

Z
u v d =

Z
u v d

u v ds

choose functions v such that v = 0 on :

Z
u v d =

f v d

v V

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Weak Form of the Poisson Equation (2)


Poisson equation with Dirichlet conditions:

u = f

in , u = 0

on

transformed into weak form:

Z
u v d =

f v d

v V

weaker requirements for a solution u:

twice differentiabale first derivative integrable


hu, v i a bilinear form (i.e. depends on 2 functions u and v );

often written as:


a (u, v ) = hf , v i

v V

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Test and Shape Functions


search for solution functions uh of the form

uh =

uj j (x)

the j (x) are typically called shape or ansatz functions


the basis functions j (x) build a vector space

(i.e., a function space) Wh


span{1 , . . . , J } = Wh

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Test and Shape Functions


search for solution functions uh of the form

uh =

uj j (x)

the j (x) are typically called shape or ansatz functions


the basis functions j (x) build a vector space

(i.e., a function space) Wh


span{1 , . . . , J } = Wh

insert into weak formulation

X


Z
uj j (x) v dx = f v dx v V

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Test and Shape Functions (2)


choose a basis {i } of the test space Vh
then: if all basis functions i satisfy

X


Z
uj j (x) i dx = f i dx i

then all v Vh satisfy the equation


the {i } are therefore often called test functions

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Test and Shape Functions (2)


choose a basis {i } of the test space Vh
then: if all basis functions i satisfy

X


Z
uj j (x) i dx = f i dx i

then all v Vh satisfy the equation


the {i } are therefore often called test functions
we obtain a system of equations for unknowns uj :

one equation for each test function i

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Test and Shape Functions (2)


choose a basis {i } of the test space Vh
then: if all basis functions i satisfy

X


Z
uj j (x) i dx = f i dx i

then all v Vh satisfy the equation


the {i } are therefore often called test functions
we obtain a system of equations for unknowns uj :

one equation for each test function i


Vh is often chosen to be identical to Wh (Ritz-Galerkin method)

we then have as many equations as unknowns

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

Lehrstuhl Informatik V

Example: Nodal Basis


i (x) :=

1
h (x xi1 )
1
h (xi+1 x)

xi1 < x < xi


xi < x < xi+1
otherwise

0,8

0,6

0,4

0,2

0,2

0,4

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

0,6

0,8

x
10

Lehrstuhl Informatik V

Assembling the System of Equations


linear linear system of equations


Z
j (x) i (x) dx uj = f i dx i
{z
}
|

XZ
j

=:Aij

aim: make matrix A sparse most Aij = 0

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

11

Lehrstuhl Informatik V

Assembling the System of Equations


linear linear system of equations


Z
j (x) i (x) dx uj = f i dx i
{z
}
|

XZ
j

=:Aij

aim: make matrix A sparse most Aij = 0


approach: local basis functions on a discretisation grid
j , j zero everywhere except in grid cells adjacent to grid point

xj
Aij = 0, if i and j dont overlap

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

11

Lehrstuhl Informatik V

Example Problem: 1D Poisson


in 1D: u 00 (x) = f (x) on = (0, 1),

hom. Dirichlet boundary cond.: u(0) = u(1) = 0


weak form:

u 0 (x) v 0 (x) dx =

f (x) v (x) dx v V
0

computational grid:

xi = ih, (for i = 1, . . . , n 1); mesh size h = 1/n


Vh = Wh : piecewise linear functions

(on intervals [xi , xi+1 ])


weak form reads:

u 0 (x) 0i (x) dx =

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

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

12

Lehrstuhl Informatik V

Nodal Basis
i (x) :=

1
h (x xi1 )
1
h (xi+1 x)

xi1 < x < xi


xi < x < xi+1
otherwise

0,8

0,6

0,4

0,2

0,2

0,4

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

0,6

0,8

x
13

Lehrstuhl Informatik V

Nodal Basis Derivatives and Integrals


Compute derivative of basis functions:
1
xi1 < x < xi

h
0
1
i (x) :=
h xi < x < xi+1

0
otherwise
Compute integrals of weak form:


Z
Z xi
Z xi+1 
1 1
1
1
2

0i (x)0i (x) dx =
dx +

dx =
h
h
h
h
h
xi1
xi

Z
Z xi+1 
1
1
1

dx =
0i (x)0i+1 (x) dx =
h h
h
xi
Z
1

0i (x)0i1 (x) dx = (same computation)


h
Z
0
0

i (x)j (x) dx = 0 for all j 6= i, i 1


(supports of basis functions do not overlap!)
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

14

Lehrstuhl Informatik V

Nodal Basis System of Equations


stiffness matrix:

1
1
h

1
..

..
. 1
1 2

2
..
.

right hand sides (assume f (x) = R):

i (x) dx = h

f (x) i (x) dx =
0

system of equations very similar to finite differences


note: for other operators L: same approach!
exercise: compute right-hand-side vector, if f (x) :=

fj j (x)

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

15

Lehrstuhl Informatik V

Outlook: A Road to Theory

weak formulation is equivalent to variational approach:

solution u minimises an energy functional

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

16

Lehrstuhl Informatik V

Outlook: A Road to Theory

weak formulation is equivalent to variational approach:

solution u minimises an energy functional


best approximation property:





u uhFE inf ku v ka
a

v Vh

in terms of the norm induced by the bilinear form a (energy norm)


thus: error bounded by interpolation error

(in energy norm)


(details in lecture Numerical Programming II . . . )

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

16

Lehrstuhl Informatik V

Time-Dependent Problems
Example: 1D Heat Equation
ut = uxx + f on domain = [0, 1] for t [0, tend ]
spatial discretisation: weak form

Z
Z
ut v dx =
uxx v dx + f v dx
Z

Z
Z
u v dx
=
uxx v dx + f v dx

spatial discretisation finite elements:

(Mh uh ) = Ah uh + fh

Mh : mass matrix, Ah : stiffness matrix, uh = uh (t)

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

17

Lehrstuhl Informatik V

Time-Dependent Problems (2)

Solve a system of ordinary differential equations:


after spatial discretisation (Mh constant):

t Mh

(uh ) = Ah uh + fh

uh a vector of time-dependent functions:

uh = (u1 (t), . . . , ui (t), . . . , un (t))

usually: approximate Mh by a simpler matrix (diagonal matrix,

e.g.) mass lumping

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

18

Lehrstuhl Informatik V

Part II: Implementation of Finite Element Methods


Element Stiffness Matrices
Element-Oriented Computation of Stiffness Matrices
Example: 1D Poisson
Example: 2D Poisson
Typical Workflow
Reference Elements and Stiffness Matrices
Element-Oriented Computation on Unstructured Meshes
Accumulation of Global Stiffness Matrix
Simple Example: 1D Poisson
Outlook: Extension to 2D and 3D
Outlook: Further Components and Aspects of FEM

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

19

Lehrstuhl Informatik V

Element Stiffness Matrices


Finite Element methods are often used for complicated meshes:

Questions:
how to set up the system of equations efficiently?
is it possible to use stencil notation??

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

20

Lehrstuhl Informatik V

Element Stiffness Matrices


Finite Element methods are often used for complicated meshes:

Questions:
how to set up the system of equations efficiently?
is it possible to use stencil notation??

Switch to element stiffness matrices!


Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

20

Lehrstuhl Informatik V

Element Stiffness Matrices (2)


domain subdivided into finite elements (k ) :

= (1) (2) (n)


observation: basis functions are defined element-wisely
use:

Rb
a

f (x) dx =

Rc
a

f (x) dx +

Rb
c

f (x) dx

element-wise evaluation of the integrals:

Z
u v dx =

XZ
k

Z
f v dx =

XZ
k

u v dx

(k )

f v dx

(k )

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

21

Lehrstuhl Informatik V

Element Stiffness Matrices (3)


leads to local stiffness matrices for each element:

Z
j i dx
(k )

{z

(k )

=:Aij

and respective element systems:

A(k) x = b(k)
accumulate to obtain global system:

A(k) x =

b(k )

| {z }
=:A

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

22

Lehrstuhl Informatik V

Element Stiffness Matrices (4)


Some comments on notation:
assume: 1D problem, n elements (i.e. intervals)
in each element only two basis functions are non-zero!
(k )

hence, almost all Aij

are zero:
(k )

Aij

Z
j i dx

=
(k)

only 2 2 elements of A(k ) are non-zero


therefore convention to omit zero columns/rows

leaves only unknowns that are in (k)


b (k ) (element stiffness matrix)
notation: write this matrix as A

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

23

Lehrstuhl Informatik V

Example: 1D Poisson
= [0, 1] splitted into (k) = [xk , xk +1 ]
nodal basis; leads to element stiffness matrix:

b (k ) =
A

1 1
1 1

consider case with only three unknowns (i.e., 3 basis functions):

A(1) + A(2)

1
= 1
0

1
1
0


0
0 0
0 + 0 1
0
0 1

0
1
1

in stencil notation:

[ 1

1 ] + [ 1 1 ] [ 1

2 1]

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

24

Lehrstuhl Informatik V

Example: 2D Poisson
u = f on domain = [0, 1]2
splitted into (i,j) = [xi , xi+1 ] [xj , xj+1 ]
bilinear basis functions

ij (x, y) = i (x)j (y )
pagoda functions

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

25

Lehrstuhl Informatik V

Example: 2D Poisson (2)


leads to element stiffness matrix:

12

12

12

12

1
b (k) =
A
21
2

12

12

accumulation leads to 9-point stencil

1
1

1
8
1

1
1

b (k) and assemble global matrix


exercise at home: compute A
(and compare with stencil)
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

26

Lehrstuhl Informatik V

Typical Workflow
1. choose grid:
quadratic or cubic cells
triangles (structured, unstructured)
tetrahedra, etc.
2. set up basis functions for each element (k) ;
for example, at all nodes xi (k )
i (xi ) = 1
i (xj ) = 0 for all j 6= i
3. for element stiffness matrix, compute all
Z
(k)
b
Aij =
j i dx
(k)

4. accumulate global stiffness matrix A (and rhs)


Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

27

Lehrstuhl Informatik V

Element-Oriented Computation on Unstructured


Meshes
Recall: FEM often used for complicated meshes:

(Re-)computation of element matrices required for each element?

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

28

Lehrstuhl Informatik V

Element-Oriented Computation on Unstructured


Meshes
Recall: FEM often used for complicated meshes:

(Re-)computation of element matrices required for each element?


left grid: no (up to scaling with mesh size)
right grid: yes?

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

28

Lehrstuhl Informatik V

Element-Oriented Computation on Unstructured


Meshes
Recall: FEM often used for complicated meshes:

(Re-)computation of element matrices required for each element?


left grid: no (up to scaling with mesh size)
right grid: yes?

requires a closer look at the computation of element matrices


Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

28

Lehrstuhl Informatik V

Element Stiffness Matrices Notation Revisited


(k )

recall notation for local stiffness matrices Aij :


(k)

Aij

Z
j (x) i (x) dx

=
(k )

which basis functions i , j belong to element k?


switch to element-local numbering of basis functions:

b (k) =
A

(k )
(k)
(x) (x) dx

(k)
(k)

(k)

where (x) = i (x) and = j (x) in (k )


(k)

(k )

requires a mapping i (and

j ),

i.e., a function (k) with i = (k) () and j = (k) ()


Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

29

Lehrstuhl Informatik V

Accumulation of Global Stiffness Matrix


b (k) :
note the different dimensions of A(k) and A
b (k ) omits zero rows and columns of A(k )
A
formulated via a projection matrix:
(k)

= P


(k) T

b (k ) P (k)
A

with

(k )
P,i


:=

1 if i = (k) ()
0 otherwise

recall computation of global stiffness matrix:

A :=

A(k ) =

P (k )

T

b (k ) P (k )
A

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

30

Lehrstuhl Informatik V

Accumulation of Global Stiffness Matrix


b (k) :
note the different dimensions of A(k) and A
b (k ) omits zero rows and columns of A(k )
A
formulated via a projection matrix:
(k)

= P


(k) T

b (k ) P (k)
A

with

(k )
P,i


:=

1 if i = (k) ()
0 otherwise

recall computation of global stiffness matrix:

A :=

A(k ) =

P (k )

T

b (k ) P (k )
A

hence, for each element:

b (k)
1. compute element stiffness matrix A
b (k ) in A(k)
2. determine position of matrix elements A
based on mapping (k) ()
T (k ) (k )
b P to global
3. add non-zero elements of A(k) = P (k ) A
matrix A
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

30

Lehrstuhl Informatik V

Element Stiffness Matrices and Meshes


Recall our initial question:

b (k ) required for each element?


(Re-)computation of A

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

31

Lehrstuhl Informatik V

Element Stiffness Matrices and Meshes


Recall our initial question:

b (k ) required for each element?


(Re-)computation of A
left grid: no (up to scaling with mesh size)
right grid: yes?

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

31

Lehrstuhl Informatik V

Element Stiffness Matrices and Meshes


Recall our initial question:

b (k ) required for each element?


(Re-)computation of A
left grid: no (up to scaling with mesh size)
right grid: yes?

b (k) via reference elements


efficient computation of A
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

31

Lehrstuhl Informatik V

Simple Example: 1D Poisson


Consider FEM for 1D Poisson on an adaptive grid:
grid points given as xi , not necessarily equidistant;
define elements (k) = [xk , xk+1 ]
piecewise linear basis functions (hat functions) i (x);
i (x) non-zero only on two elements: (i1) and (i)
mapping local to global indices: (k) (1) := k and (k) (2) := k + 1
R
(k)
(k)
b (k)
wanted: A
(x) (x) dx for every element k
, :=
(k )

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

32

Lehrstuhl Informatik V

Simple Example: 1D Poisson


Consider FEM for 1D Poisson on an adaptive grid:
grid points given as xi , not necessarily equidistant;
define elements (k) = [xk , xk+1 ]
piecewise linear basis functions (hat functions) i (x);
i (x) non-zero only on two elements: (i1) and (i)
mapping local to global indices: (k) (1) := k and (k) (2) := k + 1
R
(k)
(k)
b (k)
wanted: A
(x) (x) dx for every element k
, :=
(k )

Introduce reference element ref with linear basis functions :


1 () :=

2 () := 1

ref := [0, 1]

and a mapping x = (k ) () for each (k) defined as


(k ) () := xk + (xk+1 xk )

(k)
(k )
such that (x) = (k) () := () for x (k) .
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

32

Lehrstuhl Informatik V

Simple Example: 1D Poisson (2)


We need to compute
b (k) :=
A
,

xk +1
Z

(k)
(x) (k)
(x) dx =
x
x

xk

(k )
Z
(1)

(k ) (0)

Compare integration by substitution:

g(b)
R
g(a)

b (k)
A
,

(k)

(x) (k)
(x) dx
x
x

Z1
=

f (x) dx =

Rb

f (g(t))g 0 (t) dt

(k) (k)  (k ) (k) 

()

() (xk +1 xk ) d.
x
x

Note that:


k () = (xk +1 xk ) corresponds to the factor g 0 (t) in the
substitution rule
we still have to deal with the partial derivatives in x
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

33

Lehrstuhl Informatik V

Simple Example: 1D Poisson (3)


We require the chain rule,

f
x

f g
g x ,

to obtain:

(k) (k) 

() =
() =
()
x
x

x
x

xk
As x = (k) () := xk + (xk+1 xk ), we have =
and thus:
xk+1 xk

1
()
=
()

xk+1 xk
Finally, we get:
b (k) =
A
,

Z1

(k ) (k)  (k) (k ) 

()

() (xk+1 xk ) d
x
x

Z1
=

1
() ()
(xk+1 xk ) d.

(xk +1 xk )2

0
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

34

Lehrstuhl Informatik V

Simple Example: 1D Poisson (4)


Altogether, element stiffness matrices are computed as:
b (k) =
A
,

1
xk+1 xk

Z1

() () d

With 1 () = and 2 () = 1 , we obtain that




1
1 1
(k)
b
A =
1 1
xk+1 xk

Tobias Neckel: Scientific Computing I


Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

35

Lehrstuhl Informatik V

Simple Example: 1D Poisson (4)


Altogether, element stiffness matrices are computed as:
b (k) =
A
,

1
xk+1 xk

Z1

() () d

With 1 () = and 2 () = 1 , we obtain that




1
1 1
(k)
b
A =
1 1
xk+1 xk
Observations:
the integral values only depend on the reference element

ref = [0, 1] and the reference basis functions ,


all other element matrices are obtained by simple scaling
we did not use that , are linear functions;

same computation for more complicated basis functions!


Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

35

Lehrstuhl Informatik V

Outlook: Extension to 2D and 3D


For 2D, 3D, etc., we require the multidimensional substitution rule:
Z
Z
f (x(, , ), y (, , ), z(, , )) |J | d d d
f (x, y, z) d =
(k )

ref

where |J | is the determinant of the Jacobian:


x x x



y y y
|J | =
z z z

and also the multidimensional chain rule.


Result:
similar, element-wise computation of stiffness matrices via
reference elements
Jacobian instead of factor x 1x ; more complicated, in general
k +1
k
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

36

Lehrstuhl Informatik V

Outlook: Further Components and Aspects of FEM


Additional components and features of Finite Element Methods:
mesh generation:

structured/unstructured meshes consisting of triangles,


tetrahedra, rectangles, cuboids, quadrilaterals, hexahedrals,
prisms, . . .
higher-order basis functions:

polynomials of higher degree in various dimensions; nodal vs.


spectral elements, . . .
quadrature rules for integration:

Gaussian quadrature, e.g., to compute integrals of weak forms;


resp. choice of quadrature points for certain elements?
solving the system of equations:

e.g., set up a global system of equations explicitly, or work


directly on element representation?
. . . and many more . . .
Tobias Neckel: Scientific Computing I
Module 7: An Introduction to Finite Element Methods, Winter 2015/2016

37

You might also like