You are on page 1of 4

Computer Application in Engineering

Homework IV
Mehmet Fatih Reyhan

ID : 110170002
Problem

Solving the given 2D time-dependent heat equation for given initial conditions. Equation and

boundary conditions are given by the following expression.

∂T ∂2T
= 0.01 2
∂t ∂x

Initial conditions:

T (x, 0) : 200x 0.0 ≤ x ≤ 0.5

T (x, 0) : 200(1 − x) 0.5 ≤ x ≤ 1.0

Solution

Crank-Nicholson method is used for the problem solution.∆x is chosen as 0.1 cm so there are eleven

temperature values all over the plate and two of them are known. For Crank-Nicholson method

equation can be written as the following expression:

k+1
Li Ti−1 + Di Tik+1 + Ui Tik+1 = Ri i = 1, 2, ...9

In these equation system we can write the known values by the following expression:

L1 = 0, Li = −r, (i = 2, 3, ...9)

Di = 2(1 + r), (i = 1, 2, ...9)

U9 = 0, Ui = −r (i = 1, 2, ...8)

R1 = rT0k + 2(1 − r)T1k + rT2k + rT0k+1

k
Ri = rTi−1 + 2(1 − r)Tik + rTi+1
k

k+1
R9 = rT8k + 2(1 − r)T9k + rT10
k
+ rT10

∆t
r = 0.01 2
(∆x)
Moreover, equation system can be written in matrix form and solved by the following.

    
k+1
2(1 + r) −r   1  R1 
T
    
 −r 2(1 + r) −r  T k+1  R 
   2   2
  ..   .. 
    
 .. .. ..
 . . .  .   . 
 .  =  . 
    
. .. ..


 .. . .
 .   . 
 .   . 
    
    
k+1 

 −r 2(1 + r) −r  T8  
 
R8 

    
−r 2(1 + r) T9k+1 R9
| {z } | {z }
A B

T k+1 = A\B

Results

In the solution ∆t is not chosen constant. Time step determined for the given exact solution times.

The following tables show the exact solution,numerical solution and the percentage error.

Calculated Temperature Values


t(s) x = 0.0 x = 0.1 x = 0.2 x = 0.3 x = 0.4 x = 0.5
0 0 20 40 60 80 100
0.5 (∆t = 0.5) 0 19.9881 39.9287 59.5838 77.5741 85.8608
1 (∆t = 0.5) 0 19.9159 39.5907 58.1991 72.9334 78.8083
2 (∆t = 1) 0 19.3541 37.8259 53.8344 64.9876 69.1084
3 (∆t = 1) 0 18.2413 35.1393 49.1274 58.5568 62.1570
4 (∆t = 1) 0 16.8464 32.2462 44.7697 53.1364 56.4918
5 (∆t = 1) 0 15.4281 29.4660 40.8110 48.4314 51.6441
10 (∆t = 5) 0 9.7882 18.7104 26.0145 31.1389 33.7451
20 (∆t = 10) 0 4.0889 7.9039 11.1758 13.6595 15.1657
30 (∆t = 30) 0 0.0559 0.1168 0.2017 0.3432 0.5744

Exact Temperature Values


t(s) x = 0.0 x = 0.1 x = 0.2 x = 0.3 x = 0.4 x = 0.5
0 0 20 40 60 80 100
0.5 0 19.9997 39.9847 59.6604 76.6674 84.0423
1 0 19.961 39.6551 57.9898 72.0144 77.4324
2 0 19.3513 37.6601 53.3353 64.1763 68.0846
3 0 18.1235 34.8377 48.5749 57.7018 60.9128
4 0 16.6695 31.8585 44.1072 52.0966 54.8763
5 0 15.2059 28.9857 40.0015 47.1255 49.5912
10 0 9.3346 17.7561 24.4405 28.7327 30.2118
20 0 3.4794 6.6183 9.1093 10.7086 11.2597
30 0 0.1801 0.3427 0.4716 0.5544 0.583
Percentage Errors
t(s) x = 0.0 x = 0.1 x = 0.2 x = 0.3 x = 0.4 x = 0.5
0 0 0 0 0 0 0
0.5 0 0.0580 0.1402 0.1284 1.1826 2.1638
1 0 0.2258 0.1624 0.3609 1.2761 1.7770
2 0 0.0147 0.4402 0.9357 1.2641 1.5038
3 0 0.6500 0.8657 1.1374 1.4817 2.0425
4 0 1.0610 1.2169 1.5020 1.9960 2.9437
5 0 1.4609 1.6571 2.0462 2.7710 4.1397
10 0 4.8589 5.3747 6.4401 8.3746 11.6949
20 0 17.5181 19.4246 22.6851 27.5562 34.6897
30 0 68.9806 65.9087 57.2228 38.0960 1.4667

Numerical and exact solution values for t = 0.5 s and t = 50 s is given by the following figure.

From the figure and the error table, as the time step increases error increases significantly Which

is expected.

You might also like