Professional Documents
Culture Documents
Pde Fem
Pde Fem
Scientific Computing I
Module 7: An Introduction to Finite Element Methods
Tobias Neckel
Winter 2015/2016
Lehrstuhl Informatik V
Lehrstuhl Informatik V
2
2
u(x,
y)
+
u(x, y ) = f (x, y )
x 2
y 2
in = (0, 1)2
u(x, y) = g(x, y)
on
Lehrstuhl Informatik V
2
2
u(x,
y)
+
u(x, y ) = f (x, y )
x 2
y 2
in = (0, 1)2
u(x, y) = g(x, y)
on
Lehrstuhl Informatik V
2
2
u(x,
y)
+
u(x, y ) = f (x, y )
x 2
y 2
in = (0, 1)2
u(x, y) = g(x, y)
on
Lehrstuhl Informatik V
Lehrstuhl Informatik V
Lehrstuhl Informatik V
Lehrstuhl Informatik V
Lehrstuhl Informatik V
V)
again, infinitely many equations
Lehrstuhl Informatik V
V)
again, infinitely many equations
do integration by parts (i.e. use divergence theorem) to play
Lehrstuhl Informatik V
V)
again, infinitely many equations
do integration by parts (i.e. use divergence theorem) to play
Lehrstuhl Informatik V
u = f
in , u = 0
on
weak form:
Z
u v d =
f v d
v V
Lehrstuhl Informatik V
u = f
in , u = 0
on
weak form:
Z
u v d =
f v d
v V
Z
u v d =
Z
u v d
u v ds
Z
u v d =
f v d
v V
Lehrstuhl Informatik V
u = f
in , u = 0
on
Z
u v d =
f v d
v V
v V
Lehrstuhl Informatik V
uh =
uj j (x)
Lehrstuhl Informatik V
uh =
uj j (x)
X
Z
uj j (x) v dx = f v dx v V
Lehrstuhl Informatik V
X
Z
uj j (x) i dx = f i dx i
Lehrstuhl Informatik V
X
Z
uj j (x) i dx = f i dx i
Lehrstuhl Informatik V
X
Z
uj j (x) i dx = f i dx i
Lehrstuhl Informatik V
1
h (x xi1 )
1
h (xi+1 x)
0,8
0,6
0,4
0,2
0,2
0,4
0,6
0,8
x
10
Lehrstuhl Informatik V
Z
j (x) i (x) dx uj = f i dx i
{z
}
|
XZ
j
=:Aij
11
Lehrstuhl Informatik V
Z
j (x) i (x) dx uj = f i dx i
{z
}
|
XZ
j
=:Aij
xj
Aij = 0, if i and j dont overlap
11
Lehrstuhl Informatik V
u 0 (x) v 0 (x) dx =
f (x) v (x) dx v V
0
computational grid:
u 0 (x) 0i (x) dx =
f (x) i (x) dx i = 1, . . . , n 1
0
12
Lehrstuhl Informatik V
Nodal Basis
i (x) :=
1
h (x xi1 )
1
h (xi+1 x)
0,8
0,6
0,4
0,2
0,2
0,4
0,6
0,8
x
13
Lehrstuhl Informatik V
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
14
Lehrstuhl Informatik V
1
1
h
1
..
..
. 1
1 2
2
..
.
i (x) dx = h
f (x) i (x) dx =
0
fj j (x)
15
Lehrstuhl Informatik V
16
Lehrstuhl Informatik V
u uhFE
inf ku v ka
a
v Vh
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
(Mh uh ) = Ah uh + fh
17
Lehrstuhl Informatik V
t Mh
(uh ) = Ah uh + fh
18
Lehrstuhl Informatik V
19
Lehrstuhl Informatik V
Questions:
how to set up the system of equations efficiently?
is it possible to use stencil notation??
20
Lehrstuhl Informatik V
Questions:
how to set up the system of equations efficiently?
is it possible to use stencil notation??
20
Lehrstuhl Informatik V
Rb
a
f (x) dx =
Rc
a
f (x) dx +
Rb
c
f (x) dx
Z
u v dx =
XZ
k
Z
f v dx =
XZ
k
u v dx
(k )
f v dx
(k )
21
Lehrstuhl Informatik V
Z
j i dx
(k )
{z
(k )
=:Aij
A(k) x = b(k)
accumulate to obtain global system:
A(k) x =
b(k )
| {z }
=:A
22
Lehrstuhl Informatik V
are zero:
(k )
Aij
Z
j i dx
=
(k)
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
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]
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
25
Lehrstuhl Informatik V
12
12
12
12
1
b (k) =
A
21
2
12
12
1
1
1
8
1
1
1
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)
27
Lehrstuhl Informatik V
28
Lehrstuhl Informatik V
28
Lehrstuhl Informatik V
28
Lehrstuhl Informatik V
Aij
Z
j (x) i (x) dx
=
(k )
b (k) =
A
(k )
(k)
(x) (x) dx
(k)
(k)
(k)
(k )
j ),
29
Lehrstuhl Informatik V
= P
(k) T
b (k ) P (k)
A
with
(k )
P,i
:=
1 if i = (k) ()
0 otherwise
A :=
A(k ) =
P (k )
T
b (k ) P (k )
A
30
Lehrstuhl Informatik V
= P
(k) T
b (k ) P (k)
A
with
(k )
P,i
:=
1 if i = (k) ()
0 otherwise
A :=
A(k ) =
P (k )
T
b (k ) P (k )
A
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
31
Lehrstuhl Informatik V
31
Lehrstuhl Informatik V
31
Lehrstuhl Informatik V
32
Lehrstuhl Informatik V
2 () := 1
ref := [0, 1]
32
Lehrstuhl Informatik V
xk +1
Z
(k)
(x) (k)
(x) dx =
x
x
xk
(k )
Z
(1)
(k ) (0)
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
()
() (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
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
1
xk+1 xk
Z1
() () d
35
Lehrstuhl Informatik V
1
xk+1 xk
Z1
() () d
35
Lehrstuhl Informatik V
ref
36
Lehrstuhl Informatik V
37