summaryrefslogtreecommitdiff
path: root/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch12.ipynb
blob: 1d00a5b6ed99265086f62090b9c6d01a2a0f1900 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 :  Recycle Bypass Purge and the Industrial Application of Material Balance"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 12.1  Page No.349\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import matrix\n",
      "\t\t\t\n",
      "# Variables            \n",
      "F = 10000. ;\t\t\t#[lb/hr]\n",
      "\t\t\t\n",
      "NaOH_F = 40./100 ;\t    \t\t#[wt. fraction]\n",
      "NaOH_P1 = 95./100 ;\t    \t\t#[wt. fraction of NaOH filter cake]\n",
      "NaOH_P2 = (0.05 *  45)/100 ;\t\t\t#[wt. fraction of NaOH in NaOH soln.]\n",
      "H2O_P2 = (0.05 *  55)/100 ;\t\t\t#[wt. fraction of H2O in NaOH soln.]\n",
      "NaOH_R = 45./100;\t\t\t#[wt. fraction]\n",
      "NaOH_G = 50./100;\t\t\t#[wt. fraction]\n",
      "\t\t\t\n",
      "P = (NaOH_F *  F)/(NaOH_P1 + NaOH_P2) ;\t\t\t#[lb/hr]\n",
      "\t\t\t\n",
      "W = F-P ;\t\t\t# [lb/hr]\n",
      "\n",
      "# Calculations & Results\t\n",
      "a = matrix([[NaOH_G,-NaOH_R],[1,-1]]) \t\t\t# matrix formed of coefficients of unknown\n",
      "b = matrix([[F*NaOH_F],[P]]);\t\t\t# matrix formed by constant\n",
      "a = a.I\n",
      "x = a*b ;\t\t\t# matrix of solutions . x(1) = G, x(2) = R\n",
      "G = x[0] ;\t\t\t# [lb/hr]\n",
      "R = x[1] ;\t\t\t# [lb/hr]\n",
      " \n",
      "print '(a)  Flow rate of water removed by evaporator is  %.1f lb/hr'%W\n",
      "print 'The recycle rate of the process is %.1f lb/hr'%R\n",
      "\n",
      "\t\t\t\n",
      "NaOH_H = 45./100 ;\t\t\t#[wt fraction]\n",
      "H2O_H = 55./100 ;\t\t\t#[wt fraction]\n",
      "\n",
      "a1 = matrix([[NaOH_G,-NaOH_H],[NaOH_G,-H2O_H]]) ;\t\t\t# matrix formed of coefficients of unknown\n",
      "b1 = matrix([[((NaOH_P1+NaOH_P2)* P)],[(H2O_P2) *  P]]);\t\t\t# matrix formed by constant\n",
      "x1 = a1**-1\n",
      "x1 = x1*b1 ;\t\t\t# matrix of solutions nw_G = x1(1);H = x1(2)\n",
      "nw_G1 = x1[0] ;\t\t\t# [lb/hr]\n",
      "H = x1[1];\t\t\t# [lb/hr]\n",
      "\n",
      "nw_F = (NaOH_H *  H + (NaOH_P1 + NaOH_P2) *  P)/NaOH_F ;\t\t\t#[lb/hr]\n",
      "print ' (b)  Total feed rate when filterate is not recycled is %.1f lb/hr'%nw_F\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  Flow rate of water removed by evaporator is  5886.9 lb/hr\n",
        "The recycle rate of the process is 38868.9 lb/hr\n",
        " (b)  Total feed rate when filterate is not recycled is 53727.5 lb/hr\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 12.2  Page No.357\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "F_Bz = 100. ;\t\t\t# Fresh benzene feed / basis - [mol]\n",
      "con_Bz = .95 ;\t\t\t# Fraction of conversion of benzene\n",
      "sp_con = .20 ;\t\t\t# Fraction of single pass conversion\n",
      "ex_H2 = .20 ;\t\t\t# Fraction of exces H2 used in fresh feed\n",
      "R_Bz = 22.74 ;\t\t\t# Benzene in Recycle stream - [mol %]\n",
      "R_H2 = 78.26 ;\t\t\t# H2 in Recycle stream - [mol %]\n",
      "TLV_Bz = 0.5 ;\t\t\t# TLV value of benzene -[ppm]\n",
      "TLV_C6H12 = 300. ;\t\t\t# TLV value of cyclohexane -[ppm]\n",
      "TLV_H2 = 1000. ;\t\t\t# TLV value of H2 -[ppm]\n",
      "\n",
      "# Calculations\n",
      "F_H2 = F_Bz*3*(1+ex_H2) ;\t\t\t# H2 in Feed - [mol]\n",
      "F = F_Bz + F_H2 ;\t\t\t# Total feed - [mol]  \n",
      "\n",
      "ex_r = con_Bz*F_Bz/(-(-1)) ;\t\t\t# Extent of reaction\n",
      "\n",
      "P_Bz = F_Bz -1*(ex_r) ;\t\t\t# Benzene in P ,by benzene balance - [mol]\n",
      "P_H2 = F_H2 + -3*(ex_r) ;\t\t\t# H2 in P ,by H2 balance - [mol]\n",
      "P_C6H12 = 0 + 1*(ex_r) ;\t\t\t# Cyclohexane in P ,by cyclohexane balance - [mol]\n",
      "P = P_Bz + P_H2 + P_C6H12 ;\t\t\t# Total Product - [ mol]\n",
      "\n",
      "R = ((-(-ex_r))/(sp_con) - F_Bz)/(R_Bz/100.) ;\t\t\t# Recycle stream - [mol]\n",
      "R_by_F = R/F ;\t\t\t# Ratio of R to F \n",
      "\n",
      "TLV = (P_Bz/P)*(1/TLV_Bz) + (P_H2/P)*(1./TLV_H2) + (P_C6H12/P)*(1/TLV_C6H12) ;\t\t\t# TLV (environmental index) \n",
      "\n",
      "# Results\n",
      "print 'Ratio of R to F is %.2f .'%R_by_F\n",
      "print ' TLV (environmental index) is %.3f .'%TLV\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of R to F is 3.58 .\n",
        " TLV (environmental index) is 0.059 .\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 12.3  Page No.359\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "RR = 8.33 ;\t\t\t# Recycle ratio\n",
      "F = 100. ;\t\t\t# Overall feed/basis - [lb]\n",
      "F_g = 0.40 ;\t\t\t# Fraction of glucose in overall feed \n",
      "F_w = 0.60 ;\t\t\t# Fraction of water in overall feed \n",
      "F_dash_f = 0.04 ; \t\t\t# Fraction of fructose in feed to reactor\n",
      "P = F   \t\t\t# By overall balance -[lb]\n",
      "R = P/RR ;\t\t\t# Recycle stream - [lb]\n",
      "P_w = (F_w * F)/ P ;\t\t\t# Fraction of water in product(P), by overall water balance\n",
      "R_w = P_w ;\t\t\t#Fraction of water in recycle (R), since both R and P has same composition\n",
      "\n",
      "# Calculations\t\t\n",
      "F_dash = F +R ;\t\t\t# Feed to reactor ,by total balance -[lb]\n",
      "R_f = (F_dash*F_dash_f)/R ;\t\t\t# Fraction of fructose in recycle stream \n",
      "R_g = 1 - (R_f + R_w) ;\t\t\t# Fraction of glucose in recycle stream\n",
      "F_dash_g = (F*F_g + R*R_g)/F_dash ;\t\t\t# Fraction of glucose i feed to reactor\n",
      "\n",
      "f_con = ((F_dash*F_dash_g) - (R + P)*R_g)/(F_dash*F_dash_g) ;\t\t\t# Fraction of conversion of glucose in reactor\n",
      "\n",
      "# Results\n",
      "print 'Fraction of conversion of glucose in reactor is %.2f .'%f_con\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of conversion of glucose in reactor is 0.93 .\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 12.4   Page No.362\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "F = 100. ;\t\t\t# Overall feed/basis - [kg]\n",
      "F_com = 0.10 ;\t\t\t# Mass fraction of component in fresh feed \n",
      "F_w = 0.90 ;\t\t\t# Mass fraction of water in fresh feed \n",
      "P_w = 0.10 ;\t\t\t# Mass fraction of water in product\n",
      "P_com = 0.90 ;\t\t\t#Mass fraction of component in product\n",
      "F_dash_com = 0.03 ;\t\t\t#Mass fraction of component in feed to reactor\n",
      "W_w = 1. ;\t\t\t# Mass fraction of water in W(waste)\n",
      "C_con = .40 ;\t\t\t# Fraction of conversion of component in reactor\n",
      "\n",
      "# Calculations\n",
      "P = F_com*F/P_com ;\t\t\t#By component balance- Product - [kg]\n",
      "W = F - P ;\t\t\t# By overall balance - waste(W)- [kg]\n",
      "\n",
      "Rw = (F*F_com - F*F_com*C_con)/C_con ;\t\t\t# Mass of component in recycle(R) - [kg]\n",
      "F_dash = ( F*F_com + Rw  )/F_dash_com ;\t\t\t# By component balance - feed to reactor(F') -[kg]\n",
      "R = F_dash - F ;\t\t\t                    # Recycle(R) - By total balance -[kg]\n",
      "w = Rw/R ;\t\t\t                            # Mass fraction of component in recycle(R) \n",
      "\n",
      "# Results\n",
      "print 'Recycle(R) stream-  %.0f kg '%R\n",
      "print ' Mass fraction of component in recycle(R)-   %.4f .'%w\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Recycle(R) stream-  733 kg \n",
        " Mass fraction of component in recycle(R)-   0.0205 .\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 12.5  Page No.367\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "F = 100.        \t\t\t# Overall feed/basis - [kg]\n",
      "F_n_C5H12 = 0.80 ;\t\t\t# Fraction of n_C5H12 in overall feed \n",
      "F_i_C5H12 = 0.20 ;\t\t\t# Fraction of i_C5H12in overall feed \n",
      "S_i_C5H12 = 1. ;\t\t\t# Fraction of i_C5H12 in isopentane stream\n",
      "P_n_C5H12 = .90 ;\t\t\t# Fraction of n_C5H12 in overall product\n",
      "P_i_C5H12 = .10 ;\t\t\t# Fraction of i_C5H12 in overall product\n",
      "\n",
      "# Calculations\n",
      "P = (F*F_n_C5H12)/P_n_C5H12 ;\t\t\t#Product Material Balance of n_C5H12 -[kg]\n",
      "S = F - P ;\t\t\t# Isopentane stream (S) from overall material balance - [kg]\n",
      "\n",
      "from numpy import matrix\n",
      "a = matrix([[1,-1],[F_n_C5H12,-1]]) ;\t\t\t# Matrix of coefficients of unknown \n",
      "b = matrix([[S],[0]]) ;\t\t\t# Matrix of constants\n",
      "a = a.I\n",
      "x = a*b         \t\t\t# Matrix of solutions, x(1) = x , x(2) = y\n",
      "\n",
      "xf = x[0]/F ;\t    \t\t# Fraction of butane-free gas going to isopentane tower \n",
      "\n",
      "# Results\n",
      "print 'Fraction of butane-free gas going to isopentane tower is %.3f .'%xf\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of butane-free gas going to isopentane tower is 0.556 .\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 12.6  Page No.369\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "F = 100. ;\t\t\t# Overall feed/basis - [mole]\n",
      "F_H2 = 0.673 ;\t\t\t# Mole fraction of H2 in overall feed \n",
      "F_CO = 0.325 ;\t\t\t# Mole fraction of i_C5H12in overall feed \n",
      "F_CH4 = .002 ;\t\t\t# Mole fraction of CH4 in overall feed \n",
      "E_CH3OH = 1. ;\t\t\t#  Mole fraction of CH3OH in Exit(E)\n",
      "\t\n",
      "z = .032 ;\n",
      "CO_con = .18 ;\t\t\t# Fraction of conversion of CO in reactor\n",
      "\n",
      "# Calculations\n",
      "#By using eqn.(c) and (d)\n",
      "P = F_CH4*F/z ;\t\t\t# Purge stream - [mole]\n",
      "\n",
      "# Using eqn.(a) , (b) and (c)\n",
      "x_plus_y = 1 - z ;\t\t\t# x + y \n",
      "E = (F_H2*F + F_CO*F + 3*F_CH4*F - P*(x_plus_y + 3*z ))/3 ;\t\t\t# Exit stream - [mole]\n",
      "\n",
      "# By using eqn. (d)\n",
      "y = ( F_CO*F - E )/P ;\t\t\t# Mole fraction of CO \n",
      "\n",
      "# By using eqn. (a)\n",
      "x = 1 - z - y ;\t\t\t# Mole fraction of H2 \n",
      "\n",
      "# Lastly by using eqn.(e)\n",
      "R = ( F_CO*F - P*y - F_CO*F*CO_con )/(y*CO_con) ;\t\t\t# Recycle steam - [mole]\n",
      "\n",
      "# Results\n",
      "print 'Moles of recycle(R) per mole of feed(F) -                      %.4f '%(R/F)\n",
      "print ' Moles of CH3OH(E) per mole of feed(F)   -                      %.4f '%(E/F)\n",
      "print ' Moles of Purge(P) per mole of feed(F)   -                      %.4f '%(P/F);\n",
      "print ' Composition of Purge '\n",
      "print '  Component                 Mole fraction '\n",
      "print '  H2                        %.3f '%x\n",
      "print '  CO                        %.3f '%y\n",
      "print '  CH4                       %.3f '%z\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Moles of recycle(R) per mole of feed(F) -                      7.0556 \n",
        " Moles of CH3OH(E) per mole of feed(F)   -                      0.3125 \n",
        " Moles of Purge(P) per mole of feed(F)   -                      0.0625 \n",
        " Composition of Purge \n",
        "  Component                 Mole fraction \n",
        "  H2                        0.768 \n",
        "  CO                        0.200 \n",
        "  CH4                       0.032 \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}