Môn: Hàng Không Động Lực Học 4

Bài 1.Consider the following diffusion problem:
2
2
1 T T
x t o
o o
·
o o
(1) 0 x L < < 0 t >
0 T · at 0 x · 0 t >
L
T
k q
x
o
·
o
at x L · 0 t >
( ) T F x ·
at 0 x L s s 0 t ·
Develop the finite difference using:
i) Explicit for the differential equation, central difference formula for the boundary
condition:
Equation (1) becomes:
2
2
T T
t x
o
o o
·
o o
Each parts of mesh size:
L
x
M
A ·
Using the second-order accurate central difference formula for the second
derivative and the first-order accurate forward differencing formula for the time
derivative to yield:
( )
( )
2
2
1 1
2 2
,
2
0
n n n
i i i
i n
T T T T
x
x
x
+
+ o
]
· + A
]
o
A
[ ]
1
,
0
n n
i i
i n
T T T
t
t t
+
o
· + A
o A
Replace into equation (1)
( )
( )
1
2
1 1
2
2
0 ,
n n n n n
i i i i i
T T T T T
t x
t
x
+
+
+
]
· + A A
]
A
A
(2)
Where: ( ) ,
n
i
T T i x n t T · A A ·
Rearranged equation (2) , we have:
( )
1
1 1
1 2
n n n n
i i i i
T rT r T rT
+
+
· + +
(3)
Where:
( )
2
t
r
x
oA
·
A
0,1, 2,... n ·
1, 2,..., 1 i M ·
With a truncation error order is: ( )
2
0 , t x
]
A A
]
Suppore the temperatures are prescribed at the boundaries 0 i · and i M · . We
have:
0
0
n
T know · · at 0 x ·
L
T
k q know
x
o
· ·
o
at x L ·
We have a form of heat flux at boundary.The central differencing is used to
discretize the boudary condition:
1 1
2
n n
i i
T T
k q
x
+

·
A
At x L · and i M · , we have:
1 1
2
n n
M M
L
T T
k q
x
+

·
A
1 1
2
n n L
M M
xq
T T
k
+
A
= · +
i M · , equation (3) becomes:
( )
1
1 1
1 2
n n n n
M M M M
T rT r T rT
+
+
· + +
Replace with
1
n
M
T

so we have:
( )
1
1 1
2
1 2
n n n n L
M M M M
xq
T rT r T r T
k
+

A | `
· + + +
÷
. ,
i M ·
Rearranged:
( )
1
1
2 1 2 2
n n n L
M M M
xq
T rT r T r
k
+

A
· + + i M ·
Final:
( )
1
1 1
1 2
n n n n
i i i i
T rT r T rT
+
+
· + +

1, 2,..., 1 i M ·
;
0,1, 2,... n ·
0 T · 0 i ·
( )
1
1
2 1 2 2
n n n L
M M M
xq
T rT r T r
k
+

A
· + + i M ·
( ) T F i · 1, 2,..., i M ·
ii) Fully implicit method for difference equation, central difference formula for the
boundary condition:
Using the second-order accurate central difference formula for the second derivative
and the first-order accurate backward differencing formula for the time derivative to
yield, at 1 n + time
( )
( )
1 1 1 2
2
1 1
2 2
, 1
2
0
n n n
i i i
i n
T T T T
x
x
x
+ + +
+
+
+ o
]
· + A
]
o
A
[ ]
1
, 1
0
n n
i i
i n
T T T
t
t t
+
+
o
· + A
o A
Replace into equation (1):
( )
( )
1 1 1 1
2
1 1
2
2
0 ,
n n n n n
i i i i i
T T T T T
t x
t
x
o
+ + + +
+
+
]
· + A A
]
A
A

1, 2,..., 1 i M ·
;
0,1, 2,... n ·
( )
1 1 1
1 1
1 2
n n n n
i i i i
T rT r T rT
+ + +
+
= · + +
(4)
Suppore the temperatures are prescribed at the boundaries 0 i · and i M · . We
have:
0
0 T know · ·
at 0 x ·
L
T
k q know
x
o
· ·
o
at x L ·
We have a form of heat flux at boundary.The central differencing is used to
discretize the boudary condition, at 1 n + time:
1 1
1 1
2
n n
i i
T T
k q
x
+ +
+

·
A
At x L · and i M · , we have:
1 1
1 1
2
n n
M M
L
T T
k q
x
+ +
+

·
A
1 1
1 1
2
n n L
M M
xq
T T
k
+ +
+
A
= · +
i M · , equation (4) becomes:
( )
1 1 1
1 1
1 2
n n n n
M M M M
T rT r T rT
+ + +
+
· + +
Replace with
1
1
n
M
T
+

so we have:
( )
1 1 1
1 1
2
1 2
n n n n L
M M M M
xq
T rT r T r T
k
+ + +

A | `
· + + +
÷
. ,
i M ·
Rearranged:
( )
1 1
1
2 1 2 2
n n n L
M M M
xq
T rT r T r
k
+ +

