Computational Aerodynamics: Instructor: Prof. Marco Panesi
Computational Aerodynamics: Instructor: Prof. Marco Panesi
Computational Aerodynamics
Instructor: Prof. Marco Panesi
1. 1
AE 410
Summary of the Previous Lecture
1. 2
AE 410
Taylor Table
@u 1
Example: (a2 ui 2 + a1 ui 1 + bui ) = erT
@x i x
Each term expanded in Taylor Series and placed in a table simplifying the algebra:
@u 2
2 @ u
@3u
3
ui x ( x) ( x)
@x i @x2 i
@x3 i
@u
x
@x
0 1 0
i
1 1 2 3 1
a 2 ui 2 a2 a2 ( 2) a2 ( 2) a2 ( 2)
1! 2! 3!
a1 1 2 1
a 1 ui a1 ( 1) 3 1
1 a1 ( 1) a ( 1)
1! 2! 1 3!
bui b 0 0 0
x erT
1. 3
AE 410
Taylor Table
✓ ◆ ✓ ◆
@u 1 1 3 1 8a2 a1 3 @3u
ui 2 + 2ui 1 + ui = + ( x)
@x i x 2 2 x 6 6 @x3 i
2 3
( x) 3 @ u
erT = ( x)
3 @x3 i
@u 1 2
= (ui 2 + 4ui 1 + 3ui ) + O ( x)
@x i 2 x
1. 4
AE 410
Lagrange Interpolation
For example:
f (xi 1) = u(xi 1)
f (xi ) = u(xi )
f (xi+1 ) = u(xi+1 )
1. 5
AE 410
Lagrange Interpolation
df ui+1 ui 1
= 2a x + b =
dx i 2h
1. 6
AE 410
Lagrange Interpolation
d2 f ui+1 2ui + ui 1
= 2a =
dx2 i h2
Which is second order in accuracy.
gives rise to specific finite difference schemes. The ak(x) can be taken from
simple Lagrangian for a quadratic interpolation.
1. 7
AE 410
Lagrange Interpolation
a0 a1
a2
X
u(x) = ak (x) uk
k=0
1. 8
AE 410
Pade’ Finite Difference Schemes
This give rise to implicit finite differences (or Pade’ Finite Differences). For example, assuming
quadratic interpolation for both u(x) and u’(x) yields
✓ ◆
@u @u @u 3 ( x)4 @5u
+4 + = (ui+1 ui 1 ) +
@x i 1 @x i @x i+1 x 120 @x5
1. 9
AE 410
Pade’ Finite Differences
i-1 i i+1
1. The determination of the derivative of the point i requires the knowledge of the derivative at
the point i-1 and i+1. Hence, it is implicit!
1. 10
AE 410
Matrix Operators
Common example of finite-difference formulas are the three point centered finite
difference approximations for the first and second derivatives:
These are the basis for the point difference operator since they give an approximation to
a derivative at one discrete point in the mesh in terms of the surrounding points.
1. 11
AE 410
Matrix Operators
We are now ready to construct matrix operators which are the discrete approximations of the
spatial derivatives.
1 i-1 i i+1 Nx
0 h 1
1. 12
AE 410
Matrix Operators
It is easy to do:
1. 13
AE 410
Matrix Operators
We can express the previous equations in matrix vector form:
0 1 0 1 1
10 1
u01 h h ··· ··· 0 u1
B C B
u02 1
0 1
··· 0C B u2 C
B C B 2h 2h CB C
B .. C B .. .. .. C B .. C
B . C=B 0 . . . 0C B . C
B C B CB C
@u 0 A @ 0 ··· 1
0 1 A@
u N 1
A
N 1 2h 2h
u0N 0 ··· ··· 1
h
1
h
uN
M is a banded sparse
0 1 1
1
h h ··· ··· 0
B 1
0 1
··· 0C
B 2h 2h C
B .. .. .. C
M =B 0 . . . 0C
B C
@ 0 ··· 1
0 1 A
2h 2h
1 1
0 ··· ··· h h
1. 14
AE 410
Matrix Operators
Collecting 1/h
0 1
1 1 ··· ··· 0
B 1 0 1
··· 0C
1B C
2 2
B .. .. .. C
M= B 0 . . . 0C
hB C
@ 0 ··· 1
0 1A
2 2
0 ··· ··· 1 1
1. 15
AE 410
Matrix Operators: Implicit FD Schemes
1
u0i 1 + 4u0i + u0i+1 = ( 3ui 1 + 3ui+1 )
h
✓ ◆
1 1 3 3 17
3u0N 1 + u0N = uN 3 uN 2 uN 1+ uN
h 6 2 2 6
1. 16
AE 410
Implicit FD Matrix Operator
0 10 0 1 0 17 3 3 1 10 1
1 3 0 0 ··· 0 u1 6 2 2 6 ··· 0 u1
B1 4 1 0 ··· C B 0 C
0C B u2 C B ··· 0 C B C
B B 3 0 3 0 C B u2 C
B .. .. .. .. C B .. C B .. .. .. .. C B .. C
B0 . . . . 0C B . C 1B 0 . . . . 0 C B C
B CB C B CB . C
B .. .. .. CB . C = h B .. .. .. .. C B . C
B0 0 . . . 0C B . C B 0 . . . .C B . C
B CB . C B 0 CB . C
@0 ··· ··· 1 4 1A @ 0
uN 1 A @ 0 ··· 0 3 0 3 A @uN 1 A
1 3 3 17
0 ··· ··· ··· 3 1 u0N 0 ··· 6 2 2 6 uN
A B
To get the matrix operator M we must invert A!
~u0 = A 1
B~u = M~u
Note: Now M is DENSE but A and B are sparse and BANDED
1. 17
AE 410
Periodic Domains
We will find it convenient to use periodic domains for discussing the basic
behavior of the Finite Difference schemes w/o the influence of the boundary
conditions.
Periodic Function:
u(x + L) = u(x)
1. 18
AE 410
Periodic Domains
Periodic Function:
A function is called defined as periodic if it satisfies the following relation:
1. 19
AE 410
Periodic Domains
Because of the periodicity, u(x + L) = u(x) so we modify our
discretization as follows:
L
xi = (i 1)h, h= , i = 1, . . . , N
N
1 i-1 i i+1 Nx L
0 h 1
8
>
> x1 = 0
>
>
< x2 = h
.. NOTE: XN is NOT L
>
> .
>
>
: N 1
xN = (N 1)h = N L 6= L
1. 20
AE 410
Periodic Domains
Why is that? Because: u(xN +1 ) = u(L) = u(0)
Furthermore:
u(xi+N ) = u(i) 8i
The Finite difference stencil is “modified near the boundaries”. For example:
u2 u0 u2 uN
u01 = = Since u0 is equal to uN by periodicity.
2h 2h
uN +1 uN 1 u1 uN 1
u0N = =
2h 2h
Since uN+1 is equal to u1 by periodicity
1. 21
AE 410
The Matrix Operator Periodic Domains
1.
AE 410
The Matrix Operator Periodic Domains
2 3
b0 b1 b2 ··· bN 1
6 bN 1 b0 b1 ··· bN 2 7
6 7
1 6
6 .. .. .. .. .. 7
M= 6 . . . . . 7
7
2h 6 . .. .. .. .. 7
4 .. . . . . 5
b1 b2 ··· bN 1 b0
1.
AE 410
The Matrix Operator Periodic Domains
N
X1
m = bj exp [i(2⇡j(m 1)/N )], m = 1, . . . , N
j=0
p
Note that: i= 1
With the corresponding ~xm eigenvectors:
2 3
exp [i(2⇡(m 1)/N )]
6 7
6 exp [i(2⇡(m 1)/N ) · 2] 7
~xm =6
6 ..
7,
7 8m = 1, . . . , N
4 . 5
exp [i(2⇡(m 1)/N ) · N ]
1.
AE 410
Circulant Matrix
For those who know, the matrix X = [~x1 , ~x2 , . . . , ~xN ] is related to the
Fourier transform.
1.
AE 410
Programming Matrix Operators
Differentiation
1.
AE 410
Programming Matrix Operators
SPARSE MATRIX
Loop
1.
AE 410
Programming Matrix Operators
1.
AE 410
Example 0
1.
AE 410
What have we learned?
1. 30
AE 410