Upload
lamtuong
View
220
Download
3
Embed Size (px)
Citation preview
Platzhalter fรผr Bild, Bild auf Titelfolie hinter das Logo einsetzen
Dr. Noemi Friedman, 20,27. 01. 2016.
Introduction to PDEs and Numerical Methods
Lecture 11-12.
The finite element method: assembling the matrices,
isoparametric mapping
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture| Seite 2
RECAP: How to solve PDE with
FEM with nodal basis, piecewise linear shape functions
Finite Element method with piecewise linear functions in 1D, hom DBC
1) Weak formulation of the PDE, definition of the โenergyโ inner product (the bilinear
functional, ๐) and and the linear functional (๐น)๐ ๐ข, ๐ฃ = ๐น ๐ฃ
2) Define approximating subspace by definition of a mesh (nodes 0,1,..N, with coordinates,
elements) and setup the hat functions on them
3) Compute the elements of the stiffness matrix (Grammian) โ evaluation of integrals
๐พ๐๐ = ๐ ๐๐(๐ฅ), ๐๐(๐ฅ) = ๐๐(๐ฅ), ๐๐(๐ฅ) ๐ธ๐, ๐ = 1. . ๐ โ 1
4) Compute the elements of the vector of the right hand side โ evaluation of integrals
๐๐ = ๐น ๐๐ , ๐ = 1. . ๐ โ 15) Solve the system of equations:
for ๐ฎ, which gives the solution at the nodes.
The solution in between the nodes can be calculated from:
ฮฆ๐ ๐ฅ = Ni x =
๐ฅ โ ๐ฅ๐โ1๐
๐ฅ โ [๐ฅ๐โ1, ๐ฅ๐]
๐ฅ๐+1 + ๐ฅ
๐๐ฅ โ [๐ฅ๐ , ๐ฅ๐+1]
0 else
๐๐ฎ = ๐
๐ข x โ
๐=1
๐
๐ข๐ ๐๐(x)
๐ = 1. . ๐ โ 1
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 3
1D Example with linear nodal basis
๐ข ๐ฑ โ
๐=1
4
๐ข๐ ๐๐(๐ฑ)
๐ ๐ฅ = ๐๐ฅ
Strong form:
๐(๐ฅ)
๐
๐/5 ๐/5 ๐/5
๐ข 0 = ๐ข ๐ = 0
Weak form:
0
๐
๐ธ๐ด๐๐ข
๐๐ฅ
๐๐
๐๐ฅ๐๐ฅ =
0
๐
๐ ๐ฅ ๐ ๐ฅ ๐๐ฅ
Discretisation of the weak form:
๐=1
4
๐ข๐ ๐ธ๐ด ๐
๐๐๐(๐ฅ)
๐๐ฅ
๐๐๐(๐ฅ)
๐๐ฅ๐๐ฅ =
๐
๐(๐ฅ)๐๐(๐ฅ)๐๐ฅ
๐พ๐๐ ๐๐
๐/5 ๐/5
Not efficient to calculate all the
elements of the stiffness
matrix one by one!
Calculate element stiffness matrices and assemble
๐4 ๐5๐3๐2
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 4
1D Example with linear nodal basis
๐(๐ฅ)
๐
๐/5 ๐/5 ๐/5๐/5 ๐/5
instead:
Compute stiffness matrix elementwisely and
then assemble
๐ ๐๐ฎ
Global stiffness matrix
1 2 3 4 5 6
๐พ4๐ =
1 2 3 4 5 6
1
2
3
4
5
6
๐ข1
๐ข2
๐ข3
๐ข4
๐ข5
๐ข6
0
๐2
๐3
๐4
๐5
0
=
4 5
4
5
๐พ4๐ 1,1 = ๐ธ๐ด
ฮฉ4
๐๐4(๐ฅ)
๐๐ฅ
๐๐4(๐ฅ)
๐๐ฅ๐๐ฅ
๐พ4๐(1,1) ๐พ4
๐(1,2)
๐พ4๐(2,1) ๐พ4
๐(2,2)
๐4 ๐5๐3๐2
๐พ4๐ 1,2 = ๐ธ๐ด
ฮฉ4
๐๐4(๐ฅ)
๐๐ฅ
๐๐5(๐ฅ)
๐๐ฅ๐๐ฅ
๐พ4๐ 2,1 = ๐ธ๐ด
ฮฉ4
๐๐5(๐ฅ)
๐๐ฅ
๐๐4(๐ฅ)
๐๐ฅ๐๐ฅ
๐พ4๐ 2,2 = ๐ธ๐ด
ฮฉ4
๐๐5(๐ฅ)
๐๐ฅ
๐๐5(๐ฅ)
๐๐ฅ๐๐ฅ
๐พ4๐(1,2)๐พ4
๐(1,1)
๐พ4๐(2,1) ๐พ4
๐(2,2)๐พ5๐(1,1)
๐พ3๐(2,2)
๐พ3๐ 1,1๐พ2๐(2,2)
๐พ2๐ 1,1๐พ1๐(2,2)
1
1
๐พ3๐(1,2)
๐พ2๐(1,2)
๐พ3๐(2,1)
๐พ2๐(2,1)
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 5
1D Example with linear nodal basis
๐(๐ฅ)
๐
๐/5 ๐/5 ๐/5๐/5 ๐/5
instead:
Compute stiffness matrix elementwisely and
then assemble
๐ ๐๐ฎ
1 2 3 4 5 6
๐4๐ =
1 2 3 4 5 6
1
2
3
4
5
6
๐ข1
๐ข2
๐ข3
๐ข4
๐ข5
๐ข6
0
0
=
4
5
๐4๐ 1 =
ฮฉ4
๐(๐ฅ)๐4(๐ฅ)๐๐ฅ
๐4๐ 1
๐4๐ 2
๐4 ๐5๐3๐2
๐4๐ 2 =
ฮฉ4
๐(๐ฅ)๐5(๐ฅ)๐๐ฅ
๐พ4๐(1,2)๐พ4
๐(1,1)
๐พ4๐(2,1) ๐พ4
๐(2,2)๐พ5๐(1,1)
๐พ3๐(2,2)
๐พ3๐ 1,1๐พ2๐(2,2)
๐พ2๐ 1,1๐พ1๐(2,2)
1
1
๐พ3๐(1,2)
๐พ2๐(1,2)
๐พ3๐(2,1)
๐พ2๐(2,1)
๐4๐ 1
๐4๐ 2
๐2๐ 1
๐1๐ 2
๐3๐ 1
๐2๐ 2
๐3๐ 2
๐5๐ 1
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture| Seite 6
The same but elementwisely: How to solve PDE with
FEM with nodal basis, piecewise linear shape functions
Finite Element method with piecewise linear functions in 1D, hom DBC
1) Weak formulation of the PDE, definition of the โenergyโ inner product (the bilinear
functional, ๐) and and the linear functional (๐น)๐ ๐ข, ๐ฃ = ๐น ๐ฃ
2) a.) Define reference element, define maping between global and local coordinate systems
ฮพ ๐ฅ ๐ฅ(๐)
b.) Define reference linear shape functions
3) Compute the โelement stiffnessโ matrix โ evaluation of integrals
๐พ๐๐ = ๐ ๐๐(๐ฅ), ๐๐(๐ฅ) = ๐๐(๐ฅ), ๐๐(๐ฅ) ๐ธ๐, ๐ = 1. . 2
4) Compute the right hand side elementwisely ๐๐๐ = ๐น ๐๐ , ๐ = 1,2
5) Compile โglobal stiffnessโ matrix
6) Solve the system of equations:
for ๐ฎ, which gives the solution at the nodes.
The solution in between the nodes can be calculated from:
๐๐ฎ = ๐
๐ข x โ
๐=1
๐
๐ข๐ ๐๐(x)
N1 ฮพ = 1 โ ฮพ N2 ฮพ = ฮพ
๐พ ๐ = ๐พ4๐(1,1) ๐พ4๐(1,2)
๐พ4๐(2,1) ๐พ4
๐(2,2)
๐4๐ = ๐4
๐ 1
๐4๐ 2
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 7
Local/global coordinate system 1D
๐พ4๐ ๐, ๐ = ๐ธ๐ด
ฮฉ4
๐๐๐(๐)
๐๐
๐๐
๐๐ฅ
๐๐๐(๐)
๐๐
๐๐
๐๐ฅ๐๐ฅ =
๐ธ๐ด
๐4๐ 2
ฮฉ4
๐๐๐(๐)
๐๐
๐๐๐(๐)
๐๐๐๐ฅ
๐ = [0,1]
1
๐๐
1
๐๐
๐พ4๐ ๐, ๐ =
๐ธ๐ด
๐ ๐ 2 0
1 ๐๐๐(๐)
๐๐
๐๐๐(๐)
๐๐
๐๐ฅ(๐)
๐๐๐๐ =๐ธ๐ด
๐ ๐ 0
1 ๐๐๐(๐)
๐๐
๐๐๐(๐)
๐๐๐๐
๐ ๐
Idea:
coordinate transformation to have unit length elements element stiffnes matrix is the same for each element
๐๐
๐๐ฅ=1
๐ ๐
๐พ4๐ ๐, ๐ = ๐ธ๐ด
ฮฉ4
๐๐4(๐ฅ)
๐ฅ
๐๐5(๐ฅ)
๐๐ฅ๐๐ฅ
๐, ๐ โ [1,2]
๐, ๐ โ [4,5]
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 8
Local/global coordinate system 1D
๐4๐ ๐ =
ฮฉ4
๐(๐ฅ)๐4(๐ฅ)๐๐ฅ
ฮฉ4
๐(๐ฅ)๐5(๐ฅ)๐๐ฅ= 0
1
๐(๐)๐๐(๐)๐๐ฅ(๐)
๐๐๐๐ = ๐ ๐
0
1
๐(๐)๐๐(๐)๐๐
๐ โ [1,2]
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 9
Local/ coordinate system, isoparametric mapping 1D
coordinate transformation
using the ansatzfunctions isoparametric mapping
functions of lower order: subparametric
functions of higher order: superparametric
๐ฅ ๐ = ๐ฅ๐๐1 ๐ + ๐ฅ๐+1๐2 ๐ = ๐1 ๐ ๐2 ๐๐ฅ๐๐ฅ๐+1
local coordinate
global coordinate
๐ = 0 ๐ = 1
๐ฅ๐ ๐ฅ2
Shape functions:
Transformation from local to global coordinates:
Stiffness matrix with isoparametric elements:
๐ = [0,1]๐ฅ
๐1 ๐ = 1 โ ๐
๐2 ๐ = ๐
๐พ4๐ ๐, ๐ = ๐ธ๐ด
ฮฉ4
๐๐๐(๐ฅ)
๐ฅ
๐๐๐(๐ฅ)
๐๐ฅ๐๐ฅ = ๐ธ๐ด
ฮฉ4
๐๐๐(๐)
๐๐
๐๐
๐๐ฅ
๐๐๐(๐)
๐๐
๐๐
๐๐ฅ๐๐ฅ
๐, ๐ โ [1,2]
๐, ๐ โ [4,5]
๐พ4๐ ๐, ๐ = ๐ธ๐ด
0
1 ๐๐๐(๐)
๐๐
๐๐ฅ
๐๐
โ1๐๐๐(๐)
๐๐
๐๐ฅ
๐๐
โ1๐๐ฅ(๐)
๐๐๐๐
๐๐ฅ
๐๐= ๐ฅ๐๐๐1 ๐
๐๐+ ๐ฅ๐+1
๐๐2 ๐
๐๐
๐๐ฅ
๐๐=๐๐1 ๐
๐๐
๐๐2 ๐
๐๐
๐ฅ๐๐ฅ๐+1
๐๐ฅ
๐๐
โ1 ๐๐ฅ
๐๐
โ1
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 10
Isoparametric linear mapping 2D
triangular elements
Basis functions:
Transformation from local to global coordinates:
Stiffness matrix:
1
๐, ๐ โ [1,2,3]
๐ฅ๐๐๐๐ ๐, ๐
๐ฆ๐๐๐๐ ๐, ๐=๐1 ๐, ๐ ๐2 ๐, ๐
๐1 ๐, ๐
๐3 ๐, ๐
๐2 ๐, ๐ ๐3 ๐, ๐
๐ฅ1๐ฆ1๐ฅ2๐ฆ2๐ฅ3๐ฆ3
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 11
Isoparametric linear mapping 2D
triangular elements
Stiffness matrix:
Stiffness matrix with local coordinates:
where:
substitution rule
determinant should not be negative or zero!
๐ =
๐=1
3๐๐๐ ๐, ๐
๐๐๐ฅ๐
๐=1
3๐๐๐ ๐, ๐
๐๐๐ฅ๐
๐=1
3๐๐๐ ๐, ๐
๐๐๐ฆ๐
๐=1
3๐๐๐ ๐, ๐
๐๐๐ฆ๐
๐, ๐ โ [1,2,3]
๐, ๐ โ [1,2,3]๐ฒ๐๐ =
0
1
0
1โ๐
๐ฑโ๐ป
๐๐๐
๐๐๐๐๐
๐๐
โ ๐ฑโ๐ป
๐๐๐๐๐๐๐๐๐๐
๐ฑ ๐๐๐๐
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 12
Isoparametric linear mapping 2D
triangular elements, example
๐ฅ ๐, ๐
๐ฆ ๐, ๐=1 โ ๐ โ ๐ ๐
1 โ ๐ โ ๐
๐๐ ๐
237197
Transformation from local to global coordinates (isoparametric mapping):
๐ฅ๐๐๐๐ ๐, ๐
๐ฆ๐๐๐๐ ๐, ๐=๐1 ๐, ๐ ๐2 ๐, ๐
๐1 ๐, ๐
๐3 ๐, ๐
๐2 ๐, ๐ ๐3 ๐, ๐
๐ฅ1๐ฆ1๐ฅ2๐ฆ2๐ฅ3๐ฆ3
1 2
3
4
5 6
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 13
Local/ coordinate system, isoparametric mapping 2D
triangular elements, example
Stiffness matrix with local coordinates:
๐, ๐ โ [1,2,3]๐ฒ๐๐ = 0
1
0
1โ๐
๐ฑโ๐ป
๐๐๐
๐๐๐๐๐
๐๐
โ ๐ฑโ๐ป
๐๐๐๐๐๐๐๐๐๐
๐ฑ ๐๐๐๐
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 14
Local/ coordinate system, isoparametric mapping 2D
triangular elements, example
๐ฑ๐ป = ๐ฑ๐ป = ๐ฑ = 34๐ฑ =๐ ๐โ๐ ๐
๐ฑโ๐ป =๐
๐ฑ๐ป๐ ๐โ๐ ๐
๐ฒ๐๐๐= 0
1
0
1โ๐ 1
344 2โ7 5
๐๐๐
๐๐๐๐๐
๐๐
โ1
344 2โ7 5
๐๐๐๐๐๐๐๐๐๐
34๐๐๐๐
๐ฒ21๐= 01 01โ๐ 1
34
4 2โ7 5
โ1โ1โ1
34
4 2โ7 5
1034๐๐๐๐ == 0
1 โ11โ๐ 1
34
โ62โ4โ7๐๐๐๐
๐ฒ21๐==โ1.118 0
1 01โ๐๐๐๐๐ = โ1.118 โ
1
2= โ0.559
๐ฒ๐๐๐= 0
1
0
1โ๐
๐ฑโ๐ป
๐๐๐
๐๐๐๐๐
๐๐
โ ๐ฑโ๐ป
๐๐๐๐๐๐๐๐๐๐
๐ฑ ๐๐๐๐
๐ฒ11๐๐ฒ12๐๐ฒ13๐
๐ฒ21๐๐ฒ22๐๐ฒ23๐
๐ฒ13๐๐ฒ23๐๐ฒ33๐
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 15
Local/ coordinate system, isoparametric mapping 2D
triangular elements, example
๐ฑ๐ป = ๐ฑ = 34๐ฒ11๐๐ฒ12๐๐ฒ13๐
๐ฒ21๐๐ฒ22๐๐ฒ23๐
๐ฒ13๐๐ฒ23๐๐ฒ33๐
๐๐ =
ฮฉ๐
๐(๐ฅ)๐1(๐ฅ, ๐ฆ)๐๐ฅ
ฮฉ๐
๐(๐ฅ)๐2(๐ฅ, ๐ฆ)๐๐ฅ
ฮฉ๐
๐(๐ฅ)๐3(๐ฅ, ๐ฆ)๐๐ฅ
=
0
1
0
1โ๐
๐(๐)๐1(๐, ๐) ๐ฑ ๐๐๐๐
0
1
0
1โ๐
๐(๐)๐2(๐, ๐) ๐ฑ ๐๐๐๐
0
1
0
1โ๐
๐(๐)๐3(๐, ๐) ๐ฑ ๐๐๐๐
๐ข1๐
๐ข2๐
๐ข3๐
๐1๐
๐2๐
๐3๐
=
20,27. 01 2016. | Dr. Noemi Friedman | PDE lecture | Seite 16
Local/ coordinate system, isoparametric mapping 2D
triangular elements, example
๐ฒ11๐๐ฒ12๐๐ฒ13๐
๐ฒ21๐๐ฒ22๐๐ฒ23๐
๐ฒ31๐๐ฒ32๐๐ฒ33๐
๐ข1๐
๐ข2๐
๐ข3๐
๐1๐
๐2๐
๐3๐
=
1 2
3
4
5
local 1 2 3global 4 3 6
6
๐ฒ22๐๐ฒ21๐
๐ฒ23๐
๐ฒ12๐๐ฒ11๐
๐ฒ13๐
๐ฒ32๐๐ฒ31๐
๐ฒ33๐
๐ข1
๐ข2
๐ข3
๐ข4
๐ข5
๐ข6
๐2๐
๐1๐
๐3๐
4
3
6
1
2
3
4
5
6
1
2
3
1 2 3 4 5 6
=
4
3
6