{ "metadata": { "name": "", "signature": "sha256:140795a2dc739119552fbce01ad304d2882d8bdd1339a30f3767fc2e9c80a840" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 7: Energy and Energy Balances" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.2-1, page no. 318" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "ID=2.0 #cm\n", "Vdot=2.0 #m^3/h\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "u=Vdot*100*100 /(math.pi*math.pow(ID/2,2) *3600)\n", "mdot=Vdot*math.pow(10,3) /3600.\n", "Ek=mdot*math.pow(u,2) /2\n", "print '%s %.3f' %(\" \\n Ek (J/s) = \",Ek)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " Ek (J/s) = 0.869\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 7.2-2, page no. 318" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "g=9.81 #m/s^2\n", "mdot=15.0 #Kg/s\n", "z2=20.0 #m\n", "z1=-220. #m\n", "\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "Power=mdot*g*(z2-z1)\n", "print '%s %d' %(\" \\n Power (J/s) = \",Power)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " Power (J/s) = 35316\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 7.3-1, page no. 319" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initilization of variables\n", "Q1=2. #Kcal\n", "Ek1=0#System is stationary\n", "Ep1=0#No vertical displacement\n", "W1=0#No moving boundaries\n", "deltaU1=Q1-W1-Ek1-Ep1\n", "deltaU1J=deltaU1*1000./0.23901 \n", "print '%s %.2f' %(\"Energy gained by the gas in going from 25C to 100C is (J)\",deltaU1J)\n", "W2=100. #J\n", "Ek2=0 #The system is stationary at the initial and final states\n", "Ep2=0#Assumed negligible by hypothesis\n", "deltaU2=0#U depends only on T for an ideal gas and T doesn't change\n", "Q2=deltaU2+W2+Ek2+Ep2\n", "print '%s %.1f' %(\"Heat transferred to the gas while it expands and reequilibrates at 100C is (J)\",Q2)\n", "raw_input(\"Press the Enter key to quit\")" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Energy gained by the gas in going from 25C to 100C is (J) 8367.85\n", "Heat transferred to the gas while it expands and reequilibrates at 100C is (J) 100.0\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "Press the Enter key to quit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "text": [ "''" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.4-1, page no. 322" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "U=3800.0 #J/mol\n", "P=1.0 #atm\n", "Vcap=24.63 #L/mol\n", "ndot=250.0 #Kmol/h\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "Hcap=U+P*Vcap*101.3\n", "H=ndot*Hcap*math.pow(10,3)\n", "print '%s %d' %(\" \\n Specific Enthalpy (J/mol) = \",Hcap)\n", "print '%s %.3E' %(\"\\n Enthalpy of Helium (J/h) = \",H)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " Specific Enthalpy (J/mol) = 6295\n", "\n", " Enthalpy of Helium (J/h) = 1.574E+09\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 7.4-2, page no. 324" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "mdot=500.0/3600.#Kg/s\n", "u1=60.0 #m/s\n", "u2=360.0 #m/s\n", "deltaZ=-5. #m\n", "g=9.81 #m/s^2\n", "Qdot= -10000.#Kcal/h\n", "Ws=70.0 #KW\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "Ek=mdot*math.pow(10,-3)*(math.pow(u2,2)-math.pow(u1,2))/2\n", "Ep=mdot*g*deltaZ/math.pow(10,3)\n", "Qdot=Qdot/(0.239*3600.)\n", "Hdot=Qdot-Ws-Ek-Ep\n", "print '%s %f' %(\" \\n DeltaH (KW) = \",Hdot)\n", "Hcap=Hdot/mdot\n", "print '%s %f' %(\"\\n Specific Enthalpy (Kj/Kg) = \",Hcap)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " DeltaH (KW) = -90.365689\n", "\n", " Specific Enthalpy (Kj/Kg) = -650.632958\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 7.5-1, page no. 326" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "H0=196.23 #Btu/lbm\n", "H50=202.28 #Btu/lbm\n", "Pfinal=51.99 #psia\n", "Pinitial=18.90 #psia\n", "Vfinal=1.920 #ft^3/lbm\n", "Vinitial=4.969 #ft^3/lbm\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "deltaH=H0-H50\n", "deltaU=deltaH+((Pfinal*Vfinal-Pinitial*Vinitial)*1.987/10.73)\n", "print '%s %.3f' %(\" \\n change in Specific Enthalpy (Btu/lbm) = \",deltaH)\n", "print '%s %.3f' %(\" \\n change in Specific Internal Energy (Btu/lbm) = \",deltaU)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " change in Specific Enthalpy (Btu/lbm) = -6.050\n", " \n", " change in Specific Internal Energy (Btu/lbm) = -4.956\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 7.5-3, page no. 329" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "mdot=2000.0 #Kg/h\n", "P=10.0 #bar\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "print(\"From Steam tables, \")\n", "Hin=3201. #Kj/Kg\n", "Hout=2675. #Kj/Kg\n", "Ws= -mdot*(Hout-Hin)/3600.\n", "print '%s %d' %(\"Work delivered by Turbine to surroundings (Kw) = \",Ws)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", "From Steam tables, \n", "Work delivered by Turbine to surroundings (Kw) = 292\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 7.6-1, page no. 330" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "m1=120.0 #kg\n", "m2=175.0 #kg\n", "m3=295.0 #kg\n", "ID=6.0 #cm\n", "P=17.0 #bar\n", "H1=125.7 #Kj/Kg\n", "H2=271.9 #Kj/Kg\n", "H3=2793.0 #Kj/kg\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "deltaH=m3*H3-m1*H1-m2*H2\n", "print(\"From tables, Vdot=0.1166 m^3/kg\")\n", "Vdot=0.1166 \n", "A=math.pi*math.pow(ID/2,2) /math.pow(10,4)\n", "u=m3*Vdot/(A*60)\n", "Ek=m3*math.pow(u,2) /(2*math.pow(10,3))\n", "Qdot=deltaH+Ek\n", "print '%s %.3E' %(\"Heat required (Kj/min) = \",Qdot)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", "From tables, Vdot=0.1166 m^3/kg\n", "Heat required (Kj/min) = 7.673E+05\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 10, "text": [ "''" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.6-2, page no. 331" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "basis=1.0 #Kg/s\n", "x=0.6 #ethane\n", "T1=150.0 #K\n", "T2=250.0 #K\n", "P=5.0 #bar\n", "Hout1=434.5 #KJ/Kg\n", "Hout2=130.2 #KJ/Kg\n", "Hin1=314.3 #KJ/Kg\n", "Hin2=30.0 #KJ/Kg\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "Qdot=basis*(x*Hout1+(1-x)*Hout2-x*Hin1-(1-x)*Hin2)\n", "print '%s %.3f' %(\" \\n Heat required (KJ/Kg) = \",Qdot/basis)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " Heat required (KJ/Kg) = 112.200\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 11, "text": [ "''" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.6-3, page no. 332" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "m3=1150.0 #Kg/h\n", "H3=2676.0 #KJ/Kg\n", "H2=3074.0 #KJ/Kg\n", "H1=3278.0 #KJ/Kg\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "print(\"Mass balance on Water,\")\n", "print(\"m3+m1=m2\")\n", "print(\"Energy balance,\")\n", "print(\"m3*H3+m1*H1=m2*H2\")\n", "A=([[1,-1],[H2,-H1]])\n", "b=([[m3],[m3*H3]])\n", "C=numpy.dot(linalg.inv(A),b)\n", "#here we solved two linear equations simultaneously.\n", "m2=C[0,0]\n", "m1=C[1,0]\n", "print '%s %.3f' %(\" Input flowrate,m1 (Kg/h) = \",m1)\n", "print '%s %.3f' %(\" \\n Output flowrate, m2 (Kg/h) = \",m2)\n", "print(\"From tables,Vdot=3.11 m^3/Kg\")\n", "Vdot=3.11\n", "print '%s %.3f' %(\" Volumetric input flowrate (m^3/h) = \",m1*Vdot)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", "Mass balance on Water,\n", "m3+m1=m2\n", "Energy balance,\n", "m3*H3+m1*H1=m2*H2\n", " Input flowrate,m1 (Kg/h) = 2243.627\n", " \n", " Output flowrate, m2 (Kg/h) = 3393.627\n", "From tables,Vdot=3.11 m^3/Kg\n", " Volumetric input flowrate (m^3/h) = 6977.681\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 7.7-1, page no. 334" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "Vdot=20.0 #L/min\n", "P2=1.01325*100000. #atm\n", "ID1=0.5 #cm\n", "ID2=1.0 #cm\n", "g=9.81 #m/s^2\n", "deltaZ=50.0 #m\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "u1=Vdot*math.pow(10,4) /(math.pow(10,3) *60*math.pi*math.pow(ID1/(2),2))\n", "u2=Vdot*math.pow(10,4) /(math.pow(10,3) *60*math.pi*math.pow(ID2/(2),2))\n", "deltaP=-((u2*u2-u1*u1)/2 +g*deltaZ)*1000.\n", "P1=P2-deltaP\n", "print '%s %.3f' %(\" \\n P1 (Pa) = \",P1)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " P1 (Pa) = 456730.088\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 13, "text": [ "''" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.7-2, page no. 335" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "deltaZ= -2.5 #ft\n", "u1=0.0\n", "D=50.0 #lbm/ft^3\n", "F=0.80 #ft.lbf/lbm\n", "V=5.0 #gal\n", "g=32.174 #ft/s^2\n", "ID=0.25 #in\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "u2=math.sqrt(2*32.174*(-F-g*deltaZ/32.174))\n", "Vdot=u2*math.pi*math.pow(ID/(2),2) /144.\n", "t=V*0.1337/(Vdot*60.)\n", "print '%s %.3f' %(\"Total time taken (min) = \",t)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", "Total time taken (min) = 3.125\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 7.7-3, page no. 336" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "\n", "Ws=1000000. #N.m/s\n", "deltaP= -83.*1000. #N/m^2\n", "g=9.81 #m/s^2\n", "deltaZ= -103 #m\n", "D=1000. #kg/m^3\n", "\n", "#Calculations and printing :\n", "\n", "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n", "mdot= -Ws/(deltaP/D + g*deltaZ)\n", "print'%s %.3f' %(\" \\n Water flow rate (kg/s) = \",mdot)\n", "raw_input('press enter key to exit')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n", " \n", " Water flow rate (kg/s) = 914.553\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "press enter key to exit\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 15, "text": [ "''" ] } ], "prompt_number": 15 } ], "metadata": {} } ] }