quasi-1d finite element method for isothermal flow of ionized gas through a nozzle
DESCRIPTION
Quasi-1D Finite Element Method for Isothermal Flow of Ionized Gas Through a Nozzle. Robert Lee [email protected]. In FD, one approximates the derivatives by finite differences. In FEM, one approximates the unknown variable by basis functions - PowerPoint PPT PresentationTRANSCRIPT
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Quasi-1D Finite Element Methodfor Isothermal Flow of Ionized Gas
Through a Nozzle
Robert Lee
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Comparison of finite differencesversus finite elements
• In FD, one approximates the derivatives by finite differences.
• In FEM, one approximates the unknown variable by basis functions
• On similar grids, the matrix equation produced by FEM and FD may actually be the same
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Comparison of finite differencesversus finite elements (cont’d 2)
• FEM is ideally suited for unstructured grids while FD is applied to structured grids
structured unstructured
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Method of Weighted Residuals
The method of weighted residuals is now the most popular way to obtain an equation for the application of FEM.
( ) ( )Lu x f xL is the operator (in our case diff. eq. of interest, and u is the unknown variable. f(x) is the forcing function.
Let us define an approximation of u given by .u Then
( ) ( ) ( )R x Lu x f x 1
( ) ( )N
j jj
u x x
0 1x
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Method of Weighted Residuals (cont’d 2)
We must try to force R(x) = 0. One possible way calledpoint matching is
( ) 0 1,2, ,iR x i N
( ) ( ) 0 1,2, ,i iLu x f x i N
For 4, a typical plot of ( ) looks likeN R x
0 11x 3x2x 4x
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Method of Weighted Residuals (cont’d 3)
Point matching is equivalent to the following:1
0
( ) ( ) 0 1,2, ,iR x x x dx i N
We must consider other functions.1
0
( ) ( ) 0 1,2, ,iR x v x dx i N
( ) is called the weighting or testing function.iv x
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Finite Element Method (FEM)
• The basis functions j(x)are generated by simple functions defined piecewise (element by element) over the FEM grid.
• The basis and weighting must be smooth enough such that their derivatives in the weight residual equation exists (assume nth order derivatives), i.e.,
FEM provides a systematic and very general way ofgenerating the basis functions (usually polynomialapproximations. The criteria are:
2nj
nx
2n
in
v
x
is element of interest
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FEM (cont’d 2)
• The basis functions are chosen in such a way that the coefficients defining the unknown quantity are precisely the value of the unknown quantity at the nodes.
1 1
( ) ( )N N
n nj j j j
j j
x x
1 1
( ) ( )N N
n nj j j j
j j
u u x u u x
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FEM (cont’d 3)
Let us consider a 1-D grid
1h 4h3h2hElement 1 32 4
Node 1 2 3 4 5
Coordinate 1x 5x4x3x2x
1( )
0j i
i jx
i j
1( )
0 at other nodesj
j
x xx
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FEM (cont’d 4)
1 2 3 4 5
Assuming that we want to use the same functions for both the basis and weighting functions, the simplest function is the linear function shown below
2 ( )x
1 2 3 4 5
1
2d
dx
1
1h
2
1h
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Mass
1( ) 0uA
t A x
After applying FD to / t and linearization,
2(2 ) 0n n n nA d
u A uA u At dx
1n n 1n nu u u
n n n nu u u u
a x b
2(2 ) ( ) 0
bn n n n
i
a
A du A uA u A v x dx
t dx
Let
1,2, ,i N
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Mass (cont’d 2)
We evaluate the above expression element by element
1
2(2 ) 0
m
Mn n n n
i im
A du A uA u A dx
t dx
Let ( ) ( )i iv x x
M is the number of elements
Apply integration by parts,1 1
1
m m
m
m
m m
x xx
xx x
dg dff dx fg g dx
dx dx
1,2, ,i N
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Mass (cont’d 3)
leads to1
1
2(2 )
m
m
xMn n n n i
im x
A du A uA u A dx
t dx
1(2 ) | 0m
m
xn n n ni xu A uA u A
Note: Most of the endpoint contributions cancel outif A is continuous since and u are continuous.Consider two elements
1x 2x 3x
1,2, ,i N
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Mass (cont’d 4)
After plugging in approximation of and u,
1
1 1 1 1
2m
m
xM N N Nn i
j j i j j k km j j kx
dAu A dx
t dx
(2 ) | 0n n n n bi au A uA u A
1,2, ,i N
1
1 1 1 1 1
2m
m
xM N N N Nn n n il l p p k k j j
m l p k jx
du A u A dx
dx
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Single Element Evaluation
Consider integral for one elementm
mm 1m
and is nonzero only for , 1j jd dx j m m
1
1
( ) mm
m m
x xx
x x
11
( ) mm
m m
x xx
x x
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Single Element Evaluation (cont’d 2)
1 1 1 12m
m
x m m mn i
j j i j j k kj m j m k mx
dAu A dx
t dx
, 1i m m
1 1 1 1 1
2 0m
m
x m m m mn n n il l p p k k j j
l m p m k m j mx
du A u A dx
dx
Let us consider the integral over a single elementAnd ignore the contribution from the boundary
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Mapping from Global to Local System
mx 1mx
m
Global node number
Local node number
m m+1
1 2
Additional notation:
1( ) ( )mm x x 1 2( ) ( )m
m x x for mx
1 1 2 1 1 2n n n n
m m m m
1 1 2 1 1 2n n n n
m m m mu u u u u u u u
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Element Evaluation in Local System1 2 2 2
1 1 1
2m
m
x mm m m n m i
j j i j j k kj j kx
dAu A dx
t dx
1,2i
1 12 2 2 2
1 1 1 1
2m m
m m
x xm mn m m n m n mi i
j k k j l l p pj k l px x
d du A dx A u dx
dx dx
Reordering terms,12 2
1 1
2m
m
x mm m n m m i
j j i k k jj kx
dAu A dx
t dx
1 2 2 2 2
1 1 1 1
2 0m
m
x mn m n m n m m il l p p k k j j
l p k jx
du A u A dx
dx
1,2i
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Momentum
210
Tu u A
t A x x
After linearization, FD in time, and applying the method of weighted residuals, the expression for a single element is
12
m
n n ni
A ATu u dx
t x
2 212( ) ( ) 0
m
n n n n ni u A u A u u A dx
x
1,2, ,i N
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Momentum (cont’d 2)
Applying integration by parts, grouping terms, and disregarding B.C.’s,
212 2
( )( )
m
n n i iA Tit
d d Au u A dx
dx dx
2
m
m
n n n iAit
in n ni T
du A u dx
dx
d Adu A dx
dx dx
1,2, ,i N
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Application to Conservation of Momentum (cont’d 3)
Substituting basis function representation for unknowns and converting to local system,
12 2 221
21 1 1
( )( )
2
m
m
x m mn m m m n m m mi i
j k k i j k k j jj k kx
d d AA Tu u A dx
t dx dx
1
1
2 2 2 2
1 1 1 1
22 2 2
1 1 1
m
m
m
m
x mn m m m n m n m mi
j k k i j k k l l jj k k lx
mx min m n m n mi
k k l l k kk l kx
dAu u A dx
t dx
d Ad Tu A dx
dx dx
1,2i
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Local Matrix Build
m m mk F
11 12
21 22
m mm
m m
k kk
k k
Subscripts associated withindices i j in equations.
(11) (12)
(21) (22)
m mij ijm
ij m mij ij
k kk
k k
( )For m pqijk
1: Conservation of massp
2: Conservation of momentump 1: mass density variable jq
2: velocity variable jq u
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Local Matrix Build (cont’d 2)
1 2(11)
1
2m
m
x mm m m n m m iij j i k k j
kx
A dk u A dx
t dx
For example,
1 2(12)
1
m
m
x mm n m m iij k k j
kx
dk A dx
dx
1
2
m
m
m
jmj
ju
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Local Matrix Build (cont’d 3)
1
2
m
m
m
FF
F
(1)
(2)
mm i
i mi
FF
F
( )For , m p
iF
1: Conservation of mass equationp 2 : Conservation of momentum equationp
For example,1 2 2
(1)
1 1
2m
m
x mm n m n m i
i l l p pl px
dF A u dx
dx
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Transferring Local Matrix to Global Matrix
1 32 4
1 2 3 4 5GlobalNode #
LocalNode #
1 1 1 1 2222
For element3
3 3 3 311 33 12 34 21 43 22 44k k k k k k k k
3 3 3 31 3 2 4 1 3 2 4F F F F
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Transferring Local Matrix to Global Matrix (cont’d 2)
1 111 12
1 1 2 221 22 11 12
2 2 3 321 22 11 12
43 3 4 1221 22 11
4 421 22
0 0 0
0 0
00
0 0
0 0 0
k k
k k k k
k k k kk
k k k
k k
1
2
3
4
5
11
1 22 1
2 32 1
3 42 1
42
F
F F
F F
F F
F
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Evaluation of Area A
Assume A varies linearly within element m,2
1
m mj j
j
A A
1 is the area at local node 1mA
2 is the area at local node 2mA
m mi mi
i
d A d dAA
dx dx dx
2 2
1 1
mmjm m m mi
j j i jj j
ddA A
dx dx
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Numerical Integration: Gauss Quadrature
Gauss quadrature of order N is given by
1
11
( ) ( )N
i i Ni
f x dx w f x R
i 22
are zeros of Legendre polynomials ( )
2w
(1 )
i N
i N i
x P x
x P x
42 1 2
2
2 !
(2 1) 2 !
N N
N
N d fR
dxN N
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Numerical Integration: Gauss Quadrature (cont’d 2)
Note: Gauss quadrature is especially well suited for polynomialfunctions since for large enough N, RN=0. A polynomialof order 2N-1 can be exactly integrated by a quadrature of order N. For our case, we need coordinate transformation,
11 12
1
2
m m m m
m m
x x x x x
x xdx d
1 11 1
11
( ) ( ( )) ( ( ))2 2
m
m
x Nm m m m
i iix
x x x xf x dx f x d w f x
CIS 888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Numerical Integration: Gauss Quadrature (cont’d 2)
The highest order polynomial of interest for our problem is of order 4. We need quadrature of order 3,
1 3 2
1 3 2
0.7745966692414830 0.0
0.5555555555555560 0.8888888888888890w w w