summaryrefslogtreecommitdiff
path: root/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_6.ipynb
blob: ad9b86141b6cd8047ff2b218964da415bb650a83 (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
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
{
 "metadata": {
  "name": "Chapter 6"
 }, 
 "nbformat": 2, 
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown", 
     "source": [
      "# Chapter 6 :- Using Entropy"
     ]
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>  Example 6.1 Page no- 219"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "T = 373.15                                # temperature in kelvin", 
      "", 
      "# From table A-2", 
      "", 
      "p = 1.014*(10**5)                         # pressure in pascal", 
      "vg = 1.673", 
      "vf = 1.0435e-3", 
      "sg = 7.3549", 
      "sf = 1.3069", 
      "", 
      "# Calculations", 
      "w = p*(vg-vf)*(10**(-3))", 
      "Q = T*(sg-sf)", 
      "", 
      "# Results ", 
      "print '-> The work per unit mass is',round(w,3),'KJ/kg.'", 
      "print '-> The heat transfer per unit mass is ',round(Q,2),'KJ/kg.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The work per unit mass is 169.536 KJ/kg.", 
        "-> The heat transfer per unit mass is  2256.81 KJ/kg."
       ]
      }
     ], 
     "prompt_number": 1
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>  Example 6.2 Page no- 224"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "# Assumptions:", 
      "\"\"\"", 
      "1. The water in the piston\u2013cylinder assembly is a closed system.", 
      "", 
      "2. There is no heat transfer with the surroundings.", 
      "", 
      "3. The system is at an equilibrium state initially and finally. There is no", 
      "change in kinetic or potential energy between these two states.\"\"\"", 
      "", 
      "# From table A-2 at 100 degree celcius", 
      "ug = 2506.5                                  # in kj/kg", 
      "uf = 418.94                                  # in kj/kg", 
      "sg = 7.3549", 
      "sf = 1.3069", 
      "", 
      "", 
      "# Calculations:-", 
      "# From energy balance", 
      "W = -(ug-uf)", 
      "# From entropy balance", 
      "sigmabym = (sg-sf)", 
      "", 
      "# Results", 
      "print '-> The net work per unit mass is ',round(W,2),'KJ/kg.'", 
      "print '-> The amount of entropy produced per unit mass is ',round(sigmabym,2),'kJ/kg.k.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The net work per unit mass is  -2087.56 KJ/kg.", 
        "-> The amount of entropy produced per unit mass is  6.05 kJ/kg.k."
       ]
      }
     ], 
     "prompt_number": 2
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>  Example 6.3 Page no-225"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "T1 = 273.0                                # initial temperature of saturated vapor in kelvin", 
      "P2 = 0.7*(10**6)                          # final pressure in pascal", 
      "", 
      "# From table A-10,", 
      "u1 = 227.06                               # in kj/kg", 
      "", 
      "# minimum theoretical work corresponds to state of isentropic compression", 
      "# From table A-12,", 
      "u2s = 244.32                              # in kj/kg", 
      " ", 
      "# Calculations ", 
      "Wmin = u2s-u1", 
      "", 
      "# Results", 
      "print '-> The minimum theoretical work input required per unit mass of refrigerant is: ',round(Wmin,2),'kJ/kg.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The minimum theoretical work input required per unit mass of refrigerant is:  17.26 kJ/kg."
       ]
      }
     ], 
     "prompt_number": 3
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2> Example 6.4 Page no- 227"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given :-", 
      "Qdot = -1.2                          # in kilo watt", 
      "Tb = 300.0                           # in kelvin", 
      "Tf = 293.0                           # in kelvin", 
      "# Calculations", 
      "", 
      "# Part (a)", 
      "# From entropy balance ", 
      "sigmadot = -Qdot/Tb", 
      "", 
      "# Part(b)", 
      "# From entropy balance ", 
      "sigmadt = -Qdot/Tf", 
      "", 
      "# Results", 
      "print '-> The rate of entropy production with gearbox as system is ',round(sigmadot,5),'kw/k.'", 
      "print '-> The rate of entropy production with gearbox + sorrounding as system is',round(sigmadt,5),'kw/k.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The rate of entropy production with gearbox as system is  0.004 kw/k.", 
        "-> The rate of entropy production with gearbox + sorrounding as system is 0.0041 kw/k."
       ]
      }
     ], 
     "prompt_number": 4
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2> Example 6.5 Page no-229"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# GIven:-", 
      "Tmi = 1200.0                                   # initial temperature of metal in kelvin", 
      "cm = 0.42                                      # specific heat of metal in KJ/kg.k", 
      "mm = 0.3                                       # mass of metal in kg", 
      "Twi = 300.0                                    # initial temperature of water in kelvin", 
      "cw = 4.2                                       # specific heat of water in KJ/Kg.k", 
      "mw = 9.0                                       # mass of water in kg", 
      "", 
      "# Calculations", 
      "import math", 
      "# Part(a)", 
      "# Solving energy balance equation yields", 
      "Tf = (mw*(cw/cm)*Twi+mm*Tmi)/(mw*(cw/cm)+mm)", 
      "", 
      "# Part (b)", 
      "# Solving entropy balance equation yields", 
      "sigma = mw*cw*math.log(Tf/Twi)+mm*cm*math.log(Tf/Tmi)", 
      "", 
      "# Results", 
      "print '-> The final equilibrium temperature of the metal bar and the water is',round(Tf,2),'  kelvin.'", 
      "print '-> The amount of entropy produced is:',round(sigma,2),'kJ/k.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The final equilibrium temperature of the metal bar and the water is 302.99   kelvin.", 
        "-> The amount of entropy produced is: 0.2 kJ/k."
       ]
      }
     ], 
     "prompt_number": 5
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2> Example 6.6 Page no- 234"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 30.0                                            # pressure of steam entering the turbine in bar", 
      "T1 = 400.0                                           # temperature of steam entering the turbine in degree celcius", 
      "V1 = 160.0                                           # velocity of steam entering the turbine in m/s", 
      "T2 = 100.0                                           # temperature of steam exiting in degree celcius", 
      "V2 = 100.0                                           # velocity of steam exiting in m/s", 
      "Wcvdot = 540.0                                       # work produced by turbine in kJ/kg of steam", 
      "Tb = 350.0                                           # temperature of the boundary in kelvin", 
      "", 
      "# From table A-4 and table A-2", 
      "h1 = 3230.9                                          # specific enthalpy at entry in Kj/kg", 
      "h2 = 2676.1                                          # specific enthalpy at exit in kj/kg", 
      "", 
      "# Calculations", 
      "", 
      "# Reduction in mass and energy balance equations results in ", 
      "Qcvdot = Wcvdot + (h2 - h1)+ (V2**2-V1**2)/(2*(10**3))  # heat transfer rate", 
      "", 
      "# From table A-2", 
      "s2 = 7.3549                                             # in kj/kg.k", 
      "# From table A-4", 
      "s1 = 6.9212                                             # in kj/kg.k", 
      "", 
      "# From entropy and mass balance equations", 
      "sigmadot = -(Qcvdot/Tb) + (s2-s1)", 
      "", 
      "# Results", 
      "print '-> The rate at which entropy is produced within the turbine per kg of steam  flowing is',round(sigmadot,2),'kJ/kg.k.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The rate at which entropy is produced within the turbine per kg of steam  flowing is 0.5 kJ/kg.k."
       ]
      }
     ], 
     "prompt_number": 6
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>  Example 6.7 Page no- 235"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "T1 = 294.0                            # entry temperature of air in kelvin", 
      "P1 = 5.1                              # entry pressure of air in bars", 
      "T2 = 352.0                            # exit temperature of hot stream in kelvin", 
      "P2 = 1.0                              # exit pressure of hot stream in bars", 
      "T3 = 255.0                            # exit temperature of cold stream in kelvin", 
      "P3 = 1.0                              # exit pressure of cold stream in bars", 
      "cp = 1.0                              # in kj/kg.k", 
      "", 
      "# Calculations", 
      "import math", 
      "R = 8.314/28.97", 
      "se = 0.4*(cp*math.log((T2)/(T1))-R*math.log(P2/P1)) + 0.6*(cp*math.log((T3)/(T1))-R*math.log(P3/P1))", 
      "                                      # specific entropy in kj/kg.k", 
      "", 
      "", 
      "# Results", 
      "print '-> Specific entropy in kj/kg.k =  ',round(se,3),' KJ/kg.'", 
      "print '-> Since se > 0, the claim of the writer is true'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> Specific entropy in kj/kg.k =   0.454  KJ/kg.", 
        "-> Since se > 0, the claim of the writer is true"
       ]
      }
     ], 
     "prompt_number": 7
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>Example 6.8 Page no- 237"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 3.5                                          # pressure of refrigerant entering the compressor in bars", 
      "T1 = 268.0                                        # temperature of refrigerant entering the compressor in kelvin", 
      "P2 = 14.0                                         # pressure of refrigerant entering the condenser in bars", 
      "T2 = 348.0                                        # temperature of refrigerant entering the condenser in kelvin", 
      "P3 = 14.0                                         # pressure of refrigerant exiting the condenser in bars", 
      "T3 = 301.0                                        # temperature of refrigerant exiting the condenser in kelvin", 
      "P4 = 3.5                                          # pressure of refrigerant after passing through expansion valve in bars", 
      "P5 = 1.0                                          # pressure of indoor return air entering the condenser in bars", 
      "T5 = 293.0                                        # temperature of indoor return air entering the condenser in kelvin", 
      "AV5 = 0.42                                        # volumetric flow rate of indoor return air entering the condenser in m^3/s", 
      "P6 =  1.0                                         # pressure of return air exiting the condenser in bar", 
      "T6 = 323.0                                        # temperature of return air exiting the condenser in kelvin", 
      "", 
      "# Part(a)", 
      "", 
      "# From table A-9", 
      "s1 = 0.9572                                       # in kj/kg.k", 
      "# Interpolating in table A-9", 
      "s2 = 0.98225                                      # in kj/kg.k", 
      "h2 = 294.17                                       # in kj/kg", 
      "# From table A-7", 
      "s3 = 0.2936                                       # in kj/kg.k", 
      "h3 = 79.05                                        # in kj/kg", 
      "", 
      "h4 = h3                                           # since expansion through valve is throttling process", 
      "", 
      "# From table A-8", 
      "hf4 = 33.09                                       # in kj/kg", 
      "hg4 = 246.00                                      # in kj/kg", 
      "sf4 = 0.1328                                      # in kj/kg.k", 
      "sg4 = 0.9431                                      # in kj/kg.k", 
      "cp = 1.005                                        # in kj/kg.k", 
      "", 
      "# Calculations", 
      "import math", 
      "x4 = (h4-hf4)/(hg4-hf4)                           # quality at state 4", 
      "s4 = sf4 + x4*(sg4-sf4)                           # specific entropy at state 4", 
      "", 
      "# CONDENSER!!", 
      "v5 = ((8314/28.97)*T5)/(P5*(10**5))               # specific volume at state 5", 
      "mairdot = AV5/v5                            ", 
      "h6 = cp*T6", 
      "h5 = cp*T5", 
      "mrefdot = mairdot*(h6-h5)/(h2-h3)", 
      "deltaS65 = cp*math.log(T6/T5)-(8.314/28.97)*math.log(P6/P5) # change in specific entropy", 
      "sigmacond = (mrefdot*(s3-s2)) + (mairdot*(deltaS65))", 
      "", 
      "# COMPRESSOR!!", 
      "sigmacomp = mrefdot*(s2-s1)", 
      "", 
      "# VALVE!!", 
      "sigmavalve = mrefdot *(s4-s3)", 
      "", 
      "# Results", 
      "print '-> The rates of entropy production for control volume enclosing the condenser  is ',sigmacond,'kW/K.'", 
      "print '-> The rates of entropy production for control volume enclosing the compressor  is ',sigmacomp,'kW/K.'", 
      "print '-> The rates of entropy production for control volume enclosing the expansion valve  is  ',sigmavalve,'kW/K.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The rates of entropy production for control volume enclosing the condenser  is  0.000724165354577 kW/K.", 
        "-> The rates of entropy production for control volume enclosing the compressor  is  0.00175361560919 kW/K.", 
        "-> The rates of entropy production for control volume enclosing the expansion valve  is   0.000988192525533 kW/K."
       ]
      }
     ], 
     "prompt_number": 8
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>  Example 6.9 Page no-243"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 1.00                                    # initial pressure in bar", 
      "T1 = 300.00                                  # initial temperature in kelvin", 
      "T2 = 650.00                                  # final temperature in kelvin", 
      "", 
      "# Part(a)", 
      "# From table A-22", 
      "pr2 = 21.86                               ", 
      "pr1 = 1.3860", 
      "k = 1.39                                     # From table A-20", 
      "", 
      "# Calculations", 
      "p2 = P1*(pr2/pr1)", 
      "p2a = P1*((T2/T1)**(k/(k-1)))", 
      "", 
      "# Results", 
      "print '-> P2  =  ',p2,'bar.'", 
      "print '-> Part(b) IT software problem'", 
      "print '-> P2a  = ',p2a,'bar.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> P2  =   15.772005772 bar.", 
        "-> Part(b) IT software problem", 
        "-> P2a  =  15.7324909817 bar."
       ]
      }
     ], 
     "prompt_number": 9
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2> Example 6.10 Page no- 244"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "m1 = 5.00                                           # initial mass in kg", 
      "P1 = 5.00                                           # initial pressure in bar", 
      "T1 = 500.00                                         # initial temperature in kelvin", 
      "P2 = 1.00                                           # final pressure in bar", 
      "", 
      "# From table A-22", 
      "pr1 = 8.411", 
      "", 
      "", 
      "", 
      "# Using this value of pr2 and interpolation in table A-22", 
      "T2 = 317.00                                         # in kelvin", 
      "", 
      "# Calculations ", 
      "pr2 = (P2/P1)*pr1", 
      "m2 = (P2/P1)*(T1/T2)*m1", 
      "", 
      "# Results", 
      "print '-> The amount of mass remaining in the tank  is ',m2,'kg.'", 
      "print 'and its temperature is ',T2,'kelvin.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The amount of mass remaining in the tank  is  1.57728706625 kg.", 
        "and its temperature is  317.0 kelvin."
       ]
      }
     ], 
     "prompt_number": 10
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>  Example 6.11 Page no- 249"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 1.00                                              # inlet pressure in bar", 
      "T1 = 593.00                                            # inlet temperature in kelvin", 
      "P2 = 1.00                                              # exit pressure in bar", 
      "eta =0.75                                              # turbine efficiency", 
      "", 
      "# From table A-4", 
      "h1 = 3105.6                                            # in Kj/kg", 
      "s1 = 7.5308                                            # in kj/kg.k", 
      "# From table A-4 at 1 bar", 
      "h2s = 2743.00                                          # in kj/kg", 
      "", 
      "# Calculations", 
      "w = eta*(h1 - h2s)", 
      "", 
      "# Result", 
      "print '-> The work developed per unit mass of steam flowing through is ',w,'kJ/kg.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The work developed per unit mass of steam flowing through is  271.95 kJ/kg."
       ]
      }
     ], 
     "prompt_number": 11
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2> Example 6.12 Page no-250"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 3.00                                  # pressure of air entering in bar", 
      "T1 = 390.00                                # temperature of air entering in kelvin", 
      "P2 = 1.00                                  # pressure of exit air", 
      "Wcvdot = 74.00                             # work developed in kj/kg", 
      "", 
      "# From table A-22,at 390k", 
      "h1 = 390.88                                # in kj/kg", 
      "pr1 = 3.481", 
      "", 
      "# From interpolation table A-22", 
      "h2s = 285.27                               # in kj/kg", 
      "", 
      "# calculations", 
      "pr2 = (P2/P1)*pr1", 
      "Wcvdots = h1 - h2s", 
      "eta = Wcvdot/Wcvdots", 
      "", 
      "# Result", 
      "print '-> The turbine efficiency is ',round(eta,4),'.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The turbine efficiency is  0.7007 ."
       ]
      }
     ], 
     "prompt_number": 12
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2> Example 6.13 Page no-251"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 1.00                                       # pressure of entering steam in Mpa", 
      "T1 = 593.00                                     # temperature of entering steam in kelvin", 
      "V1 = 30.00                                      # velocity of entering steam in m/s", 
      "P2 = 0.3                                        # pressure of exit steam in Mpa", 
      "T2 = 453.00                                     # temperature of exit steam in kelvin", 
      "", 
      "# From table A-4, at T1 = 593 kelvin and P1 = 1 Mpa;", 
      "# and at T2 = 453 kelvin and P2 = .3 Mpa", 
      "h1 = 3093.9                                     # in kj/kg", 
      "s1 = 7.1962                                     # in kj/kg.k", 
      "h2 = 2823.9                                     # in kj/kg", 
      "", 
      "", 
      "# Interpolating in table A-4", 
      "h2s = 2813.3                                    # in kj/kg", 
      "", 
      "# Calculations", 
      "V2squareby2 = h1 - h2 + (V1**2)/2000", 
      "V2squareby2s = h1 - h2s + (V1**2)/2000", 
      "eta = V2squareby2/V2squareby2s", 
      "", 
      "# Results", 
      "print '-> The nozzle efficiency is ',round(eta,4),'.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The nozzle efficiency is  0.9623 ."
       ]
      }
     ], 
     "prompt_number": 13
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>Example 6.14 Page no- 252"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "# From table A-9", 
      "h1 = 249.75                                             # in kj/kg", 
      "h2 = 294.17                                             # in kj/kg", 
      "mdot = 0.07                                             # in kg/s", 
      "", 
      "# From table A-9", 
      "s1 = 0.9572                                             # in Kj/Kg.k", 
      "h2s = 285.58                                            # in kj/kg", 
      "", 
      "# Calculations", 
      "wcvdot = -(mdot*(h2-h1))", 
      "eta = (h2s-h1)/(h2-h1)        ", 
      "", 
      "# Results", 
      "print '-> The power in  is',wcvdot,'KW.'", 
      "print '-> The isentropic efficiency is ',round(eta,3),'.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The power in  is -3.1094 KW.", 
        "-> The isentropic efficiency is  0.807 ."
       ]
      }
     ], 
     "prompt_number": 14
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "##<heading2>Example 6.15 Page no-256"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "# Given:-", 
      "P1 = 1.00                               # pressure of entering air in bar", 
      "T1 = 293.00                             # temperature of entering air in kelvin", 
      "P2 = 5.00                               # pressure of exit air in bar", 
      "n = 1.3", 
      "R = 8.314/28.97", 
      "", 
      "# From table A-22", 
      "h1 = 293.17                             # in kj/kg", 
      "h2 = 426.35                             #  in kj/kg", 
      "", 
      "# Calculations", 
      "T2 = T1*((P2/P1)**((n-1)/n))             # in kelvin", 
      "wcvdot=((n*R)/(n-1))*(T1-T2)            # in kj/kg", 
      "Qcvdot= wcvdot + (h2-h1)                # in kj/kg", 
      "", 
      "# Results", 
      "print '-> The work per unit mass passing through the device is',round(wcvdot,2),'kJ/kg.'", 
      "print '-> The heat transfer per unit mass is  ',round(Qcvdot,2),'kJ/kg.'"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "-> The work per unit mass passing through the device is -163.89 kJ/kg.", 
        "-> The heat transfer per unit mass is   -30.71 kJ/kg."
       ]
      }
     ], 
     "prompt_number": 15
    }
   ]
  }
 ]
}