You are on page 1of 15

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

Bài 1.Consider the following diffusion problem:

 2T 1 T
 (1) 0 xL t 0
x 2  t

T 0 at x0 t 0

T
k  qL at xL t 0
x

T  F  x at 0 xL t 0

Develop the finite difference using:

i) Explicit for the differential equation, central difference formula for the boundary
condition:

Equation (1) becomes:

T  2T
 2
t x

Each parts of mesh size:

L
x 
M

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:

 2T Ti n1  2Ti n  Ti n1


 0   x  
2

x 2  x 
2  
i ,n

T Ti n 1  Ti n
  0  t 
t i ,n t

Replace into equation (1)


Ti n 1  Ti n Ti n1  2Ti n  Ti n1
 0  t ,  x   (2)
2

t  x 
2  

Where: T  T  ix, nt   Ti n

Rearranged equation (2) , we have:

Ti n 1  rTi n1   1  2r  Ti n  rTi n1 (3)

t
Where: r
 x 
2

n  0,1, 2,...

i  1, 2,..., M  1

With a truncation error order is: 0  t ,  x  


2

Suppore the temperatures are prescribed at the boundaries i  0 and i  M . We


have:

T0n  0  know at x0

T
k  qL  know at xL
x

We have a form of heat flux at boundary.The central differencing is used to


discretize the boudary condition:

Ti n1  Ti n1
k q
2x

At x  L and i  M , we have:

TMn 1  TMn 1
k  qL
2x

2xqL
 TMn 1   TMn 1
k

i  M , equation (3) becomes:

TMn 1  rTMn 1   1  2r  TMn  rTMn 1


n
Replace with TM 1 so we have:

 2xqL 
TMn 1  rTMn 1   1  2r  TMn  r   TMn 1  iM
 k 

Rearranged:

xqL
TMn 1  2rTMn 1   1  2r  TMn  2r iM
k

Final:

Ti n 1  rTi n1   1  2r  Ti n  rTi n1 i  1, 2,..., M  1 ; n  0,1, 2,...

T 0 i0

xqL
TMn 1  2rTMn 1   1  2r  TMn  2r iM
k

T  F  i i  1, 2,..., 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 n  1 time

 2T Ti n11  2Ti n 1  Ti n11


 0   x  
2

x 2  x 
2  
i , n 1

T Ti n 1  Ti n
  0  t 
t i , n 1 t

Replace into equation (1):

Ti n 1  Ti n Ti n11  2Ti n 1  Ti n11


 0  t ,  x  
2
 i  1, 2,..., M  1 ; n  0,1, 2,...
t  x 
2  
 Ti n  rTi n11   1  2r  Ti n 1  rTi n11 (4)

Suppore the temperatures are prescribed at the boundaries i  0 and i  M . We


have:

T0  0  know at x0

T
k  qL  know at xL
x

We have a form of heat flux at boundary.The central differencing is used to


discretize the boudary condition, at n  1 time:

Ti n11  Ti n11
k q
2x

At x  L and i  M , we have:

TMn 11  TMn 11


k  qL
2x

2xqL
 TMn 11   TMn 11
k

i  M , equation (4) becomes:

TMn   rTMn 11   1  2r  TMn 1  rTMn 11

n 1
Replace with TM 1 so we have:

 2xqL 
TMn   rTMn 11   1  2r  TMn 1  r   TMn 11  iM
 k 

Rearranged:

xqL
TMn  2rTMn 11   1  2r  TMn 1  2r iM
k

Final:
Ti n   rTi n11   1  2r  Ti n 1  rTi n11 i  1, 2,..., M  1 n  0,1, 2,...

T 0 i0

xqL
TMn  2rTMn 11   1  2r  TMn 1  2r iM
k

T  F  i i  1, 2,..., 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:

Ti n 1  Ti n   Ti n11  2Ti n 1  Ti n11 Ti n1  2Ti n  Ti n1 


  0   t  ,  x  
2 2
  
t  x   x 
2 2
2  

Rearranged:

rTi n11   2  2r  Ti n 1  rTi n11  rTi n1   2  2r  Ti n  rTi n1 (5)

t
Where: r
 x 
2

Suppore the temperatures are prescribed at the boundaries i  0 and i  M . We have:

T0  0  know at x0

T
k  qL  know at xL
x

We have a form of heat flux at boundary.The central differencing is used to discretize


the boudary condition :
Ti n11  Ti n11
k q
2x

At x  L and i  M , we have:

TMn 1  TMn 1
k  qL
2x

2xqL
 TMn 1   TMn 1
k

At n  1 time:

2xqL
TMn 11   TMn 11
k

i  M , equation (5) becomes:

rTMn 11   2  2r  TMn 1  rTMn 11  rTMn 1   2  2r  TMn  rTMn 1

Replace to equation (5), we have:

 2xqL   2xqL 
 rTMn 11   2  2r  TMn 1  r   TMn 11   rTMn 1   2  2r  TMn  r   TMn 1  i  M
 k   k 

Rearranged:

2xqL
2rTMn 11   2  2r  TMn 1  2rTMn 1   2  2r  TMn  4r iM
k