A
· + + i M ·
Final:
( )
1 1 1
1 1
1 2
n n n n
i i i i
T rT r T rT
+ + +
+
· + +

1, 2,..., 1 i M · 0,1, 2,... n ·
0 T · 0 i ·
( )
1 1
1
2 1 2 2
n n n L
M M M
xq
T rT r T r
k
+ +

A
· + + i M ·
( ) T F i · 1, 2,..., i M ·
iii) Crank-Nicolson method for the fidderential equation and central difference formul;a
for the boundary condition:
Retains the left-hand side of the implicit equation, and modifies the righ-hand side by
taking the arithmetic average of the right-hand sides of the explicit equation and the implicit
equation. So we have the finite-difference approximation of the diffusion equation with
Crank-Nicolson method becomes:
( ) ( )
( ) ( )
1 1 1 1
2 2
1 1 1 1
2 2
2 2
0 ,
2
n n n n n n n n
i i i i i i i i
T T T T T T T T
t x
t
x x
o
+ + + +
+ +
]
+ +
]
· + + A A ]
]
A
A A
]
]
Rearranged:
( ) ( )
1 1 1
1 1 1 1
2 2 2 2
n n n n n n
i i i i i i
rT r T rT rT r T rT
+ + +
+ +
+ + · + +
(5)
Where:
( )
2
t
r
x
oA
·
A
Suppore the temperatures are prescribed at the boundaries 0 i · and i M · . We have:
0
0 T know · ·
at 0 x ·
L
T
k q know
x
o
· ·
o
at x L ·
We have a form of heat flux at boundary.The central differencing is used to discretize
the boudary condition :
1 1
1 1
2
n n
i i
T T
k q
x
+ +
+

·
A
At x L · and i M · , we have:
1 1
2
n n
M M
L
T T
k q
x
+

·
A
1 1
2
n n L
M M
xq
T T
k
+
A
= · +
At 1 n + time:
1 1
1 1
2
n n L
M M
xq
T T
k
+ +
+
A
· +
i M · , equation (5) becomes:
( ) ( )
1 1 1
1 1 1 1
2 2 2 2
n n n n n n
M M M M M M
rT r T rT rT r T rT
+ + +
+ +
+ + · + +
Replace to equation (5), we have:
( ) ( )
1 1 1
1 1 1 1
2 2
2 2 2 2
n n n n n n L L
M M M M M M
xq xq
rT r T r T rT r T r T
k k
+ + +

A A | ` | `
+ + + · + + +
÷ ÷
. , . ,
i M ·
Rearranged:
( ) ( )
1 1
1 1
2
2 2 2 2 2 2 4
n n n n L
M M M M
xq
rT r T rT r T r
k
+ +

A
+ + · + + i M ·
Final:
( ) ( )
1 1 1
1 1 1 1
2 2 2 2
n n n n n n
i i i i i i
rT r T rT rT r T rT
+ + +
+ +
+ + · + + 1, 2,..., 1 i M ·
0,1, 2,... n ·
0 T · 0 i ·
( ) ( )
1 1
1 1
2
2 2 2 2 2 2 4
n n n n L
M M M M
xq
rT r T rT r T r
k
+ +

