summaryrefslogtreecommitdiff
path: root/A_Heat_Transfer_Text_Book/Chapter1.ipynb
blob: 9deb44998ab65986037d70a8a7f096e8e54cad43 (plain)
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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 - \"Introduction\""
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.1, Page number: 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variables\n",
      "k=35;                                      #Thermal  Conductivity,  [W/m*K]\n",
      "T1=110                                     #  Temperature  of  front[C]\n",
      "T2=50;                                     #  Temperature  of  back,[C]\n",
      "A=0.4                                      #area  of  slab,[m**2]\n",
      "x=0.03;                                    #Thickness  of  slab,[m]\n",
      "\n",
      "#Calculations\n",
      "q=-k*(T2-T1)/(1000*x);                     #formula  for  heat  flux[KW/m^2]\n",
      "Q=q*A;                                     #formula  for  heat  transfer  rate[KW]\n",
      "\n",
      "#Results\n",
      "print \"Heat flux is:\",q,\"KW/m^2\\n\"\n",
      "print \"Heat transfer rate is:\",Q,\"KW \\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat flux is: 70.0 KW/m^2\n",
        "\n",
        "Heat transfer rate is: 28.0 KW \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.2, Page number: 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from sympy import solve,symbols\n",
      "\n",
      "#Variables\n",
      "x=symbols('x');\n",
      "k1=372;                                 #  Thermal  Conductivity  of  slab,W/m*K\n",
      "x1=0.003;                               #  Thickness  of  slab,m\n",
      "x2=0.002                                #  Thickness  of  steel,m\n",
      "k2=17;                                  #  Thermal  Conductivity  of  steel,W/m*K\n",
      "T1=400;                                 #  Temperature  on  one  side,C\n",
      "T2=100                                  #Temperature  on  other  side,C\n",
      "\n",
      "#Calculations\n",
      "Tcu=solve(x+2*x*(k1/x1)*(x2/k2)-(T1-T2),x);\n",
      "#q=k1*(Tcu/x1)=k2*(Tss/x2);\n",
      "Tss  =  Tcu[0]*(k1/x1)*(x2/k2);         #  formula for temperature gradient in steel side\n",
      "Tcul=T1-Tss;\n",
      "Tcur=T2+Tss;\n",
      "q=k2*Tss/(1000*x2);                     #  formula for heat conducted, kW\\m^2\n",
      "\n",
      "#Results\n",
      "print \"Temperature on left copper side is :\",round(Tcul,3),\"C\\n\"\n",
      "print \"Temperature on right copper  side is :\",round(Tcur,3),\"C\\n\"\n",
      "print \"Heat conducted through the wall is :\",round(q,3),\"kW\\m^2\\n\"\n",
      "print \"Our initial approximation was accurate within a few percent.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature on left copper side is : 254.971 C\n",
        "\n",
        "Temperature on right copper  side is : 245.029 C\n",
        "\n",
        "Heat conducted through the wall is : 1232.749 kW\\m^2\n",
        "\n",
        "Our initial approximation was accurate within a few percent.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.3, Page number: 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variables\n",
      "q1=6000;                                          #Heat  flux,  W*m**-2\n",
      "T1=120;                                           #Heater  Temperature,  C\n",
      "T2=70;                                            #final  Temperature  of  Heater, C\n",
      "q2=2000;                                          #final  heat  flux, W*m**-2\n",
      "\n",
      "#Calculations\n",
      "h=q1/(T1-T2)                                      #formula  for  average  heat  transfer  cofficient\n",
      "Tnew=T2+q2/h;                                     #formula  for  new  Heater  temperature, C\n",
      "\n",
      "#Results\n",
      "print \"Average Heat transfer coefficient is:\",h,\"W/(m^2*K)\\n\"\n",
      "print \"New Heater Temperature is:\",round(Tnew,3),\"C\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average Heat transfer coefficient is: 120.0 W/(m^2*K)\n",
        "\n",
        "New Heater Temperature is: 86.667 C\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.4, Page number: 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from numpy import array\n",
      "from numpy import linspace\n",
      "import matplotlib.pyplot as plt\n",
      "from pylab import *\n",
      "%matplotlib inline\n",
      "\n",
      "#Variables\n",
      "h=250;                                  #Heat Transfer  Coefficient,  W/(m**2*K)\n",
      "k=45;                                   #Thermal  Conductivity,  W/(m*K)\n",
      "c=180;                                  #Heat  Capacity,  J/(kg*K)\n",
      "a=9300;                                 #density,  kg/m**3\n",
      "T1=200;                                 #temperature,  C\n",
      "D=0.001;                                #diameter  of  bead, m\n",
      "t1=linspace(0,5,50);                    #defining time interval of 0.1 seconds\n",
      "T=linspace(0,5,50);\n",
      "i=0;\n",
      "\n",
      "#Calculations\n",
      "while i<50:\n",
      "    T[i]=T1-c*math.exp(-t1[i]/((a*c*D)/(6*h)));      #Calculating temperature at each time in degree C\n",
      "    i=i+1;\n",
      "\n",
      "plt.plot(t1,T);\n",
      "plt.xlabel(\"Time(in sec)\");\n",
      "plt.ylabel(\"Temperature(in degree C)\");\n",
      "plt.title(\"Thermocouple response to a hot  gas flow\");\n",
      "plt.show();\n",
      "\n",
      "Bi  =  h*(D/2)/k;                       #biot  no.\n",
      "\n",
      "#Results\n",
      "print \"The value of Biot no for this thermocouple is\",round(Bi,5);\n",
      "print \"Bi is <0.1 and hence the thermocouple could be considered as a lumped heat capacity system and the assumption taken is valid.\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "ename": "ImportError",
       "evalue": "DLL load failed: %1 is not a valid Win32 application.",
       "output_type": "pyerr",
       "traceback": [
        "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mImportError\u001b[0m                               Traceback (most recent call last)",
        "\u001b[1;32m<ipython-input-4-48a98dda89ad>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0m__future__\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mdivision\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmath\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0marray\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      4\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mlinspace\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;32mC:\\Users\\jaidev\\Anaconda\\lib\\site-packages\\numpy\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m    151\u001b[0m         \u001b[1;32mreturn\u001b[0m \u001b[0mloader\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mpackages\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0moptions\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    152\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 153\u001b[1;33m     \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0madd_newdocs\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    154\u001b[0m     \u001b[0m__all__\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'add_newdocs'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'ModuleDeprecationWarning'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    155\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;32mC:\\Users\\jaidev\\Anaconda\\lib\\site-packages\\numpy\\add_newdocs.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m     11\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0m__future__\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mdivision\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mabsolute_import\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mprint_function\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     12\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 13\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlib\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0madd_newdoc\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     14\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     15\u001b[0m \u001b[1;31m###############################################################################\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;32mC:\\Users\\jaidev\\Anaconda\\lib\\site-packages\\numpy\\lib\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      6\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mversion\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mversion\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0m__version__\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      7\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mtype_check\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      9\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mindex_tricks\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     10\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mfunction_base\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;32mC:\\Users\\jaidev\\Anaconda\\lib\\site-packages\\numpy\\lib\\type_check.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      9\u001b[0m            'common_type']\n\u001b[0;32m     10\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 11\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnumeric\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0m_nx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     12\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnumeric\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0masarray\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0masanyarray\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0marray\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0misnan\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m\\\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     13\u001b[0m                 \u001b[0mobj2sctype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mzeros\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;32mC:\\Users\\jaidev\\Anaconda\\lib\\site-packages\\numpy\\core\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mversion\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mversion\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0m__version__\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmultiarray\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      7\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mumath\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      8\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0m_internal\u001b[0m \u001b[1;31m# for freeze programs\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;31mImportError\u001b[0m: DLL load failed: %1 is not a valid Win32 application."
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.5, Page number: 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from sympy import solve,symbols\n",
      "\n",
      "#Variables\n",
      "x=symbols('x');\n",
      "T1=293;                                    #Temperature  of  air  around  thermocouple,  K\n",
      "T2=373;                                    #Wall  temperature,  K\n",
      "h=75;                                      #Average  Heat  Transfer  Coefficient,  W/(m**2*K)\n",
      "s=5.67*10**-8;                             #stefan  Boltzman  constant,  W/(m**2*K**4)\n",
      "\n",
      "#Calculations\n",
      "x=solve((h*(x-T1)+s*(x**4-T2**4)),x);\t   #Calculating Thermocouple Temperature, K\n",
      "y=x[1]-273;\t\t\t\t                   #Thermocouple Temperature, C\n",
      "\n",
      "#Results\n",
      "print \"Thermocouple Temperature is :\",round(y,3),\"C\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermocouple Temperature is : 28.395 C\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6, Page number: 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from sympy import solve,symbols\n",
      "\n",
      "#Variables\n",
      "x=symbols('x');\n",
      "e=0.4;                                             #emissivity\n",
      "T1=293;                                            #Temperature  of  air  around  Thermocouple,  K\n",
      "T2=273;                                            #wall  Temperature,  K\n",
      "h=75;                                              #Average  Heat  Transfer  Coefficient,  W/(m**2*K)\n",
      "s=5.6704*10**-8;                                   #stefan  Boltzman  constant,  W/(m**2*K**4)\n",
      "\n",
      "#Calculations\n",
      "z=solve(((s*e*((373)**4 - (x)**4)) - h*(x-293)),x);\t#Calculating Thermocouple Temperature, K\n",
      "y=z[0]-273;\t\t\t\t\t                        #Thermocouple Temperature, C\n",
      "\n",
      "'''NOTE: Equation written is absolutely correct and solving this equation\n",
      "        should give real result as: 296.112 i.e. 23.112 C, but somehow python is giving wrong result.'''\n",
      "\n",
      "#Results\n",
      "print \"Thermocouple Temperature is :\",round(y,1),\"C \\n\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermocouple Temperature is : 25.9 C \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}