finite element method. fem approaches there are two main methods that are applied to solving...
TRANSCRIPT
Finite Element Method
FEM Approaches
There are two main methods that are applied to solving problems using the FEM method.
Variational methods that use the classical Rayleigh-Ritz technique
Galerkin’s methods which is one technique in a family of methods referred to as method of weighted residuals.
Variational Approach
In solving problems arising in physics and engineering it is often possible to replace the problem of integrating a differential equation by the equivalent problem of seeking a function that gives a minimum value of some integral. Problems of this type are called variational problems.
The methods that allow us to reduce the problem of integrating a differential equation to the equivalent variational problem are usually called variational methods.
Variational Approach
What is a functional?
dxyyxFyIb
a
),,()(
subjected to the boundary conditions
BbyAay )(,)(
functional
Goal: Find a function F(x,y,y’) for which the functional I(y) has an extremum (usually a minimum)
Variational Approach
Some problems:
dxyyxFyIb
a
),,()( NOT:
Question: Are there situations in which the function F(x,y,y’) for which the functional I(y) in minimized is ALSO a solution to the PDE and BCs??
.....0),( 22 ort
UUoryxfU
Variational Approach
Question: Are there situations in which the function F(x,y,y’) for which the functional I(y) in minimized is ALSO a solution to the PDE and BCs??
Answer: Yes, all PDEs typically found in physics and engineering have functionals or variational equations whose solution is equivalent to solving the PDE directly.
Variational Approach
Deriving those equations can be done using the calculus of variations (beyond the scope of this class).
Answer: Yes, all PDEs typically found in physics and engineering have functionals or variational equations whose solution is equivalent to solving the PDE directly.
Variational Approach
Name of equations PDE Variational principle
Homogeneous
wave equation with sources
Homogeneous
wave equation without sources
Diffusion equation
Homogenous Poisson’s equation
Homogenous Laplace’s equation
gk 22
022 k
02
t
k
g2
02
dvgkIv 2
2
1)( 222
dvkIv 222
2
1)(
dvdtt
kIt v
22
2
1)(
dvgIv 2
2
1)(
2
dvIv 2
2
1)(
Finite Element Method
The finite element method (FEM) has its origin in the field of structural analysis. However, since then the method has been employed in nearly all areas of computational physics and engineering.
The FEM method, while more difficult to program than either the finite difference (FD) or method of moments (MOM), is a more powerful and versatile numerical technique for handling problems involving complex geometries and inhomogeneous media.
Basic concept
Although the behaviour may be complex when viewed over a largeregion, a simple approximation may suffice over a small subregion.
The region is divided up into finite elements.
(usually, triangles or squares,but can be more complicated)
Regardless of the shape the field is approximated by a different expression over each element, maintaining continuity at adjoiningelements.
Solution Strategy: Variational Approach
The equations to be solved are usually stated not in terms of field the variables but in terms of an integral-type functional such as energy.
The functional is chosen such that the field solution makes the functional stationary
The total functional is the sum of the integral over each element
Finite Element Method
The finite element method (FEM) involves basically four steps:
(1) Discretize the solution region into a finite number of subregions or elements
(2) Derive the governing equations for each element based on either a variational approach or Galerkin’s method
(3) Assemble all the elements together in the solution space.
(4) Solve the resulting system of equations
Finite Element Method
CREATING THE MESH
(1) Discretize the solution region into a finite number of subregions or elements
Finite Element Method in 2D
CREATING THE MESH
(1) Discretize the solution region into a finite number of subregions or elements
• divide the geometry into elements(in 2D triangular elements are common)• each element has a number of nodesattached.
In this figure there are 8 elements (E1-E8)and 9 nodes (N1-N9)
Finite Element Method
The mesh is often described using two tables(element table and a node table)
Element TableElement# Node1 Node2 Node31 4 7 82 4 8 53 8 9 5......8 2 6 3
Node TableNode# x y1 0 1 2 0.5 1 3 1 1 ......9 1 0
2D FEM: Right Triangular Single Element
The simplest element is the right triangle (0,1,2)
x
y
1
2
h
h
0
The potential can becalculated as
,x y a bx cy
a,b,c unknown
! Smart to specify theinterpolation at the vertices!
Then: 1 0 2 00,x y x y
h h
Other elements
Square element: consider as two triangles. This is ok, but doesnot lead to a smooth interpolation over the square. Better to usea higher order interpolation that uses four nodal values
,x y a bx cy dxy This scheme leads to:
0 12
84 5
36 7 8
01
1
8 ii
Element expansion
In general we wish to approximate the unknown function, (x,y),Inside an element by an interpolation of its values at the vertices.
element shape functions or basis functions. In FEM theseare usually interpolation functions
unknown anywherewithin the element
Provided the valuesat the vertices are known
N
iii yxyx
1
),(),(
Number of vertices
Generalized Triangular
Develop the Governing Equations for a Single Element
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
cybxayxVe ),(
Assume the unknown variable (V), in eachelement can be found as a linear interpolationof its value at the three nodes.
FIND a, b and c
c
b
a
yx
yx
yx
V
V
V
e
e
e
33
22
11
3
2
1
1
1
1
Finite Element Method
Develop the Governing Equations for a Single Triangular Element
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
c
b
a
yx
yx
yx
V
V
V
e
e
e
33
22
11
3
2
1
1
1
1
Solve for the unknowns (a, b and c) and thensubstituting that result into
cybxayxVe ),(
Finite Element Method
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
3
1
),(),(i
eiie VyxyxV
where
12131312
122112213
311331132
233223321
2
1
2
1),(
2
1),(
2
1),(
yyxxyyxxA
yxxxyyyxyxA
yx
yxxxyyyxyxA
yx
yxxxyyyxyxA
yx
Shape or basis functions(only function of geometry)
Finite Element Method
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
12131312
122112213
311331132
233223321
2
1
2
1),(
2
1),(
2
1),(
yyxxyyxxA
yxxxyyyxyxA
yx
yxxxyyyxyxA
yx
yxxxyyyxyxA
yx
Properties of the shape functions
1),(
,0
,1),(
3
1
i
i
i
yx
ji
jiyx
2D Example:Laplace’s Equation
When the quantity being sought (here the electrostatic potential V)
Recall: The true potential is known to minimize the electrostaticfield energy.
dvVVIv 2
2
1)(
0),(2 yxV
Create the Mesh
Step #1: Discretize the surface/volume to be solved into small finite elements. Label each element and its associated nodes
1
2
3
4
1 2 3
Basic concept: Review
Step #2: Approximate the complex solution within the whole regionin terms of a sum of solutions found within each element
1
2
3
41 2 3
eN
ee yxVyxV
1
),(),(
FEM Laplace’s Equation
Approximate the solution within each element in terms ofeach value at the corresponding nodes. (i.e. interpolation)
(x1,y1)
(x2,y2)
(x3,y3) Element
1 2 3 3 2 2 3 3 2
2 3 1 1 3 3 1 1 3
3 1 2 2 3 1 2 2 1
1,
21
,21
,2
x y x y x y y y x x x yA
x y x y x y y y x x x yA
x y x y x y y y x x x yA
3
1
),(),(i
eiie VyxyxV
Finite Element Method
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
To derive an equation for each element we plug in our linear approximation into an functional expression.
dvyxVdvVyxVIv i
iei
v ieiie
23
1
23
1
),(2
1),(
2
1)(
3
1
),(),(i
eiie VyxyxV
dvVVIv
ee 2
2
1)(
eji j
j
v
ieie VdsyxyxVVI
3
1
3
1
),(),(2
1)(
Finite Element Method
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
To derive an equation for each element we plug in our linear approximation into an functional expression.
dvyxVdvVyxVIv i
iei
v ieiie
23
1
23
1
),(2
1),(
2
1)(
3
1
),(),(i
eiie VyxyxV
dvVVIv
ee 2
2
1)(
eji j
j
v
ieie VdsyxyxVVI
3
1
3
1
),(),(2
1)(
1 2 3 3 2 2 3 3 2
2 3 1 1 3 3 1 1 3
3 1 2 2 3 1 2 2 1
1,
21
,21
,2
x y x y x y y y x x x yA
x y x y x y y y x x x yA
x y x y x y y y x x x yA
Finite Element Method
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
Example: Laplace’s Equation
dsyxyxVVI j
v
ii j
eie ),(),(2
1)(
3
1
3
1
dxdyyxyxC j
v
ieij ),(),(
Let
eet
ee VCVVI2
1)(
where
3
2
1
e
e
e
e
V
V
V
V and
eee
eee
eee
e
CCC
CCC
CCC
C
333231
232221
131211
element coefficient matrix
Finite Element Method
Example: Laplace’s Equation
dxdyyxyxC j
v
ieij ),(),(
eet
ee VCVVI2
1)(
23322
1QPQPA
1 2 3 3 2 2 3 3 2
2 3 1 1 3 3 1 1 3
3 1 2 2 3 1 2 2 1
1,
21
,21
,2
x y x y x y y y x x x yA
x y x y x y y y x x x yA
x y x y x y y y x x x yA
jijieij QQPP
AC
4
1
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)
213
132
321
yyP
yyP
yyP
123
212
231
xxQ
xxQ
xxQ
Solution for triangular elements
Finite Element Method
x
y
Ve(x,y)
1
2
3
Ve1
(x1, y1)
Ve2
(x2, y2)
Ve3
(x3, y3)dxdyyxyxC j
v
ieij ),(),(
Main property of the coefficient matrix:
eji
eij CC
Finite Element Method
Assembling of All Elements Together
Solve for the unknowns (a, b and c) and thensubstituting that result into
N
ee yxIyxI
1
),(),(
VCVyxIyxI tN
ee 2
1),(),(
1
where
NV
V
V
V
V
....3
2
1
and
NNN
N
e
CC
C
CC
CCCC
C
.........
...............
............
.........
...
1
31
2221
1131211
Global coefficient matrix
Finite Element Method
Assembling of All Elements Together
NNN
N
e
CC
C
CC
CCCC
C
.........
...............
............
.........
...
1
31
2221
1131211
Coefficients are only non-zero for elements that touch each other
1
2 4
3
5
E1
1-4-2(1-2-3) E2
1-3-4(1-2-3)
E3
3-5-4(1-2-3)
322
323
321
332
333
233
122
331
232
123
231
121
312
313
223
311
122
221
132
133
131
213
112
212
113
211
111
00
0
00
0
CCC
CCCCCCCCC
CCCCCC
CCC
CCCCCC
C
Finite Element Method
Setting up and solving the resulting equations
The solution for the node values is the ones that result in the functional obtaining its minimum value!
VCVyxIyxI tN
ee 2
1),(),(
1
NkV
yxI
V
yxI
V
yxI
V
yxI
k
N
,....,2,10),(
0),(
......),(),(
21
Finite Element Method
Setting up and solving the resulting equations
NkV
yxI
k
,....,2,10),(
Example for five nodes:
5
4
3
2
1
5554535251
4544434241
3534333231
2524232221
1514131211
54321
V
V
V
V
V
CCCCC
CCCCC
CCCCC
CCCCC
CCCCC
VVVVVI
0
2
515414313212
1551441331221111
CVCVCVCV
CVCVCVCVCVV
I
Finite Element Method
Setting up and solving the resulting equations
NkV
yxI
k
,....,2,10),(
Example for five nodes:
0
2
515414313212
1551441331221111
CVCVCVCV
CVCVCVCVCVV
I
In general:
NkCVN
iiki ,....3,2,10
1
Iterative solution method
At node k in a mesh with n nodes, we have the solution
e.g. see previous slide
We note that Cki = 0 if node k is not directly connected to node i,only nodes that are directly connected to node k contribute to Vk.
We apply this iteratively to all free nodes (not at fixed boundary value) where the potential is unknown. Initially we assign either0, random or some average value to each free node and then iterate on the above equation until convergence is met.
n
kiikii
kkk CV
CV
,1
1
Finite Element Method
Example: Poisson’s Equation
dvVyxgyxVyxVIv i
eiii
eiii
eiie
3
1
3
1
23
1
),(),(2),(2
1)(
3
1
),(),(i
eiie VyxyxV
ejj
v
ii j
eiejj
v
ii j
eie gdsyxyxVVdsyxyxVVI
),(),(),(),(2
1)(
3
1
3
1
3
1
3
1
),(2 yxgV
dvgVVVIv 2
2
1)(
2
3
1
),(),(i
eii gyxyxg
Equations for single element:
Finite Element Method
Example: Poisson’s Equation
ejj
v
ii j
eiejj
v
ii j
eie gdsyxyxVVdsyxyxVVI
),(),(),(),(2
1)(
3
1
3
1
3
1
3
1
),(2 yxgV dvgVVVI
v 2
2
1)(
2
Equations for single element:
eet
eeet
ee gTVVCVVI 2
1)(
where
3
2
1
e
e
e
e
V
V
V
V and
dsyxyxC j
v
ieij ),(),(
dsyxyxT j
v
ie
ij ),(),(
Finite Element Method
Example: Poisson’s Equation ),(2 yxgV
Equations for single element: eet
eeet
ee gTVVCVVI 2
1)(
dsyxyxC j
v
ieij ),(),( dsyxyxT j
v
ie
ij ),(),(
23322
1QPQPA
jijieij QQPP
AC
4
1
213
132
321
yyP
yyP
yyP
123
212
231
xxQ
xxQ
xxQ
Solution for triangular elements
23322
1QPQPA
jiA
jiAT e
ij 6/
12/
213
132
321
yyP
yyP
yyP
123
212
231
xxQ
xxQ
xxQ
Solution for triangular elements
Finite Element Method
Example: Poisson’s Equation ),(2 yxgV
dvgVVVIv 2
2
1)(
2
Put all the elements together:
gTVVCVVIVI ttN
ee
2
1)()(
1
Construct matrix and then solve:
Nk
V
gTVVCV
V
VI
k
tt
k
,.....3,2,1021
)(
Finite Element Method
Example: Poisson’s Equation ),(2 yxgV
Example:
Nk
V
gTVVCV
V
VI
k
tt
k
,.....3,2,102
1)(
02
1
5
4
3
2
1
5554535251
4544434241
3534333231
2524232221
1514131211
54321
5
4
3
2
1
5554535251
4544434241
3534333231
2524232221
1514131211
543211
g
g
g
g
g
TTTTT
TTTTT
TTTTT
TTTTT
TTTTT
VVVVV
V
V
V
V
V
CCCCC
CCCCC
CCCCC
CCCCC
CCCCC
VVVVVV
5
11
11
5
21
111
11
iii
iii gT
CCV
CVResult in:
In General:
N
iiki
kk
N
kiikii
kkk gT
CCV
CV
1)(1
11
Finite Element Method
Example: Homogenous Wave Equation
dvyxgyxyxkyxIv i
eiii
eiii
eiii
eiie
3
1
3
1
23
1
2
23
1
),(),(2),(),(2
1)(
3
1
),(),(i
eiie yxyx
ejj
v
ii j
eiejj
v
ii j
ei
ejj
v
ii j
eie
gdsyxyxdsyxyxk
dsyxyxI
),(),(),(),(2
),(),(2
1)(
3
1
3
1
3
1
3
1
2
3
1
3
1
),(),(),( 22 yxgyxkyx
3
1
),(),(i
eii gyxyxg
Equations for single element: dvgkIv 2
2
1)( 222
Finite Element Method
Example: Wave Equation
Equations for single element:
eet
eeet
eeet
ee gTTk
CI 22
1)(
2
where
3
2
1
e
e
e
e and
dsyxyxC j
v
ieij ),(),(
dsyxyxT j
v
ie
ij ),(),(
),(),(),( 22 yxgyxkyx
ejj
v
ii j
eiejj
v
ii j
ei
ejj
v
ii j
eie
gdsyxyxdsyxyxk
dsyxyxI
),(),(),(),(2
),(),(2
1)(
3
1
3
1
3
1
3
1
2
3
1
3
1
Finite Element Method
Example: Wave Equationwith no sources
Equations for single element:
eet
eeet
ee Tk
CI 22
1)(
2
where
3
2
1
e
e
e
e and
dsyxyxC j
v
ieij ),(),(
dsyxyxT j
v
ie
ij ),(),(
0),(),( 22 yxkyx
ejj
v
ii j
eiejj
v
ii j
eie dsyxyxk
dsyxyxI
),(),(2
),(),(2
1)(
3
1
3
1
23
1
3
1
Finite Element Method
Example: Wave Equation
Put all the elements together:
Tk
CII ttN
ee 22
1)()(
2
1
0),(),( 22 yxkyx
x
y
z
Finite Element Method: Waveguide
TM Modes
22tz kk
zjkz
zeyxzyxE ),(),,(
TE Modes
zjkz
zeyxzyxH ),(),,(
where 0),(),( 22 yxkyx t
and
Finite Element Method: Waveguide
TM Modes
Put all the elements together:
Tk
CII tttN
ee 22
1)()(
2
1
0),(),( 22 yxkyx t
Band Matrix Solution: Break the matrices up into sub-matrices that distinguishesfree-nodes from those that are known or prescribed nodes (i.e. boundary values):
p
f
pppf
fpffpf
t
p
f
pppf
fpffpf TT
TTkCC
CCI
22
1 2
zjkz
zeyxzyxE ),(),,(
Finite Element Method: Waveguide
TM Modes
0),(),( 22 yxkyx t
Minimize the functional:
p
f
pppf
fpffpf
t
p
f
pppf
fpffpf TT
TTkCC
CCI
22
1 2
zjkz
zeyxzyxE ),(),,(
0
0
2
p
ffpfft
p
ffpff
f
TTkCC
I
Finite Element Method: Waveguide
TM Modes
0),(),( 22 yxkyx t
zjkz
zeyxzyxE ),(),,(
For TM modes: 0 psince tangential E field must vanish on PEC boundary
02
p
f
fpfftp
f
fpff TTkCC
02 ffftff TkC
Finite Element Method: Waveguide
TM Modes 0),(),( 22 yxkyx tzjk
zzeyxzyxE ),(),,(
02 ffftff TkC
Pre-multiply both sides by1
ffT
0
0
0
21
121
f
ftffff
ffffftffff
IA
IkCT
TTkCT
Where:
2
1
t
ffff
k
CTA
Finite Element Method
Project #2: Write a FEM program that calculates the mode shapes and cutoff frequencies of the TM modes for the air filled ridge waveguideshown below.
h
w wd
t
1
1
r
r
PEC Walls