summaryrefslogtreecommitdiff
path: root/Elementary_Principles_of_Chemical_Processes/Chapter9.ipynb
diff options
context:
space:
mode:
authorhardythe12014-08-06 17:26:32 +0530
committerhardythe12014-08-06 17:26:32 +0530
commit98bff1c301dd3b8b14983037a8a483e3eae1796d (patch)
tree1f6a831fd79192d4cbc0c4738c77f8fbf29d0552 /Elementary_Principles_of_Chemical_Processes/Chapter9.ipynb
parent90bb10608fa3697134121eabc32cfae69e7686d8 (diff)
downloadPython-Textbook-Companions-98bff1c301dd3b8b14983037a8a483e3eae1796d.tar.gz
Python-Textbook-Companions-98bff1c301dd3b8b14983037a8a483e3eae1796d.tar.bz2
Python-Textbook-Companions-98bff1c301dd3b8b14983037a8a483e3eae1796d.zip
adding books
Diffstat (limited to 'Elementary_Principles_of_Chemical_Processes/Chapter9.ipynb')
-rwxr-xr-xElementary_Principles_of_Chemical_Processes/Chapter9.ipynb822
1 files changed, 822 insertions, 0 deletions
diff --git a/Elementary_Principles_of_Chemical_Processes/Chapter9.ipynb b/Elementary_Principles_of_Chemical_Processes/Chapter9.ipynb
new file mode 100755
index 00000000..230963f2
--- /dev/null
+++ b/Elementary_Principles_of_Chemical_Processes/Chapter9.ipynb
@@ -0,0 +1,822 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e681b00ee14cb4ba49bab5814ba58d8e293c97db9c72b39fdd9bbdd0d2223049"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9: Balances on Reactive Processes"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9.9-1, page no. 443"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "ndot=2400.0 #mol/s\n",
+ "Hr1= -2878 #Kj/mol\n",
+ "HvWater=44.0 #Kj/mol\n",
+ "HvButane=19.2 #Kj/mol\n",
+ "\n",
+ "#Calculations and print '%s %.3f' %ing :\n",
+ "\n",
+ "print (\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print (\"Part 1\")\n",
+ "E1= ndot/4\n",
+ "deltaH1=E1*Hr1\n",
+ "print '%s %.3E' %(\"enthalpy change (KJ/s) = \",deltaH1)\n",
+ "print (\"part2\")\n",
+ "Hr2=2*Hr1\n",
+ "E2=ndot/8\n",
+ "deltaH2=E2*Hr2\n",
+ "print '%s %.3E' %(\"Enthalpy change (kJ/s) = \",deltaH2)\n",
+ "print (\"part 3\")\n",
+ "Hr3=Hr1+5*HvWater+HvButane\n",
+ "deltaH3=E1*Hr3\n",
+ "print '%s %.3E' %(\"Enthalpy change (kJ/s) = \",deltaH3)\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",
+ "Part 1\n",
+ "enthalpy change (KJ/s) = -1.727E+06\n",
+ "part2\n",
+ "Enthalpy change (kJ/s) = -1.727E+06\n",
+ "part 3\n",
+ "Enthalpy change (kJ/s) = -1.583E+06\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 9.1-2, page no. 445"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "deltaHr= -420.8 #kj/mol\n",
+ "R=8.314\n",
+ "T=298.0 #K\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 reaction, only gaseous are counted\")\n",
+ "left=1+2\n",
+ "right=1+1\n",
+ "deltaUr=deltaHr-R*T*(right-left)/math.pow(10,3)\n",
+ "print '%s %.3f' %(\"deltaUr (KJ/mol) = \",deltaUr)\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 reaction, only gaseous are counted\n",
+ "deltaUr (KJ/mol) = -418.322\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 9.3-1, page no. 447"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "HCO2= -393.5 #KJ/mol\n",
+ "HH2O= -285.84 #KJ/mol\n",
+ "HC5H12= -173. #KJ/mol\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",
+ "Hr=5*HCO2+6*HH2O-HC5H12\n",
+ "print '%s %.3f' %(\" \\n Heat of the rxn (KJ/mol) = \",Hr)\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 of the rxn (KJ/mol) = -3509.540\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 9.4-1, page no. 449"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "Hethane= -1559.9 #Kj/mol\n",
+ "Hethene= -1411 #Kj/mol\n",
+ "Hhydrogen= -285.84 #Kj/mol\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",
+ "Hr=Hethane-Hethene-Hhydrogen\n",
+ "print '%s %.3f' %(\" \\n Heat of the rxn (KJ/mol) = \",Hr)\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 of the rxn (KJ/mol) = 136.940\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 9.5-1, page no. 453"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "import scipy\n",
+ "from scipy import integrate\n",
+ "nNH3=100.0 #mol/s\n",
+ "nO2in=200.0 #mol/s\n",
+ "H1=8.470 #Kj/mol\n",
+ "H3=9.570 #Kj/mol\n",
+ "T1=25.0\n",
+ "T2=300.0\n",
+ "Hr= -904.7 #Kj/mol\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",
+ "def fun(T):\n",
+ " fun=29.50*math.pow(10,-3)+ T*0.8188*math.pow(10,-5) - math.pow(T,2) * 0.2925 *math.pow(10,-8) + math.pow(T,3) * 0.3652 * math.pow(10,-12)\n",
+ " return fun\n",
+ "\n",
+ "H2, err=scipy.integrate.quad(fun,T1,T2) #scipy.integrate.quad is an inbuilt function which can calculate definite integrals\n",
+ "E=nNH3/4.\n",
+ "nO2out=nO2in-nNH3*5./4.\n",
+ "nNO=nNH3\n",
+ "nH2O=nNH3*6./4.\n",
+ "deltaH=E*Hr+(nO2out*H1+nNO*H2+nH2O*H3)\n",
+ "Qdot=deltaH\n",
+ "print '%s %.3f' %(\" \\n Heat Transferred (kW) = \",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",
+ " \n",
+ " Heat Transferred (kW) = -19701.467\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 9.5-2, page no. 454"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "import scipy\n",
+ "from scipy import integrate\n",
+ "\n",
+ "NinMethane=100.0 #mol\n",
+ "NinOxygen=100.0 #mol\n",
+ "NinNitrogen=376.0 #mol\n",
+ "NoutMethane=60.0 #mol\n",
+ "NoutOxygen=50.0 #mol\n",
+ "NoutNitrogen=376.0 #mol\n",
+ "NoutFormal=30.0 #mol\n",
+ "NoutCarbon=10.0 #mol\n",
+ "NoutWater=50.0 #mol\n",
+ "H1= -74.85 #Kj/mol\n",
+ "H2= 2.235 #Kj/mol\n",
+ "H3= 2.187 #Kj/mol\n",
+ "H5=3.758#Kj/mol\n",
+ "H6=3.655 #Kj/mol\n",
+ "H8= -393.5+4.75 #Kj/mol\n",
+ "H9= -241.83+4.27 #Kj/mol\n",
+ "T1=25.0 #C\n",
+ "T2=150.0 #C\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",
+ "def fun1(T):\n",
+ " fun1=34.31*math.pow(10,-3)+ T*5.469*math.pow(10,-5) + math.pow(T,2) * 0.3661 *math.pow(10,-8) - math.pow(T,3) * 11 * math.pow(10,-12)\n",
+ " return fun1\n",
+ "\n",
+ "HoutMethane, err=scipy.integrate.quad(fun1,T1,T2)\n",
+ "H4= -74.85 + HoutMethane\n",
+ "def fun2(T):\n",
+ " fun2=34.28*math.pow(10,-3)+ T*4.268*math.pow(10,-5) - math.pow(T,3) * 8.694 * math.pow(10,-12)\n",
+ " return fun2\n",
+ "\n",
+ "HoutFormal, err2=scipy.integrate.quad(fun2,T1,T2) #scipy.integrate.quadis an inbuilt function which can calculate definite integrals\n",
+ "H7= -115.90+ HoutFormal\n",
+ "deltaH=NoutWater*H9+NoutCarbon*H8+NoutFormal*H7+NoutNitrogen*H6+NoutOxygen*H5+NoutMethane*H4-NinNitrogen*H3-NinOxygen*H2-NinMethane*H1\n",
+ "Q=deltaH\n",
+ "print '%s %.3f' %(\" \\n Q (KJ) = \",Q)\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",
+ " Q (KJ) = -15296.233\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 9.5-4, page no. 458"
+ ]
+ },
+ {
+ "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=150.0 #mol/s\n",
+ "x=0.9\n",
+ "HinEthanol= -212.19\n",
+ "HinEthanone= -147.07\n",
+ "HoutEthanol= -216.81\n",
+ "HoutEthanone= -150.9\n",
+ "HoutHydrogen=6.595\n",
+ "NinEthanol=135.0\n",
+ "NinEthanone=15.0\n",
+ "Q=2440.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",
+ "print(\"Carbon Balance\")\n",
+ "print(\"basis*x *2 + basis* (1-x) *2=2 n1+2 n2\")\n",
+ "print(\"Hydrogen Balance\")\n",
+ "print(\"basis * x *6 + basis * (1-x)*4 = 6 n1+4 n2+2 n3\")\n",
+ "print(\"Energy Balance\")\n",
+ "print(\"Q= HoutEthanol n1 HoutEthanone n2 + HoutHydrogen n3 -NinEthanol * HinEthanol -NinEthanone* HinEthanone\")\n",
+ "A=([[1, 1, 0],[3, 2, 1],[216.81, 150.9, -6.595]])\n",
+ "b=([[150],[435],[28412]])\n",
+ "C=numpy.dot(linalg.inv(A),b)\n",
+ "n1=C[0,0]\n",
+ "print '%s %.3f' %(\" \\n n1 (mol Ethanol/s) = \",n1)\n",
+ "n2=C[1,0]\n",
+ "print '%s %.3f' %(\" \\n n2 (mol Ethanone/s) = \",n2)\n",
+ "n3=C[2,0]\n",
+ "print '%s %.3f' %(\" \\n n3 (mol Hydrogen/s) = \",n3)\n",
+ "print(\"The solutions in the Text are Wrong\")\n",
+ "fraction=(NinEthanol-n1)/NinEthanol\n",
+ "print '%s %.3f' %(\"Fractional conversion of Ethanol = \",fraction)\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",
+ "Carbon Balance\n",
+ "basis*x *2 + basis* (1-x) *2=2 n1+2 n2\n",
+ "Hydrogen Balance\n",
+ "basis * x *6 + basis * (1-x)*4 = 6 n1+4 n2+2 n3\n",
+ "Energy Balance\n",
+ "Q= HoutEthanol n1 HoutEthanone n2 + HoutHydrogen n3 -NinEthanol * HinEthanol -NinEthanone* HinEthanone\n",
+ " \n",
+ " n1 (mol Ethanol/s) = 91.957\n",
+ " \n",
+ " n2 (mol Ethanone/s) = 58.043\n",
+ " \n",
+ " n3 (mol Hydrogen/s) = 43.043\n",
+ "The solutions in the Text are Wrong\n",
+ "Fractional conversion of Ethanol = 0.319\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "press enter key to exit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 7,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9.5-5, page no. 460"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "print(\"from tables,\")\n",
+ "HfAcid= -1294. #Kj/mol\n",
+ "HfBase= -469.1 #Kj/mol\n",
+ "HfSalt= -1974. #Kj/mol \n",
+ "HfWater= -285.8 #Kj/mol\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(\"part 1\")\n",
+ "Hr=HfSalt+3*HfWater-HfAcid-3*HfBase\n",
+ "print '%s %.3f' %(\"Hr of the rxn (KJ/mol) = \",Hr)\n",
+ "print(\"part 2\")\n",
+ "deltaH=Hr*5./3.\n",
+ "print '%s %.3f' %(\"deltaH (KJ) = \",deltaH)\n",
+ "raw_input('press enter key to exit')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "from tables,\n",
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "part 1\n",
+ "Hr of the rxn (KJ/mol) = -130.100\n",
+ "part 2\n",
+ "deltaH (KJ) = -216.833\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 9.5-6, page no. 461"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "x=0.1\n",
+ "y=0.2\n",
+ "MAcid=98.1\n",
+ "MS=32.0\n",
+ "MSalt=142.0\n",
+ "MBase=40.0\n",
+ "MWater=18.0\n",
+ "MNa=46.0\n",
+ "basis=1000.0 #g\n",
+ "T2=35.0\n",
+ "T1=25.0\n",
+ "T3=40.0\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(\"Using S balance, \")\n",
+ "m2=basis*x*MS*MSalt/(MAcid*MS)\n",
+ "print '%s %.3f' %(\" \\n m2 (g Na2SO4) = \",m2)\n",
+ "print(\"Using Na balance, \")\n",
+ "m1=2*MNa*m2*MBase/(y*MNa*MSalt)\n",
+ "print '%s %.3f' %(\" \\n m1 (g NaOH) = \",m1)\n",
+ "print(\"Total mass balance, \")\n",
+ "m3=basis+m1-m2\n",
+ "print '%s %.3f' %(\" \\n m3 (g H2O) = \",m3)\n",
+ "print '%s %.3f' %(\" \\n Mass of product solution = \",m2+m3)\n",
+ "m=m2+m3\n",
+ "Water=m2*2/MSalt\n",
+ "print '%s %.3f' %(\" \\n Water Formed in the reaction (mol H2O) = \",Water)\n",
+ "print(\"H2SO4(aq):\")\n",
+ "a1=basis*(1-x)/MWater\n",
+ "b1=basis*x/MAcid\n",
+ "rAcid=a1/b1\n",
+ "print '%s %.3f' %(\" \\n rAcid (mol Water/mol Acid) = \",rAcid)\n",
+ "print(\"NaOH(aq):\")\n",
+ "a2=m1*(1-y)/MWater\n",
+ "b2=m1*y/MBase\n",
+ "rBase=a2/b2\n",
+ "print '%s %.3f' %(\" \\n rBase (mol Water/mol Base) = \",rBase)\n",
+ "print(\"Na2SO4(aq):\")\n",
+ "a3=m3/MWater\n",
+ "b3=m2/MSalt\n",
+ "rSalt=a3/b3\n",
+ "print '%s %.3f' %(\" \\n rSalt (mol Water/mol Salt) =\",rSalt)\n",
+ "E=b1\n",
+ "print '%s %.3f' %(\" \\n Extent of reaction (mol) = \",E)\n",
+ "nHAcid=basis*3.85*(T3-T1)/1000\n",
+ "nHSalt=m*4.184*(T2-T1)/1000\n",
+ "nHBase=0\n",
+ "HfSalt= -1384\n",
+ "HfAcid= -884.6\n",
+ "HfBase= -468.1\n",
+ "HfWater= -285.84\n",
+ "deltaHr=HfSalt+ 2*HfWater - HfAcid - 2*HfBase\n",
+ "print '%s %.3f' %(\" \\n Entahlpy change in the rxn (KJ/mol) = \",deltaHr)\n",
+ "Q=E*deltaHr + (nHSalt-nHAcid-nHBase)\n",
+ "print '%s %.3f' %(\" \\n Q of the rxn (KJ) = \",Q)\n",
+ "print(\"The answer in the Text is wrong.\")\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",
+ "Using S balance, \n",
+ " \n",
+ " m2 (g Na2SO4) = 144.750\n",
+ "Using Na balance, \n",
+ " \n",
+ " m1 (g NaOH) = 407.747\n",
+ "Total mass balance, \n",
+ " \n",
+ " m3 (g H2O) = 1262.997\n",
+ " \n",
+ " Mass of product solution = 1407.747\n",
+ " \n",
+ " Water Formed in the reaction (mol H2O) = 2.039\n",
+ "H2SO4(aq):\n",
+ " \n",
+ " rAcid (mol Water/mol Acid) = 49.050\n",
+ "NaOH(aq):\n",
+ " \n",
+ " rBase (mol Water/mol Base) = 8.889\n",
+ "Na2SO4(aq):\n",
+ " \n",
+ " rSalt (mol Water/mol Salt) = 68.833\n",
+ " \n",
+ " Extent of reaction (mol) = 1.019\n",
+ " \n",
+ " Entahlpy change in the rxn (KJ/mol) = -134.880\n",
+ " \n",
+ " Q of the rxn (KJ) = -136.342\n",
+ "The answer in the Text is wrong.\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 9.6-1, page no. 465"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "\n",
+ "x=0.85\n",
+ "H1= 802 #KJ/mol\n",
+ "H2= 1428 #kJ/mol\n",
+ "M1=16.0\n",
+ "M2=30.0\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",
+ "y1=x*16\n",
+ "y2=(1-x)*30\n",
+ "xCH4=y1/(y1+y2)\n",
+ "HHVMethane=(H1+ 2*44.013)/M1\n",
+ "HHVEthane=(H2+ 3*44.013)/M2\n",
+ "HHV=xCH4*HHVMethane + (1-xCH4)*HHVEthane\n",
+ "print '%s %.3f' %(\" \\n HHV of Fuel (KJ/g) = \",HHV)\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",
+ " HHV of Fuel (KJ/g) = 54.725\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
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file