1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# Chapter 03:Multidimensional steady-state heat conduction"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex3.1:pg-92"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Introduction to heat transfer by S.K.Som, Chapter 3, Example 1\n",
"Temperature at the centre in Degree C is\n",
"T= 125.371641666\n"
]
}
],
"source": [
"import math\n",
" \n",
"print\"Introduction to heat transfer by S.K.Som, Chapter 3, Example 1\"\n",
"#Length and breadth is given as 1 unit (Gemoetry is Square)\n",
"L = 1;#length\n",
"#Problem can be divided into two modules\n",
"#Solution to module 1 is given by Eq. 3.21, considering the first three terms\n",
"#n is the looping parameter\n",
"#theta is the non dimensional temperature defined as ((T-100)/100) where T is actual temperature in degree Celcius.\n",
"#Initialising theta as zero\n",
"theta = 0;\n",
"for n in range(1,3):\n",
" theta = theta+((2/math.pi)*((math.sin((n*math.pi)/2)*math.sinh((n*math.pi)/2))*((-1)**(n+1)+1)))/(n*math.sinh(n*math.pi));\n",
" \n",
"#Solution to module 2 is given by Eq. 3.24, considering the first three terms\n",
"for n in range(1,3):\n",
" theta2 = theta+(((3*2)/math.pi)*((math.sin((n*math.pi)/2)*math.sinh((n*math.pi)/2))*((-1)**(n+1)+1)))/(n*math.sinh(n*math.pi));\n",
" \n",
"#Calculating value of temperature from the value of theta\n",
"#Temperature in degree celcius\n",
"print\"Temperature at the centre in Degree C is\"\n",
"T = theta*100+100\n",
"print\"T=\",T"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex3.2:pg-94"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Introduction to heat transfer by S.K.Som, Chapter 3, Example 2\n",
"Steady state non dimensional temperature is\n",
"theta=2*math.sinh(pi*y/a)*math.sin(pi*x/a)/(math.sinh(pi)) + math.sinh(pi*x/a)*math.sin(pi*y/a)/(math.sinh(pi))\n",
"theta= 0.597805223008\n",
"Temperature in K at centre point\n",
"T= 359.780522301\n"
]
}
],
"source": [
"import math\n",
" \n",
"print\"Introduction to heat transfer by S.K.Som, Chapter 3, Example 2\"\n",
"#Temperature in K at four edges are given\n",
"#Theta is non dimensional temperature defined as ((T-300)/100) where T is actual temperature in K.\n",
"#Given length as well as the breadth of square plate is ''a''\n",
"#Problem can be divided into two modules\n",
"#Solution to module 1 is given by Eq. 3.23\n",
"#Solution of first module is non dimensional temperature theta1\n",
"#theta1=2*math.sinh(pi*y/a)*math.sin(pi*x/a)/(math.sinh(pi))\n",
"#Solution to module 2 is given by Eq. 3.24\n",
"#Solution of second module is non dimensional temperature theta2\n",
"#theta2=math.sinh(pi*x/a)*math.sin(pi*y/a)/(math.sinh(pi))\n",
"#Therefore\n",
"print\"Steady state non dimensional temperature is\"\n",
"print\"theta=2*math.sinh(pi*y/a)*math.sin(pi*x/a)/(math.sinh(pi)) + math.sinh(pi*x/a)*math.sin(pi*y/a)/(math.sinh(pi))\"\n",
"#At the centre, x coordinate and y coordinate in unit are\n",
"#x=a/2, y=a/2\n",
"#Non dimensional temperature at centre point\n",
"theta = (2*math.sinh(math.pi/2))/math.sinh(math.pi)+math.sinh(math.pi/2)/math.sinh(math.pi);\n",
"#Temperature in K at centre point\n",
"print\"theta=\",theta\n",
"print\"Temperature in K at centre point\"\n",
"T = theta*100+300\n",
"print\"T=\",T"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex3.3:pg-96"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Introduction to heat transfer by S.K.Som, Chapter 3, Example 3\n",
"Temperatures at nodal points in degree K\n",
"T1 in degree K\n",
"[ 398.67699539 155.83601706 66.53320567 119.43598224 79.06693359\n",
" 40.99573505 14.15266777 9.19140047]\n",
"T2 in degree K\n",
"[ 77.91800853 232.60510053 92.0706763 39.53346679 80.21585865\n",
" 48.72486726 19.11393507 11.30646706]\n",
"T3 in degree K\n",
"[ 33.26660284 92.0706763 237.56636783 20.49786753 48.72486726\n",
" 82.33092523 46.76647228 21.51623292]\n",
"T4 in degree K\n",
"[ 14.15266777 38.22787014 93.53294456 9.19140047 22.61293411\n",
" 43.03246584 124.91948821 27.99199234]\n",
"T5 in degree K\n",
"[-0. -0. -0. -0. -0. -0. -0. -0.]\n",
"T6 in degree K\n",
"[-0. -0. -0. -0. -0. -0. -0. -0.]\n",
"T7 in degree K\n",
"[ 95.65671512 227.3827139 384.21098442 77.62207329 214.83157803\n",
" 554.32152494 100.40908695 109.12176865]\n",
"T8 in degree K\n",
"[ 24.51040125 60.30115763 114.75324223 18.87022369 50.97049352\n",
" 124.71059274 74.64531291 166.55931761]\n"
]
}
],
"source": [
"import math\n",
"import numpy\n",
" \n",
"print\"Introduction to heat transfer by S.K.Som, Chapter 3, Example 3\"\n",
"#internodal distance in x direction in m\n",
"deltax = 1.0/4;\n",
"#internodal distance in y direction in m\n",
"deltay = 1.0/4;\n",
"#Air temperature in degree K\n",
"Tinfinity = 400;\n",
"#Heat transfer coefficient in W/(m**2*K)\n",
"h = 10;\n",
"#T1, T2, T3, T4, T5, T6, T7, T8 are nodal temperatures in degree K.\n",
"#T is the temperature matrix and is transpose of [T1 T2 T3 T4 T5 T6 T7 T8]\n",
"#using Nodal Equations, we have Coefficeint Matrix A as\n",
"A = [[-4,1,0,0,1,0,0,0],[1,-4,1,0,0,1,0,0],[0,1,-4,1,0,0,1,0],[2,0,0,0,-4,1,0,0],[0,2,0,0,1,-4,1,0],[0,0,2,0,0,1,-4,1],[0,0,2,-6,0,0,0,1],[0,0,0,2,0,0,2,-6]]#Coefficient matrix B\n",
"B = [[-1200],[-600],[-600],[-600],[0],[0],[-1400],[-800]]\n",
"\n",
"\n",
"#Therefore the temperature matrix is\n",
"T = numpy.linalg.inv(A)*B;\n",
"#Temperature at nodal points in degree K\n",
"print\"Temperatures at nodal points in degree K\"\n",
"print\"T1 in degree K\"\n",
"T1 = T[0]\n",
"print T1\n",
"print\"T2 in degree K\"\n",
"T2 = T[1]\n",
"print T2\n",
"print\"T3 in degree K\"\n",
"T3 = T[2]\n",
"print T3\n",
"print\"T4 in degree K\"\n",
"T4 = T[3]\n",
"print T4\n",
"print\"T5 in degree K\"\n",
"T5 = T[4]\n",
"print T5\n",
"print\"T6 in degree K\"\n",
"T6 = T[5]\n",
"print T6\n",
"print\"T7 in degree K\"\n",
"T7 = T[6]\n",
"print T7\n",
"print\"T8 in degree K\"\n",
"T8 = T[7]\n",
"print T8"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex3.5:pg-98"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Introduction to heat transfer by S.K.Som, Chapter 3, Example 5\n",
"Temperatures at nodal points in degree C\n",
"T2 in degree C\n",
"[ 1.83976243e-36 4.79441040e-01 3.66134997e-01 3.07581515e-01\n",
" 5.38080937e-01]\n",
"T3 in degree C\n",
"[ 1.46972670e-67 1.92742646e+00 1.47191880e+00 1.23652483e+00\n",
" 1.07886949e+00]\n",
"T4 in degree C\n",
"[ 4.52446173e-92 1.47191880e+00 3.54032873e+00 2.97414801e+00\n",
" 1.67320356e+00]\n",
"T5 in degree C\n",
"[ 6.50142301e-108 1.23652483e+000 2.97414801e+000 5.91733919e+000\n",
" 2.36010173e+000]\n",
"T6 in degree C\n",
"[ 2.06473580e-113 1.16395938e+000 2.79961015e+000 5.57008016e+000\n",
" 3.18199172e+000]\n"
]
}
],
"source": [
"import math\n",
"import numpy\n",
" \n",
"print\"Introduction to heat transfer by S.K.Som, Chapter 3, Example 5\"\n",
"#Thermal conductivity of aluminium in W/(m*K)\n",
"k = 200.0\n",
"#Diameter in m\n",
"d = 20*(10**(-3));\n",
"#Length of fin in m\n",
"L = 0.2;\n",
"#Wall temperature in degree C\n",
"Tw = 400.0;\n",
"#Air temperature in degree C\n",
"Tinfinity = 30;\n",
"#Heat transfer coefficient in W/(m**2*K)\n",
"h = 40.0;\n",
"#internodal distance in x direction in m\n",
"deltax = L/5;\n",
"#Node 1 temperature is equal to wall temperature in degree C\n",
"T1 = Tw;\n",
"#using Nodal Equations, we have Coefficeint Matrix A as\n",
"A = [[2.064,-1,0,0,0],[-1,2.064,-1,0,0],[0,-1,2.064,-1,0],[0,0,-1,2.064,-1],[0,0,0,-1,1.032]]\n",
"#Coefficient matrix B\n",
"B = [401.92,1.92,1.92,1.92,0.96]\n",
"#T2, T3, T4, T5, T6 are nodal temperature in degree C\n",
"#T is the temperature matrix and is transpose of [T2 T3 T4 T5 T6]\n",
"#Therefore the temperature matrix is\n",
"T = numpy.linalg.inv(A)**B;\n",
"#Temperature at nodal points in degree C\n",
"print\"Temperatures at nodal points in degree C\"\n",
"print\"T2 in degree C\"\n",
"T2 = T[0]\n",
"print T2\n",
"print\"T3 in degree C\"\n",
"T3 = T[1]\n",
"print T3\n",
"print\"T4 in degree C\"\n",
"T4 = T[2]\n",
"print T4\n",
"print\"T5 in degree C\"\n",
"T5 = T[3]\n",
"print T5\n",
"print\"T6 in degree C\"\n",
"T6 = T[4]\n",
"print T6"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex3.6:pg-104"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Introduction to heat transfer by S.K.Som, Chapter 3, Example 6\n",
"Temperatures at nodal points in degree C\n",
"T1 in degree C\n",
"[ -0. -0. -0. 186.04651163 1.86046512\n",
" 2.79069767 1.86046512 0.46511628 74.41860465]\n",
"T2 in degree C\n",
"[ -0. -0. -0. 74.41860465 1.69263965\n",
" 3.56988732 2.51738192 0.62934548 157.39630784]\n",
"T3 in degree C\n",
"[ -0. -0. -0. 83.72093023 3.88875569\n",
" 4.80220571 3.06401343 0.76600336 65.85950611]\n",
"T4 in degree C\n",
"[ -0. -0. -0. 55.81395349 2.45504675\n",
" 5.7444258 4.10453129 1.02613282 77.58331335]\n",
"T5 in degree C\n",
"[ -0. -0. -0. 37.20930233 1.77415488\n",
" 4.6199952 7.34116519 1.8352913 51.37856629]\n",
"T6 in degree C\n",
"[ -0. -0. -0. 37.20930233 8.78446416\n",
" 4.92927356 2.18652601 0.5466315 33.8527931 ]\n",
"T7 in degree C\n",
"[ -0. -0. -0. 27.90697674 2.46463678\n",
" 9.98561496 3.49556461 0.87389115 35.69887317]\n",
"T8 in degree C\n",
"[ -0. -0. -0. 18.60465116 1.09326301\n",
" 3.49556461 10.57779909 2.64444977 25.17381923]\n",
"T9 in degree C\n",
"[ -0. -0. -0. 9.30232558 0.5466315\n",
" 1.74778231 5.28889954 11.32222489 12.58690961]\n"
]
}
],
"source": [
"import math\n",
" \n",
"print\"Introduction to heat transfer by S.K.Som, Chapter 3, Example 6\"\n",
"#Thermal conductivity of concrete in W/mK\n",
"k = 2;\n",
"#Length in m\n",
"L = 0.2;\n",
"#Breadth in m\n",
"b = 0.2;\n",
"#Depth in m\n",
"d = 0.2;\n",
"#Temperature of hot gas in chimney in degree C\n",
"Tg = 400;\n",
"#Air temperature in degree C\n",
"Tinfinity = 20;\n",
"#internodal distance in x direction in m\n",
"deltax = 0.1;\n",
"#internodal distance in y direction in m\n",
"deltay = 0.1;\n",
"#Heat transfer coefficient in W/(m**2*K)\n",
"h = 20;\n",
"#T1, T2, T3, T4, T5, T6, T7, T8, T9 are nodal temperatures in degree K.\n",
"#T is the temperature matrix and is transpose of [T1 T2 T3 T4 T5 T6 T7 T8 T9]\n",
"#using Nodal Equations, we have Coefficeint Matrix A as\n",
"A = numpy.array([[1,0,-4,2,0,1,0,0,0],[0,1,1,-4,1,0,1,0,0],[0,0,0,2,-4,0,0,2,0],[-3,1,1,0,0,0,0,0,0],[0,0,1,0,0,-3,1,0,0],[0,0,0,2,0,1,-6,1,0],[0,0,0,0,2,0,1,-6,1],[0,0,0,0,0,0,0,1,-2],[1,-4,0,2,0,0,0,0,0]]);\n",
"#Coefficient matrix B\n",
"B = numpy.array([0,0,0,-400,-20,-40,-40,-20,-400]);\n",
"#Therefore the temperature matrix is\n",
"T = numpy.linalg.inv(A)*B;\n",
"#Temperature at nodal points in degree C\n",
"print\"Temperatures at nodal points in degree C\"\n",
"print\"T1 in degree C\"\n",
"T1 = T[0]\n",
"print T1\n",
"print\"T2 in degree C\"\n",
"T2 = T[1]\n",
"print T2\n",
"print\"T3 in degree C\"\n",
"T3 = T[2]\n",
"print T3\n",
"print\"T4 in degree C\"\n",
"T4 = T[3]\n",
"print T4\n",
"print\"T5 in degree C\"\n",
"T5 = T[4]\n",
"print T5\n",
"print\"T6 in degree C\"\n",
"T6 = T[5]\n",
"print T6\n",
"print\"T7 in degree C\"\n",
"T7 = T[6]\n",
"print T7\n",
"print\"T8 in degree C\"\n",
"T8 = T[7]\n",
"print T8\n",
"print\"T9 in degree C\"\n",
"T9 = T[8]\n",
"print T9"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|