### FEM + - Projects at Harvard

Lecture 9: Finite Elements
Sauro Succi
FEM: non-spherical cows
Coordinate-free: Unstructured
FEM for fluids
The Finite Element Method
The Finite Element Method
Less intuition, more systematic, solid math
Foundations (functional analysis)
Strong vs Weak Convergence
Pointwise (strong) formulation
| f (x j ) - f j |= O(d ) ® 0
p
Local interpolation around x=x_j:
Looses accuracy on non-uniform meshes
Awkward on unstructured lattices
f (xk , yk ) - f (x, y)
[¶x f ](x, y) = å
xk - x
k=1
n
Variational (weak) formulation
F[ f ] º ¶t f - Lf = 0
F[F, g] º< g, F >= ò g(x)F[ f (x)]dx = 0
For any g, find f_N such that:
Min{(g,¶t fN - LfN )}
Hilbert space L2: Global statement
d( fN , f ) = ò | f - fN | dx
2
Expansion on basis function
N
f N (x;t) = å f j (t)j j (x)
j=1
Projection on Hilbert space
g º j j ® M jk fk = 0
M jk =< j j , j k >
Convergence in Hilbert space
d( fN , f ) ® 0
Expansion on basis function
N
f N (x;t) = å f j (t)j j (x)
j=1
Operators to Matrices
b
M jk =< j j , j k >= ò j j (x)j k (x)dx
a
b
L jk =< j j , Lj k >= ò j j (x)L(x, y)j k (y)dxdy
a
Examples of matrices:
using linear hat functions
FEM matrix operators
h
h ''
Fj = ( f j-1 + 4 f j + f j+1 ) » h( f j + f j )
6
3
2
1
df
G j = (- f j-1 + f j+1 ) » h | j
2
dx
1
H j = ( f j-1 - 2 f j + f j+1 )
h
Finite-support basis function
e j (x) º e(x - x j ) = (1-
j -1
j
| x - xj |
h
)Q(x j-1, x j+1 )
j +1
Useful identities
e j (xk ) = d jk
N
N
x = å x j e j (x)
1 = å e j (x)
j=1
j=1
j -1
j +1
j
N
x ¹ å x e (x)
2
2
j j
j=1
Mass matrix
M jk = ò e j (x)ek (x)dx
j -1
j
j +1
Uniform mesh:
h
M jk = [d j,k-1 + 4d j,k + d j,k+1 ]
6
Mass matrix: smoother
åM
k
f = Fj
jk k
x j+1
h
Fj = [ f j-1 + 4 f j + f j+1 ] » ò f (x)dx
6
x j-1
h
h
h
[1;4;1] » [0;6;0]+ [1;-2;1]
6
6
6
h d f
Fj = { f j +
]
}h
j
6 dx 2
2
2
Ajk = ò e j (x)e'k (x)dx = -Akj
j -1
j
j +1
Uniform mesh:
h
A jk = [-d j,k-1 + d j,k+1 ]
6
b
1
+
a
1 2
1 2
1 1 2
ò e'i (x)e'i (x)dx = ( a ) a + ( b ) b = a + b ® h
-a
1
b
b
1 2
1
1
ò e'i (x)e'i+1 (x)dx = -( b ) b = - b ® - h
-a
Diffusion matrix
Djk = ò e' j (x)e'k (x)dx = Dkj
j -1
j
j +1
Uniform mesh:
1
D jk = [d j,k-1 - 2d j,k + d j,k+1 ]
6
Ajkl = ò e j (x)ek (x)e'l (x)dx
j -1
j
Ajkl uk ul
j +1
Uniform mesh:
A jkl =
uj
6
[-dk,l-1 + dk,l+1 ]
FEM operators
N
( f , ek ) = ò [ek (x)å f j e j (x)]dx = å M jk f j = Fk
j=1
j
df
dek (x) N
( , ek ) = ò []å f j e j (x)]dx = å D jk f j = Gk
dx
dx j=1
j
d2 f
( 2 , ek ) =
dx
ò
dek (x) N de j (x)
fj
]dx = å L jk f j = H k
å
dx j=1
dx
j
Matrix assembly
Element-wise
1
j -1
(1,1) ® M j-1, j-1
(1, 2) ® M j-1, j
(2,1) ® M j, j-1
(2, 2) ® M j, j
21
2
j
j +1
(1,1) ® M j, j
(1, 2) ® M j, j+1
FEM operators
+ Strong math back-up
+ Very systematic
+ Fluid/Solid coupling
- Expensive (matrix algebra)
Summary
FEM +:
Powerful math backup (weak convergence)
Systematic programming
Geometrical flexibility
FEM -:
Matrix algebra anyway (lumping)
Heavy duty
Mainstream for solid mech, not fluids
1d example: assembly
j -1
j
A j-1, j
Aright
j-1, j-1
A j, j-1 A left
jj right A j, j+1
A jj
left
A j+1, j A j+1, j+1
j +1
4 matrix elements
per interval;
2 intervals per node=
8 matrix elements/node
FEM: cows are cows
Coordinate-free: Unstructured
3
f (x, y) = å fl el (x , h )
l=1
(0,1)
e1 (x, h) = (1- x - h)
h
e2 (x, h ) = x
e3 (x, h) = h
(0, 0)
x
(1, 0)
4
z
x
f (x, y, z) = å fl el (x , h, V )
l=1
h
Boundary conditions
Element-wise
M i,i-1, M i,i
M i,i , M i,i+1
Mi+1,i , Mi+1,+1
Triangle basis function
3
1
2
e1 (x, y) º1- x - h
1Û (0, 0)
e2 (x, y) º x
2 Û (1, 0)
e3 (x, y) º h
3 Û (0,1)
Triangle basis function
3
1
2
f (x, y) = f1e1 (x, h)+ f2e2 (x, h)+ f3e3 (x, h)
e1 (x, h) º1- x - h
1Û (0, 0)
e2 (x, h) º1- x - h
2 Û (1, 0)
e3 (x, h) º1- x - h
3 Û (0,1)
Matrix assembly
e =1, Nel
v =1, Nvert
Element-wise: connectivity
[Mi,i , Mi,i+p[i,1]...Mi,i+p[i,Z[i]] ]
(1, 2,3)e ® Matrix(i, j)
Matrix assembly
(1, 2,3)e ®[LM]3´3 ®[GM]NV´NV

 
 
   
Linear Algebra
Direct Methods:
Minimize bandwidth
Optimal Numbering (NP complete)
Iterative Methods:
Sparse matrix algebra: A*x+y
Optimal Numbering
File:Finite element sparse matrix.png
Size of this preview: 600 × 600 pixels.
Original ﬁle (816 × 816 pixels, ﬁle size: 1 KB, MIME type: image/png)
This is a ﬁle from the Wikimedia Commons. Information from its description page there
is shown below.
Commons is a freely licensed media ﬁle repository. You can help.
Description
Illustration of the en:Finite element method, the en:sparse matrix of the discretized
problem.
Date 02:18, 15 June 2007 (UTC)
Some app’s from the web
+ sample code fem.f
Finite-support basis function
e(x) = (1- | x |)[H(x +1)+ H(1- x)]
j -1
j
j +1
ò å f e (x)e (x) dx =å
j j
j,k
k
jk
M jk fk
Finite-support basis function
ò f (x)dx = ò å f e (x) å1e (x)] dx =
j j
j
j -1
k
k
j +1
j
ò å f e (x)e (x) dx =å
j j
j,k
k
jk
M jk fk
Finite-support basis function
å
j -1
jk
M jk fk = å Fj
j
j
j +1
x j+1
h
Fj = [ f j-1 + 4 f j + f j+1 ] » ò f (x)dx
6
x j-1