summaryrefslogtreecommitdiff
path: root/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter01.ipynb
blob: 88d398a59da1bcd3235b7fb00ed5db7be549486a (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
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
{
 "metadata": {
  "name": "",
  "signature": "sha256:49c580cddfa6fee61cb89005e8162fda0d32dc5e946341e173242a32280cb578"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1: Introduction to Engineering Principles and Units"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3-1, Page number 6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Finding mole mass or weight fraction of solution \n",
      "\n",
      "#Variable declaration\n",
      "mNaOH = 50.         #Mass of NaOH in solution in gram\n",
      "mH2O = 50.          #Mass of H2O in solution in gram\n",
      "MWNaOH = 40         #Molecular weight of NaOH\n",
      "MWH2O = 18.02       #Molecular weight of H2O\n",
      "masstolbm = 1/453.6 #Conversion factor for Mass to Lb mass\n",
      "\n",
      "#Calculation\n",
      "mT = mNaOH + mH2O       #Total mass of solution\n",
      "mfNaOH = mNaOH/mT       #mfNaOH mass fraction of NaOH  \n",
      "mfH2O = mH2O/mT         #mfNaOH mass fraction of H2O\n",
      "nNaOH = mNaOH/MWNaOH    #Number of moles of NaOH\n",
      "nH2O = mH2O/MWH2O       #Number of  moles of H2O\n",
      "nT = nNaOH + nH2O       #Total number of moles in solution\n",
      "xNaOH = nNaOH/nT        #xNaOH mole fraction of NaOH\n",
      "xH2O = nH2O/nT          #xH2O mole fraction of H2O\n",
      "lbmNaOH = mNaOH*masstolbm  \n",
      "lbmH2O = mH2O*masstolbm\n",
      "\n",
      "#Result\n",
      "print \"Mass fraction of NaOH\", mfNaOH\n",
      "print \"Mass fraction of H2O\", mfH2O \n",
      "print \"Mole fraction of NaOH\", round(xNaOH,3) \n",
      "print \"Mole fraction of H2O\", round(xH2O,3)\n",
      "print \"Mass of NaOH in Lb mass\",round(lbmNaOH,4), \"lbm\"\n",
      "print \"Mass of H2O in Lb mass\", round(lbmH2O,4), \"lbm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass fraction of NaOH 0.5\n",
        "Mass fraction of H2O 0.5\n",
        "Mole fraction of NaOH 0.311\n",
        "Mole fraction of H2O 0.689\n",
        "Mass of NaOH in Lb mass 0.1102 lbm\n",
        "Mass of H2O in Lb mass 0.1102 lbm\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4-1, Page number 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the value of gas law constant\n",
      "\n",
      "#Variable declaration \n",
      "P = 14.7        #Pressure (psia)\n",
      "V = 359.        #Volume of gas(ft3)\n",
      "Tf = 32         #Temperature in (degF)\n",
      "n = 1.          #Number of moles of Ideal Gas (lbmol)\n",
      "\n",
      "#Calculation\n",
      "Tr = 460 + Tf    #Deg F to deg Rankine conversion\n",
      "R = P*V/(n*Tr)   #R Gas constant in ft3.psia/(lbmol.degR)\n",
      "\n",
      "#Result\n",
      "print 'Gas law constant in lbmole, ft3, \u00b0R, and psia units %5.2f ft3.psia/(lbmol.degR)'%(R)\n",
      "\n",
      "#Variable declarationSI units\n",
      "P = 101325        #Pressure (Pa)\n",
      "V = 22.414        #Volume of gas(m3)\n",
      "T = 0             #Temperature in (deg C)\n",
      "n = 1.            #Number of moles of Ideal Gas (kgmol)\n",
      "\n",
      "#Calculation\n",
      "TK = 273.15 + T     #Deg C to Kelvin conversion\n",
      "R = P*V/(n*TK)      #R Gas constant in m3.pa/(kgmol.K)\n",
      "\n",
      "#Result\n",
      "print 'Gas law constant in kgmole, m3, K, and pa units %5.2f m3.pa/(kgmol.K)'%(R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gas law constant in lbmole, ft3, \u00b0R, and psia units 10.73 ft3.psia/(lbmol.degR)\n",
        "Gas law constant in kgmole, m3, K, and pa units 8314.47 m3.pa/(kgmol.K)\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4-2, Page number 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Composition of Gas\n",
      "\n",
      "#Variable declaration\n",
      "pCO2 = 75.         #Partial pressure of CO2 (mmHg)\n",
      "pCO = 50.          #Partial pressure of CO (mmHg)\n",
      "pN2 = 595.         #Partial pressure of N2 (mmHg) \n",
      "pO2 = 26.          #Partial pressure of O2 (mmHg)\n",
      "\n",
      "#Calculation\n",
      "#Total pressure by Dalton's law\n",
      "P = pCO2 + pCO + pN2 + pO2\n",
      "xCO2 = pCO2/P\n",
      "xCO = pCO/P\n",
      "xN2 = pN2/P\n",
      "xO2 = pO2/P\n",
      "\n",
      "\n",
      "#Result\n",
      "print \"Total Pressure P\",P, \"mmHg\"\n",
      "print \"mole fraction of CO2\", round(xCO2,3)\n",
      "print \"mole fraction of CO\", round(xCO,3)\n",
      "print \"mole fraction of N2\", round(xN2,3)\n",
      "print \"mole fraction of O2\", round(xO2,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Pressure P 746.0 mmHg\n",
        "mole fraction of CO2 0.101\n",
        "mole fraction of CO 0.067\n",
        "mole fraction of N2 0.798\n",
        "mole fraction of O2 0.035\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5-1, Page number 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Concentration of Orange Juice using evaporator\n",
      "\n",
      "#Variable declaration\n",
      "F = 1000.         #Feed rate of orange juice to evaporator (kg/hr)\n",
      "MpSi = 7.08       #Mass percent of solids in incomming juice\n",
      "MpSo = 58.        #Mass percent of solids in concentrated juice\n",
      "xW = 0.0\n",
      "#Calculation\n",
      "    #Overall Mass Balance\"\n",
      "    #$F = W + C$\"\n",
      "    #Component Mass Balance on solids\"\n",
      "    #$F.xF = W.xW + C.xC$\n",
      "\n",
      "C = F*MpSi/(100)/(MpSo/100)\n",
      "#Using overall Balance equation\n",
      "W = 1000-C\n",
      "\n",
      "#Results\n",
      "print \"Flow rate of Concentrated juice stream\", round(C,1) ,\"kg/hr\"\n",
      "print \"Flow rate of evaporated water stream\", round(W,1) ,\"kg/hr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate of Concentrated juice stream 122.1 kg/hr\n",
        "Flow rate of evaporated water stream 877.9 kg/hr\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5-2, Page number 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Crystallization of KNO3 and Recycle\n",
      "\n",
      "#Variable declaration\n",
      "\n",
      "F = 1000. #F: Feed to the process, kg/hr\n",
      "xW = 0.   #xW: Weight % of KNO3 in water vaopor stream\n",
      "xF = 20.  #xF: Weight % of KNO3 in Feed\n",
      "xP = 96.  #xP: Weight % of KNO3 in product stream\n",
      "xR = 37.5 #xR: Weight % of KNO3 in Recycle\n",
      "xS = 50.  #xS: Weight % of KNO3 in stream from evaporator to crystallizer\n",
      "#Calculation\n",
      "    #Overall material Balance\n",
      "    # F = W + P\n",
      "    # Component material balance on KNO3\n",
      "    # F.xF = W.xW + P.xP\n",
      "    # Solving for P\n",
      "P = (F*xF/100)/(xP/100)    #P: Product rate from process, kg/hr\n",
      "    #Balance over crystallizer\n",
      "    # S = R + P  --> P = S - R\n",
      "    #Component balance over crystallizer\n",
      "    # S.xS = R.xR + P.xP  --> (R + P).xS = R.xR + P.xP --> ((R + P).xS - P.xP )/xR = \n",
      "R = P*(xP-xS)/(xS-xR)        #R: REcycle rate, kg/hr\n",
      "S = R + P                    #S: Concentrate rate from evaporator to crystallizer, kg/hr\n",
      "\n",
      "#Result\n",
      "print \"Product rate from the process is\",round(P,1), \"kg/hr\"\n",
      "print \"Recycle rate from the process is\",round(R,1), \"kg/hr\"\n",
      "print \"Stream leaving evaporator \",round(S,1), \"kg/hr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Product rate from the process is 208.3 kg/hr\n",
        "Recycle rate from the process is 766.7 kg/hr\n",
        "Stream leaving evaporator  975.0 kg/hr\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5-3, Page number 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Combustion of fuel gas\n",
      "\n",
      "#Variable declaration\n",
      "    #Basis 100 kg mol of feed,  moles = mole%x100/100\n",
      "H2=3.1        #Moles of H2 in feed\n",
      "CO=27.2       #moles of CO in feed\n",
      "CO2=5.6       #Moles of CO2 in feed\n",
      "O2=0.5        #Moles of O2 in feed\n",
      "N2=63.6       #Moles of N2 in feed\n",
      "    #98% CO reacts to form CO2\n",
      "\n",
      "#Calculation\n",
      "    #CO + (0.5)O2 ----> CO2\n",
      "    #H2 +(0.5)O2  ----> H2O\n",
      "    #Accounting the total number of moles of O2 in the fuel gas theoretically\n",
      "\n",
      "MthO2=(0.5)*CO + 0.5*H2 - O2 #theoretically required O2 moles\n",
      "\n",
      "    #For 20% excess moles required \n",
      "MactO2=(1.2)*MthO2  #Actual moles of O2 required \n",
      "\n",
      "    #Since air contains 79 mol% of N2\n",
      "MN2=(79./21)*MactO2 #moles of N2 in air\n",
      "    #2% CO does not react\n",
      "MTN2 = MN2 + N2\n",
      "MO2in = O2 + MactO2\n",
      "#Mflueg = moles of water + unreacted CO + CO2 (from reacted CO and CO2 in feed ) + N2 + O2 \n",
      "MH2Oflueg = H2\n",
      "MN2flueg = MTN2\n",
      "MCOflueg = 0.02*CO\n",
      "MCO2flueg = CO2 + 0.98*CO\n",
      "MO2flueg = MO2in - (0.5*H2 + 0.98*CO/2 )\n",
      "\n",
      "Mflueg = MH2Oflueg + 0.02*CO + CO2 + 0.98*CO + MTN2 + (MO2in - (0.5*H2 + 0.98*CO/2 ))\n",
      "\n",
      "\n",
      "#Result\n",
      "print \"Moles of CO in exit flue\",round(MCOflueg,2),\"mol\"\n",
      "print \"Moles of CO2 in exit flue\",round(MCO2flueg,2),\"mol\"\n",
      "print \"Moles of O2 in exit flue\",round(MO2flueg,2),\"mol\"\n",
      "print \"Moles of N2 in exit flue\",round(MTN2,1),\"mol\"\n",
      "print \"Moles of H2O in exit flue\",round(MH2Oflueg,2),\"mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Moles of CO in exit flue 0.54 mol\n",
        "Moles of CO2 in exit flue 32.26 mol\n",
        "Moles of O2 in exit flue 3.2 mol\n",
        "Moles of N2 in exit flue 129.7 mol\n",
        "Moles of H2O in exit flue 3.1 mol\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6-1, Page number 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heating of N2 Gas\n",
      "\n",
      "#Variable declaration\n",
      "\n",
      "M=3.          #Moles of N2\n",
      "T1=298.       #Temperature of N2 gas (K)\n",
      "T2=673.       #Temperature of N2 gas (K)\n",
      "T3=1123.      #Temperature of N2 gas (K)\n",
      "\n",
      "# Data\n",
      "Cpm1=29.68    #Mean heat capacity of N2 gas ranging 298K-673K (J/gmol.k)\n",
      "Cpm2=31.00    #Mean heat capacity of N2 gas ranging 298K-1123K (J/gmol.k)\n",
      "\n",
      "#Calculation\n",
      "#Heat required (Hi)=M*Cpmi*(del T)\n",
      "H1 = M*Cpm1*(T2-T1)   #Heat required in (J)\n",
      "H2 = M*Cpm2*(T3-T1)   #Heat required in (J)\n",
      "H3 = H2-H1            #Heat required in (J) Since there is no mean heat capacity for the interval 673K-1123K\n",
      "\n",
      "#Result\n",
      "print \"(a) Heat required to raise the temperature from 298K-673K\",H1,\"J\"\n",
      "print \"(b) Heat required to raise the temperature from 298K-1123K\",H2,\"J\"\n",
      "print \"(c) Heat required to raise the temperature from 673K-1123K\",H3,\"J\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Heat required to raise the temperature from 298K-673K 33390.0 J\n",
        "(b) Heat required to raise the temperature from 298K-1123K 76725.0 J\n",
        "(c) Heat required to raise the temperature from 673K-1123K 43335.0 J\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6-2, Page number 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heating  of Milk\n",
      "\n",
      "#Variable declaration\n",
      "\n",
      "mdot = 4536.        #Mass rate of kg/hr\n",
      "Ti = 4.4            #Temeprature of incomming milk, deg C\n",
      "To = 54.4           #Temperature of milk leaving exhanger, deg C\n",
      "C = 3.85            #Heat capacity of cow milk, kJ/(kg.K)\n",
      "#Data\n",
      "\n",
      "#Calculation\n",
      "Mdot = mdot/3600    #Mass rate of kg/s\n",
      "delT = To - Ti      #delT: Temperature difference between milk temperature at outlet and inlet \n",
      "Q = Mdot*C*delT     #Q: Heat required, kW\n",
      "#Result\n",
      "print \"Rate of Heat Addition: \",Q, \"kJ/s or kW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of Heat Addition:  242.55 kJ/s or kW\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6-3, Page number 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Use of Steam Table\n",
      "\n",
      "#Variable declaration\n",
      "\n",
      "m = 1 # mass of water in kg or lbm\n",
      "\n",
      "#Part A SI Units\n",
      "# Data\n",
      "H21_11 = 88.60 # Enathalpy at 21.11 degC, kJ/kg\n",
      "H60 = 251.13   # Enathalpy at 60 degC, kJ/kg \n",
      "#Calculation\n",
      "\n",
      "delH = H60 - H21_11\n",
      "\n",
      "#Result\n",
      "print \"Enthalpy change for heating 1kg of steam\", delH, \"kJ/kg\"\n",
      "\n",
      "#Part A British Units\n",
      "# Data\n",
      "H70 = 38.09 # Enathalpy at 70 degF, btu/lbm\n",
      "H140 = 107.96   # Enathalpy at 140 degF, btu/lbm\n",
      "\n",
      "#Calculation\n",
      "\n",
      "delH = H140 - H70\n",
      "\n",
      "#Result\n",
      "print \"Enthalpy change for heating 1 lbm of steam\", delH, \"Btu/lbm\"\n",
      "\n",
      "#Part B SI Units\n",
      "# Data\n",
      "H21_11 = 88.60    # Enathalpy at 21.11 degC, kJ/kg\n",
      "H115_6 = 2699.9   # Enathalpy at 115.6 degC, kJ/kg at 172.2 kPa\n",
      "\n",
      "#Calculation\n",
      "delH = H115_6 - H21_11\n",
      "\n",
      "#Result\n",
      "print \"Enthalpy change for heating 1kg of steam\", delH, \"kJ/kg\"\n",
      "\n",
      "#Part B British Units\n",
      "# Data\n",
      "H70 = 38.09  # Enathalpy at 70 degF, btu/lbm\n",
      "H240 = 1160.7   # Enathalpy at 140 degF, btu/lbm at 24.97 psia\n",
      "\n",
      "#Calculation\n",
      "delH = H240 - H70\n",
      "\n",
      "#Result\n",
      "print \"Enthalpy change for heating 1 lbm of steam\", delH, \"Btu/lbm\"\n",
      "\n",
      "#Part C SI Units\n",
      "# Data\n",
      "Hv_115_6 = 2699.9 # Enathalpy at 115.6 degC, kJ/kg at 172.2 kPa\n",
      "Hl_115_6 = 484.9  # Enathalpy at 115.6 degC, kJ/kg at 172.2 kPa\n",
      "\n",
      "#Calculation\n",
      "LambdaV = Hv_115_6 - Hl_115_6\n",
      "\n",
      "#Result\n",
      "print \"Enthalpy of vaporization 1 kg of steam\", LambdaV, \"kJ/kg\"\n",
      "\n",
      "#Part C British Units\n",
      "# Data\n",
      "Hv_115_6 = 1160.7                #Enathalpy water vapor at 240 degF, Btu/lbm at 24.97 psia\n",
      "Hl_115_6 = 208.44                #Enathalpy saturated water at 240 degF, Btu/lbm at 24.97 psia\n",
      "\n",
      "#Calculation\n",
      "LambdaV = Hv_115_6 - Hl_115_6\n",
      "#Result\n",
      "print \"Enthalpy of vaporization 1 kg of steam\", LambdaV, \"Btu/lbm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy change for heating 1kg of steam 162.53 kJ/kg\n",
        "Enthalpy change for heating 1 lbm of steam 69.87 Btu/lbm\n",
        "Enthalpy change for heating 1kg of steam 2611.3 kJ/kg\n",
        "Enthalpy change for heating 1 lbm of steam 1122.61 Btu/lbm\n",
        "Enthalpy of vaporization 1 kg of steam 2215.0 kJ/kg\n",
        "Enthalpy of vaporization 1 kg of steam 952.26 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6-4, Page number 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Combustion of Carbon\n",
      "\n",
      "#Variable declaration\n",
      "n = 10. # gmol of Carbon \n",
      "nCO2 = 90. #Percent of Carbon converted to CO2\n",
      "nCO = 10.  #Percent of Carbon converted to CO\n",
      "DelHcCO2 = -393513 # Standard enthalpy change of combustion for CO2 in kJ/kmol\n",
      "DelHcCO = -110523 # Standard enthalpy change of combustion for CO2 in kJ/kmol\n",
      " \n",
      "#Calculation\n",
      "n1 = n/1000\n",
      "delHc = n1*nCO2*DelHcCO2/100 + n1*nCO*DelHcCO/100\n",
      "\n",
      "#Result\n",
      "print \" Entahlpy change on incomplete combustion of Carbon:\", round(delHc), \"kJ\"\n",
      "\n",
      "#Data kcal Units \n",
      "DelHcCO2 = -94.0518 # Standard enthalpy change of combustion for CO2 in kcal/gmol\n",
      "DelHcCO = -26.4157 # Standard enthalpy change of combustion for CO2 in kcal/gmol\n",
      "\n",
      "#Calculation\n",
      "delHc = n*nCO2*DelHcCO2/100 + n*nCO*DelHcCO/100\n",
      "\n",
      "#Result\n",
      "print \" Entahlpy change on incomplete combustion of Carbon:\", round(delHc), \"kcal\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Entahlpy change on incomplete combustion of Carbon: -3652.0 kJ\n",
        " Entahlpy change on incomplete combustion of Carbon: -873.0 kcal\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6-5, Page number 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Reaction of Methane\n",
      "\n",
      "#Variable declaration\n",
      "molCH4=1.             #MOles of CH4 (kg)\n",
      "press=101.32          #Pressure (kPa)\n",
      "temp=298.             #temperature (K)\n",
      "delHfCH4=-74848.     #Heat of Formation of CH4 (kJ/kg mol)\n",
      "delHfH2O=-285840.    #Heat of Formation of H2O (kJ/kg mol)\n",
      "delHfCO=-110523.     #Heat of Formation of CO (kJ/kg mol)\n",
      "delHfH2=0            #Heat of Formation of H2 (kJ/kg mol)\n",
      "\n",
      "#Calculation\n",
      "            #delH= delHf(products)-delHf(reactants) \n",
      "\n",
      "delH= (delHfCO + 3*delHfH2) - (delHfCH4 + delHfH2O)\n",
      "\n",
      "#Result\n",
      "print 'The standard heat of Formation %5.2e'%(delH),\"kJ/kg mol (Endothermic)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The standard heat of Formation 2.50e+05 kJ/kg mol (Endothermic)\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7-1, Page number 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heating of Fermentation Medium\n",
      "\n",
      "#Variable declaration SI Units \n",
      "\n",
      "F=2000.    #Feed rate of Liquid (kg/h)\n",
      "TLi=30.    #Initial temperature of the liquid (\u00b0C)\n",
      "TLo=70.    #Final temperature of the liquid (\u00b0C)\n",
      "TWi=95.    #Temperature of water while entering (\u00b0C)\n",
      "TWo=85.    #Temperature of water while leaving (\u00b0C)\n",
      "Tref=25.   #Reference temperature (\u00b0C)\n",
      "CL=4.06    #Enthalpy of liquid at 25 degC (kJ/kg)\n",
      "Cw=4.21    #Enthalpy of water at 25 degC (kJ/kg)\n",
      "\n",
      "#Calculations \n",
      "\n",
      "delTLi=TLi-Tref\n",
      "delTLo=TLo-Tref\n",
      "delTW=TWi-Tref\n",
      "    #Input streams\n",
      "HLi=F*CL*delTLi\n",
      "    #Output streams\n",
      "HLo=F*CL*delTLo \n",
      "    #Heat gained by the system = Heat gained at outlet - heat at inlet\n",
      "QL = HLo-HLi\n",
      "    #Heat gained by liquid = Heat lost by water \n",
      "W = QL/(Cw*(TWi-TWo))\n",
      "\n",
      "#Result\n",
      "print 'Rate Enthalpy of the liquid entering %5.2e kJ/kg'%HLi\n",
      "print 'Rate Enthalpy of the liquid leaving %5.2e kJ/kg'%HLo\n",
      "print 'Heat added to fermentation medium %5.4e'%(QL),\"kJ/h\"\n",
      "print \"Feed rate of water supplied\",round(W,2),\"kg/h\"\n",
      "print 'The answer has been checked using calculator and \\ndiffers from answer given in book because of truncation'\n",
      "print \"Heat added to fermentation medium:\",round(QL/3600,2),\"kW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate Enthalpy of the liquid entering 4.06e+04 kJ/kg\n",
        "Rate Enthalpy of the liquid leaving 3.65e+05 kJ/kg\n",
        "Heat added to fermentation medium 3.2480e+05 kJ/h\n",
        "Feed rate of water supplied 7714.96 kg/h\n",
        "The answer has been checked using calculator and \n",
        "differs from answer given in book because of truncation\n",
        "Heat added to fermentation medium: 90.22 kW\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7-2, Page number 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat and Material Balance in Combustion\n",
      "\n",
      "#Variable declaration SI Units \n",
      "mCO = 1.                         #Moles of CO burnt in furnace (kmol/h)\n",
      "delHc=-282989.                   #Standard heat of combustion of CO (kJ/kmol)\n",
      "CpmCO = 29.38                    #Mean Heat capacity of CO between temperature 298k-478k\n",
      "CpmCO2 = 49.91                   #Mean Heat capacity of CO2 between temperature 298k-478k\n",
      "CpmN2 = 31.43                    #Mean Heat capacity of N2 between temperature 298k-478k\n",
      "CpmO2 = 33.25                    #Mean Heat capacity of O2 between temperature 298k-478k\n",
      "Cpmair = 29.29                   #Mean Heat capacity of Air between temperature 298k-478k\n",
      "Tref = 298.                      #Reference temperature for enthalpy calculation\n",
      "TCOi = 473.                      #Temperature of CO inlet stream \n",
      "Tair = 373.                      #Temperature of inlet air stream\n",
      "Texit = 1273.                    #Temperature of outgoing stream\n",
      "\n",
      "#Calculation\n",
      "               #CO(g) + (0.5)O2(g) ---> CO2(g)\n",
      "               #Since from the above equation we get that 1 mole of CO will require 0.5 mole O2\n",
      "MthO2 = (0.5)*1.                 #Theoretically required O2 moles (kmol/h)\n",
      "MactO2 = (1.9)*(MthO2)           #Moles of O2 actually added\n",
      "MN2 =  (0.79/0.21)*MactO2        #Moles of N2 added\n",
      "xO2 = MactO2 - MthO2             #Moles of O2 in exit flue\n",
      "xCO2 = mCO                       #Moles of CO2 formed is equal to moles of CO added\n",
      "xN2 = MN2                        #Moles of N2 in the exit flue\n",
      "MAir = xN2 + MactO2\n",
      "\n",
      "              #Input streams \n",
      "HinAir = MAir*Cpmair*(Tair-Tref)\n",
      "HinCO = mCO*CpmCO*(TCOi-Tref)\n",
      "HCO2 = xCO2*CpmCO2*(Texit-Tref)\n",
      "HN2 = xN2*CpmN2*(Texit-Tref)\n",
      "HO2 = xO2*CpmO2*(Texit-Tref)\n",
      "Qr = mCO*delHc    #Heat removed = total enthalpy of leaving streams - total enthalpy of incoming streams + heat added due to reaction\n",
      "q =  HCO2 + HO2 + HN2 - (HinAir + HinCO-Qr)\n",
      "\n",
      "#Result\n",
      "print 'moles of O2 actually added %4.3f kgmol/h'%MactO2\n",
      "print 'moles of N2 added %4.3f kgmol/h, Notice this value differs from \\nthan in book hence following values also change but are correct'%xN2\n",
      "print 'moles of air  added %4.3f kgmol/h'%(MactO2+MN2)\n",
      "print 'moles of O2 in exit flue gas %4.3f kgmol/h'%xO2\n",
      "print 'Enthalpy of air entering %4.3f kJ/h'%HinAir\n",
      "print 'Enthalpy of CO entering %4.3f kJ/h'%HinCO\n",
      "print 'Enthalpy of CO2 leaving %4.3f kJ/h'%HCO2\n",
      "print 'Enthalpy of N2 leaving %4.3f kJ/h'%HN2\n",
      "print 'Enthalpy of O2 leaving %4.3f kJ/h'%HO2\n",
      "print \"Heat Removed: \", round(q), \"kJ/hr\"\n",
      "print \"Heat Removed: \", round(q*1000./3600.),\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "moles of O2 actually added 0.950 kgmol/h\n",
        "moles of N2 added 3.574 kgmol/h, Notice this value differs from \n",
        "than in book hence following values also change but are correct\n",
        "moles of air  added 4.524 kgmol/h\n",
        "moles of O2 in exit flue gas 0.450 kgmol/h\n",
        "Enthalpy of air entering 9937.679 kJ/h\n",
        "Enthalpy of CO entering 5141.500 kJ/h\n",
        "Enthalpy of CO2 leaving 48662.250 kJ/h\n",
        "Enthalpy of N2 leaving 109516.713 kJ/h\n",
        "Enthalpy of O2 leaving 14588.437 kJ/h\n",
        "Heat Removed:  -125301.0 kJ/hr\n",
        "Heat Removed:  -34806.0 W\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7-3, Page number 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Oxidation of LactoseC12H22O11\n",
      "\n",
      "#Variable declaration\n",
      "        #HLact37, Total Enthalpy of Lactose stream in at 37 deg C  \n",
      "        #HO237, Total Enthalpy of Oxygen stream in at 37 deg C  \n",
      "        #HH2O37, Total Enthalpy of Water out at 37 deg C  \n",
      "        #HCO237, Total Enthalpy of CO2 stream out at 37 deg C \n",
      "        #delHcLact37, Heat of combustion for Lactose, J/mol\n",
      "\n",
      "\n",
      "nLact = 1.     #Mass of Lactose in gmol\n",
      "nO2 = 12.      #Moles oo O2 fed\n",
      "nCO2 = 12.     #Moles oo CO2 \n",
      "nH2O = 11.     #Moles oo H2O  \n",
      "MWLact = 342.3 #Molecular weight of lactose\n",
      "MWH2O = 18.02  #Molecular weight of water\n",
      "CpmLact = 1.2  #Mean specific heat of Lactose, J/g.K\n",
      "CpmO2 = 29.38  #Mean specific heat of O2, J/mol.K\n",
      "CpmH2O = 4.18  #Mean specific heat of H2O, J/mol.K\n",
      "CpmCO2 = 37.45 #Mean specific heat of CO2, J/mol.K\n",
      "delHcLact = 5648.8e3 #Std. Heat of combustion for Lactose, J/mol\n",
      "Tref = 25.     #Reference temperature, deg C\n",
      "Ts = 37.       #Stream temperature, deg C\n",
      "\n",
      "\n",
      "#Calculation\n",
      "                #H = n*Cpmi*(T-Tref)\n",
      "                #Del T in degC = Del T in K\n",
      "mLact = nLact*MWLact\n",
      "HLact37 = mLact*CpmLact*(Ts-Tref)\n",
      "HO237 = nO2*CpmO2*(Ts-Tref)\n",
      "HCO237 = nCO2*CpmCO2*(Ts-Tref)\n",
      "HH2O37 = nH2O*MWH2O*CpmH2O*(Ts-Tref)\n",
      "delHcLact37 = HCO237 + HH2O37 - (HLact37 + HO237 + delHcLact)\n",
      "\n",
      "#Result\n",
      "\n",
      "print \"Enthalpy of Lactose stream in at 37 deg C:\",round(HLact37),\"J/gmol\"\n",
      "print \"Enthalpy of Oxygen stream in at 37 deg C :\",round(HO237),  \"J/gmol\"  \n",
      "print \"Enthalpy of Water out at 37 deg C        :\",round(HH2O37), \"J/gmol\"  \n",
      "print \"Enthalpy of CO2 stream out at 37 deg C   :\",round(HCO237), \"J/gmol\"\n",
      "print \"Heat of combustion for Lactose           :\",round(HLact37),\"J/gmol\"\n",
      "print 'Heat of combustion of Lactose at 37 deg C:%6.3e'%(delHcLact37),\"J/gmol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy of Lactose stream in at 37 deg C: 4929.0 J/gmol\n",
        "Enthalpy of Oxygen stream in at 37 deg C : 4231.0 J/gmol\n",
        "Enthalpy of Water out at 37 deg C        : 9943.0 J/gmol\n",
        "Enthalpy of CO2 stream out at 37 deg C   : 5393.0 J/gmol\n",
        "Heat of combustion for Lactose           : 4929.0 J/gmol\n",
        "Heat of combustion of Lactose at 37 deg C:-5.643e+06 J/gmol\n"
       ]
      }
     ],
     "prompt_number": 30
    }
   ],
   "metadata": {}
  }
 ]
}