{ "metadata": { "name": "", "signature": "sha256:9d66b3fe8b5c5765d2f891791ade4779b402bd1eb1946b5f370c5174c61892cb" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3: Processes and Process Variables" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.1-1, page no. 44" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "mass=215.0 #kg\n", "\n", "#Calculations and printing :\n", "\n", "density=13.546*62.43\n", "print '%s %.2f' %(\"density of mercury (lbm/ft^3) = \",density)\n", "#the multiplication factor is to convert density from gm/cc to lbm/ft^3.\n", "volume=mass/(.454*density) #ft^3\n", "#the division by 0.454 is to convert mass in kg to lbm.\n", "print '%s %.2f %s %.2f' %(\" \\n The volume of \",mass,\"kg of mercury is(ft^3) = \",volume)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "density of mercury (lbm/ft^3) = 845.68\n", " \n", " The volume of 215.00 kg of mercury is(ft^3) = 0.56\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 1, "text": [ "''" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.1-2, page no. 45" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "T1=20.0 # \u02daC\n", "T2=100.0 # \u02daC\n", "Vat20=0.560 #ft^3\n", "D=0.0208333 #ft\n", "\n", "#Calculations and printing :\n", "\n", "print(\"we know that V(T)=Vo[1+0.math.pow(18182x10,()-3)xT +0.math.pow(0078x10,()-6)xTxT]\")\n", "Vat0=Vat20/(1+0.18182*math.pow(10,-3)*T1 +0.0078*math.pow(10,-6)*T1*T1)\n", "#the function is defined with the variable as temperature\n", "def volume(T):\n", " volume=Vat0*(1+0.18182* math.pow(10,-3) *T +0.0078* math.pow(10,-6) *T*T)\n", " return volume\n", "\n", "print '%s %.3f' %(\" vat20 (ft^3) = \",volume(T1))\n", "print '%s %.3f' %(\" \\n vat100 (ft^3) =\",volume(T2))\n", "change=((volume(T2))-(volume(T1)))*4/(math.pi*D*D)\n", "print '%s %.3f' %(\" \\n change in the height of mercury level (ft) = \",change)\n", "#the answer is a bit different due to rounding off of volume(T2) in textbook\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "we know that V(T)=Vo[1+0.math.pow(18182x10,()-3)xT +0.math.pow(0078x10,()-6)xTxT]\n", " vat20 (ft^3) = 0.560\n", " \n", " vat100 (ft^3) = 0.568\n", " \n", " change in the height of mercury level (ft) = 23.931\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "''" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3-1, page no. 48" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "mass=100.0 #g of CO2\n", "M=44.01 #molecular weight\n", "\n", "#Calculations and print '%s %.3f' %ing :\n", "\n", "moles=mass/M\n", "print '%s %.3f' %(\"\\n no.of moles=\",moles)\n", "lbmole=moles/453.6\n", "print '%s %.3f' %(\"\\n no.of lb moles=\",lbmole)\n", "Cmoles=moles\n", "print '%s %.3f' %(\"\\n no.of moles of carbon=\",Cmoles)\n", "Omoles=2*moles\n", "print '%s %.3f' %(\"\\n no.of moles of oxygen=\",Omoles)\n", "O2moles=moles\n", "print '%s %.3f' %(\"\\n no.of moles of dioxygen=\",O2moles)\n", "gramsO=Omoles*16\n", "print '%s %.3f' %(\"\\n no.of grams of oxygen=\",gramsO)\n", "gramsO2=O2moles*32\n", "print '%s %.3f' %(\"\\n no.of grams of oxygen=\",gramsO2)\n", "moleculesCO2=moles*6.02*math.pow(10,(23))\n", "print '%s %.3E' %(\"\\n no.of molecules of CO2 =\",moleculesCO2)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", " no.of moles= 2.272\n", "\n", " no.of lb moles= 0.005\n", "\n", " no.of moles of carbon= 2.272\n", "\n", " no.of moles of oxygen= 4.544\n", "\n", " no.of moles of dioxygen= 2.272\n", "\n", " no.of grams of oxygen= 72.711\n", "\n", " no.of grams of oxygen= 72.711\n", "\n", " no.of molecules of CO2 = 1.368E+24\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "text": [ "''" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3-2, page no. 50" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "xA=0.15 #mass fraction\n", "yB=0.20 #mole fraction\n", "mass=175.0 #kg of solution\n", "flowrate1=53.0 #lbm/h\n", "flowrate2=1000.0 #mol/min\n", "massofA=300.0 #lbm\n", "molarB=28.0 #kmolB/s\n", "\n", "#Calculations and printing :\n", "\n", "massA=mass*xA\n", "print '%s %d %s %.3f'%(\" \\n Mass of A in\",mass,\" kg of solution (kg A) =\",massA)\n", "flowrateA=flowrate1*xA\n", "print '%s %d %s %.3f'%(\" \\n Mass flow rate of A in a stream flowing at\",flowrate1,\" lbm/h (lbm A/h)=\",flowrateA )\n", "flowrateB=flowrate2*yB\n", "print '%s %d %s %.3f'%(\" \\n Molar flowrate of B in a stream flowing at\",flowrate2,\" mol/min (molB/min)= \",flowrateB)\n", "Totalflowrate=molarB/yB\n", "print '%s %d %s %.3f'%(\" \\n Total flow rate of a solution with\",molarB,\"kmolB/s=\",Totalflowrate)\n", "MassSolution=massofA/xA\n", "print '%s %d %s %.3f'%(\" \\n Mass of solution that contains\",massofA,\" lbm of A =\",MassSolution)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " \n", " Mass of A in 175 kg of solution (kg A) = 26.250\n", " \n", " Mass flow rate of A in a stream flowing at 53 lbm/h (lbm A/h)= 7.950\n", " \n", " Molar flowrate of B in a stream flowing at 1000 mol/min (molB/min)= 200.000\n", " \n", " Total flow rate of a solution with 28 kmolB/s= 140.000\n", " \n", " Mass of solution that contains 300 lbm of A = 2000.000\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 4, "text": [ "''" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3-3, page no. 50" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "#let the total mass be 100\n", "massO2=16.0\n", "massCO=4.0\n", "massCO2=17.0\n", "massN2=63.0\n", "MO2=32.0\n", "MCO=28.0\n", "MCO2=44.0\n", "MN2=28.0\n", "\n", "#Calculations and print '%s %.3f' %ing :\n", "\n", "molO2=massO2/MO2\n", "molCO=massCO/MCO\n", "molCO2=massCO2/MCO2\n", "molN2=massN2/MN2\n", "TotalMol=molO2+molCO+molCO2+molN2\n", "print '%s %.3f' %(\" \\n molefraction of O2=\",molO2/TotalMol)\n", "print '%s %.3f' %(\" \\n molefraction of CO=\",molCO/TotalMol)\n", "print '%s %.3f' %(\" \\n molefraction of CO2=\",molCO2/TotalMol)\n", "print '%s %.3f' %(\" \\n molefraction of N2=\",molN2/TotalMol)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " \n", " molefraction of O2= 0.152\n", " \n", " molefraction of CO= 0.044\n", " \n", " molefraction of CO2= 0.118\n", " \n", " molefraction of N2= 0.686\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 5, "text": [ "''" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3-4, page no. 51" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "yN2=0.79\n", "MN2=28.0 #g/mol\n", "MO2=32.0 g/mol\n", "xN2=0.767\n", "\n", "#Calculations and printing :\n", "\n", "Mbar=yN2*MN2+(1-yN2)*MO2\n", "print '%s %.3f' %(\" \\n average molecular weight of air from molar composition (g/mol) = \",Mbar)\n", "InvMbar=xN2/28 + (1-xN2)/32\n", "print '%s %.3f' %(\" \\n average molecular weight of air from mass composition (g/mol) = \",1./InvMbar)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " \n", " average molecular weight of air from molar composition (g/mol) = 28.840\n", " \n", " average molecular weight of air from mass composition (g/mol) = 28.840\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 6, "text": [ "''" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3-5, page no. 52" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "conc=0.5 #molar\n", "rate=1.25 #m^3/min\n", "D=1.03 #no units\n", "M=98.0\n", "\n", "#Calculations and print '%s %.3f' %ing :\n", "\n", "mass_conc=conc*98.\n", "print '%s %.3f' %(\"mass concentration of sulfuric acid (kg/m^3) = \",mass_conc)\n", "mass_flowrate=rate*mass_conc/60.\n", "print '%s %.3f' %(\" \\n Mass flow rate of sulfuric acid (kg/s) = \",mass_flowrate)\n", "massfraction=1/(rate*D*1000/60)\n", "print '%s %.3f' %(\" \\n Mass fraction of sulfuric acid=\",massfraction)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "mass concentration of sulfuric acid (kg/m^3) = 49.000\n", " \n", " Mass flow rate of sulfuric acid (kg/s) = 1.021\n", " \n", " Mass fraction of sulfuric acid= 0.047\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "''" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.4-1, page no. 55" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "Pressure=2.00*100000. #Pa\n", "\n", "#Calculations and printing :\n", "\n", "Pressure=Pressure*1000./(13600.*9.807)\n", "print '%s %.3E' %(\"Pressure (mm of Hg) = \",Pressure)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure (mm of Hg) = 1.500E+03\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 9, "text": [ "''" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.4-2, page no. 55" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "P0=10.4*1.013*100000. /10.33 #m H2O\n", "D=1000.0 #kg/m^3\n", "g=9.807 #m/s^2\n", "h=30.0 #m\n", "\n", "#Calculations and printing :\n", "\n", "Ph=P0+D*g*h\n", "print '%s %.3E' %(\"Pressure at the bottom of the lake (N/m^2) = \",Ph)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure at the bottom of the lake (N/m^2) = 3.962E+05\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 12, "text": [ "''" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.4-3, page no. 59" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initilization of variables\n", "import math\n", "spg=1.05\n", "h1=382. #mm of fluid\n", "h2=374. #mm of fluid\n", "reading= -2 #in of Hg\n", "Patm=30. #in of Hg\n", "#Calculations and printing:\n", "deltaP=(spg-1)*980.7*(h1-h2)/10.\n", "print '%s %.1f' %(\"Pressure drop between points 1 and 2 (dynes/cm^2) = \",deltaP)\n", "P1=Patm+reading\n", "print '%s %.1f' %(\"\\n Absolute Pressure (in Hg) = \",P1)\n", "raw_input(\"Press the Enter key to quit\")" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure drop between points 1 and 2 (dynes/cm^2) = 39.2\n", "\n", " Absolute Pressure (in Hg) = 28.0\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "Press the Enter key to quit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 13, "text": [ "''" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.5-2, page no. 62" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "T1=20.0 #F\n", "T2=80.0 #F\n", "\n", "#Calculations and printing :\n", "\n", "#In this code I used a function to achieve the conversion\n", "def conversion(fahrenheit):\n", " conversion=(fahrenheit-32)/1.8\n", " return conversion;\n", "\n", "difference=conversion(T2)-conversion(T1)\n", "print '%s %.2f %s %.2f' %(\"Equivalent temperature of\",T2-T1,\" temperature in C =\",difference)\n", "deltaTF=T2-T1\n", "deltaTC=deltaTF/1.8\n", "print '%s %.2f' %(\" \\n By second method, result=\",deltaTC)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Equivalent temperature of 60.00 temperature in C = 33.33\n", " \n", " By second method, result= 33.33\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 14, "text": [ "''" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.5-3, page no. 63" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initilization of variables\n", "import math\n", "a=0.487\n", "b=2.29*math.pow(10, -4)\n", "print '%s %.2f %s %.1E %s' %(\"Given Cp(Btu/lbm.F) = \",a,\"+\",b,\"T (F)\")\n", "print(\"\\n Step 1\")\n", "af1=a+b*32\n", "bf1=b*1.8\n", "print(\"\\n Step 2\")\n", "af2=af1*1.8/(454*9.486*math.pow(10, -4))\n", "bf2=bf1*1.8/(454*9.486*math.pow(10, -4))\n", "print '%s %.2f %s %.1E %s' %(\"Final Cp(J/g.C) = \",af2,\"+\",bf2,\"T (C)\")\n", "raw_input(\"Press the Enter key to quit\")" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Given Cp(Btu/lbm.F) = 0.49 + 2.3E-04 T (F)\n", "\n", " Step 1\n", "\n", " Step 2\n", "Final Cp(J/g.C) = 2.07 + 1.7E-03 T (C)\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "Press the Enter key to quit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 15, "text": [ "''" ] } ], "prompt_number": 15 } ], "metadata": {} } ] }