Final:

rTi n11   2  2r  Ti n 1  rTi n11  rTi n1   2  2r  Ti n  rTi n1 i  1, 2,..., M  1


n  0,1, 2,...

T 0 i0

2xqL
2rTMn 11   2  2r  TMn 1  2rTMn 1   2  2r  TMn  4r iM
k

T  F  i i  1, 2,..., M

Bài 2.Consider the diffusion problem given in the dimensionless form as:

 2T T
 0  x 1 t 0
x 2 t

T 0 at x0 t 0

T 0 at x 1 t 0

T  sin   x  at 0  x 1 t 0

The exact solution of this problem is given by:

T  x, t   e  t sin   x 
2

Write the finite formulation of this problem by using the explicit method. Solve the resulting
difference equations with a step size x  0.1 and calculate the center temperature  x  0.5 
by taking:

1
i. r
6

ii. r  0.5

iii. r  0.6

Solution:
 x  0.1
  M  10
 L 1

The finite-difference approximation of the differential equation of heat conduction:


Ti n 1  rTi n1   1  2r  Ti n  rTi n1 i  1, 2,...,9

t
Where r 
 x 
2

t
r x t  r *  x 
2

 x 
2

1 1
r 0.1
6 600

r  0.5 0.1 0.005

r  0.6 0.1 0.006

So we have:

1 n 1 1 n 2 n 1 n
r : Ti  Ti 1  Ti  Ti 1
6 6 3 6

r  0.5 : Ti  0.5  Ti 1  Ti 1 
n 1 n n

r  0.6 : Ti n 1  0.6Ti n1  0.2Ti n  0.6Ti n1

The temperature at the boundary nodes are specified as:

T0n  0 and T10n  0

And the initial condition becomes:

 i 
Ti 0  sin    i  1, 2,...,10
 10 

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
 r :
6

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

 r  0.5 :

t T(0.5,t) t T(0.5,t) t T(0.5,t) t T(0.5,t)

0.00500 1.00000 0.02500 0.81813 0.04500 0.69579


0.065000 0.617753
0 0 0 6 0 7
0.01000 0.95105 0.03000 0.77809 0.05000 0.66977
0.070000 0.599357
0 7 0 3 0 8

0.01500 0.90450 0.03500 0.74919 0.05500 0.65306


0.085000 0.561797
0 8 0 5 0 9

0.02000 0.86023 0.04000 0.06000 0.63143


0.717119 0.100000 0.526355
0 9 0 0 8

• r  0.6 :

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:

T T  2T
u  2 (1)
t x t

We have:

T Ti n 1  Ti n

t t

 2T Ti n1  2Ti n  Ti n1



t 2  x 
2

T Ti n1  Ti n1

x 2x

Replace to equation (1) :

Ti n 1  Ti n Tn Tn T n  2Ti n  Ti n1


 0  t ,  x  
2
  u i 1 i 1   i 1
t 2 x  x 
2  

Rearranged:

c n
Ti n 1  Ti n 
2
 Ti 1  Ti n1   r  Ti n1  2Ti n  Ti n1 

c n
 Ti n 1  Ti n  
2
 Ti 1  Ti n1   r  Ti n1  2Ti n  Ti n1  (2)

t u t
Where: r c
 x 
2
x

b. Using Fourier stability analysis, examine the stability criterion for the finite
difference approximation of his convection-diffusion equation:
We consider the error term  i defined as:
n

  in   n e I mix

   e
n  n t

  in  e nt e I mix (3)

Substitute equation (3) into the finite-difference equation (2):

c I m x  I  m x  nt I  mix
e t
 1 e nt e I mix  
2

e e 
e e  
 r e I m x  2  e  I m x e nt e I mix

c I m x  I  m x
 et  1  
2
e  e  
 r e I m x  2  e  I m x 
c
 et  1   2 I sin   m x    r  2 cos   m x   2 
2
 e  1  Ic sin   m x   2r  cos   m x   1
t

 et   1  2r   2r cos   m x   Ic sin   m x 

The requirement:

  1  et  1

  1  2r   2r cos   m x   Ic sin   m x   1

 is a unire circle. The ellipse is tangent to the uniw circlr at the point where the circle
intersects the real positive axis.
Imaginary

R=1 ?

c
F

Real

The stability condition   1 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:

 u t
 c  1  1
 x
 1 t 1 (4)
 r  
 x  2
2
 2
Imaginary

R=1 ?

2r
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:

 c 2  2r
 (5)
 2r  1

Define the mesh Reynolds number (or Peclet number):

u t  x 
2
u x c
Pe   Re x  
 x t r

Equation (5) become:

 c 2
 r  c
 (6)
 2c  c
 r

So we have:
c 2
2c  
r c
(7)
2
 2c  Re x 
c

If t is chosen too large to violate the above stability criterion for a fixed value of x
, 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:

c 1

2
c 2  2r or t  is the stability criterion arises from discretization of convection
u2

 x 
2

term and 2r  1 or t  arises from the diffusion term.


2

You might also like