summaryrefslogtreecommitdiff
path: root/Introduction_To_Chemical_Engineering/ch8.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Introduction_To_Chemical_Engineering/ch8.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Introduction_To_Chemical_Engineering/ch8.ipynb')
-rw-r--r--Introduction_To_Chemical_Engineering/ch8.ipynb472
1 files changed, 472 insertions, 0 deletions
diff --git a/Introduction_To_Chemical_Engineering/ch8.ipynb b/Introduction_To_Chemical_Engineering/ch8.ipynb
new file mode 100644
index 00000000..a18b8152
--- /dev/null
+++ b/Introduction_To_Chemical_Engineering/ch8.ipynb
@@ -0,0 +1,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": {}
+ }
+ ]
+} \ No newline at end of file