summaryrefslogtreecommitdiff
path: root/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter5.ipynb
blob: ce4f45c995e0a3468f5d44ec1183db8d02efc0c2 (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
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 05:First law applied to Flow Processes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.1:pg-97"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.1\n",
      "\n",
      " The rate of work input is  116.0  kW\n",
      "\n",
      " The ratio of the inlet pipe diameter and outet pipe diameter is  0.0  \n"
     ]
    }
   ],
   "source": [
    "# Part(a)\n",
    "import math\n",
    "V1 = 0.95 # Inlet volume flow rate in m**3/kg\n",
    "\n",
    "P1 = 100 # Pressure at inlet in kPa\n",
    "\n",
    "v1 = 7 # velocity of flow at inlet in m/s\n",
    "\n",
    "V2 = 0.19 # Exit volume flow rate in m**3/kg\n",
    "\n",
    "P2 = 700 # Pressure at exit in kPa \n",
    "\n",
    "v2 = 5 # velocity of flow at exit in m/s\n",
    "\n",
    "w = 0.5 # mass flow rate in kg/s\n",
    "\n",
    "u21 = 90  # change in internal energy in kJ/kg\n",
    "\n",
    "Q = -58  # Heat transfer in kW\n",
    "\n",
    "W =  - w*( u21 + (P2*V2-P1*V1) + ((v2**2-v1**2)/2) ) + Q  # W = dW/dt  \n",
    "\n",
    "print \"\\n Example 5.1\"\n",
    "\n",
    "print \"\\n The rate of work input is \",abs(W) ,\" kW\"\n",
    "\n",
    "#The answers given in textbook is wrong\n",
    "\n",
    "# Part (b)\n",
    "\n",
    "A = (v2/v1)*(V1/V2)  # A = A1/A2\n",
    "\n",
    "d_ratio = math.sqrt(A)  # d = d1/d2\n",
    "\n",
    "print \"\\n The ratio of the inlet pipe diameter and outet pipe diameter is \",d_ratio ,\" \"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.2:pg-98"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.2\n",
      "\n",
      " The internal energy decreases by  20.0  kJ\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "V1 = 0.37 # volume flow rate at inlet in m**3/kg\n",
    "\n",
    "P1 = 600# Inlet pressure in kPa\n",
    "\n",
    "v1 = 16 # Inlet velocity of flow in m/s\n",
    "\n",
    "V2 = 0.62 # volume flow rate at exit in m**3/kg \n",
    "\n",
    "P2 = 100# Exit pressure in kPa\n",
    "\n",
    "v2 = 270 # Exit velocity of flow in m/s\n",
    "\n",
    "Z1 = 32 # Height of inlet port from datum in m\n",
    "\n",
    "Z2 = 0 #Height of exit port from datum in m\n",
    "\n",
    "g = 9.81  # Acceleration due to gravity\n",
    "\n",
    "Q = -9  # Heat transfer in kJ/kg\n",
    "\n",
    "W = 135  # Work transfer in kJ/kg\n",
    "\n",
    "U12 = (P2*V2-P1*V1) + ((v2**2-v1**2)/2000) + (Z2-Z1)*g*1e-3 + W - Q  # Change in internal energy in kJ\n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Example 5.2\"\n",
    "\n",
    "print \"\\n The internal energy decreases by \",round(U12) ,\" kJ\"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.3:pg-99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.3\n",
      "\n",
      " The steam flow rate is  53.5854836932  Kg/s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "P1 = 4 # Boiler pressure in MPa\n",
    "\n",
    "t1 = 400 # Exit temperature at boiler in degree Celsius\n",
    "\n",
    "h1 = 3213 # Enthalpy at boiler exit in kJ/kg\n",
    "\n",
    "V1 = 0.073 # specific volume at boiler exit in m**3/kg\n",
    "\n",
    "P2 = 3.5 # Pressure at turbine end in MPa\n",
    "\n",
    "t2 = 392 # Turbine exit temperature in degree Celsius\n",
    "\n",
    "h2 = 3202 # Enthalpy at turbine exit in kJ/kg\n",
    "\n",
    "V2 = 0.084 # specific volume at turbine exit in m**3/kg\n",
    "\n",
    "Q = -8.5 # Heat loss from pipeline in kJ/kg\n",
    "\n",
    "v1 = math.sqrt((2*(h1-h2+Q)*1e3)/(1.15**2-1)) # velocity of flow in m/s\n",
    "\n",
    "A1 = (math.pi/4)*0.2**2 # Area of pipe in m**2\n",
    "\n",
    "w = (A1*v1)/V1 # steam flow rate in Kg/s\n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Example 5.3\"\n",
    "\n",
    "print \"\\n The steam flow rate is \",w ,\" Kg/s\"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.4:pg-100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.4\n",
      "\n",
      " The amount of heat that should be supplied is  703.880549402  Kg/h\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "h1 = 313.93 # Enthalpy of water at heater inlet in kJ/kg\n",
    "\n",
    "h2 = 2676 # Enthalpy of hot water at temperature 100.2 degree Celsius\n",
    "\n",
    "h3 = 419 #Enthalpy of water at heater inlet in kJ/kg\n",
    "\n",
    "w1 = 4.2 # mass flow rate in kg/s\n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Example 5.4\"\n",
    "\n",
    "w2 = w1*(h3-h1)/(h2-h3)# Steam rate  \n",
    "\n",
    "print \"\\n The amount of heat that should be supplied is \",w2*3600 ,\" Kg/h\"\n",
    "\n",
    "\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.5:pg-100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.5\n",
      "\n",
      " The rate of heat transfer to the air in the heat exchanger is  1577.85  kJ/s\n",
      "\n",
      " The power output from the turbine assuming no heat loss is  298  kW\n",
      "\n",
      " The velocity at the exit of the nozzle is  552.358579186  m/s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "t1 = 15 # Heat exchanger inlet temperature in degree Celsius\n",
    "\n",
    "t2 = 800 # Heat exchanger exit temperature in degree Celsius\n",
    "\n",
    "t3 = 650 # Turbine exit temperature in degree Celsius\n",
    "\n",
    "t4 = 500 # Nozzle exit temperature in degree Celsius\n",
    "\n",
    "v1 = 30 # Velocity of steam at heat exchanger inlet in m/s\n",
    "\n",
    "v2 = 30# Velocity of steam at turbine inlet in m/s\n",
    "\n",
    "v3 = 60 # Velocity of steam at nozzle inlet in m/s\n",
    "\n",
    "w = 2 # mass flow rate in kg/s\n",
    "\n",
    "cp = 1005 # Specific heat capacity of air in kJ/kgK\n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Example 5.5\"\n",
    "\n",
    "Q1_2 = w*cp*(t2-t1) # rate of heat transfer\n",
    "\n",
    "print \"\\n The rate of heat transfer to the air in the heat exchanger is \",Q1_2/1e3 ,\" kJ/s\"\n",
    "\n",
    "\n",
    "\n",
    "W_T = w*( ((v2**2-v3**2)/2) + cp*(t2-t3)) # power output from the turbine\n",
    "\n",
    "print \"\\n The power output from the turbine assuming no heat loss is \",W_T/1000 ,\" kW\"\n",
    "\n",
    "v4 = math.sqrt( (v3**2) + (2*cp*(t3-t4)) ) # velocity at the exit of the nozzle\n",
    "\n",
    "print \"\\n The velocity at the exit of the nozzle is \",v4 ,\" m/s\"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.6:pg-102"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.6\n",
      "\n",
      " Velocity of exhaust gas is  541.409855832  m/s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "ha = 260  # Enthalpy of air in kJ/kg\n",
    "\n",
    "hg = 912  # Enthalpy of gas in kJ/kg\n",
    "\n",
    "Va = 270  # Velocity of air in m/s\n",
    "\n",
    "wf = 0.0190  # mass of fuel in Kg\n",
    "\n",
    "wa = 1 # mass of air in Kg\n",
    "\n",
    "Ef = 44500  # Chemical energy of fuel in kJ/kg\n",
    "\n",
    "Q = 21  # Heat loss from the engine in kJ/kg\n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Example 5.6\"\n",
    "\n",
    "Eg = 0.05*wf*Ef/(1+wf)  # As 5% of chemical energy is not released in reaction\n",
    "\n",
    "wg = wa+wf # mass of flue gas\n",
    "\n",
    "Vg = math.sqrt(2000*(((ha+(Va**2*0.001)/2+(wf*Ef)-Q)/(1+wf))-hg-Eg)) \n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Velocity of exhaust gas is \",Vg ,\" m/s\"\n",
    "\n",
    "#Answer given in textbook is wrong\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex5.8:pg-103"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 5.8\n",
      "\n",
      " The rate at which air flows out of the tank is  0.85  kg/h\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "\n",
    "V = 0.12 # Volume of tank in m**3\n",
    "\n",
    "p = 1 # Pressure in MPa\n",
    "\n",
    "T = 150 # Temperature in degree centigrade\n",
    "\n",
    "P = 0.1 # Power to peddle wheel in kW\n",
    "\n",
    "print \"\\n Example 5.8\"\n",
    "\n",
    "u0 = 0.718*273 # Internal energy at 0 degree Celsius\n",
    "\n",
    "# Function for internal energy of gas\n",
    "\n",
    "def f1(t):\n",
    "    u = u0+(0.718*t)\n",
    "    pv = 0.287*(273+t)\n",
    "    return (u,pv)\n",
    "       \n",
    "U,PV=f1(T)\n",
    "       \n",
    "       \n",
    "hp = U+PV # At 150 degree centigrade\n",
    "m_a = P/hp\n",
    "       \n",
    "print \"\\n The rate at which air flows out of the tank is \",round(m_a*3600,2) ,\" kg/h\"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n",
    "\n",
    "\n"
   ]
  }
 ],
 "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
}