summaryrefslogtreecommitdiff
path: root/Introduction_To_Chemical_Engineering/ch8.ipynb
blob: a18b815210f3043ffd3ca6a37d0ffd89f2f8f192 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 : Measuring Devices"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.4 page number 336"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "pressure_difference = 3.4          #in mm water\n",
      "pressure = 1.0133*10**5            #in pa\n",
      "temperatue = 293.        #in K\n",
      "mass_of_air = 29.       #in Kg\n",
      "\n",
      "# Calculations and Results\n",
      "density_air = pressure/(temperatue*8314)*mass_of_air      #in kg/m3\n",
      "print \"Density of air = %f kg/cu m\"%(density_air)\n",
      "\n",
      "delta_p = pressure_difference*9.8           #in pascal, acceleration due to gravity, g=9.8\n",
      "Height=4\n",
      "density_difference = delta_p/(9.8*Height);\n",
      "print \"Density difference = %f kg/cu m\"%(density_difference)\n",
      "\n",
      "density_mixture= density_air-density_difference;      #in kg/m3\n",
      "print \"Density of mixture = %f kg/cu m\"%(density_mixture)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Density of air = 1.206309 kg/cu m\n",
        "Density difference = 0.850000 kg/cu m\n",
        "Density of mixture = 0.356309 kg/cu m\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.5 page number 341\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find viscosity of oil \n",
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "diameter=0.6;     #in m\n",
      "disk_distance=1.25*10**-3;    #in m\n",
      "speed=5.;      #revolutions/min\n",
      "torque=11.5;  #in Joules\n",
      "\n",
      "# Calculations\n",
      "#we know that torque= pi*omega*viscosity*radius**4/2*disc_distance\n",
      "viscosity=(2*disk_distance*torque)/(3.14*(10*3.14)*(diameter/2)**4);\n",
      "\n",
      "# Results\n",
      "print \"viscosity = %f Pa-s\"%(viscosity)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "viscosity = 0.035999 Pa-s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.6 page number 342\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find the viscosity of solution using given parameters\n",
      "\n",
      "import math \n",
      "# Variables\n",
      "diameter =10.;               #in mm\n",
      "density_of_solution = 1750.;     #in kg/m3\n",
      "density_of_air = 1.2;           #in kg/m3\n",
      "velocity = 0.9;          #in mm/s\n",
      "\n",
      "# Calculations and Results\n",
      "viscosity = (density_of_solution-density_of_air)*9.8*(diameter*10**-3)**2/(18*velocity*10**-3);         #expression for finding viscosity\n",
      "\n",
      "print \"viscosity of solution = %f Pa-s\"%(viscosity)\n",
      "\n",
      "\n",
      "#checking stoke's region validity\n",
      "v=(0.2*viscosity)/(density_of_solution*diameter*10**-3);\n",
      "if v>0.9 :\n",
      "    print \"system follows stokes law\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "viscosity of solution = 105.791605 Pa-s\n",
        "system follows stokes law\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.7 page number 367\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find the flow rate in an orifice\n",
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "density_of_water = 1000.;     #in kg/m3\n",
      "viscosity = 1*10.**-3;         #in Pa-s\n",
      "pipe_diameter = 250.;         #in mm\n",
      "orifice_diameter = 50.;       # in mm\n",
      "density_of_mercury = 13600.;  # in mm\n",
      "manometer_height = 242.;      #in mm\n",
      "\n",
      "# Calculations and Results\n",
      "height_water_equivalent = (density_of_mercury-density_of_water)*(manometer_height*10**-3)/(density_of_water)     #in m\n",
      "\n",
      "#assuming Re>30000\n",
      "Co = 0.61;\n",
      "velocity = Co*(2*9.8*height_water_equivalent/(1-(orifice_diameter/pipe_diameter)**4))**0.5;     #in m/s\n",
      "\n",
      "#checking Reynold's number\n",
      "Re = (orifice_diameter*10**-3*velocity*density_of_water)/viscosity;\n",
      "print \"reynolds number = %f which is greater than 30000\"%(Re)\n",
      "\n",
      "if Re>30000:\n",
      "    print \"velocity of water = %f m/s\"%(velocity)\n",
      "\n",
      "rate_of_flow = (3.14*(orifice_diameter*10.**-3)**2./4)*velocity*density_of_water;\n",
      "print \"rate of flow = %f litre/s\"%(rate_of_flow)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "reynolds number = 235976.385359 which is greater than 30000\n",
        "velocity of water = 4.719528 m/s\n",
        "rate of flow = 9.262073 litre/s\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.8 page number 368\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find the coefficient of discharge for converging cone\n",
      "\n",
      "import math \n",
      "# Variables\n",
      "pipe_diameter=0.15;          #in m\n",
      "venturi_diameter=0.05;       #in m\n",
      "pressure_drop=0.12;           #m of water\n",
      "flow_rate=3.;                 #in kg/s\n",
      "density = 1000.;              #in kg/m3\n",
      "viscosity = 0.001            #in Pa-s\n",
      "\n",
      "# Calculations and Results\n",
      "velocity = ((4./3.14)*flow_rate)/(venturi_diameter**2*density);\n",
      "print \"velociy = %f m/s\"%(velocity)\n",
      "\n",
      "#calculating coefficient of discharge\n",
      "Cv=velocity*((1-(venturi_diameter/pipe_diameter)**4)/(2*9.8*pressure_drop))**0.5;\n",
      "print \"coefficient of discharge = %f\"%(Cv)\n",
      "\n",
      "#calculating reynold's number\n",
      "Re = velocity*(venturi_diameter/pipe_diameter)**2*pipe_diameter*density/viscosity;\n",
      "print \"reynolds No = %f\"%(Re)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "velociy = 1.528662 m/s\n",
        "coefficient of discharge = 0.990593\n",
        "reynolds No = 25477.707006\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.9 page number 369\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find pA and pB\n",
      "\n",
      "import math \n",
      "# Variables\n",
      "h1=0.66;       #in m\n",
      "h2=0.203;      #in m\n",
      "h3=0.305      #in m\n",
      "density=1000.;  #in kg/m3\n",
      "pB=68900.;      #in Pa\n",
      "s1=0.83;\n",
      "s2=13.6;\n",
      "\n",
      "# Calculations and Results\n",
      "print (\"part 1\")\n",
      "pA=pB+(h2*s2-(h1-h3)*s1)*density*9.81;    #in Pa\n",
      "print \"pressure at A = %f Pa\"%(pA)\n",
      "\n",
      "print (\"part 2\")\n",
      "pA1=137800.      #in Pa\n",
      "pressure=735.   #mm Hg\n",
      "pB1=pA1-(h2*s2-(h1-h3)*s1)*density*9.81;\n",
      "pressure_B=(pB1-pressure*133.3)/9810.;        #m of water\n",
      "print \"pressure at B = %f m of water\"%(pressure_B)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part 1\n",
        "pressure at A = 93092.931500 Pa\n",
        "part 2\n",
        "pressure at B = 1.593432 m of water\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.10 page number 370\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find the rate of oil flow in l/s\n",
      "\n",
      "import math \n",
      "# Variables\n",
      "density_oil=900.;       #in kg/m3\n",
      "viscosity_oil=38.8*10**-3;    #in Pa-s\n",
      "density_water = 1000.;       #in kg/m3\n",
      "diameter=0.102              #in m\n",
      "manometer_reading=0.9;       #m of water\n",
      "\n",
      "# Calculations and Results\n",
      "delta_H=manometer_reading*(density_water-density_oil)/density_oil;\n",
      "print \"manometer reading as m of oil = %f m\"%(delta_H)\n",
      "\n",
      "maximum_velocity=(2*9.8*delta_H)**0.5;\n",
      "print \"maximum_velocityVmax) = %f m/s\"%(maximum_velocity)\n",
      "\n",
      "Re=diameter*maximum_velocity*density_oil/viscosity_oil;\n",
      "print \"if Re<4000 then v=0.5*Vmax Re = %f\"%(Re)\n",
      "if Re<4000 :\n",
      "    velocity=maximum_velocity*0.5;\n",
      "\n",
      "print \"velocity = %f m/s\"%(velocity)\n",
      "\n",
      "flow_rate=(3.14/4)*diameter**2*velocity*1000;\n",
      "print \"flow rate =%f litre/s\"%(flow_rate)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "manometer reading as m of oil = 0.100000 m\n",
        "maximum_velocityVmax) = 1.400000 m/s\n",
        "if Re<4000 then v=0.5*Vmax Re = 3312.371134\n",
        "velocity = 0.700000 m/s\n",
        "flow rate =5.716998 litre/s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.11 page number 372\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find the maximum capacity of keroscene\n",
      "\n",
      "import math \n",
      "# Variables\n",
      "flow_rate_steel=1.2;     #l/s\n",
      "density_steel=7.92;\n",
      "density_kerosene=0.82;\n",
      "density_water=1;\n",
      "\n",
      "# Calculations\n",
      "flow_rate_kerosene =(((density_steel-density_kerosene)/density_kerosene)/((density_steel-density_water)/density_water))**0.5*flow_rate_steel\n",
      "\n",
      "\n",
      "# Results\n",
      "print \"maximum_flow rate of kerosene = %f litre/s\"%(flow_rate_kerosene)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum_flow rate of kerosene = 1.342303 litre/s\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 8.12 page number 373\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find the rate of flow of flue gas\n",
      "\n",
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "# Variables\n",
      "initial_CO2 = 0.02;       #weight fraction\n",
      "flow_rate_CO2 = 22.5;     #gm/s\n",
      "final_CO2=0.031;          #weight fraction\n",
      "\n",
      "#flow rate of flue gas =x\n",
      "#amount of CO2 entering = 0.02*x\n",
      "#amount of CO2 leaving = 0.02x+0.0225\n",
      "#amount of gas leaving = x+0.0225\n",
      "#amount of CO2 leaving = 0.031*(x+0.0225)\n",
      "\n",
      "# Calculations\n",
      "def f(x): \n",
      "\t return initial_CO2*x+0.0225 - 0.031*(x+0.0225)\n",
      "\n",
      "flow_rate_flue_gas=fsolve(f,0)\n",
      "\n",
      "# Results\n",
      "print \"flow rate of flue gas = %f kg/s\"%(flow_rate_flue_gas)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "flow rate of flue gas = 1.982045 kg/s\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}