summaryrefslogtreecommitdiff
path: root/Turbomachines_by_A._V._Arasu/Ch1.ipynb
blob: ab863ced1aa2b41a24b693a2bd157a9a09bc764d (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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
{
 "metadata": {
  "name": "",
  "signature": "sha256:04fae3340038d72ec2280e59669f4edde21c4cc5f0e44781b3f3472ae74ef696"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter1 - Basic Concepts of Turbo Machines"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex-1.1 Page 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#input data\n",
      "P01=1#initial pressure of a fluid in bar\n",
      "P02=10#final pressure of a fliud in bar\n",
      "T01=283#initial total temperature in K\n",
      "ntt=0.75#total-to-total efficiency\n",
      "d=1000#density of water in kg/m**3\n",
      "r=1.4#ratio of specific heats for air\n",
      "Cp=1.005#specific at heat at constant pressure in kJ/kg.K\n",
      "\n",
      "#calculations\n",
      "h0s1=(1/d)*(P02-P01)*10**2#enthalpy in kJ/kg\n",
      "h01=(h0s1/ntt)#enthalpy in kJ/kg\n",
      "T02s=T01*(P02/P01)**((r-1)/r)#temperature in K\n",
      "h0s2=(Cp*(T02s-T01))#enthalpy in kJ/kg\n",
      "h02=(h0s2/ntt)#enthalpy in kJ/kg\n",
      "\n",
      "#output\n",
      "print '''The work of compression for adiabatic steady flow per kg of fliud if - \n",
      "(a)The fliud is liquid water is %3.1f kJ/kg\n",
      "(b)The fliud is air as a perfect gas is %3.2f kJ/kg'''%(h01,h02)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The work of compression for adiabatic steady flow per kg of fliud if - \n",
        "(a)The fliud is liquid water is 1.2 kJ/kg\n",
        "(b)The fliud is air as a perfect gas is 352.94 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.2 Page 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#input data\n",
      "P01=7#Total initial pressure of gases at entry in bar\n",
      "T01=1100#Total initial temperature in K\n",
      "P02=1.5#Total final pressure of gases at exit in bar\n",
      "T02=830#Total final temperature in K\n",
      "C2=250#Exit velocity in m/s\n",
      "r=1.3#Ratio of specific heats of gases\n",
      "M=28.7#Molecular weight of gases\n",
      "R1=8.314#Gas constant of air in kJ/kg.K\n",
      "\n",
      "#calculations\n",
      "T02s=T01*(P02/P01)**((r-1)/r)#Final temperature in K\n",
      "ntt=((T01-T02)/(T01-T02s))#Total-to-total efficiency\n",
      "R=(R1/M)#Gas constant of given gas in kJ/kg.K\n",
      "Cp=((r*R)/(r-1))#Specific heat of given gas at constant pressure in kJ/kg.K\n",
      "T2s=(T02s-((C2**2)/(2*Cp*1000)))#Temperature in isentropic process at exit in K\n",
      "nts=((T01-T02)/(T01-T2s))#Total-to-static efficiency\n",
      "\n",
      "#output\n",
      "print '''The total-to-total efficiency of gases is %0.2f %%\n",
      "The total-to-static efficiency of gases is %0.1f %%'''%(ntt*100,nts*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total-to-total efficiency of gases is 82.05 %\n",
        "The total-to-static efficiency of gases is 76.3 %\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.3 Page 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "h0=6#Change in total enthalpy in kJ/kg\n",
      "T01=303#Total inlet temperature of fluid in K\n",
      "P01=1#Total inlet pressure of fliud in bar\n",
      "Cp=1.005#specific at heat at constant pressure in kJ/kg.K\n",
      "ntt=0.75#Adiabatic total-to-total efficiency\n",
      "r=1.4#ratio of specific heats for air\n",
      "\n",
      "#calculations\n",
      "T02=T01+(h0/Cp)#Exit total termperature of fliud in K\n",
      "P1=(1+((ntt*h0)/(Cp*T01)))**(r/(r-1))#Total pressure ratio of fluid \n",
      "h0s=ntt*h0#Change in enthalpy of process in kJ/kg\n",
      "P0=((h0s*1000)/100)#Change in pressure in bar\n",
      "P02=P0+P01#Total outlet pressure of fliud in bar\n",
      "P2=(P02/P01)#Total pressure ratio of fliud\n",
      "\n",
      "#output\n",
      "print '''(a)The exit total temperature of fliud is %3.2f K\n",
      "(b)The total pressure ratio if:\n",
      "(1)The fliud is air is %3.3f\n",
      "(2)The fliud is liquid water is %3.0i'''%(T02,P1,P2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The exit total temperature of fliud is 308.97 K\n",
        "(b)The total pressure ratio if:\n",
        "(1)The fliud is air is 1.053\n",
        "(2)The fliud is liquid water is  46\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.4 Page 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "W=100#Output power developed in kW\n",
      "Q=0.1#Flow through device in m**3/s\n",
      "d=800#Density of oil in kg/m**3\n",
      "ntt=0.75#Total-to-total efficiency\n",
      "C1=3#inlet flow velocity of oil in m/s\n",
      "C2=10#outlet flow velocity of oil in m/s\n",
      "\n",
      "#calculations\n",
      "m=d*Q#Mass flow rate of oil in kg/s\n",
      "h0=-(W/m)#Change in total enthalpy in kJ/kg\n",
      "h0s=(h0/ntt)#Isentropic change in total enthalpy in kJ/kg\n",
      "P0=((d*h0s)*(1/100))#Change in total pressure of oil in bar\n",
      "P=P0-((d/(2000*100))*(C2**2-C1**2))#Change in static pressure in bar\n",
      "\n",
      "#output\n",
      "print '''The change in total pressure of oil is %3.1f bar\n",
      "The change in static presure is %3.1f bar'''%(P0,P)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in total pressure of oil is -13.3 bar\n",
        "The change in static presure is -13.7 bar\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.5 Page 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "N=4#Number of stages in turbine handling\n",
      "P=0.4#Stagnation presure ratio between exit and inlet of each stage\n",
      "ns1=0.86#Stage efficiency of first and second stages\n",
      "ns2=0.84#Stage efficiency of third and fourth stages\n",
      "r=1.4#ratio of specific heats for air\n",
      "\n",
      "#calculations\n",
      "u=1-(P)**((r-1)/r)#constant\n",
      "T03=(1-(u*ns1))**2#Temperature after the end of first two stages in (K*Cp*T01) where Cp is specific at heat at constant pressure in kJ/kg.K and T01 is initial temperature at entry of stage 1 in K\n",
      "W12=u*(1+(1-(u*ns1)))*ns1#Actual work output from first two stages in (kW*Cp*T01)\n",
      "W34=T03*u*(1+(1-(u*ns2)))*ns2#Actual work output from last two stages in (kW*Cp*T01)\n",
      "W=(W12+W34)#Total actual work output from turbine in (kW*Cp*T01)\n",
      "Ws=1-(1-u)**N#Total isentropic work due to single stage compressor in (kW*Cp*T01)\n",
      "n=(W/Ws)#Overall turbine efficiency\n",
      "\n",
      "#output\n",
      "print 'the overall efficiency of the turbine is %.1f %%'%(n*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the overall efficiency of the turbine is 89.6 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.6 Page 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "from math import log10\n",
      "#input data\n",
      "P=1400#Pressure developed by compressor in mm W.G\n",
      "P1=1.01#Initial pressure of air in bar\n",
      "T1=305#Initial temperature of air in K\n",
      "T2=320#Final temperature of air in K\n",
      "P=1400*9.81*10**-5#Pressure developed by compressor in bar\n",
      "r=1.4#ratio of specific heats for air\n",
      "\n",
      "#calculations\n",
      "P2=P1+P#Final pressure of air in bar\n",
      "T2s=T1*(P2/P1)**((r-1)/r)#Isentropic temperature at exit in K\n",
      "nc=((T2s-T1)/(T2-T1))#compressor efficiency\n",
      "np=((r-1)/r)*((log10(P2/P1))/(log10(T2/T1)))#Infinitesimal stage efficiency\n",
      "\n",
      "#output\n",
      "print '''(a)The compressor efficiency is %0.2f %%\n",
      "(b)The infinitesimal stage efficiency is %0.2f %%'''%(nc*100,np*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The compressor efficiency is 75.43 %\n",
        "(b)The infinitesimal stage efficiency is 75.88 %\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.7 Page 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "P1=1.01#Input pressure to compressor in bar\n",
      "T1=305#Input temperature to compressor in K\n",
      "P2=3#Output pressure from compressor in bar\n",
      "r=1.4#ratio of specific heats for air\n",
      "nc=0.75#compressor efficiency\n",
      "\n",
      "#calculations\n",
      "T2s=T1*(P2/P1)**((r-1)/r)#Isentropic output temperature from compressor in K\n",
      "T2=T1+((T2s-T1)/nc)#Actual output temperature from compressor in K\n",
      "np=((r-1)/r)*((log10(P2/P1))/(log10(T2/T1)))#Infinitesimal efficiency of compressor\n",
      "\n",
      "#output\n",
      "print 'The infinitesimal efficiency of the compressor is %0.1f %%'%(np*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The infinitesimal efficiency of the compressor is 78.5 %\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.8 Page 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "P=2.2#Pressure ratio across a gas turbine\n",
      "n=0.88#Efficiency of a gas turbine\n",
      "T1=1500#Inlet temperature of the gas in K\n",
      "r=1.4#ratio of specific heats for air\n",
      "\n",
      "#calculations\n",
      "T2s=T1*(1/P)**((r-1)/r)#Isentropic output temperature from gas turbine in K\n",
      "T2=T1-(n*(T1-T2s))#actual output temperature from gas turbine in K\n",
      "np=(r/(r-1))*((log10(T1/T2))/(log10(P)))#Polytropic efficiency of the turbine\n",
      "\n",
      "\n",
      "#output\n",
      "print 'The polytropic efficiency of the turbine is %0.1f %%'%(np*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The polytropic efficiency of the turbine is 86.7 %\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.9 Page 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# input data\n",
      "P=1.3#Pressure ratio of stages\n",
      "N=8#Number of stages\n",
      "m =45#The flow rate through compressor in kg/s\n",
      "nc=0.8#Overall efficiency of the compressor\n",
      "P1=1#Initial pressure of the air at entry in bar\n",
      "T1=308#Initial temperature of the air at entry in K\n",
      "r=1.4#ratio of specific heats for air\n",
      "\n",
      "#calculations\n",
      "PN=(P)**8#Overall pressure ratio of all 8 stages\n",
      "TN=PN**((r-1)/r)#Overall temperature ratio of all 8 stages\n",
      "TN1s=TN*T1#Ideal exit temperature in K\n",
      "TN1=((TN1s-T1)/nc)+T1#Actual exit temperature in K\n",
      "PN1=PN*P1#Actual exit pressure in bar\n",
      "np=((r-1)/r)*((log10(PN1/P1))/(log10(TN1/T1)))#Polytropic efficiency of the cycle\n",
      "ns=((((P)**((r-1)/r))-1)/(((P)**((r-1)/(r*np)))-1))#The stage efficiency of the cycle\n",
      "\n",
      "#output\n",
      "print '''(a)The state of air at compressor exit are-\n",
      "(1)actual temperature is %3.1f K\n",
      "(2)actual pressure is %3.2f bar\n",
      "(b)The polytropic efficiency of the cycle is %0.f %%\n",
      "(c)The stage efficiency of the cycle is %0.2f %%'''%(TN1,PN1,np*100,ns*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The state of air at compressor exit are-\n",
        "(1)actual temperature is 624.3 K\n",
        "(2)actual pressure is 8.16 bar\n",
        "(b)The polytropic efficiency of the cycle is 85 %\n",
        "(c)The stage efficiency of the cycle is 84.31 %\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex - 1.10 Page 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "#input data\n",
      "P=11#Overall pressure ratio in three stages of a gas turbine\n",
      "nt=0.88#Overall efficiency in three stages of a gas turbine\n",
      "T1=1500#Temperature at inlet of a gas turbine in K\n",
      "r=1.4#ratio of specific heats for air\n",
      "\n",
      "#calculations\n",
      "T0=nt*T1*(1-(1/P)**((r-1)/r))#Overall change in temperature in all stages in K\n",
      "TN1=T1-T0#Temperature at final stage of a gas turbine in K\n",
      "np=((r/(r-1))*log10(T1/TN1))/(log10(P))#Overall polytropic efficiency of the gas turbine\n",
      "Ts=T0/3#Individual stage change in temperature in K\n",
      "T2=T1-Ts#Exit temperature at the end of first stage in K\n",
      "P1=(T1/T2)**(r/(np*(r-1)))#Pressure ratio at first stage of gas turbine \n",
      "ns1=((1-(1/P1)**((np*(r-1))/r))/(1-(1/P1)**((r-1)/r)))#Stage efficiency of first stage \n",
      "T3=T2-Ts#Exit temperature at the end of second stage in K\n",
      "P2=(T2/T3)**(r/(np*(r-1)))#Pressure ratio at second stage of gas turbine\n",
      "ns2=((1-(1/P2)**((np*(r-1))/r))/(1-(1/P2)**((r-1)/r)))#Stage efficiency of second stage\n",
      "T4=T3-Ts#Exit temperature at the end of third stage in K\n",
      "P3=(T3/T4)**(r/(np*(r-1)))#Pressure ratio at the third stage of gas turbine\n",
      "ns3=((1-(1/P3)**((np*(r-1))/r))/(1-(1/P3)**((r-1)/r)))#Stage efficiency of third stage\n",
      "\n",
      "#output\n",
      "print '''(a)The values for first stage are -\n",
      "(1)Pressure ratio is %3.2f\n",
      "(2)stage efficiency is %0.2f %%\n",
      "(b)The values of second stage are -\n",
      "(1)Pressure ratio is %3.3f\n",
      "(2)Stage efficiency is %0.1f %%\n",
      "(c)The values of third stage are -\n",
      "(1)Pressure ratio is %3.2f\n",
      "(2)Stage efficiency is %0.2f'''%(P1,ns1*100,P2,ns2*100,P3,ns3*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The values for first stage are -\n",
        "(1)Pressure ratio is 1.93\n",
        "(2)stage efficiency is 84.96 %\n",
        "(b)The values of second stage are -\n",
        "(1)Pressure ratio is 2.182\n",
        "(2)Stage efficiency is 85.2 %\n",
        "(c)The values of third stage are -\n",
        "(1)Pressure ratio is 2.61\n",
        "(2)Stage efficiency is 85.52\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.11 Page 29  "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "N=4#Number of stages in compressor\n",
      "m=45#mass flow rate of air delivered by compressor in kg/s\n",
      "P1=1.2#Pressure ratio at first stage\n",
      "ns=0.65#Stage efficiency of first stage\n",
      "r=1.4#ratio of specific heats for air\n",
      "Cp=1.005#specific at heat at constant pressure in kJ/kg.K\n",
      "T1=293#Temperature of air at inlet in K\n",
      "\n",
      "#calculations\n",
      "P=(P1)**N#Overall pressure in all 4 stages\n",
      "np=((r-1)/r)*((log10(P1))/(log10((((P1**((r-1)/r))-1)/ns)+1)))#Polytropic efficiency of the cycle\n",
      "nc=(((P1**(N*((r-1)/r)))-1)/((P1**(N*((r-1)/(r*np))))-1))#Overall efficiency of the cycle\n",
      "TN1=T1*((P1**(N))**((r-1)/(r*np)))#Final temperature at the exit of the compressor at final stage in K\n",
      "W=m*Cp*(TN1-T1)#Power required to drive the compressor in kW\n",
      "\n",
      "#output\n",
      "\n",
      "print '''(a)The overall pressure ratio of the process is %3.1f\n",
      "(b)The overall efficiency of the process is %0.2f %%\n",
      "(c)The power required to drive the compressor is %3.2f kW'''%(P,nc*100,W)\n",
      "# the answer in the textbook is not correct."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The overall pressure ratio of the process is 2.1\n",
        "(b)The overall efficiency of the process is 62.29 %\n",
        "(c)The power required to drive the compressor is 4928.55 kW\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.12 Page 31  "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "P0=0.2*9.81*(10**3)*(10**-5)#Total increase in pressure in bar\n",
      "P01=1.04#Total inlet pressure of air in bar\n",
      "T01=291#Total inlet temperature of air in K\n",
      "ntt=0.72#Total-to-total efficiency of the process\n",
      "r=1.4#ratio of specific heats for air\n",
      "Cp=1.005#specific at heat at constant pressure in kJ/kg.K\n",
      "\n",
      "#calculations\n",
      "P2=P0+P01#The total exit pressure in bar\n",
      "T02=((((P2/P01)**((r-1)/r)-1)*T01)/ntt)+T01#Total temperature at the outlet in K\n",
      "h0=Cp*(T02-T01)#Actual change in total enthalpy in kJ/kg\n",
      "h0s=h0*ntt#Isentropic change in total enthalpy in kJ/kg\n",
      "\n",
      "#output\n",
      "print '''(a)The total exit pressure is %3.4f bar\n",
      "and the total exit temperature is %3.2f K\n",
      "(b)The actual change in total enthalpy is %3.3f kJ/kg\n",
      "and the isentropic change in total enthalpy is %3.3f kJ/kg'''%(P2,T02,h0,h0s)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The total exit pressure is 1.0596 bar\n",
        "and the total exit temperature is 293.16 K\n",
        "(b)The actual change in total enthalpy is 2.175 kJ/kg\n",
        "and the isentropic change in total enthalpy is 1.566 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.13 Page 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#input data\n",
      "P=5#Pressure ratio in the process\n",
      "ntt=0.8#Total-to-total efficiency of the process\n",
      "m=5#Air flow rate through turbine in kg/s\n",
      "W=500#Total power output from the turbine in kW\n",
      "r=1.4#ratio of specific heats for air\n",
      "Cp=1.005*10**3#specific at heat at constant pressure in J/kg.K\n",
      "C2=100#Flow velocity of air in m/s\n",
      "\n",
      "#calculations\n",
      "T=(W*10**3)/(m*Cp)#Total change in temperature in the process in K\n",
      "T02s=(1/P)**((r-1)/r)#Isentropic temperature at the outlet from turvine in (K*T01)\n",
      "T01=(T/ntt)*(1/(1-0.631))#Inlet total temperature in K\n",
      "T02=T01-T#Actual exit total temperature in K\n",
      "T2=T02-((C2**2)/(2*Cp))#Actual exit static temperature in K\n",
      "T02s1=T02s*T01#Isentropic temperature at the outlet from turbine in K\n",
      "T2s=T02s1-((C2**2)/(2*Cp))#Actual isentropic temperature in K\n",
      "nts=(T/(T01-T2s))#Total-to-static efficiency\n",
      "\n",
      "#output\n",
      "print '''(a)The inlet total temperature is %i K\n",
      "(b)The actual exit total temperature is %3.1f K\n",
      "(c)The actual exit static temperature is %3.1f K\n",
      "(d)The total-to-static efficiency is %0.2f  %%'''%(T01,T02,T2,nts*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The inlet total temperature is 337 K\n",
        "(b)The actual exit total temperature is 237.6 K\n",
        "(c)The actual exit static temperature is 232.6 K\n",
        "(d)The total-to-static efficiency is 77.00  %\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1.14 Page 33  "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "#input data\n",
      "N=3#Number of stages in turbine\n",
      "P=2#Pressure ratio of each stage\n",
      "ns=0.75#Stage efficiency of each stage\n",
      "T1=873#Initial temperature of air in K\n",
      "m=25#Flow rate of air in kg/s\n",
      "r=1.4#ratio of specific heats for air\n",
      "Cp=1.005#specific at heat at constant pressure in J/kg.K\n",
      "\n",
      "#calculations\n",
      "np=(r/(r-1))*((log(1-(ns*(1-(1/P)**((r-1)/r)))))/(log(1/P)))#Polytropic efficiency of the process\n",
      "nt=((1-(1/P)**(N*np*((r-1)/r)))/(1-(1/P)**(N*((r-1)/r))))#Overall efficiency of the turbine\n",
      "W=m*Cp*T1*(1-(1/P)**(N*np*((r-1)/r)))#Power developed by the turbine in kW\n",
      "RF=nt/ns#Reheat factor of the process\n",
      "\n",
      "#output\n",
      "print '''(a)The overall efficiency of the turbine is %0.2f %%\n",
      "(b)The power developed by the turbine is %i kW\n",
      "(c)The reheat factor of the process is %3.2f'''%(nt*100,W,RF)\n",
      "\n",
      "#comments\n",
      "# the answer in the textbook is not correct."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The overall efficiency of the turbine is 78.63 %\n",
        "(b)The power developed by the turbine is 7725 kW\n",
        "(c)The reheat factor of the process is 1.05\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}