A
+ + · + + i M ·
( ) T F i · 1, 2,..., i M ·
Bài 2. Consider the diffusion problem given in the dimensionless form as:
2
2
T T
x t
o o
·
o o
0 1 x < < 0 t >
0 T · at 0 x · 0 t >
0 T · at 1 x · 0 t >
( ) sin T x r ·
at 0 1 x s s 0 t ·
The exact solution of this problem is given by:
( ) ( )
2
, sin
t
T x t e x
r
r

·
Write the finite formulation of this problem by using the explicit method. Solve the resulting
difference equations with a step size 0.1 x A · and calculate the center temperature ( ) 0.5 x ·
by taking:
i.
1
6
r ·
ii. 0.5 r ·
iii. 0.6 r ·
Solution:
0.1
10
1
x
M
L
A · ¹
= ·
'
·
¹
The finite-difference approximation of the differential equation of heat conduction:
( )
1
1 1
1 2
n n n n
i i i i
T rT r T rT
+
+
· + + 1, 2,..., 9 i ·
Where
( )
2
t
r
x
A
·
A
( )
2
t
r
x
A
·
A
x A ( )
2
* t r x A · A
1
6
r · 0.1
1
600
0.5 r · 0.1 0.005
0.6 r · 0.1 0.006
So we have:
1
6
r · :
1
1 1
1 2 1
6 3 6
n n n n
i i i i
T T T T
+
+
· + +
0.5 r · : ( )
1
1 1
0.5
n n n
i i i
T T T
+
+
· +
0.6 r · :
1
1 1
0.6 0.2 0.6
n n n n
i i i i
T T T T
+
+
· + +
The temperature at the boundary nodes are specified as:
0
0
n
T · and
10
0
n
T ·
And the initial condition becomes:
0
sin
10
i
i
T r
| `
·
÷
. ,
1, 2,...,10 i ·
Code for programe:
deltax=0.1;
r=input('input value for r, r= ');
deltat=r*deltax^2
x=0;
for i=1:10
T(1,i)=sin(pi*x);
x=x+deltax;
end
t=0;
n=1;
' t T(0.5,t)'
while t<=0.1
t=t+deltat;
T(n,11)=0;
for i=2:10
T(n+1,i)=r*T(n,i-1)+(1-2*r)*T(n,i)+r*T(n,i+1);
T(n+1,1)=T(n+1,2);
end
if mod(n,2)==0
m=n;
s=t;
fprintf('%10f',s,T(m,6))
fprintf('\n')
end
n=n+1;
end
Result:
-
1
6
r · :
t T(0.5,t) t T(0.5,t) t T(0.5,t) t T(0.5,t) t T(0.5,t)
0.003333 0.983686 0.023333 0.812837 0.043333 0.700885 0.063333 0.626288 0.083333 0.571539
0.006667 0.951851 0.026667 0.790394 0.046667 0.686502 0.066667 0.616082 0.086667 0.563691
0.010000 0.921046 0.030000 0.769674 0.050000 0.673012 0.070000 0.606361 0.090000 0.556132
0.013333 0.891414 0.033333 0.750517 0.053333 0.660321 0.073333 0.597082 0.093333 0.548841
0.016667 0.863351 0.036667 0.732764 0.056667 0.648349 0.076667 0.588207 0.096667 0.541800
0.020000 0.837135 0.040000 0.716265 0.060000 0.637025 0.080000 0.579703 0.100000 0.534989


- 0.5 r · :
t T(0.5,t) t T(0.5,t) t T(0.5,t) t T(0.5,t)
0.00500
0
1.00000
0
0.02500
0
0.81813
6
0.04500
0
0.69579
7
0.065000 0.617753
0.01000
0
0.95105
7
0.03000
0
0.77809
3
0.05000
0
0.66977
8
0.070000 0.599357
0.01500
0
0.90450
8
0.03500
0
0.74919
5
0.05500
0
0.65306
9
0.085000 0.561797
0.02000
0
0.86023
9
0.04000
0
0.717119
0.06000
0
0.63143
8
0.100000 0.526355
• 0.6 r · :
0.012000 0.941268 0.060000 0.605133
0.024000 0.833949 0.072000 0.543874
0.036000 0.738867 0.084000 0.472705
0.048000 0.666867 0.096000 0.376853

Bài 3.
a. Using the simple implicit scheme with forward-time and central-space discretization,
develop finite-difference approximation for the following one-demensional, transient,
convection-diffusion equation:
2
2
T T T
u
t x t
o
o o o
+ ·
o o o
(1)
We have:
1 n n
i i
T T T
t t
+
o
·
o A
( )
2
1 1
2 2
2
n n n
i i i
T T T T
t
x
+
+ o
·
o
A
1 1
2
n n
i i
T T T
x x
+
+ o
·
o A
Replace to equation (1) :
( )
( )
1
2
1 1 1 1
2
2
0 ,
2
n n n n n n n
i i i i i i i
T T T T T T T
u t x
t x
x
o
+
+ +
+ +
]
= + · + A A
]
A A
A
Rearranged:
( ) ( )
1
1 1 1 1
2
2
n n n n n n n
i i i i i i i
c
T T T T r T T T
+
+ +
· + +
( ) ( )
1
1 1 1 1
2
2
n n n n n n n
i i i i i i i
c
T T T T r T T T
+
+ +
= · + + (2)
Where:
( )
2
t
r
x
oA
·
A
u t
c
x
A
·
A
b. Using Fourier stability analysis, examine the stability criterion for the finite
difference approximation of his convection-diffusion equation:
We consider the error term
n
i
r defined as:
m
I i x n n
i
n n t
e
e
þ
y
r c
c
A
A
¹ ·
¹
'
·
¹
¹
m
I i x n n t
i
e e
þ y
r
A A
= · (3)
Substitute equation (3) into the finite-difference equation (2):
( ) ( ) ( )
1 2
2
m m m m m m m
I i x I x I x I i x I x I x I i x t n t n t n t
c
e e e e e e e r e e e e
þ þ þ þ þ þ þ y y y y A A A A A A A A A A A
· + +
( ) ( )
( ) ( )
( ) ( )
( ) ( ) ( )
1 2
2
1 2 sin 2cos 2
2
1 sin 2 cos 1
1 2 2 cos sin
m m m m
I x I x I x I x t
t
m m
t
m m
t
m m
c
e e e r e e
c
e I x r x
e Ic x r x
e r r x Ic x
þ þ þ þ y
y
y
y
þ þ
þ þ
þ þ
A A A A A
A
A
A
= · + +
= · A + A ] ]
] ]
= · A + A ]
]
= · + A A
The requirement:
1 1
t
e
y
c
A
s = s
( ) ( ) ( ) 1 2 2 cos sin 1
m m
r r x Ic x þ þ = + A A s
c
is a unire circle. The ellipse is tangent to the uniw circlr at the point where the circle
intersects the real positive axis.
Real
Imaginary
R=1
c
?
F
The stability condition
1 c s
is satisfied if the ellipse remain entirely within the unit
circle. So the requirements for the lengths of the semi-minor and semi-major axis of the
ellipse:
( )
2
1 1
1 1
2 2
u t
c
x
t
r
x
o
A ¹
s = s
¹
A
¹
'
A
¹ s = s
A ¹
¹
(4)
2r
c
?
R=1
Imaginary
Real
That picture show that even it is satisfied given by equation (4), the solution can still
be unstable. Using the stability limitation given by Anderson. Tannehil and Pletcher:
2
2
2 1
c r
r
¹ s
'
s
¹
(5)
Define the mesh Reynolds number (or Peclet number):
( )
2
Re
x
x u x u t c
Pe
x t r o o
A
A A A
· · · ·
A A
Equation (5) become:
2
2
c
r c
c
c
r
¹
s
¹
¹
'
¹
s
¹
¹
(6)
So we have:
2
2
2
2 Re
x
c
c
r c
c
c
A
s s
= s s
(7)
If t A is chosen too large to violate the above stability criterion for a fixed value of x A
, the numerical results exhibit oscillations that grow rapidly, and after a few step, the
amplitute becomes so large that the computer may register an “overflow”. So we
combine two results in equation (6) for more requitement:
1 c s
2
2 c r s or
2
2
t
u
o
A s is the stability criterion arises from discretization of convection
term and 2 1 r s or
( )
2
2
x
t
o
A
A s
arises from the diffusion term.