summaryrefslogtreecommitdiff
path: root/Fundamentals_Of_Thermodynamics/Chapter17.ipynb
blob: 4ae8005bd697aff5c29f00b9fee479dcc43d4b9a (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:70b7f86a423a7c9685f997491946441e1c53cfe8fe328afd6e5b37a44e4dce11"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 17: COMPRESSIBLE FLOW"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.1:PG-710"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques1\n",
      "#to determine isentropic stagnation pressure and temperature \n",
      "\n",
      "T=300;#Temperature of air in K\n",
      "P=150;#Pressure of air in kPa\n",
      "v=200;#velocity of air flow n m/s\n",
      "Cp=1.004;#specific heat at constant pressure in kJ/kg\n",
      "To=v**2/(2000*Cp)+T;#stagnation temperature in K\n",
      "k=1.4;#constant\n",
      "Po=P*(To/T)**(k/(k-1));#stagnation pressure in kPa\n",
      "print 'Stagnation Temperature is ',round(To,1),' K \\n'\n",
      "print 'Stagnation Pressure is ',round(Po,2),'kPa \\n'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stagnation Temperature is  319.9  K \n",
        "\n",
        "Stagnation Pressure is  187.85 kPa \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.2:PG-713"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques2\n",
      "#to determine the force\n",
      "\n",
      "#initializing variables\n",
      "mdot=-1 # mass flow rate out of control volume in kg/s\n",
      "Vx=-1 # x component of velocity of control volume in m/s\n",
      "Vy=10 # y component of velocity of control volume in m/s\n",
      "\n",
      "Fx=mdot*Vx # Force in X direction\n",
      "\n",
      "Fy=mdot*Vy # Force in Y direction\n",
      "\n",
      "print \"the force the man exert on the wheelbarrow\",round(Fx),\"N\"\n",
      "print \"the force the floor exerts on the wheelbarrow\",round(Fy),\"N\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the force the man exert on the wheelbarrow 1.0 N\n",
        "the force the floor exerts on the wheelbarrow -10.0 N\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.3:PG-715"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques3\n",
      "#determining the thrust acting on a control surface\n",
      "\n",
      "#i-inlet\n",
      "#e-exit\n",
      "#using momentum equation on control surface in x direction\n",
      "me=20.4;#mass exiting in kg\n",
      "mi=20;#mass entering in kg\n",
      "ve=450;#exit velocity in m/s\n",
      "vi=100;#inlet velocity in m/s\n",
      "Pi=95;#Pressure at inlet in kPa\n",
      "Pe=125;#Pressure at exit in kPa\n",
      "Po=100;#surrounding pressure in kPa\n",
      "Ai=0.2;#inlet area in m^2\n",
      "Ae=0.1;#exit area in m^2\n",
      "Rx=(me*ve-mi*vi)/1000-(Pi-Po)*Ai+(Pe-Po)*Ae;#thrust in x direction in kN\n",
      "\n",
      "print \"Thrust acting in x direction is \",round(Rx,2),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thrust acting in x direction is  10.68 kN\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.4:PG-717"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques4\n",
      "#to determine increase in enthalpy\n",
      "#initializing variables\n",
      "#i-inlet\n",
      "#e-exit\n",
      "\n",
      "T=25+273 # temperature in kelvin\n",
      "v=0.001003 # specific volume of water in kg/m^3 at 25 *c from table B.1.1 \n",
      "ve=7;#exit velocity in m/s\n",
      "vi=30;#inlet velocity in m/s\n",
      "Pi=350;#Pressure at inlet in kPa\n",
      "Pe=600;#Pressure at exit in kPa\n",
      "\n",
      "#using momentum equation on control surface \n",
      "Pes= (vi**2-ve**2)/(2*v*1000)+Pi # exit pressure for reversible diffuser\n",
      "delH=(vi**2-ve**2)/(2*1000.0) # change in enthalpy from first law in kJ/kg\n",
      "delU=delH-v*(Pe-Pi) # change in internal energy in kJ/kg\n",
      "delS=delU/T # change in entropy in kJ/kg.K\n",
      "print\"the exit pressure for reversible diffuser is \",round(Pes),\"kPa\"\n",
      "print\"the increase in enthalpy is \",round(delH,5),\"kJ/kg\"\n",
      "print\"the increase in internal energy is \",round(delU,5),\"kJ/kg\"\n",
      "print\"the increase in entropy is \",round(delS,6),\"kJ/kg.K\"\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the exit pressure for reversible diffuser is  774.0 kPa\n",
        "the increase in enthalpy is  0.4255 kJ/kg\n",
        "the increase in internal energy is  0.17475 kJ/kg\n",
        "the increase in entropy is  0.000586 kJ/kg.K\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.5:PG-720"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques5\n",
      "#determining velocity of sound in air\n",
      "import math\n",
      "k=1.4;#constant\n",
      "R=0.287;#gas constant\n",
      "#at 300K\n",
      "T1=300;# temperature in kelvin\n",
      "c1=math.sqrt(k*R*T1*1000)\n",
      "print \"Speed of sound at 300 K is\",round(c1,1),\" m/s\" \n",
      "#at 1000K\n",
      "T2=1000;# temperature in kelvin\n",
      "c2=math.sqrt(k*R*T2*1000)\n",
      "print \"Speed of sound at 1000 K is\",round(c2,1),\" m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of sound at 300 K is 347.2  m/s\n",
        "Speed of sound at 1000 K is 633.9  m/s\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.6:PG-727"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques6\n",
      "#determining mass flow rate through control volume\n",
      "import math\n",
      "k=1.4;#constant\n",
      "R=0.287;#gas constant\n",
      "To=360;#stagnation Temperature in K \n",
      "T=To*0.8333;#Temperature of air in K, 0.8333 stagnation ratio from table\n",
      "v=math.sqrt(k*R*T*1000);#velocity in m/s\n",
      "P=528;#stagnation pressure in kPa\n",
      "d=P/(R*T);#stagnation density in kg/m^3\n",
      "A=500*10**-6;#area in m^2\n",
      "ms=d*A*v;#mass flow rate in kg/s\n",
      "print\" Mass flow rate at the throat section is\",round(ms,4),\"kg/s\"\n",
      "#e-exit state\n",
      "Te=To*0.9381;#exit temperature in K, ratio from table\n",
      "ce=math.sqrt(k*R*Te*1000);#exit velocity of sound in m/s\n",
      "Me=0.573;#Mach number\n",
      "ve=Me*ce;\n",
      "Pe=800;#exit pressure in kPa\n",
      "de=Pe/R/Te;\n",
      "mse=de*A*ve;\n",
      "print\" Mass flow rate at the exit section is\",round(mse,4),\" kg/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass flow rate at the throat section is 1.0646 kg/s\n",
        " Mass flow rate at the exit section is 0.8711  kg/s\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.7:PG-728"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques7\n",
      "#determining exit properties in a control volume\n",
      "import math\n",
      "Po=1000;#stagnation pressure in kPa\n",
      "To=360;#stagnation temperature in K\n",
      "\n",
      "#when diverging section acting as nozzle\n",
      "\n",
      "Pe1=0.0939*Po;#exit pressure of air in kPa\n",
      "Te1=0.5089*To;#exit temperature in K\n",
      "k=1.4;#constant\n",
      "R=0.287;#gas constant for air\n",
      "ce=math.sqrt(k*R*Te1*1000);#velocity of sound in exit section in m/s\n",
      "Me=2.197;#mach number from table\n",
      "ve1=Me*ce;#velocity of air at exit section in m/s\n",
      "print \"When diverging section act as a nozzle :-\"\n",
      "print \"Exit pressure is\",round(Pe1,4),\" kPa\"\n",
      "print \"Exit Temperature\",round(Te1,1),\" K\"\n",
      "print \"Exit velocity is\",round(ve1,1),\" m/s \"\n",
      "\n",
      "#when diverging section act as diffuser\n",
      "\n",
      "Me=0.308;\n",
      "Pe2=0.0936*Po;#exit pressure of air in kPa\n",
      "Te2=0.9812*To;#exit temperature in K\n",
      "ce=math.sqrt(k*R*Te2*1000);#velocity of sound in exit section in m/s\n",
      "ve2=Me*ce;\n",
      "print \"When diverging section act as a diffuser :-\"\n",
      "print \"Exit pressure is\",round(Pe2,1),\" kPa\"\n",
      "print \"Exit Temperature\",round(Te2,2),\" K\"\n",
      "print \"Exit velocity is\",round(ve2,),\" m/s \"\n",
      "\n",
      "# The value of Exit pressure when diverging section acts as diffuser is wrong\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When diverging section act as a nozzle :-\n",
        "Exit pressure is 93.9  kPa\n",
        "Exit Temperature 183.2  K\n",
        "Exit velocity is 596.1  m/s \n",
        "When diverging section act as a diffuser :-\n",
        "Exit pressure is 93.6  kPa\n",
        "Exit Temperature 353.23  K\n",
        "Exit velocity is 116.0  m/s \n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex17.9:PG-733"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques9\n",
      "#determining exit plane properties in control volume\n",
      "\n",
      "#x-inlet\n",
      "#y-exit\n",
      "Mx=1.5;#mach number for inlet\n",
      "My=0.7011;#mach number for exit\n",
      "Px=272.4;#inlet pressure in kPa\n",
      "Tx=248.3;#inlet temperature in K\n",
      "Tox=360 # stagnation temperature in Kelvin\n",
      "Pox=1000.0;#stagnation pressure for inlet\n",
      "Py=2.4583*Px;# Pressure at 1.5 mach in kPa\n",
      "Ty=1.320*Tx;# temperature at 1.5 mach in K\n",
      "Poy=0.9298*Pox;# pressure at 1.5 mach in kPa\n",
      "\n",
      "Toy=Tox # constant\n",
      "Me=0.339 # from table with A/A*=1.860 and M < 1\n",
      "Pe=0.9222*Py;#Exit Pressure in kPa\n",
      "Te=0.9771*Toy;#Exit temperature in K\n",
      "Poe=0.9222*Poy;#Exit pressure in kPa\n",
      "\n",
      "print \"Exit Mach no.=\",Me\n",
      "print \"Exit temperature =\",round(Te,2),\"K \"\n",
      "print \"Exit pressure =\",round(Poe,1),\"kPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exit Mach no.= 0.339\n",
        "Exit temperature = 351.76 K \n",
        "Exit pressure = 857.5 kPa\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 45
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}