summaryrefslogtreecommitdiff
path: root/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch3.ipynb
blob: 4e398ea981d99bafecb7fe562955ec1248b63289 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:445dec12235c400efa979dcf04faa2911a77ac6433ec8e786b9205e0e8fdeeb4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : The balance equation and mass balance"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 3.4 page no : 88\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "# variables\n",
      "V=15.;                        #gal volume of gasoline\n",
      "t=2.;                         #min\n",
      "rho_water=62.3;               #lbm/ft^3\n",
      "sg=0.72;                      #specific gravity\n",
      "\n",
      "# calculation and Result\n",
      "q=(15/2.0)*(0.1336/60)        #ft^3/s vol. flow rate\n",
      "print \"volumetric flow rate is %f ft^3/s\"%q\n",
      "m=q*sg*rho_water              #lbm/s\n",
      "print \"Mass flow rate is %f lbm/s\"%m\n",
      "d=1.;                         #in diameter of pipe\n",
      "a=((math.pi)*d**2/4.0)/144.0;    #ft^2 area of pipe\n",
      "v_avg=q/a                     #ft/s\n",
      "print \"The average velocity is %f ft/s\"%v_avg"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "volumetric flow rate is 0.016700 ft^3/s\n",
        "Mass flow rate is 0.749095 lbm/s\n",
        "The average velocity is 3.061886 ft/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.5 page no : 90\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "# variables\n",
      "d1=2.;                       #ft diameter of pipe at position 1\n",
      "a1=(math.pi)/4*d1**2;        #ft^2\n",
      "v1=50.;                      #ft/s vel of gas at position 1\n",
      "rho1=2.58;                   #lbm/ft^3 density of gas at position 1\n",
      "d2=3.;                       #ft diameter of pipe at position 2\n",
      "\n",
      "# calculation\n",
      "a2=(math.pi)/4*d2**2;\n",
      "rho2=1.54;                   #lbm/ft^3 density at position 2\n",
      "v2=(rho1/rho2)*(a1/a2)*v1    #ft/s\n",
      "\n",
      "# result\n",
      "print \"Velocity is %f ft/s\"%v2\n",
      "m=rho1*v1*a1                 #lbm/s mass flow rate\n",
      "print \"The mass flow rate is %f lbm/s\"%m"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity is 37.229437 ft/s\n",
        "The mass flow rate is 405.265452 lbm/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.6 page no : 91\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "# variables\n",
      "d1=0.25;                      #m diameter of pipe at position 1\n",
      "v1=2.;                        #m/s velocity\n",
      "rho=998.2;                    #kg/m^3  density of water\n",
      "a1=(math.pi)/4*d1**2;         #m^2\n",
      "d2=0.125                      #m diameter of pipe at position 2\n",
      "\n",
      "# calculation\n",
      "a2=(math.pi)/4*d2**2;         #m^2\n",
      "m=rho*a1*v1                   #kg/s mass flow rate\n",
      "\n",
      "# result\n",
      "print \"Mass flow rate is %f kg/s\"%m\n",
      "q=m/rho                       #m^3/s volumetric flow rate\n",
      "print \"The volumetric flow rate is %f m^3/s\"%q\n",
      "v2=(a1/a2)*v1                 #m/s velocity\n",
      "print \"Velocity of water is %f m/s\"%v2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass flow rate is 97.998056 kg/s\n",
        "The volumetric flow rate is 0.098175 m^3/s\n",
        "Velocity of water is 8.000000 m/s\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.7 page no : 92\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "# variables\n",
      "p_initial=1.;                        #atm pressure initially\n",
      "p_final=0.0001;                      #atm pressure finally\n",
      "V=10.;                               #ft^3 volume of system\n",
      "q=1.;                                #ft^3/min vol. flow rate\n",
      "\n",
      "# calculation\n",
      "t=(V/q)*math.log(p_initial/p_final)  #min\n",
      "\n",
      "# result\n",
      "print \"The time required is %f min\"%t"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time required is 92.103404 min\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.8 page no : 93\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# variables\n",
      "m_in=0.0001;                      #lbm/min\n",
      "q_out=1.;                         #ft^3/min\n",
      "rho_sys=m_in/q_out                #lbm/ft^3\n",
      "rho_air=0.075;                    #lbm/ft^3\n",
      "p_initial=1.;                     #atm\n",
      "\n",
      "# calculation\n",
      "p_steady=p_initial*(rho_sys/rho_air)          #atm\n",
      "\n",
      "# result\n",
      "print \"The steady state pressure is %f atm\"%p_steady"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The steady state pressure is 0.001333 atm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.9 page no : 94\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "# variables\n",
      "d=3.;                          #m diameter of tank\n",
      "a=(math.pi)*d**2/4;            #m^2\n",
      "d_in=0.1;                      #m inner diameter of inflow pipe\n",
      "d_out=0.2;                     #m\n",
      "v_in=2.0;                      #m/s\n",
      "v_out=1.0;                     #m/s\n",
      "\n",
      "# calculation\n",
      "q_in=((math.pi)*d_in**2/4.0)*v_in;                #m^3/s\n",
      "q_out=((math.pi)*d_out**2/4.0)*v_out;             #m^3/s\n",
      "\n",
      "#let D represent d/dt\n",
      "DV=q_in-q_out;                 #m^3/s\n",
      "\n",
      "# result\n",
      "if DV>1:\n",
      "    print \"The water level in tank is rising\"\n",
      "elif DV<1:\n",
      "    print \"The water level in tank is falling\"\n",
      "else:\n",
      "    print \"No accumulation\"\n",
      "#let h be the height of water in tank\n",
      "Dh=DV/a                       #m/s \n",
      "print \"The rate of level of water is rising or falling in a cylindrical tank is %f m/s\"%Dh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The water level in tank is falling\n",
        "The rate of level of water is rising or falling in a cylindrical tank is -0.002222 m/s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.11 page no : 97\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# variables\n",
      "q=5/8.0;                     #kg/hr mass evaporation rate of benzene\n",
      "c=1.3*10**(-6);              #kg/m^3 concentration of benzene\n",
      "\n",
      "# calculation\n",
      "Q=q/c/3600.0                 #m^3/s\n",
      "\n",
      "# result\n",
      "print \"The flow rate of ventilation air supply is %f m^3/s\"%Q"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flow rate of ventilation air supply is 133.547009 m^3/s\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}