diff options
author | Jovina Dsouza | 2014-06-18 12:43:07 +0530 |
---|---|---|
committer | Jovina Dsouza | 2014-06-18 12:43:07 +0530 |
commit | 206d0358703aa05d5d7315900fe1d054c2817ddc (patch) | |
tree | f2403e29f3aded0caf7a2434ea50dd507f6545e2 /Introduction_To_Chemical_Engineering/ch4.ipynb | |
parent | c6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff) | |
download | Python-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/ch4.ipynb')
-rw-r--r-- | Introduction_To_Chemical_Engineering/ch4.ipynb | 916 |
1 files changed, 916 insertions, 0 deletions
diff --git a/Introduction_To_Chemical_Engineering/ch4.ipynb b/Introduction_To_Chemical_Engineering/ch4.ipynb new file mode 100644 index 00000000..4c312cd2 --- /dev/null +++ b/Introduction_To_Chemical_Engineering/ch4.ipynb @@ -0,0 +1,916 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : Flow Of Fluids" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.1 page number 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find water compressibility\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "delta_p=70.; #in bar\n", + "Et=20680. #in bar\n", + "\n", + "# Calculations\n", + "compressibility = delta_p/Et;\n", + "\n", + "# Results\n", + "print \"compressibilty of water = %f\"%(compressibility)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "compressibilty of water = 0.003385\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.3 page number 128\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the viscosity of oil\n", + "\n", + "import math \n", + "# Variables\n", + "F=0.5*9.8; #in N\n", + "A=3.14*0.05*0.15; #in m2\n", + "\n", + "# Calculations and Results\n", + "shear_stress=F/A; #in Pa\n", + "print \"shear_stress = %f Pa\"%(shear_stress)\n", + "\n", + "velocity_distribution =0.1/(0.05*10**-3);\n", + "viscosity=shear_stress/velocity_distribution;\n", + "print \"viscosity = %f Pa-s\"%(viscosity) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "shear_stress = 208.067941 Pa\n", + "viscosity = 0.104034 Pa-s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.5 page number 133\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find variation of losses with velocity\n", + "\n", + "import math \n", + "# Variables\n", + "loss_ratio=3.6; #delta_P2/delta_P1=3.6\n", + "velocity_ratio=2.; #u2/u1=2\n", + "\n", + "# Calculations\n", + "n=math.log(loss_ratio,2); #delta_P2/delta_P1=(u2/u1)**n\n", + "\n", + "# Results\n", + "print \"power constant = %f flow is turbulent\"%(n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power constant = 1.847997 flow is turbulent\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.8 page number 137\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the boundary layer properties\n", + "\n", + "import math \n", + "print ('part 1')\n", + "\n", + "# Variables\n", + "x=0.05 #in m\n", + "density=1000. #in kg/m3\n", + "\n", + "# Calculations and Results\n", + "viscosity=1.*10**-3 #in Pa-s\n", + "u=1. #in m/s\n", + "Re=(density*u*x)/viscosity;\n", + "\n", + "print \"Reynolds Number = %f\"%(Re)\n", + "\n", + "thickness=4.65*x*(Re)**-0.5;\n", + "print \"boundary layer thickness = %f m\"%(thickness)\n", + "\n", + "print ('part 2')\n", + "Re_x=3.2*10**5;\n", + "x_cr=(Re_x*viscosity)/(density*u);\n", + "print \"transition takes place at x = %f m\"%(x_cr) \n", + "\n", + "print ('part 3')\n", + "x=0.5 #in m\n", + "Re=(density*u*x)/viscosity;\n", + "thickness=0.367*x*(Re)**-0.2;\n", + "print \"boundary layer thickness= %f m\"%(thickness)\n", + "\n", + "t_sublayer=71.5*x*(Re)**-0.9;\n", + "print \"sub layer thickness= %f m\"%(t_sublayer)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "part 1\n", + "Reynolds Number = 50000.000000\n", + "boundary layer thickness = 0.001040 m\n", + "part 2\n", + "transition takes place at x = 0.320000 m\n", + "part 3\n", + "boundary layer thickness= 0.013300 m\n", + "sub layer thickness= 0.000266 m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.9 page number 138\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the flow properties\n", + "\n", + "import math \n", + "# Variables\n", + "d1=0.05 #in m\n", + "A1=(3.14*d1**2)/4.;\n", + "density_1=2.1 #in kg/m3\n", + "u1=15. #in m/s\n", + "P1=1.8; #in bar\n", + "P2=1.3; #in bar\n", + "\n", + "# Calculations and Results\n", + "w=density_1*A1*u1;\n", + "density_2=density_1*(P2/P1);\n", + "print \"density at section 2 = %f kg/cubic meter\"%(density_2)\n", + "\n", + "u2=u1*(density_1/density_2)*(0.05/0.075)**2;\n", + "print \"velocity at section 2 = %f m/s\"%(u2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "density at section 2 = 1.516667 kg/cubic meter\n", + "velocity at section 2 = 9.230769 m/s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.10 page number 139\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the temperature increase\n", + "\n", + "import math \n", + "# Variables\n", + "Q=0.001*10**5 #in J/s\n", + "w=0.001*1000 #in kg/s\n", + "density=1000. #in kg/m3\n", + "cp=4.19*10**3 #in J/kg K\n", + "\n", + "# Calculations\n", + "delta_T=Q/(w*cp);\n", + "\n", + "# Results\n", + "print \"Temperature increase = %f degree celcius\"%(delta_T)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature increase = 0.023866 degree celcius\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.11 page number 142\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the pressure\n", + "\n", + "import math \n", + "# Variables\n", + "u1=0; #in m/s\n", + "ws=0;\n", + "P1=0.7*10**5 #in Pa\n", + "P3=0\n", + "density=1000 #in kg/m3\n", + "\n", + "# Calculations and Results\n", + "u3=((2*(P1-P3))/density)**0.5;\n", + "print \"u3 = %f m/s\"%(u3)\n", + "\n", + "ratio_area=0.5;\n", + "u2=u3/ratio_area;\n", + "print \"u2 = %f m/s\"%(u2)\n", + "\n", + "#applying bernoulli's equation\n", + "P2=1.7*10**5-((density*u2**2)/2)\n", + "print \"P2 = %f Pa\"%(P2)\n", + "print \"this flow is physically unreal\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "u3 = 11.832160 m/s\n", + "u2 = 23.664319 m/s\n", + "P2 = -110000.000000 Pa\n", + "this flow is physically unreal\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.12 page number 143\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the power requirements\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "Q=3800./(24*3600) #in m3/s\n", + "d=0.202 #in m\n", + "\n", + "# Calculations\n", + "u=Q/((3.14/4)*d**2); #in m/s\n", + "delta_P=5.3*10**6 #in Pa\n", + "density=897. #in kg/m3\n", + "F=delta_P/density; #in J/kg\n", + "ws=9.8*30+F;\n", + "mass_flow_rate= Q*density;\n", + "power=(ws*mass_flow_rate)/0.6;\n", + "\n", + "# Results\n", + "print \"power required = %f kW\"%(power/1000)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power required = 407.834267 kW\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.13 page number 146\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the tube length\n", + "\n", + "import math \n", + "# Variables\n", + "density=1000 #in kg/m3\n", + "viscosity=1*10**-3 #in Pa s\n", + "P=100*1000 #in Pa\n", + "\n", + "# Calculations and Results\n", + "vdP=P/density;\n", + "\n", + "Q=2.5*10**-3/(24*3600)\n", + "A=3.14*(0.0005)**2/4;\n", + "u=Q/A;\n", + "print \"u = %f m/s\"%(u)\n", + "\n", + "Re=density*u*0.0005/viscosity;\n", + "print \"Re = %f\"%(Re)\n", + "\n", + "#F=18.86*L\n", + "L=(-u**2+vdP)/18.86;\n", + "print \"L = %f m\"%(L)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "u = 0.147440 m/s\n", + "Re = 73.720217\n", + "L = 5.301074 m\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.14 page number 151\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the discharge pressure\n", + "\n", + "import math \n", + "# Variables\n", + "d=0.025 #in m\n", + "u=3. #in m/s\n", + "density=894. #in kg/m3\n", + "viscosity=6.2*10**4 #in Pa-s\n", + "\n", + "# Calculations and Results\n", + "Re=(u*d*density)/viscosity;\n", + "f=0.0045;\n", + "L=50.;\n", + "\n", + "delta_P=2*f*density*u**2*(L/d)\n", + "print \"frictional head loss = %f kPa\"%(delta_P/1000)\n", + "\n", + "required_P=25*density*9.8;\n", + "total_head=delta_P+required_P;\n", + "print \"total pressure head = %f bar\"%(total_head/10**5)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frictional head loss = 144.828000 kPa\n", + "total pressure head = 3.638580 bar\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.15 page number 152\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the level difference\n", + "\n", + "import math \n", + "# Variables\n", + "Q=0.8*10**-3; #in m3/s\n", + "d=0.026 #in m\n", + "A=(3.14*(d**2))/4 #in m2\n", + "\n", + "# Calculations\n", + "u=Q/A; #in m/s\n", + "density=800 #in kg/m3\n", + "viscosity=0.0005 #in Pa-s\n", + "\n", + "Re=(u*density*d)/viscosity;\n", + "f=0.079*(Re)**-0.25;\n", + "L=60\n", + "h_f=2*f*((u**2)/9.8)*(L/d);\n", + "\n", + "# Results\n", + "print \"level difference = %f m\"%(h_f)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "level difference = 5.343360 m\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.16 page number 153\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the engery cost\n", + "\n", + "import math \n", + "# Variables\n", + "delta_z=50; #in m\n", + "L=290.36 #in m\n", + "d=0.18 #in m\n", + "Q=0.05 #in m3/s\n", + "\n", + "# Calculations\n", + "A=(3.14*d**2)/4; #in m2\n", + "u=Q/A; #in m/s\n", + "density=1180; #in kg/m3\n", + "viscosity=0.0012 #in Pa-s\n", + "Re=u*density*d/viscosity;\n", + "\n", + "f=0.004;\n", + "sigma_F=2*f*u**2*L/d;\n", + "ws=((9.8*50)+sigma_F)/0.6;\n", + "mass_flow_rate=Q*density; #in Kg/s\n", + "power=mass_flow_rate*ws/1000; #in KW\n", + "energy_cost=power*24*0.8;\n", + "\n", + "# Results\n", + "print \"Energy cost = Rs %f\"%(energy_cost)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy cost = Rs 1019.280105\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.17 page number 154\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the pressure loss\n", + "\n", + "import math \n", + "# Variables\n", + "density=998 #in kg/m3\n", + "viscosity=0.0008 #in Pa-s\n", + "d=0.03 #in m\n", + "u=1.2 #in m/s\n", + "\n", + "# Calculations\n", + "Re=density*d*u/viscosity;\n", + "\n", + "f=0.0088;\n", + "D=1 #in m\n", + "N=10\n", + "L=3.14*D*N;\n", + "delta_P=(2*f*u**2*L)/d; #in Pa\n", + "delta_P_coil=delta_P*(1+(3.54*(d/D)));\n", + "\n", + "# Results\n", + "print \"frictional pressure drop = %f kPa\"%(delta_P_coil)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frictional pressure drop = 29.343858 kPa\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.18 page number 154\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find pressure drop per unit length\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "b=0.050 #in m\n", + "a=0.025 #in m\n", + "d_eq=b-a #in m\n", + "density=1000 #in kg/m3\n", + "u=3 #in m/s\n", + "viscosity = 0.001\n", + "\n", + "# Calculations\n", + "Re=d_eq*u*density/viscosity;\n", + "\n", + "e=40*10**6 #in m\n", + "f=0.0062;\n", + "P_perunit_length=2*f*density*u**2/d_eq; #in Pa/m\n", + "\n", + "# Results\n", + "print \"pressure per unit length = %f Pa/m\"%(P_perunit_length)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure per unit length = 4464.000000 Pa/m\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.19 page number 155\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the flow rate\n", + "\n", + "import math \n", + "# Variables\n", + "d = 0.3 #in m\n", + "u = 17.63 #avg velocity in m/s\n", + "\n", + "# Calculations\n", + "q = (3.14/4)*d**2*u;\n", + "\n", + "# Results\n", + "print \"volumetric flow rate = %f cubic meter per second\"%(q)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate = 1.245559 cubic meter per second\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.20 page number 156\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the size of pipe required\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 0.15 #in m\n", + "\n", + "# Calculations\n", + "u = (0.0191/0.15**2); #in m/s\n", + "q = (3.14/4)*d**2*u;\n", + "\n", + "# Results\n", + "print \"volumetric flow rate = %f cubic meter/s\"%(q)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate = 0.014994 cubic meter/s\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.21 page number 160\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the pressure gradient\n", + "\n", + "import math \n", + "# Variables\n", + "Q=0.0003 #in m3/s\n", + "d=0.05 #in m\n", + "A=(3.14*d**2)/4;\n", + "\n", + "# Calculations\n", + "u=Q/A;\n", + "\n", + "density=1000; #in kg/m3\n", + "viscosity=0.001; #in Pa-s\n", + "e=0.3;\n", + "dp=0.00125; #particle diameter in m\n", + "\n", + "Re=(dp*u*density)/(viscosity*(1-e));\n", + "fm=(150/Re)+1.75;\n", + "L=0.5 #in m\n", + "delta_Pf=fm*((density*L*u**2)/dp)*((1-e)/e**3); #in Pa\n", + "\n", + "#applying bernoulli's equation, we get\n", + "delta_P=delta_Pf-(density*9.8*L);\n", + "pressure_gradient=delta_P/(L*1000); #in kPa/m\n", + "\n", + "# Results\n", + "print \"required pressure gradient = %f kPa/m of packed height\"%(pressure_gradient)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "required pressure gradient = 1104.702008 kPa/m of packed height\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.22 page number 163\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find minimum fluidization velocity\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "d=120*10**-6 #in m\n", + "density=2500 #particle density in kg/m3\n", + "e_min=0.45;\n", + "density_water=1000 #in kg/m3\n", + "\n", + "# Calculations and Results\n", + "viscosity=0.9*10**-3; #in Pa-s\n", + "umf=(d**2*(density-density_water)*9.8*e_min**3)/(150*viscosity*(1-e_min));\n", + "print \"minimum fludization velocity = %f m/s\"%(umf)\n", + "\n", + "Re_mf=(d*umf*density_water)/(viscosity*(1-e_min));\n", + "\n", + "\n", + "#given that uo/umf=10\n", + "def F(e):\n", + " return e**3+1.657*e-1.675;\n", + "\n", + "#initial guess\n", + "x = 10.;\n", + "e = fsolve(F,x)\n", + "\n", + "print \"e = %f\"%(e)\n", + "length_ratio=(1-e_min)/(1-e);\n", + "print \"ratio of heights = %f\"%(length_ratio)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum fludization velocity = 0.000260 m/s\n", + "e = 0.753096\n", + "ratio of heights = 2.227583\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.23 page number 167\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#to find the power requirements\n", + "\n", + "import math \n", + "# Variables\n", + "P=9807. #in Pa\n", + "density=1000. #in kg/m3\n", + "Q=250./(60.*density)\n", + "head=25. #in m\n", + "\n", + "# Calculations\n", + "w= head*Q*P; #in kW\n", + "power_delivered=w/0.65;\n", + "power_taken=power_delivered/0.9;\n", + "\n", + "# Results\n", + "print \"power_delivered = %f kW\"%(power_delivered/1000)\n", + "print \"power taken by motor = %f kW\"%(power_taken/1000)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power_delivered = 1.571635 kW\n", + "power taken by motor = 1.746261 kW\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |