{ "metadata": { "name": "", "signature": "sha256:27df12dd9928a7234ef95007770cbb19da31332c34bb007953024d3646517da2" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 6: Multiphase Systems" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.1-1, page no. 244" ] }, { "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", "T2=15.4+273.2 #K\n", "T1=7.6+273.2 #K\n", "P1=40.0 #mm of Hg\n", "P2=60.0 #mm of Hg\n", "T=42.2+273.2 #K\n", "R=8.314 #J/mol.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(\"let deltaHv/R = S\")\n", "S= - (T1*T2* math.log(P2/P1))/(T1-T2)\n", "deltahv=S*R\n", "print '%s %d' %(\" \\n Latent Heat of Vaporization (J/mol) =\",deltahv)\n", "B=math.log(P1) + S/T1\n", "print '%s %.3f' %(\"\\n B=\",B)\n", "P=math.exp(-S/T + B)\n", "print '%s %.3f %s %.3f' %(\"\\n P* at\",T,\" K is (mm Hg)= \",P)\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", "let deltaHv/R = S\n", " \n", " Latent Heat of Vaporization (J/mol) = 35023\n", "\n", " B= 18.691\n", "\n", " P* at 315.400 K is (mm Hg)= 207.400\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 6.3-1, page no. 250" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "P=760.0 #mm of Hg\n", "Pstar=289.0 #mm of Hg\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", "y=Pstar/P\n", "print '%s %.3f %s %.3f' %(\" \\n Molar composition of Water is\",y,\" and Air is\",1-y)\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", " Molar composition of Water is 0.380 and Air is 0.620\n" ] } ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.3-2, page no. 251" ] }, { "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", "T=100.0+273.2 #K\n", "PT=5260.0 #mm of Hg\n", "y=0.1 #by volume\n", "basis= 100 #mol of feed gas\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", "P=y*PT\n", "if(P<760):\n", " print(\"The Vapour is Super heated\")\n", "elif(P==760): \n", " print(\"The vapour is At Dew point\")\n", "else:\n", " print(\"The vapour is not Super heated\")\n", "\n", "print(\"From tables Tdp=90 C\")\n", "print(\"Superheat = 100-90=10 C \")\n", "print(\"Using Raoult law at the outlet\")\n", "y1=355/PT\n", "print '%s %.3f' %(\"y1=\",y1)\n", "print(\"Balance on Dry Air\")\n", "n2=basis*(1-y)/(1-y1)\n", "print '%s %.3f' %(\"n2 (mol) = \",n2)\n", "print(\"Total mole balance\")\n", "n1=basis-n2\n", "print '%s %.3f' %(\"n1 (mol) = \",n1)\n", "print '%s %.3f' %(\" \\n Percentage condesation=\",n1*100/(y*basis))\n", "Psaturation=760/y\n", "print '%s %.3f %s' %(\"\\n Any increase in pressure above\", Psaturation,\" mm of Hg must cause condensation \")\n", "print(\" \\n For the next part of the problem use the same code by modifying PT to be 8500 mm of Hg\")\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", "The Vapour is Super heated\n", "From tables Tdp=90 C\n", "Superheat = 100-90=10 C \n", "Using Raoult law at the outlet\n", "y1= 0.067\n", "Balance on Dry Air\n", "n2 (mol) = 96.514\n", "Total mole balance\n", "n1 (mol) = 3.486\n", " \n", " Percentage condesation= 34.862\n", "\n", " Any increase in pressure above 7600.000 mm of Hg must cause condensation \n", " \n", " For the next part of the problem use the same code by modifying PT to be 8500 mm of Hg\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 6.3-3, page no. 254" ] }, { "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", "T=75.0 +273 #K\n", "P75=289.0 #mm of Hg\n", "hr=0.3\n", "Porig=825.0 #mm of Hg\n", "PorigBar=1.1 #bar\n", "Vdot=1000.0 #M^3/h\n", "R=0.0831\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", "P=hr*P75\n", "y=P/Porig\n", "ndot=PorigBar*Vdot/(R*T)\n", "ndotWater=ndot*y\n", "print '%s %.3f' %(\" \\n Molar flowrate of Water (Kmol/h) = \",ndotWater)\n", "ndotBDA=ndot*(1-y)\n", "print '%s %.3f' %(\" \\n Molar flowrate of Dry Air (Kmol/h) = \",ndotBDA)\n", "ndotO2=ndotBDA*0.21\n", "print '%s %.3f' %(\" \\n Molar flowrate of Oxygen (Kmol/h) = \",ndotO2)\n", "hm=P/(Porig-P)\n", "ha=hm*18/29\n", "hmdot=P75/(Porig-P75)\n", "hp=100*hm/hmdot\n", "print '%s %.3f' %(\" \\n Molal Humidity (mol water/mol BDA) = \",hm)\n", "print '%s %.3f' %(\" \\n Absolute Humidity (kg water/kg BDA) = \",ha)\n", "print '%s %.3f' %(\" \\n Percentage Humidity=\",hp)\n", "print(\"\\n From table B.3, Tdp=48.7 C\")\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", " Molar flowrate of Water (Kmol/h) = 3.997\n", " \n", " Molar flowrate of Dry Air (Kmol/h) = 34.040\n", " \n", " Molar flowrate of Oxygen (Kmol/h) = 7.148\n", " \n", " Molal Humidity (mol water/mol BDA) = 0.117\n", " \n", " Absolute Humidity (kg water/kg BDA) = 0.073\n", " \n", " Percentage Humidity= 21.780\n", "\n", " From table B.3, Tdp=48.7 C\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 6.4-1, page no. 255" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \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", "basis=100.0 #lb-mole/h\n", "x=0.45\n", "PH2O=31.6 #mm of Hg\n", "PSO2=176.0 #mm of Hg\n", "P=760.0 #mm of Hg\n", "y=2.0\n", "M1=64.0 \n", "M2=18.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", "yH2O=PH2O/P\n", "ySO2=PSO2/P\n", "yAir=1-yH2O-ySO2\n", "print(\"Using Air balance, \")\n", "nG2=(1-x)*basis/yAir\n", "print '%s %.3f' %(\"nG2 (lbm/h) = \",nG2)\n", "xSO2=y/102\n", "xH2O=1-xSO2\n", "print(\"Using SO2 balance, \")\n", "nL2=(basis*x-nG2*ySO2)*M1/(xSO2)\n", "print '%s %.3f' %(\"nL2 (lbm/h) = \",nL2)\n", "print(\"Using H2O balance, \")\n", "nL1=nG2*yH2O*M2 + nL2*xH2O\n", "print '%s %.3f' %(\"nL1 (lbm H2O/h) = \",nL1)\n", "SO2Absorbed=nL2*xSO2\n", "SO2Fed=basis*x*M1\n", "Fraction=SO2Absorbed/SO2Fed\n", "print '%s %.3f' %(\" \\n Fraction SO2 absorbed (lbm SO2 absorbed/lbm SO2 fed) = \",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", "Using Air balance, \n", "nG2 (lbm/h) = 75.670\n", "Using SO2 balance, \n", "nL2 (lbm/h) = 89683.186\n", "Using H2O balance, \n", "nL1 (lbm H2O/h) = 87981.325\n", " \n", " Fraction SO2 absorbed (lbm SO2 absorbed/lbm SO2 fed) = 0.611\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 6.4-2, page no. 258" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "basis=100.0 #lb-mole/h\n", "x=0.45\n", "PH2O=31.6 #mm of Hg\n", "PSO2=176.0 #mm of Hg\n", "P=760.0 #mm of Hg\n", "y=2.0\n", "M1=64.0 \n", "M2=18.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", "yH2O=PH2O/P\n", "ySO2=PSO2/P\n", "yAir=1-yH2O-ySO2\n", "print(\"Using Air balance, \")\n", "nG2=(1-x)*basis/yAir\n", "print '%s %.3f' %(\"nG2 (lbm/h) = \",nG2)\n", "xSO2=y/102\n", "xH2O=1-xSO2\n", "print(\"Using SO2 balance, \")\n", "nL2=(basis*x-nG2*ySO2)*M1/(xSO2)\n", "print '%s %.3f' %(\"nL2 (lbm/h) = \",nL2)\n", "print(\"Using H2O balance, \")\n", "nL1=nG2*yH2O*M2 + nL2*xH2O\n", "print '%s %.3f' %(\"nL1 (lbm H2O/h) = \",nL1)\n", "SO2Absorbed=nL2*xSO2\n", "SO2Fed=basis*x*M1\n", "Fraction=SO2Absorbed/SO2Fed\n", "print '%s %.3f' %(\" \\n Fraction SO2 absorbed (lbm SO2 absorbed/lbm SO2 fed) = \",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", "Using Air balance, \n", "nG2 (lbm/h) = 75.670\n", "Using SO2 balance, \n", "nL2 (lbm/h) = 89683.186\n", "Using H2O balance, \n", "nL1 (lbm H2O/h) = 87981.325\n", " \n", " Fraction SO2 absorbed (lbm SO2 absorbed/lbm SO2 fed) = 0.611\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 6.5-1, page no. 264" ] }, { "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", "basis=150.0 #kg feed\n", "S100=0.905 #g AgNO3/g\n", "S20=0.689 #g AgNO3/g\n", "inputx=0.095 #kg water/kg\n", "outputx=0.311 #kg water/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(\"\\n Composition of Filter cake,\")\n", "print(\"\\n m2=4m3\")\n", "print(\"\\n Water balance around the crystallizer,\")\n", "print '%s' %(\"\\n basis*inputx* kg H2O = outputx m1 + outputx m1 \\n\")\n", "print(\"Mass balance around crystallizer, \\n\")\n", "print '%d %s' %(basis,\"=m1+m2+m3\")\n", "A=([[0, 1, -4],[outputx, 0, outputx],[1, 1, 1]])\n", "b=([[0],[basis*inputx],[basis]])\n", "C=numpy.dot(linalg.inv(A),b)\n", "#Here we solved two linear equations simultaneously\n", "m1=C[0,0]\n", "print '%s %.2f' %(\" \\n m1 (Kg) = \",m1)\n", "m2=C[1,0]\n", "print '%s %d' %(\" \\n m2 (Kg) = \",m2)\n", "m3=C[2,0]\n", "print '%s %d' %(\" \\n m3 (Kg) = \",m3)\n", "print(\"\\n Overall AgNO3 balance,\")\n", "m5=(1-inputx)*basis - (1-outputx)*m1\n", "print '%s %d' %(\"\\n m5 (kg AgNO3 crystals recovered) = \",m5)\n", "percentage=m5*100/(basis*(1-inputx))\n", "print '%s %.3f' %(\" \\n Percentage recovery=\",percentage)\n", "print(\"\\n Overall mass balance\")\n", "m4=basis-m1-m5\n", "print '%s %d' %(\"\\n m4 (Kg water removed in the Dryer) = \",m4)\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", " Composition of Filter cake,\n", "\n", " m2=4m3\n", "\n", " Water balance around the crystallizer,\n", "\n", " basis*inputx* kg H2O = outputx m1 + outputx m1 \n", "\n", "Mass balance around crystallizer, \n", "\n", "150 =m1+m2+m3\n", " \n", " m1 (Kg) = 19.77\n", " \n", " m2 (Kg) = 104\n", " \n", " m3 (Kg) = 26\n", "\n", " Overall AgNO3 balance,\n", "\n", " m5 (kg AgNO3 crystals recovered) = 122\n", " \n", " Percentage recovery= 89.963\n", "\n", " Overall mass balance\n", "\n", " m4 (Kg water removed in the Dryer) = 8\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 6.5-2, page no. 266" ] }, { "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", "inputx=0.6\n", "basis=100.0 #kg Feed\n", "S=63.0 #Kg KNO3/100 Kg H2O\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", "outputx=S/(S+100)\n", "print '%s %.3f' %(\"x (Kg KNO3/Kg) = \",outputx)\n", "print(\"Water balance\")\n", "m1=basis*(1-inputx)/(1-outputx)\n", "print '%s %.3f' %(\" \\n m1 (Kg) = \",m1)\n", "print(\"Mass balance\")\n", "m2=basis-m1\n", "print '%s %.3f' %(\" \\n m2 (kg) = \",m2)\n", "percentage=m2*100/(basis*inputx)\n", "print '%s %.3f' %(\" \\n Percentage of KNO3 in the feed that crystallizes is \",percentage)\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", "x (Kg KNO3/Kg) = 0.387\n", "Water balance\n", " \n", " m1 (Kg) = 65.200\n", "Mass balance\n", " \n", " m2 (kg) = 34.800\n", " \n", " Percentage of KNO3 in the feed that crystallizes is 58.000\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 6.5-3, page no. 267" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "basis=1.0 #Tonne Epsom salt produced/h\n", "inputx=0.301 #Tonne MgSO4/tonne\n", "outputx=0.232 #Tonne MgSO4/tonne\n", "M=120.4\n", "M1=246.4\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(\"Total mass balance\")\n", "print(\"m1=1+m2\")\n", "print(\"MgSO4 balance\")\n", "print(\" \\n inputx m1 = bassis* M/ M1 + m2 outputx\")\n", "A=([[1, -1],[inputx, -outputx]])\n", "b=([[1],[basis*M/M1]])\n", "C=numpy.dot(linalg.inv(A),b)\n", "#Here we solved two linear equations simultaneously\n", "m1=C[0,0]\n", "m2=C[1,0]\n", "print '%s %.3f' %(\" \\n m1 (Tonne/h) = \",m1)\n", "print '%s %.3f' %(\" \\n m2 (Tonne/h) = \",m2)\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 mass balance\n", "m1=1+m2\n", "MgSO4 balance\n", " \n", " inputx m1 = bassis* M/ M1 + m2 outputx\n", " \n", " m1 (Tonne/h) = 3.719\n", " \n", " m2 (Tonne/h) = 2.719\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 6.5-4, page no. 270" ] }, { "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", "m1=5.0 #g of solute\n", "m2=100.0 #g of Water\n", "P=1.0 #atm\n", "Tf=100.421 #C\n", "Ti=25.0 #C\n", "R=8.314 #J/mol.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", "x=(Tf-100.)*40656./(R*373.16*373.16)\n", "y=m2/18.016\n", "Ms=m1*(1-x)/(y*x)\n", "print '%s %.3f' %(\" \\n Ms (g/mol) =\",Ms)\n", "deltaTm=R*273.16*273.16*x/6009.5\n", "Tms=0-deltaTm\n", "print '%s %.3f' %(\" \\n Tms (C)=\",Tms)\n", "Pstar=(1-x)*23.756\n", "print '%s %.3f' %(\" \\n Solvent Vapour pressure (mm Hg) = \",Pstar)\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", " Ms (g/mol) = 60.028\n", " \n", " Tms (C)= -1.526\n", " \n", " Solvent Vapour pressure (mm Hg) = 23.405\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 6.6-1, page no. 272" ] }, { "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", "V1=200.0 #CC Acetone\n", "x=0.1 #Wt acetone \n", "V2=400.0 #CC chloroform\n", "DA=0.792 #g/cc\n", "DC=1.489 #g/cc\n", "DW=1.0 #g/cc\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", "Dbar=DA*DW/(x*DW + (1-x)*DA)\n", "mass1=V1*Dbar\n", "mass2=V2*DC\n", "print(\"C balance\")\n", "m4=mass2\n", "print '%s %.3f' %(\" \\n m4=\",m4)\n", "print(\"W balance\")\n", "m2=(1-x)*mass1\n", "print '%s %.3f' %(\" \\n m2=\",m2)\n", "print(\"A balance\")\n", "print(\"m1+m3=x * mass1\")\n", "print(\"Distribution Cooefficient ,K=m3*(m1+m2)/m1*(m3+m4)\")\n", "print(\"On solving, \")\n", "m1=2.7\n", "m3=16.8\n", "percentage=m3*100/(x*mass1)\n", "print '%s %.3f' %(\" \\n m1=\",m1)\n", "print '%s %.3f' %(\" \\n m3=\",m3)\n", "print '%s %.3f' %(\" \\n percentage of acetone transferred to chloroform=\",percentage)\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", "C balance\n", " \n", " m4= 595.600\n", "W balance\n", " \n", " m2= 175.394\n", "A balance\n", "m1+m3=x * mass1\n", "Distribution Cooefficient ,K=m3*(m1+m2)/m1*(m3+m4)\n", "On solving, \n", " \n", " m1= 2.700\n", " \n", " m3= 16.800\n", " \n", " percentage of acetone transferred to chloroform= 86.206\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 6.6-2, page no. 274" ] }, { "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", "basis=1000.0 #Kg of solution\n", "inputxA=0.3 #Wt. fraction of acetone\n", "outputxA1=0.05\n", "outputxM1=0.02\n", "outputxA2=0.1\n", "outputxM2=0.87\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\")\n", "print(\"ms + basis = mE + mR\")\n", "print(\"acetone balance\")\n", "print(\"inputxA *basis = outputxA2 *mE + outputxA1* mR\")\n", "print(\"Water balance\")\n", "print(\" \\n 1-inputxA *basis = 1-outputxA2-outputxM2 *mE + 1-outputxA1-outputxM1* mR\")\n", "A=([[1, 1, -1],[outputxA2, outputxA1, 0],[1-outputxA2-outputxM2, 1-outputxA1-outputxM1, 0]])\n", "b=([[basis],[inputxA*basis],[(1-inputxA)*basis]])\n", "C=numpy.dot(linalg.inv(A),b)\n", "#Here We solved three linear equations simultaneously\n", "mE=C[0,0]\n", "mR=C[1,0]\n", "mS=C[2,0]\n", "print '%s %.3f' %(\" \\n mE (Kg) = \",mE)\n", "print '%s %.3f' %(\" \\n mR (Kg) = \",mR)\n", "print '%s %.3f' %(\" \\n mS (Kg MIBK) = \",mS)\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\n", "ms + basis = mE + mR\n", "acetone balance\n", "inputxA *basis = outputxA2 *mE + outputxA1* mR\n", "Water balance\n", " \n", " 1-inputxA *basis = 1-outputxA2-outputxM2 *mE + 1-outputxA1-outputxM1* mR\n", " \n", " mE (Kg) = 2666.667\n", " \n", " mR (Kg) = 666.667\n", " \n", " mS (Kg MIBK) = 2333.333\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 6.7-1, page no. 276" ] }, { "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", "V=50.0 #L\n", "P=1.0 #atm\n", "T=34.0+273.2 #K\n", "y=0.3\n", "xF=0.001\n", "R=0.08206\n", "Pstar=169.0 #mm of Hg\n", "Pmm=760.0 #mm of Hg\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", "n=P*V/(R*T)\n", "print '%s %.3f' %(\" \\n No.of moles (mol) = \",n)\n", "y0=y*Pstar/Pmm\n", "print '%s %.3f' %(\" \\n Y0= (mol CCl4/mol) = \",y0)\n", "Pfinal=xF*Pmm\n", "b=0.096*Pfinal\n", "Xstar=0.794*b/(1+b)\n", "print '%s %.3f' %(\" \\n Mass of CCl4 adsorbed to Carbon at equilibrium (g CCl4 ads/g C) = \",Xstar)\n", "Mads=(y0*n- xF*n)*154\n", "print '%s %.3f' %(\" \\n Mass of CCl4 adsorbed (g) = \",Mads)\n", "Mc=Mads/Xstar\n", "print '%s %.3f' %(\" \\n Mass of carbon Required (g) = \",Mc)\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", " No.of moles (mol) = 1.983\n", " \n", " Y0= (mol CCl4/mol) = 0.067\n", " \n", " Mass of CCl4 adsorbed to Carbon at equilibrium (g CCl4 ads/g C) = 0.054\n", " \n", " Mass of CCl4 adsorbed (g) = 20.071\n", " \n", " Mass of carbon Required (g) = 371.750\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 } ], "metadata": {} } ] }