summaryrefslogtreecommitdiff
path: root/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/chapter6.ipynb
blob: 1d9240ef6fd741e0e6b11268c4417b1240403765 (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
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6:Distillation "
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.1,Page number:324"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T1 = 303  # [K]\n",
      "P = 1  # [bar]\n",
      "D = 0.6 \n",
      "W = 0.4 \n",
      "zf = 0.5 \n",
      " \n",
      "# Parameters for componenr 'A'\n",
      "Tc_a = 540.3  # [K]\n",
      "Pc_a = 27.4  # [bar]\n",
      "A_a = -7.675 \n",
      "B_a = 1.371 \n",
      "C_a =-3.536 \n",
      "D_a = -3.202 \n",
      "\n",
      "# Parameters for component 'B'\n",
      "Tc_b = 568.8  # [K]\n",
      "Pc_b = 24.9  # [bar]\n",
      "A_b = -7.912 \n",
      "B_b = 1.380 \n",
      "C_b = -3.804 \n",
      "D_b = -4.501 \n",
      "\n",
      "import math\n",
      "from numpy import *\n",
      "from scipy.optimize import fsolve\n",
      "# Using equation 6.5\n",
      "# x_a = 1-(T/Tc_a) \n",
      "# P_a = Pc_a*math.exp((A_a*x_a+B_a*x_a**1.5+C_a*x_a**3+D_a*x_a**6)/(1-x_a))  # [bar]\n",
      "\n",
      "# x_b = 1-(T/Tc_b) \n",
      "# P_b = Pc_b*math.exp((A_b*x_b+B_b*x_b**1.5+C_b*x_b**3+D_b*x_b**6)/(1-x_b))  # [bar]\n",
      "\n",
      "# m_a = P_a/P \n",
      "# m_b = P_b/P \n",
      "\n",
      "# Solution of simultaneous equation\n",
      "def F(e):\n",
      "    f1 = e[1] - (e[2]*Pc_a*math.exp(((A_a*(1-(e[0]/Tc_a))+B_a*(1-(e[0]/Tc_a))**1.5+C_a*(1-(e[0]/Tc_a))**3+D_a*(1-(e[0]/Tc_a))**6))/(1-(1-(e[0]/Tc_a)))))/P \n",
      "    f2 = 1-e[1] - ((1-e[2])*Pc_b*math.exp((A_b*(1-(e[0]/Tc_b))+B_b*(1-(e[0]/Tc_b))**1.5+C_b*(1-(e[0]/Tc_b))**3+D_b*(1-(e[0]/Tc_b))**6)/(1-(1-(e[0]/Tc_b)))))/P \n",
      "    f3 = (-W/D) - ((e[1]-zf)/(e[2]-zf)) \n",
      "    return(f1,f2,f3)\n",
      "\n",
      "\n",
      "# Initial guess\n",
      "e = [400,0.6,0.4] \n",
      "y = fsolve(F,e) \n",
      "T = y[0]  # [K] \n",
      "Yd = y[1] \n",
      "Xw = y[2] \n",
      "\n",
      "print\"The composition of the vapor and liquid and the temperature in the separator if it behaves as an ideal stage are\",round(Yd,3),round(Xw,3),\"and\",round(T,1),\"K respectively\\n\\n\"\n",
      "\n",
      "# For the capculation of the amount of heat to be added per mole of feed\n",
      "T0 = 298  # [K]\n",
      "lambdaA = 36.5  # [Latent heats of vaporization at To = 298 K ,kJ/mole]\n",
      "lambdaB = 41.4  # [Latent heats of vaporization at To = 298 K ,kJ/mole]\n",
      "CpA = 0.187  # [kJ/mole.K]\n",
      "CpB = 0.247  # [kJ/mole.K]\n",
      "CLA1 = 0.218  # [ 298-303 K,  kJ/mole.K]\n",
      "CLB1 = 0.253  # [ 298-303 K,  kJ/mole.K]\n",
      "CLA2 = 0.241  # [ 298-386 K,  kJ/mole.K]\n",
      "CLB2 = 0.268  # [ 298-386 K,  kJ/mole.K]\n",
      "# Bubble point calculated when 'D' approaches 0 and Dew point calculated when 'D' approaches 1\n",
      "Tbp = 382.2 # [Bubble point of the mixture, K]\n",
      "Tdp = 387.9 # [Dew point of mixture, K]\n",
      "\n",
      "HF = (T1-T0)*(Xw*CLA1+CLB1*(1-Xw))  # [kJ/mole]\n",
      "HW = (Tbp-T0)*(Xw*CLA2+CLB2*(1-Xw))  # [kJ/mole]\n",
      "HG = (Tdp-T0)*(Yd*CpA+(1-Yd)*CpB) + Yd*lambdaA +(1-Yd)*lambdaB  # [kJ/mole]\n",
      "\n",
      "f =1 # [feed]\n",
      "# Using equation 6.4\n",
      "def f14(Q):\n",
      "    return(W/D + (HG-(HF+Q/f))/(HW -(HF+Q/f)))\n",
      "Q = fsolve(f14,40) \n",
      "print\"The amount of heat to be added per mole of feed is\",round(Q[0],2),\"kJ/mole\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The composition of the vapor and liquid and the temperature in the separator if it behaves as an ideal stage are 0.576 0.385 and 385.4 K respectively\n",
        "\n",
        "\n",
        "The amount of heat to be added per mole of feed is 42.08 kJ/mole\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.2,Page number:326"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# a-benzene   b-toluene   c-orthoxylene\n",
      "T = 373  # [K]\n",
      "P = 101.3  # [kPa]\n",
      "Pa = 182.7  # [kPa]\n",
      "Pb = 73.3  # [kPa]\n",
      "Pc= 26.7  # [kPa]\n",
      "Zfa = 0.5 \n",
      "Zfb = 0.25 \n",
      "Zfc = 0.25 \n",
      "\n",
      "import math\n",
      "from numpy import *\n",
      "from scipy.optimize import fsolve\n",
      "# Therefore\n",
      "ma = Pa/P \n",
      "mb = Pb/P \n",
      "mc = Pc/P \n",
      "# Let Feed is 1 kmole\n",
      "# Therefore D+W = 1\n",
      "\n",
      "# Solution of simultaneous equation\n",
      "def F(e):\n",
      "    f1 = e[0]+e[1]-1 \n",
      "    f2 = e[1]/e[0] + (e[2]-Zfa)/(e[3]-Zfa) \n",
      "    f3 = e[2]-ma*e[3] \n",
      "    f4 = e[4]-mb*e[5] \n",
      "    f5 = 1-e[2]-e[4] -mc*(1-e[3]-e[5]) \n",
      "    f6 = e[1]/e[0] + (e[4]-Zfb)/(e[5]-Zfb) \n",
      "\n",
      "    return(f1,f2,f3,f4,f5,f6)\n",
      "\n",
      "# Initial guess\n",
      "e = [0.326,0.674,0.719,0.408,0.198,0.272] \n",
      "y = fsolve(F,e) \n",
      "D = y[0] \n",
      "W = y[1] \n",
      "Yad = y[2] \n",
      "Xaw = y[3] \n",
      "Ybd = y[4] \n",
      "Xbw = y[5] \n",
      "Ycd = 1-Yad-Ybd \n",
      "Xcw = 1-Xaw-Xbw \n",
      "\n",
      "print\"The amounts of liquid and vapor products are D=\",round(D,3),\"and W=\",round(W,3),\"respectively\"\n",
      "print\"The vapor compositions of components A(Yad), B(Ybd) and C(Ycd) are\",round(Yad,3),round(Ybd,3),round(Ycd,3),\"respectively\"\n",
      "print\"The liquid composition of components A(Xaw), B(Xbw) and C(Xcw) are\",round(Xaw,3),round(Xbw,3),round(Xcw,3),\"respectively\\n\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amounts of liquid and vapor products are D= 0.326 and W= 0.674 respectively\n",
        "The vapor compositions of components A(Yad), B(Ybd) and C(Ycd) are 0.714 0.199 0.087 respectively\n",
        "The liquid composition of components A(Xaw), B(Xbw) and C(Xcw) are 0.396 0.275 0.329 respectively\n",
        "\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.3,Page number:328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#   n-heptane - a    n-octane - b\n",
      "P = 1  \t\t\t\t\t\t# [bar]\n",
      "\n",
      "\t# Basis:\n",
      "F = 100  \t\t\t\t\t#  [mole]\n",
      "\t# Therefore\n",
      "D = 60  \t\t\t\t\t# [mole]\n",
      "W = 40  \t\t\t\t\t# [mole]\n",
      "xf = 0.5 \n",
      "\n",
      "#Calculation\n",
      "\n",
      "\n",
      "import math\n",
      "from numpy import *\n",
      "from pylab import *\n",
      "y_star = [0.5,0.55,0.60,0.65,0.686,0.70,0.75] \n",
      "x = [0.317,0.361,0.409,0.460,0.5,0.516,0.577] \n",
      "#for i in range(1,7):\n",
      "#    f(i-1) = 1/(y_star(i-1)-x(i-1)) \n",
      "area = matrix([[0.317,5.464],[0.361,5.291],[0.409,5.236],[0.460,5.263],[0.5,5.376],[0.516,5.435],[0.577,7.78]]) \n",
      "\t# LHS of equation 6.11\n",
      "a = math.log(F/W) \n",
      "\n",
      "\n",
      "a1=plot(area[:,0],area[:,1],label='$area under curve$') \n",
      "legend(loc='upper left')\n",
      "xlabel(\"x\") \n",
      "ylabel(\"1/(y_satr-x)\") \n",
      "\n",
      "# When the area becomes equal to 0.916, integration is stopped  this occurs at \n",
      "xw = 0.33  # [mole fraction of heptane in residue]\n",
      "yd =( F*xf-W*xw)/D  # [mole fraction of heptane]\n",
      "#Result\n",
      "\n",
      "print\"The composition of the composited distillate and the residue are \",round(yd,3),\"and\",round(xw,3),\"respectively\\n\\n\"\n",
      "show(a1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The composition of the composited distillate and the residue are  0.613 and 0.33 respectively\n",
        "\n",
        "\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEPCAYAAABcA4N7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtUU1e+B/BvFKqCCOIThfoAKj4wBhGVO0isFoVWL7bW\noWqlaC3V6ahd09XermlH67iW9tY+Rl3jWN/YWpyiVcoAWrSxthRRQe2tUxQL00gFREQFFAic+8cp\n0QjEhOTkJOH7WSuLR06S3/ZIvtl7n32OQhAEAURERG3oJHcBRERk3xgURERkFIOCiIiMYlAQEZFR\nDAoiIjKKQUFEREZJHhRr167FyJEjERwcjLlz56Kurq7FNsuWLUNgYCCUSiXy8/OlLomIiMwgaVAU\nFxdj69atyMvLww8//IDGxkYkJycbbJOeno7CwkJcunQJH3/8MZYsWSJlSUREZCZJg6JHjx5wdXVF\nbW0tdDodamtrMXDgQINtUlNTER8fDwAYP348qqqqUFZWJmVZRERkBkmDwtvbG3/605/w6KOPYsCA\nAfDy8sLUqVMNtikpKYGfn5/+Z19fX1y5ckXKsoiIyAySBsXly5fx0Ucfobi4GL/++iuqq6vx6aef\nttjuwbOIKBQKKcsiIiIzuEj55KdPn0Z4eDh69eoFAHj66aeRnZ2NefPm6bcZOHAgtFqt/ucrV660\nGJ4CgICAAFy+fFnKcomInI6/vz8KCwsteg5JexRBQUHIycnBnTt3IAgCsrKyMGLECINtZs6ciaSk\nJABATk4OvLy80K9fvxbPdfnyZQiC4LS3lStXyl4D28b2sX3Od7PGB2xJexRKpRILFixAaGgoOnXq\nhJCQECxevBhbtmwBACQmJiImJgbp6ekICAiAu7s7du7cKWVJRERkJkmDAgBef/11vP766wa/S0xM\nNPh506ZNUpdBRETtxJXZdkKtVstdgmScuW0A2+fonL191qAQBMEhLlykUCjgIKUSEdkNa7x3Sj70\nJDVvb2/cuHFD7jJIJj179kRlZaXcZRA5NYfvUbCn0bFx/xMZZ42/Ec5REBGRUQwKIiIyikFBRERG\nMSiIiMgoBgURERnFoOjgvv76awwYMMDgxIxERPdjUHRwERER6Nevn8E1QYiI7seg6ODOnDmDcePG\nyV0GUYeSnAzk5cldhemcPigUCuvc2uvixYt4++23kZ6ejueffx5paWnIy8vDvn37oFar8be//Q0h\nISHQarX48ccf8cYbb+Bf//oXVq9e3epzzJ8/H2lpadBqtThw4ACee+45AEBDQ4P+6oFnzpzB3//+\nd7z11ls4ePAg9u/fj4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82cORNz587Fzz//\njKtXr2Ljxo1yl0QkCVlPM07kqJKSktClSxfExcWhqakJ4eHh0Gg0UKvVcpdGZHXsURARkVGcoyAi\nIqMYFEREZBSDgoiIjGJQEBGRUQwKIiIyikFBRERGMSiIiMgoBgURERn1/9PstASQFiXjAAAAAElF\nTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x762d0b8>"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.4,Page number:342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "T = 298  \t\t\t\t\t\t\t\t# [K]\n",
      "Fa = 200  \t\t\t\t\t\t\t\t# [feed, kmole/hr]\n",
      "zf = 0.6 \n",
      "yd = 0.95  \n",
      "xd = yd \n",
      "xw = 0.05 \n",
      "q = 0.5  \t\t\t\t\t\t\t\t# [Lf/F]\n",
      "\n",
      "\n",
      "print\"Illustration 6.4(a)\"\n",
      "\t# Solution (a)\n",
      "\n",
      "import math\n",
      "from scipy.optimize import fsolve\n",
      "from numpy import *\n",
      "\n",
      "\t# Solution of simultaneous equation \n",
      "def F(e):\n",
      "    f1 = Fa - e[0]-e[1] \n",
      "    f2 = zf*Fa - yd*e[0] - xw*e[1] \n",
      "    return(f1,f2)\n",
      "\n",
      "\n",
      "# Initial guess\n",
      "e = [120,70] \n",
      "y = fsolve(F,e) \n",
      "D = y[0] \n",
      "W = y[1] \n",
      "print\"Quantity of liquid and vapor products are \",round(D,1),\"kmole/h and\",round(W,1),\"kmole/h respectively\"\n",
      "\n",
      "\n",
      "print\"Illustration 6.4(b)\"\n",
      "# Solution(b)\n",
      "\t# VLE data is generated in the same manner as generated in Example 6.1 by applying \tRaoult's law\n",
      "\t# VLE_data = [T,x,y]\n",
      "VLE_data = matrix([[379.4,0.1,0.21],[375.5,0.2,0.37],[371.7,0.3,0.51],[368.4,0.4,0.64],[365.1,0.5,0.71],[362.6,0.6,0.79],[359.8,0.7,0.86],[357.7,0.8,0.91],[355.3,0.9,0.96]]) \n",
      "\t# From figure 6.14\n",
      "\t# The minimum number of equilibrium stages is stepped off between the equilibrium curve and the 45 degree Iine, starting from the top, giving\n",
      "Nmin = 6.7 \n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The minimum number of theoretical stages is\",Nmin\n",
      "\n",
      "print\"Illustration 6.4(c)\"\n",
      "\t# Solution(c)\n",
      "\t# Slope of q-line = Lf/F/(1-(Lf/F))\n",
      "s = q/(1-q) \n",
      "\t# For minimum reflux ratio\n",
      "\t# From figure 6.12 y-intercept is\n",
      "i = 0.457 \n",
      "# Therefore Rmin is\n",
      "Rmin = xd/i -1 \n",
      "\n",
      "#result\n",
      "\n",
      "print\"The minimum reflux ratio is\",round(Rmin,3),\"mole reflux/mole distillate\"\n",
      "\n",
      "print\"Illustration 6.4(d)\"\n",
      "\n",
      "\t# Solution(d)\n",
      "R = 1.3*Rmin \n",
      "\t# The y-intercept of the rectifying-section operating line is\n",
      "ia = xd/(R+1) \n",
      "\t# The operating line for the stripping section is drawn to pass through the point x = y = \txw =0.05 on the 45\" line and the point of intersection of the q-line   # and the \t\t\trectifying-section operating line.\n",
      "\t# Therefore from figure 6.15 \n",
      "Nact = 13 \n",
      "\t# But it include boiler\n",
      "Nact1 = Nact-1 \n",
      "print\"The number of equilibrium stages for the reflux ratio specified is\",Nact1\n",
      "\t# For the optimal feed-stage location, the transition from one operating line to the \tother occurs \tat the first opportunity\n",
      "\t# after passing the operating-line intersection \n",
      "\t# Therefore from figure 6.15 shows that \n",
      "\n",
      "\n",
      "print\"The optimal location of the feed stage for the reflux ratio specified is sixth from the top\"\n",
      "\n",
      "print\"Illustration 6.4(e)\"\n",
      "# Solution(e)\n",
      "L = R*D  \t\t\t\t\t\t\t\t# [kmole/h]\n",
      "V = L+D  \t\t\t\t\t\t\t\t# [kmole/h]\n",
      "# From equation 6.27\n",
      "Lst = L+q*Fa  \t\t\t\t\t\t\t\t# [kmole/h]\n",
      "# From equation 6.28\n",
      "Vst = V+(q-1)*Fa  \t\t\t\t\t\t\t# [kmole/h]\n",
      "\n",
      "\t# For 50% vaporization of the feed ( zf = 0.60), from calculations similar to those \t\tillustrated in Example 6.1, the separator temperature and the equilibrium     # \tcompositions are\n",
      "Tf = 365.5  \t\t\t\t\t\t\t\t# [K]\n",
      "yf = 0.707 \n",
      "xf = 0.493 \n",
      "\n",
      "\t# Latent heat vaporisation data at temperature T = 298 K\n",
      "lambdaA = 33.9  \t\t\t\t\t\t\t# [kJ/mole]\n",
      "lambdaB = 38  \t\t\t\t\t\t\t\t# [kJ/mole]\n",
      "\t# Heat capacities of liquids (298-366 K)\n",
      "Cla = 0.147  \t\t\t\t\t\t\t\t# [kJ/mole.K]\n",
      "Clb = 0.174  \t\t\t\t\t\t\t\t# [kJ/mole.K]\n",
      "\t# Heat capacities of gases, average in the range 298 to 366 K\n",
      "Cpa = 0.094  \t\t\t\t\t\t\t\t# [kJ/mole.K]\n",
      "Cpb = 0.118  \t\t\t\t\t\t\t\t# [kJ/mole.K]\n",
      "\t# Substituting in equation 6.6 gives\n",
      "Hf = 0 \n",
      "Hlf = (Tf-T)*(xf*Cla+(1-xf)*Clb)  \t\t\t\t\t# [kJ/mole of liquid \t\t\t\t\t\t\t\t\tfeed]\n",
      "\t# From equation 6.7\n",
      "Hvf = (Tf-T)*(yf*Cpa+(1-yf)*Cpb) + yf*lambdaA + (1-yf)*lambdaB  \t# [kJ/mole of vapor feed]\n",
      "\n",
      "Lf = Fa*q  \t\t\t\t\t# [kmole/h]\n",
      "Vf = Fa*(1-q)  \t\t\t\t\t# [kmole/h]\n",
      "\t# From equation 6.3\n",
      "Qf = (Hvf*Vf +Hlf*Lf-Fa*Hf)*1000.0/3600.0  # [kW]\n",
      "\n",
      "\n",
      "Tlo = 354.3  \t\t\t\t\t# [Bubble point temperature, K]\n",
      "T1 = 355.8  \t\t\t\t\t# [Dew point temperature, K]\n",
      "y1 = 0.95  \t\t\t\t\t# [composition of saturated vapor at dew point]\n",
      "x0 = 0.95  \t\t\t\t\t# [composition of saturated liquid at bubble \t\t\t\t\t\tpoint]\n",
      "Hv1 = (T1-T)*(y1*Cpa+(1-y1)*Cpb) + y1*lambdaA + (1-y1)*lambdaB  # [kJ/mole of vapor feed]\n",
      "Hlo = (Tlo-T)*(x0*Cla+(1-x0)*Clb)  \t\t# [kJ/mole of liquid feed]\n",
      "\n",
      "\t# An energy balance around condenser\n",
      "Qc = V*(Hv1-Hlo)*1000/3600  \t\t\t# [kW]\n",
      "\n",
      "\t# A flash-vaporization calculation is done in which the fraction vaporized is known \t(53.8/75.4 = \t0.714) and the concentration\n",
      "\t# of the liquid residue is fixed at xw = 0.05\n",
      "\t# The calculations yield\n",
      "Tr = 381.6  \t\t\t\t\t# [K]\n",
      "x12 = 0.093 \n",
      "y13 = 0.111 \n",
      "T12 = 379.7  \t\t\t\t\t# [Bubble point of the liquid entering in the \t\t\t\t\t\treboiler, K]\n",
      "\n",
      "Hl12 = (T12-T)*(x12*Cla+(1-x12)*Clb)  \t\t# [kJ/mole of liquid feed]\n",
      "Hv13 = (Tr-T)*(y13*Cpa+(1-y13)*Cpb) + y13*lambdaA + (1-y13)*lambdaB  # [kJ/mole of vapor feed]\n",
      "\n",
      "Hlw = (Tr-T)*(xw*Cla+(1-xw)*Clb)  # [kJ/mole of liquid feed]\n",
      "\n",
      "\t# An energy balance around the reboiler \n",
      "Qr = (Vst*Hv13+W*Hlw-Lst*Hl12)*1000.0/3600.0  \t# [kW]\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The thermal load of the condenser, reboiler, and feed preheater are\",round(Qc),\"kW\",round(Qr),\"kW\",\"and\", round(Qf),\"kW respectively\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Illustration 6.4(a)\n",
        "Quantity of liquid and vapor products are  122.2 kmole/h and 77.8 kmole/h respectively\n",
        "Illustration 6.4(b)\n",
        "The minimum number of theoretical stages is 6.7\n",
        "Illustration 6.4(c)\n",
        "The minimum reflux ratio is 1.079 mole reflux/mole distillate\n",
        "Illustration 6.4(d)\n",
        "The number of equilibrium stages for the reflux ratio specified is 12\n",
        "The optimal location of the feed stage for the reflux ratio specified is sixth from the top\n",
        "Illustration 6.4(e)\n",
        "The thermal load of the condenser, reboiler, and feed preheater are 2549.0 kW 1794.0 kW and 1466.0 kW respectively\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stderr",
       "text": [
        "C:\\Anaconda\\lib\\site-packages\\scipy\\optimize\\minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n",
        "  improvement from the last ten iterations.\n",
        "  warnings.warn(msg, RuntimeWarning)\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.7,Page number:357"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t# a-benzene   b-toluene\n",
      "xa = 0.46 \n",
      "xb = 0.54 \n",
      "Tb = 395  \t\t\t\t# [bottom temp., K]\n",
      "Tt = 360  \t\t\t\t# [top temp., K]\n",
      "alphab = 2.26 \n",
      "alphat = 2.52 \n",
      "D = 1.53  \t\t\t\t# [diameter of column, m]\n",
      "f = 0.81  \t\t\t\t# [flooding]\n",
      "deltaP = 700  \t\t\t\t# [average gas-pressure drop, Pa/tray]\n",
      "import math\n",
      "\n",
      "Tavg = (Tb+Tt)/2  \t\t\t# [K]\n",
      "alpha_avg = (alphab+alphat)/2 \n",
      "\n",
      "print \"Solution6.7(a)\" \n",
      "\t# Solution(a)\n",
      "\t\n",
      "\t# Constants for components 'a' and 'b'\n",
      "Aa = 4.612 \n",
      "Ba = 148.9 \n",
      "Ca = -0.0254 \n",
      "Da = 2.222*10**-5 \n",
      "ua =math.exp(Aa+Ba/Tavg+Ca*Tavg+Da*Tavg**2)  \t\t\t# [cP]\n",
      "\n",
      "Ab = -5.878 \n",
      "Bb = 1287 \n",
      "Cb = 0.00458 \n",
      "Db = -0.450*10**-5 \n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "ub = math.exp(Ab+Bb/Tavg+Cb*Tavg+Db*Tavg**2)  \t\t\t# [cP]\n",
      "\n",
      "\t# At the average column temperature \n",
      "ul = ua**xa*ub**xb  \t\t\t\t\t\t# [cP]\n",
      "K = alpha_avg*ul \n",
      "\t# From the O\u2019Connell correlation\n",
      "Eo = 0.52782-0.27511*math.log10(K) + 0.044923*(math.log10(K))**2 \n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The overall tray efficiency using the O\u2019Connell correlation is \",round(Eo,1) \n",
      "\n",
      "print \"Example 6.7(b)\"\n",
      "\t# Solution(b)\n",
      "\n",
      "#Calculation\n",
      "\n",
      "Nideal = 20  \t\t\t\t\t\t\t# [number of ideal stages]\n",
      "Nreal = Nideal/(Eo)  \t\t\t\t\t\t# [nnumber of real stages]\n",
      "print Nreal \n",
      "\t# Since real stages cannot be fractional, therefore\n",
      "Nreal = 34  \n",
      "\t# From Table 4.3 tray spacing \n",
      "t = 0.6  \t\t\t\t\t\t\t# [m]\n",
      "\t# Adding 1 m over the top tray as an entrainment separator and 3 m beneath # the bottom \ttray for bottoms surge capacity, the total column height is\n",
      "Z = 4+Nreal*t  \t\t\t\t\t\t\t# [m]\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The number of real trays and the total tower height are\",Nreal,\"and\",Z,\" m respectively\"\n",
      "\n",
      "print \"Solution 6.7(c)\"\n",
      "\t# Solution(c)\n",
      "\n",
      "\t# Total gas pressure drop\n",
      "deltaPc = deltaP*Nreal/1000  \t\t\t\t\t# [kPa]\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The total gas-pressure drop through the column is\",deltaPc,\"kPa\"  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Solution6.7(a)\n",
        "The overall tray efficiency using the O\u2019Connell correlation is  0.6\n",
        "Example 6.7(b)\n",
        "32.1801990089\n",
        "The number of real trays and the total tower height are 34 and 24.4  m respectively\n",
        "Solution 6.7(c)\n",
        "The total gas-pressure drop through the column is 23 kPa\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.10,Page number:371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from numpy import *\n",
      "\n",
      "#Variable declaration\n",
      "\t# A-toluene   B-1,2,3-trimethyl benzene   C-benzene\n",
      "\t# Solution of above three are ideal \n",
      "\t# Feed\n",
      "za = 0.40 \n",
      "zb = 0.30 \n",
      "zc = 0.30 \n",
      "\t# Bottom \n",
      "FRAd = 0.95  \t\t\t\t# [recovery of toluene in distillate]\n",
      "FRBw = 0.95  \t\t\t\t# [recovery of 1,2,3-trimethyl benzene in the bottom]\n",
      "P = 1  \t\t\t\t\t# [atm]\n",
      "\n",
      "\t# First estimate of distillate composition \n",
      "xc = 40/70 \n",
      "xa = 30/70 \n",
      "xb = 0 \n",
      "\t# The bubble point temperature for this solution is \n",
      "Tb = 390  \t\t\t\t# [K]\n",
      "\t# The corresponding parameters for benzene, toluene and 1,2,3-trimethyl benzene\n",
      "\t# For toluene\n",
      "Tc_a = 568.8  \t\t\t\t\t# [K]\n",
      "Pc_a = 24.9  \t\t\t\t\t# [bar]\n",
      "A_a = -7.912 \n",
      "B_a = 1.380 \n",
      "C_a =-3.804 \n",
      "D_a = -4.501 \n",
      "\t# For 1,2,3-trimethyl benzene\n",
      "Tc_b = 664.5  \t\t\t\t\t# [K]\n",
      "Pc_b = 34.5 \t\t\t\t\t# [bar]\n",
      "A_b = -8.442 \n",
      "B_b = 2.922 \n",
      "C_b =-5.667 \n",
      "D_b = -2.281 \n",
      "\t# For benzene\n",
      "Tc_c = 540.3  \t\t\t\t\t# [K]\n",
      "Pc_c = 27.4  \t\t\t\t\t# [bar]\n",
      "A_c = -7.675 \n",
      "B_c = 1.371 \n",
      "C_c =-3.536 \n",
      "D_c = -3.202 \n",
      "\n",
      "\n",
      "\t# At the estimated reboiler temperature of 449.3 K\n",
      "Tr = 449.3  \t\t\t\t\t# [K]\n",
      "\t# P = [Toluene 1,2,3-trimethyl benzene Benzene]\n",
      "\n",
      "\t# P = [Tc Pc A B C D]\n",
      "P1=zeros((3,6))\n",
      "P1= matrix([[568.8,24.9,-7.912,1.380,-3.804,-4.501],[664.5,34.5,-8.442,2.922,-5.667,2.281],[540.3,27.4,-7.675,1.371,-3.536,-3.202]]) \n",
      "\n",
      "for i in range(0,3):\n",
      "    P1[i]= P1[i,1]*math.exp((P1[i,2]*(1-Tr/P1[i,0])+P1[i,3]*(1-Tr/P1[i,0])**1.5+P1[i,4]*(1-Tr/P1[i,0])**3+P1[i,5]*(1-Tr/P1[i,0])**6)/(1-(1-Tr/P1[i,0]))) \n",
      "\n",
      "PA1 = P1.item(0)  \t\t\t\t\t# [bar]\n",
      "PB1 = P1.item(6)  \t\t\t\t\t# [bar]\n",
      "PC1 = P1.item(12)\t\t\t\t# [bar]\n",
      "alphaAB1 = PA1/PB1 \n",
      "alphaCB1 = PC1/PB1 \n",
      "\n",
      "\t\t# At the estimated distillate temperature of 390 K\n",
      "Td = 390  \t\t\t\t\t# [K]\n",
      "\t# P = [Toluene 1,2,3-trimethyl benzene Benzene]\n",
      "\t# P = [Tc,Pc,A,B,C,D]\n",
      "P2 = zeros((3,6)) \n",
      "P2= matrix([[568.8,24.9,-7.912,1.380,-3.804,-4.501],[664.5,34.5,-8.442,2.922,-5.667,2.281],[540.3,27.4,-7.675,1.371,-3.536,-3.202]]) \n",
      "for i in range(0,3):\n",
      "    P2[i] = P2[i,1]*math.exp((P2[i,2]*(1-Td/P2[i,0])+P2[i,3]*(1-Td/P2[i,0])**1.5+P2[i,4]*(1-Td/P2[i,0])**3+P2[i,5]*(1-Td/P2[i,0])**6)/(1-(1-Td/P2[i,0])))\n",
      "    \n",
      "PA2 = P2.item(0)  # [bar]\n",
      "PB2 = P2.item(6)  # [bar]\n",
      "PC2 = P2.item(12)  # [bar]\n",
      "alphaAB2 = PA2/PB2 \n",
      "alphaCB2 = PC2/PB2 \n",
      "# The geometric-average relative volatilities are\n",
      "alphaAB_avg = math.sqrt(alphaAB1*alphaAB2) \n",
      "alphaCB_avg = math.sqrt(alphaCB1*alphaCB2) \n",
      "\n",
      "# From equation 6.66\n",
      "Nmin = math.log(FRAd*FRBw/((1-FRAd)*(1-FRBw)))/log(alphaAB_avg) \n",
      "\n",
      "# From equation 6.67\n",
      "FRCd = alphaCB_avg**Nmin/((FRBw/(1-FRBw))+alphaCB_avg**Nmin)  # [fractional recovery of benzene in the distillate]\n",
      "\n",
      "#Results\n",
      "\n",
      "\n",
      "print\"The number of equilibrium stages required at total reflux is\",round(Nmin,2)\n",
      "print\"The recovery fraction of benzene in the distillate is \",round(FRCd,3)\n",
      "print\"\\n\\nThus, the assumption that virtually all of the LNK will be recovered in the distillate is justified\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of equilibrium stages required at total reflux is 4.32\n",
        "The recovery fraction of benzene in the distillate is  0.997\n",
        "\n",
        "\n",
        "Thus, the assumption that virtually all of the LNK will be recovered in the distillate is justified\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.11,Page number:376"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t# 1-toluene   2-1,2,3--trimethylbenzene   3-benzene\n",
      "\t# Basis: 100 kmol/h of feed\n",
      "F = 100  \t\t\t\t\t\t# [kmole/h]\n",
      "\t# Since feed is saturated, therefore\n",
      "q = 0 \n",
      "\t# From example 6.10\n",
      "x1d = 0.3 \n",
      "x2d = 0.3 \n",
      "x3d = 0.4 \n",
      "a12 = 3.91 \n",
      "a32 = 7.77 \n",
      "a22 = 1  \n",
      "\n",
      "#Calculation\n",
      "\n",
      "import math\n",
      "from scipy.optimize import fsolve\n",
      "\t# Equ 6.78 gives\n",
      "def f14(Q):\n",
      "    return(1- a12*x1d/(a12-Q)-a22*x2d/(a22-Q)-a32*x3d/(a32-Q)) \n",
      "Q = fsolve(f14,2) \n",
      "\n",
      "\t# From the problem statement\n",
      "\t# d1 = D*x1d    d2 = D*x2d\n",
      "d1 = F*x1d*0.95  \t\t\t\t\t# [kmol/h]\n",
      "d2 = F*x2d*0.05  \t\t\t\t\t# [kmol/h]\n",
      "d3 = F*x3d*0.997  \t\t\t\t\t# [kmol/h]\n",
      "\n",
      "\t\t# Summing the three distillate, d1,d2 and d3\n",
      "D = d1+d2+d3  \t\t\t\t\t\t# [kmole/h]\n",
      "\n",
      "Vmin = a12*d1/(a12-Q)+a22*d2/(a22-Q)+a32*d3/(a32-Q) \n",
      "\n",
      "\t\t# From the mass balance \n",
      "Lmin = Vmin-D  \t\t\t\t\t\t# [kmol/h]\n",
      "\t# Minimum reflux ratio\n",
      "Rmin = Lmin/D \n",
      "\n",
      "#Results\n",
      "print\"The minimum reflux ratio is \",round(Rmin[0],3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum reflux ratio is  0.717\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.12,Page number:377"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# x-mole fraction  a-relative volatility\n",
      "xA = 0.25   \n",
      "aA = 4.08 \n",
      "xB = 0.11   \n",
      "aB = 1.00 \n",
      "xC = 0.26   \n",
      "aC = 39.47 \n",
      "xD = 0.09   \n",
      "aD = 10.00 \n",
      "xE = 0.17   \n",
      "aE = 2.11 \n",
      "xF = 0.12   \n",
      "aF = 0.50 \n",
      "\n",
      "FRlkd = 0.98 \n",
      "FRhkd = 0.01 \n",
      "import math\n",
      "from scipy.optimize import fsolve\n",
      "from numpy import *\n",
      "\t# For methane\n",
      "D_CR = (aC-1)/(aA-1)*FRlkd + (aA-aC)/(aA-1)*FRhkd \n",
      "\t# For ethane\n",
      "D_DR = (aD-1)/(aA-1)*FRlkd + (aA-aD)/(aA-1)*FRhkd \n",
      "\t# For butane\n",
      "D_ER = (aE-1)/(aA-1)*FRlkd + (aA-aE)/(aA-1)*FRhkd \n",
      "\t# For hexane\n",
      "D_FR = (aF-1)/(aA-1)*FRlkd + (aA-aF)/(aA-1)*FRhkd \n",
      "\t# Since the feed is 66% vaporized\n",
      "q = 1-0.66 \n",
      "\n",
      "\t# Now equation 6.82 is solved for two values of Q\n",
      "def f14(Q1):\n",
      "    return(0.66 - aA*xA/(aA-Q1)-aB*xB/(aB-Q1)-aC*xC/(aC-Q1)-aD*xD/(aD-Q1)-aE*xE/(aE-Q1)-aF*xF/(aF-Q1)) \n",
      "Q1 = fsolve(f14,1.2) \n",
      "\n",
      "def f15(Q2):\n",
      "    return(0.66 - aA*xA/(aA-Q2)-aB*xB/(aB-Q2)-aC*xC/(aC-Q2)-aD*xD/(aD-Q2)-aE*xE/(aE-Q2)-aF*xF/(aF-Q2)) \n",
      "Q2 = fsolve(f15,2.5) \n",
      "\n",
      "\t# Basis: 100 mole of feed\n",
      "F = 100  \t\t\t\t\t\t\t# [mole]\n",
      "\t# Let d1 = Dxad, d2 = Dxbd, d3 = Dxcd, and so on\n",
      "d1 = F*xA*FRlkd  \t\t\t\t\t\t# [moles of propane]\n",
      "d2 = F*xB*FRhkd  \t\t\t\t\t\t# [moles of pentane]\n",
      "d3 = F*xC  \t\t\t\t\t\t\t# [moles of methane]\n",
      "d4 = F*xD  \t\t\t\t\t\t\t# [moles of ethane]\n",
      "d6 = F*xF*0  \t\t\t\t\t\t\t# [moles of hexane]\n",
      "\t# And d5 is unknown\n",
      "\t# Applying equation 6,78 for each value of Q\n",
      "\n",
      "\t# Solution of simultaneous equation \n",
      "#Vmin=aA*d1/(aA-Q1)+aB*d2/(aB-Q1)+aC*d3/(aC-Q1)+aD*d4/(aD-Q1)+aE*d5/(aE-Q1)+aF*d6/(aF-Q1)\n",
      "#Vmin=aA*d1/(aA-Q2)+aB*d2/(aB-Q2)+aC*d3/(aC-Q2)+aD*d4/(aD-Q2)+aE*d5/(aE-Q2)+aF*d6/(aF-Q2)\n",
      "# we get\n",
      "d5=-(72.243-121.614)/(2.494+2.863)\n",
      "Vmin=72.243 + 2.494*D5\n",
      "\n",
      "\t# From equ 6.84\n",
      "D = d1+d2+d3+d4+d5+d6  \t\t\t\t\t\t# [mole]\n",
      "# From mass balance \n",
      "Lmin = Vmin-D  \t\t\t\t\t\t\t# [mole]\n",
      "# For minimum reflux ratio\n",
      "Rmin = Lmin/D \n",
      "print\"The minimum reflux ratio is\",round(Rmin,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum reflux ratio is 0.384\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.13,Page number:380"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from scipy.optimize import fsolve\n",
      "from numpy import *\n",
      "\n",
      "#Variable declaration\n",
      "\t# A-benzene  B-toluene  C-1,2,3-trimethylbenzene\n",
      "\t# From example 6.10\n",
      "Nmin = 4.32  # [stages]\n",
      "\t# From example 6.11\n",
      "Rmin = 0.717  \t\t\t\t\t\t# [minimum reflux ratio]\n",
      "\t# For R = 1\n",
      "R = 1 \n",
      "X = (R-Rmin)/(R+1) \n",
      "\t# From equ 6.88\n",
      "Y = 1-math.exp((1+54.4*X)/(11+117.2*X)*(X-1)/math.sqrt(X)) \n",
      "\t# Fro equ 6.86\n",
      "N = (Y+Nmin)/(1-Y) \n",
      "\t# From example 6.10 99.7% of the LNK (benzene) is recovered in the distillate# , 95% of \t\tthe light key is in the distillate, and 95% of the heavy key is in# the bottoms\n",
      "\n",
      "\t# For a basis of 100 mol of feed, the material balances for three components # are\n",
      "\t# For distillate\n",
      "nAd = 39.88  \t\t\t\t\t\t# [LNK, moles of benzene]\n",
      "nBd = 28.5  \t\t\t\t\t\t# [LK, moles of toluene]\n",
      "nCd = 1.50  \t\t\t\t\t\t# [HK, moles of 1,2,3-trimethylbenzene]\n",
      "nTd = nAd+nBd+nCd  \t\t\t\t\t# [total number of moles]\n",
      "xAd = nAd/nTd \n",
      "xBd = nBd/(nTd) \n",
      "xCd = nCd/(nTd) \n",
      "\n",
      "\t# For bottoms\n",
      "nAb = 0.12 \n",
      "nBb = 1.50 \n",
      "nCb = 28.50 \n",
      "nTb = nAb+nBb+nCb \n",
      "xAb = nAb/nTb \n",
      "xBb = nBb/nTb \n",
      "xCb = nCb/nTb \n",
      "\n",
      "D = nTd \n",
      "W = nTb \n",
      "\t# From problem statement\n",
      "Zlk = 0.3 \n",
      "Zhk = Zlk \n",
      "\t# Substituting in equation 6.89\n",
      "\t# T = Nr/Ns\n",
      "T = (Zhk/Zlk*W/D*(xBb/xCd)**2)**0.206 \n",
      "\n",
      "\t# Solution of simultaneous equation \n",
      "def H(e):\n",
      "    f1 = e[0]-e[1]*T \n",
      "    f2 = e[0]+e[1]-N \n",
      "    return(f1,f2)        \n",
      "\n",
      "\n",
      "\t# Initial guess\n",
      "e = [5,4] \n",
      "y = fsolve(H,e) \n",
      "Nr = y[0]  \t\t\t\t\t# [number of stages in rectifying section]\n",
      "Ns = y[1]  \t\t\t\t\t# [number of stages in stripping section]\n",
      "\n",
      "#Result\n",
      "\n",
      "print \"Nr=\",round(Nr,2),\"Ns=\",round(Ns,2),\"\\n\"\n",
      "print\"Rounding the estimated equilibrium stage requirement leads to 1 stage as a partial reboiler, 4 stages below the feed, and 5 stages above the feed\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nr= 5.39 Ns= 4.53 \n",
        "\n",
        "Rounding the estimated equilibrium stage requirement leads to 1 stage as a partial reboiler, 4 stages below the feed, and 5 stages above the feed\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.14,Page number:387"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t# a-acetone  b-methanol  c-water\n",
      "yna = 0.2971  \n",
      "yn1a = 0.17  \n",
      "ynIa = 0.3521  \n",
      "mnIa = 2.759  \n",
      "xna = 0.1459 \n",
      "ynb = 0.4631  \n",
      "yn1b = 0.429  \n",
      "ynIb = 0.4677  \n",
      "mnIb = 1.225  \n",
      "xnb = 0.3865 \n",
      "ync = 0.2398  \n",
      "yn1c = 0.4010  \n",
      "ynIc = 0.1802  \n",
      "mnIc = 0.3673  \n",
      "xnc = 0.4676 \n",
      "\n",
      "Fabv = 4.927  \t\t\t\t\t\t# [mol/square m.s]\n",
      "Facv = 6.066  \t\t\t\t\t\t# [mol/square m.s]\n",
      "Fbcv = 7.048  \t\t\t\t\t\t# [mol/square m.s]\n",
      "aI = 50  \t\t\t\t\t\t# [square m]\n",
      "Vn1 = 188  \t\t\t\t\t\t# [mol/s]\n",
      "Vn = 194.8  \t\t\t\t\t\t# [mol/s]\n",
      "\n",
      "print \"Solution6.14(a)\" \n",
      "from numpy import *\n",
      "import math\n",
      "\t# Solution(a)\n",
      "\n",
      "ya = (yna+ynIa)/2 \n",
      "yb = (ynb+ynIb)/2 \n",
      "yc = (ync+ynIc)/2 \n",
      "\n",
      "Rav = ya/Facv+yb/Fabv+yc/Facv \n",
      "Rbv = yb/Fbcv+ya/Fabv+yc/Fbcv \n",
      "\n",
      "Rabv = -ya*(1/Fabv-1/Facv) \n",
      "Rbav = -yb*(1/Fabv-1/Fbcv) \n",
      "\t# Thus in matrix form\n",
      "Rv =matrix([[Rav,Rabv],[Rbav,Rbv]]) \n",
      "kv = Rv.I  \t\t\t# [inverse of Rv]\n",
      "\t# From equ 6.99\n",
      "b =matrix([[yna-ynIa],[ynb-ynIb]]) \n",
      "J = kv*b \n",
      "\n",
      "\t# From equ 6.98\n",
      "Jc = -sum(J)  \t\t\t\t# [mol/square m.s]\n",
      "\n",
      "print\"The molar diffusional rates of acetone, methanol and water are\",round(J[0][0],4),\"mol/square m.s\",round(J[1][0],4),\"mol/square m.s and\",round(Jc,3) ,\"mol/square m.s respectively\"\n",
      "print \"Solution 6.14(b)\\n\" \n",
      "\t# Solution(b)\n",
      "Ntv = Vn1-Vn  \t\t\t\t\t\t# [mol/s]\n",
      "\n",
      "\t# From equation 6.94\n",
      "Nta = aI*J[0][0]+ya*Ntv \n",
      "Ntb = aI*J[1][0]+yb*Ntv \n",
      "Ntc = aI*Jc+yc*Ntv \n",
      "print\"The mass transfer rates of acetone, methanol and water are\",round(Nta,1),\"mol/s\" ,round(Ntb,1),\" mol/s and\", round(Ntc),\" mol/s respectively\"\n",
      "\n",
      "print \"Example6.14(c)\\n\"\n",
      "\t# Solution(c)\n",
      "\n",
      "\t# Approximate values of Murphree vapor tray efficiency are obtained from   # equation \t6.105\n",
      "\n",
      "EMG_a = (yna-yn1a)/(mnIa*xna-yn1a) \n",
      "EMG_b = (ynb-yn1b)/(mnIb*xnb-yn1b) \n",
      "EMG_c = (ync-yn1c)/(mnIc*xnc-yn1c) \n",
      "\n",
      "print\"The Murphree vapor tray efficiencies for acetone, methanol and water are\",round(EMG_a,3), round(EMG_b,3),\"and\",round(EMG_c,3), \"respectively\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Solution6.14(a)\n",
        "The molar diffusional rates of acetone, methanol and water are"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " -0.3068 mol/square m.s -0.0824 mol/square m.s and 0.389 mol/square m.s respectively\n",
        "Solution 6.14(b)\n",
        "\n",
        "The mass transfer rates of acetone, methanol and water are -17.5 mol/s -7.3  mol/s and 18.0  mol/s respectively\n",
        "Example6.14(c)\n",
        "\n",
        "The Murphree vapor tray efficiencies for acetone, methanol and water are 0.547 0.767 and 0.703 respectively\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}