Академический Документы
Профессиональный Документы
Культура Документы
2T 1 T
(1) 0 xL t 0
x 2 t
T 0 at x0 t 0
T
k qL at xL t 0
x
T F x at 0 xL t 0
i) Explicit for the differential equation, central difference formula for the boundary
condition:
T 2T
2
t x
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:
T Ti n 1 Ti n
0 t
t i ,n t
t
Where: r
x
2
n 0,1, 2,...
i 1, 2,..., M 1
T
k qL know at xL
x
Ti n1 Ti n1
k q
2x
At x L and i M , we have:
TMn 1 TMn 1
k qL
2x
2xqL
TMn 1 TMn 1
k
2xqL
TMn 1 rTMn 1 1 2r TMn r TMn 1 iM
k
Rearranged:
xqL
TMn 1 2rTMn 1 1 2r TMn 2r iM
k
Final:
T 0 i0
xqL
TMn 1 2rTMn 1 1 2r TMn 2r iM
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
T Ti n 1 Ti n
0 t
t i , n 1 t
T0 0 know at x0
T
k qL know at xL
x
Ti n11 Ti n11
k q
2x
At x L and i M , we have:
2xqL
TMn 11 TMn 11
k
n 1
Replace with TM 1 so we have:
2xqL
TMn rTMn 11 1 2r TMn 1 r TMn 11 iM
k
Rearranged:
xqL
TMn 2rTMn 11 1 2r TMn 1 2r iM
k
Final:
Ti n rTi n11 1 2r Ti n 1 rTi n11 i 1, 2,..., M 1 n 0,1, 2,...
T 0 i0
xqL
TMn 2rTMn 11 1 2r TMn 1 2r iM
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:
Rearranged:
t
Where: r
x
2
T0 0 know at x0
T
k qL know at xL
x
At x L and i M , we have:
TMn 1 TMn 1
k qL
2x
2xqL
TMn 1 TMn 1
k
At n 1 time:
2xqL
TMn 11 TMn 11
k
2xqL 2xqL
rTMn 11 2 2r TMn 1 r TMn 11 rTMn 1 2 2r TMn r TMn 1 i M
k k
Rearranged:
2xqL
2rTMn 11 2 2r TMn 1 2rTMn 1 2 2r TMn 4r iM
k
Final:
T 0 i0
2xqL
2rTMn 11 2 2r TMn 1 2rTMn 1 2 2r TMn 4r iM
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 x0 t 0
T 0 at x 1 t 0
T sin x at 0 x 1 t 0
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
t
Where r
x
2
t
r x t r * x
2
x
2
1 1
r 0.1
6 600
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
i
Ti 0 sin i 1, 2,...,10
10
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
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 :
• r 0.6 :
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
T Ti n1 Ti n1
x 2x
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 mix
e
n n t
c I m x I m x nt I mix
e t
1 e nt e I mix
2
e e
e e
r e I m x 2 e I m x e nt e I mix
c I m x I m x
et 1
2
e e
r e I m x 2 e I m x
c
et 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
The requirement:
1 et 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
u t x
2
u x c
Pe Re x
x t r
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