diff options
author | kinitrupti | 2017-05-12 18:53:46 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:53:46 +0530 |
commit | 6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch) | |
tree | 22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Chemical_Engineering_Thermodynamics_by_Y._V._C._Rao/ch9.ipynb | |
parent | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff) | |
download | Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2 Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip |
Removed duplicates
Diffstat (limited to 'Chemical_Engineering_Thermodynamics_by_Y._V._C._Rao/ch9.ipynb')
-rwxr-xr-x | Chemical_Engineering_Thermodynamics_by_Y._V._C._Rao/ch9.ipynb | 1125 |
1 files changed, 1125 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics_by_Y._V._C._Rao/ch9.ipynb b/Chemical_Engineering_Thermodynamics_by_Y._V._C._Rao/ch9.ipynb new file mode 100755 index 00000000..9efdc810 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_Y._V._C._Rao/ch9.ipynb @@ -0,0 +1,1125 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : Multicomponent mixtures" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page No : 313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "per_ethanol = 60.\t\t\t #mole percent of ethanol in a ethanol-water system\n", + "per_water = 40. \t\t\t #mole percent of water in a ethanol-water system\n", + "v1 = 57.5*10**-6\t\t\t #partial molar volume of ethanol in the ethanol-water system in m**3\n", + "rho = 849.4;\t \t\t #density of the mixture in kg/m**3\n", + "M_ethanol = 46*10**-3\t\t\t #molar mass of ethanol in kg/mol\n", + "M_water = 18*10**-3 \t\t\t #molar mass of ethanol in kg/mol\n", + "\n", + "# Calculations\n", + "X1 = per_ethanol/100\n", + "X2 = per_water/100\n", + "M = (X1*M_ethanol)+(X2*M_water)\n", + "v = M/rho\n", + "v2 = (v-(X1*v1))/(X2);\t\t\t \n", + "\n", + "# Results\n", + "print \" The partial molar volume of water = %f m**3/mol\"%(v2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The partial molar volume of water = 0.000016 m**3/mol\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.2 Page No : 313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 3.\t\t\t #volume of mixture to be prepared in m**3\n", + "per_ethanol = 60.\t\t\t #mole percent of ethanol in a ethanol-water system\n", + "per_water = 40.\t\t\t #mole percent of water in a ethanol-water system\n", + "v1 = 57.5*10**-6;\t\t\t #partial molar volume of ethanol in the ethanol-water system in m**3/mol\n", + "v2 = 16*10**-6\t\t\t #partial molar volume of water in the ethanol-water system in m**3/mol\n", + "v1_pure = 57.9*10**-6\t\t\t #molar volume of pure ethanol in m**3/mol\n", + "v2_pure = 18*10**-6\t\t\t #molar volume of pure water in m**3/mol\n", + "\n", + "# Calculations\n", + "X1 = per_ethanol/100;\t\t\t # Calculations of the mole fraction of ethanol (no unit)\n", + "X2 = per_water/100;\t\t\t # Calculations of the mole fraction of water (no unit)\n", + "v = (X1*v1)+(X2*v2);\t\t\t # Calculations of the molar volume of the solution using Eq.(9.10) in m**3/mol\n", + "N = V/v\t \t\t # Calculations of the mole number of solution required in mol\n", + "N1 = N*X1\t\t\t # Calculations of the mole number of ethanol in solution in mol\n", + "N2 = N*X2;\t\t\t # Calculations of the mole number of water in solution in mol\n", + "V1 = N1*v1_pure;\t\t\t # Calculations of the volume of pure ethanol required in m**3\n", + "V2 = N2*v2_pure;\t\t\t # Calculations of the volume of pure water required in m**3\n", + "\n", + "# Results\n", + "print \" The volume of pure ethanol required = %0.3f m**3\"%(V1);\n", + "print \" The volume of pure water required = %0.3f m**3\"%(V2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The volume of pure ethanol required = 2.548 m**3\n", + " The volume of pure water required = 0.528 m**3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3 Page No : 318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "# Variables\n", + "T = 427.85;\t\t\t #temperature of n-octane vapour in K\n", + "P = 0.215;\t\t\t #pressure of n-octane vapour in MPa\n", + "a = 3.789;\t\t\t #van der Waals constant in Pa(m**3/mol)**2\n", + "b = 2.37*10**-4;\t\t\t #van der Waals constant in m**3/mol\n", + "v = 15.675*10**-3;\t\t\t #molar volume of n-octane saturated vapour taken from Example 3.8 in m**3/mol\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "Z = (P*10**6*v)/(R*T)\t\t\t # Calculations of the compressibility factor (no unit)\n", + "# Calculations of the fugacity coefficient (f/P) using the expression derived in Example 9.3 (no unit)\n", + "phi = math.exp(Z-1-math.log (((P*10**6)*(v-b))/(R*T))-a/(R*T*v));\n", + "f = (P*10**6*phi)*10**-6\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of n-octane vapour = %0.2f \"%(phi);\n", + "print \" The fugacity of n-octane vapour = %0.4f MPa\"%(f);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of n-octane vapour = 0.95 \n", + " The fugacity of n-octane vapour = 0.2043 MPa\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 Page No : 322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 427.85;\t\t\t #temperature of n-octane vapour in K\n", + "P = 0.215;\t\t\t #pressure of n-octane vapour in MPa\n", + "Tc = 569.4;\t\t\t #critical temperature of n-octane in K\n", + "Pc = 24.97;\t\t\t #critical pressure of n-octane in bar\n", + "w = 0.398;\t\t\t #acentric factor (no unit)\n", + "\n", + "# Calculations\n", + "Tr = T/Tc\n", + "Pr = (P*10**6)/(Pc*10**5)\n", + "log_phi0 = -0.032;\t\n", + "log_phi1 = -0.025;\n", + "phi = round(log_phi0 + 0.398*log_phi1,3)\n", + "phie = 1.1014\n", + "f = P*phie\n", + "\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of n-octane vapour = %.3f \"%(phi);\n", + "print \" The fugacity of n-octane vapour = %.4f MPa\"%(f);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of n-octane vapour = -0.042 \n", + " The fugacity of n-octane vapour = 0.2368 MPa\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.6 Page No : 327" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 339.7\t\t\t #temperature of ethylene in K\n", + "P = 1.\t \t\t #pressure of ethylene in bar\n", + "Tc = 283.1\t\t\t #critical temperature of ethylene in K\n", + "Pc = 51.17\t\t\t #critical pressure of ethylene in bar\n", + "w = 0.089\t\t\t #acentric factor (no unit)\n", + "\n", + "# Calculations\n", + "Tr = T/Tc\n", + "Pr = P/Pc\n", + "B0 = 0.083-(0.422/(Tr**1.6))\n", + "B1 = 0.139-(0.172/(Tr**4.2))\n", + "phi = math.exp((B0+(w*B1))*(Pr/Tr))\n", + "f = P*phi\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of ethylene = %0.4f \"%(phi);\n", + "print \" The fugacity of ethylene = %0.4f bar\"%(f);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of ethylene = 0.9963 \n", + " The fugacity of ethylene = 0.9963 bar\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.7 Page No : 330" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t \t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "Tc = [425.2,569.4];\t\t\t #critical temperature of n-butane and n-octane in K\n", + "Pc = [37.97,24.97];\t\t\t #critical pressure of n-butane and n-octane in bar\n", + "vc = [255.0*10**-6,486.0*10**-6];\t\t\t #critical molar volume of n-butane and n-octane in m**3/mol\n", + "Zc = [0.274,0.256];\t \t\t #compressibility factor of n-butane and n-octane corresponding to Tc,Pc (no unit)\n", + "w = [0.199,0.398];\t\t\t #acentric factor of n-butane and n-octane (no unit)\n", + "R = 8.314 \t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "K_12 = 1-((8*((vc[0]*vc[1])**(1./2)))/((((vc[0])**(1./3))+((vc[1])**(1./3)))**3))\n", + "Tc_12 = (((Tc[0])*(Tc[1]))**(1./2))*(1-K_12);\t\t\t \n", + "w_12 = (w[0]+w[1])/2\n", + "Zc_12 = (Zc[0]+Zc[1])/2\n", + "vc_12 = ((((vc[0])**(1./3))+((vc[1])**(1./3)))/2)**3\n", + "Pc_12 = ((Zc_12*R*Tc_12)/vc_12)*10**-6;\t\t\t \n", + "Tr_12 = T/Tc_12\n", + "B_12_0 = 0.083-(0.422/(Tr_12**(1.6)));\t\t\t \n", + "B_12_1 = 0.139-(0.172/(Tr_12**(4.2)));\t\t\t \n", + "B_12 = ((R*Tc_12)/(Pc_12*10**6))*(B_12_0+(w_12*B_12_1))\n", + "Tr1 = T/Tc[0]\n", + "B_11_0 = 0.083-(0.422/(Tr1**(1.6)));\t\t\t \n", + "B_11_1 = 0.139-(0.172/(Tr1**(4.2)));\t\t\t \n", + "B_11 = ((R*Tc[0])/(Pc[0]*10**5))*(B_11_0+(w[0]*B_11_1))\n", + "Tr2 = T/Tc[1]\n", + "B_22_0 = 0.083-(0.422/(Tr2**(1.6)))\n", + "B_22_1 = 0.139-(0.172/(Tr2**(4.2)))\n", + "B_22 = ((R*Tc[1])/(Pc[1]*10**5))*(B_22_0+(w[1]*B_22_1))\n", + "Bm = ((y1**2)*B_11)+((2*y1*y2)*B_12)+((y2**2)*B_22);\t\t\n", + "\n", + "# Results\n", + "print \" The second virial coefficient for an equimolar mixture of n-butane and n-octane at\\\n", + " 600K = %.2e m**3/mol\"%(Bm);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The second virial coefficient for an equimolar mixture of n-butane and n-octane at 600K = -3.09e-04 m**3/mol\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.8 Page No : 331" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "a = [1.3874,3.7890];\t\t\t #van der Waals constant of n-butane and n-octane in Pa(m**3/mol)**2\n", + "b = [0.1163*10**-3,0.237*10**-3];\t\t\t #van der Waals constant of n-butane and n-octane in m**3/mol\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "a_m = ((y1**2)*a[0])+((2*y1*y2)*math.sqrt(a[0]*a[1]))+((y2**2)*a[1])\n", + "b_m = (y1*b[0])+(y2*b[1])\t\t\t\n", + "\n", + "# Results\n", + "print \" The van der Waals constant for an equimolar mixture of n-butane and n-octane,\\\n", + " a_m = %0.4f Pam**3/mol)**2\"%(a_m);\n", + "print \" The van der Waals constant for an equimolar mixture of n-butane and n-octane,\\\n", + " b_m = %f m**3/mol\"%(b_m);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The van der Waals constant for an equimolar mixture of n-butane and n-octane, a_m = 2.4405 Pam**3/mol)**2\n", + " The van der Waals constant for an equimolar mixture of n-butane and n-octane, b_m = 0.000177 m**3/mol\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.9 Page No : 333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t \t \t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16.\t \t \t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tc = [425.2,569.4];\t\t\t #critical temperature of n-butane and n-octane in K\n", + "Pc = [37.97,24.97];\t\t\t #critical pressure of n-butane and n-octane in bar\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "Tr1 = T/Tc[0]\n", + "Pr1 = P/Pc[0]\n", + "Z1_0 = 0.95\n", + "Tr2 = T/Tc[1]\n", + "Pr2 = P/Pc[1]\n", + "Z2_0 = 0.785\n", + "\n", + "Zm = (y1*Z1_0)+(y2*Z2_0)\n", + "vm = (Zm*R*T)/(P*10**5)\n", + "\n", + "P1 = y1*P\n", + "P2 = y2*P\n", + "Pr1 = P1/Pc[0]\n", + "Pr2 = P2/Pc[1]\n", + "Z1_0 = 0.97\n", + "Z2_0 = 0.91\n", + "Zm = (y1*Z1_0)+(y2*Z2_0)\n", + "vm_dalton = (Zm*R*T)/(P*10**5)\n", + "\n", + "P1 = ((Z1_0*y1*R*T)/(vm_dalton))*10**-2\n", + "P2 = ((Z2_0*y2*R*T)/(vm_dalton))*10**-2\n", + "Pr1 = P1/Pc[0]\n", + "Pr2 = P2/Pc[1]\n", + "Z1_0_new = 0.97\n", + "Z2_0_new = 0.91\n", + "if Z1_0_new == Z1_0 and Z2_0_new == Z2_0:\n", + " vm_new = vm_dalton;\t\t\t \n", + "else:\n", + " Zm = (y1*Z1_0_new)+(y2*Z2_0_new)\n", + " vm_new = (Zm*R*T)/(P*10**5);\t\n", + "\n", + "# Results\n", + "print \" The molar volume of an equimolar mixture of n-butane and n-octane found using the\\\n", + " Amagats law of additive volumes = %0.4e m**3/mol\"%(vm);\n", + "print \" The molar volume of an equimolar mixture of n-butane and\\\n", + " n-octane found using the Daltons law of additive pressures = %0.2e m**3/mol\"%(vm_new);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of an equimolar mixture of n-butane and n-octane found using the Amagats law of additive volumes = 2.7046e-03 m**3/mol\n", + " The molar volume of an equimolar mixture of n-butane and n-octane found using the Daltons law of additive pressures = 2.93e-03 m**3/mol\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.10 Page No : 334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16.\t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tc = [425.2,569.4];\t\t\t #critical temperature of n-butane and n-octane in K\n", + "Pc = [37.97,24.97];\t\t\t #critical pressure of n-butane and n-octane in bar\n", + "R = 8.314;\t \t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "Tcm = (y1*Tc[0])+(y2*Tc[1]);\t\t\t \n", + "Pcm = (y1*Pc[0])+(y2*Pc[1])\n", + "Trm = T/Tcm;\t\t\t \n", + "Prm = P/Pcm;\t\t\t \n", + "Zm0 = 0.9;\t\t\t \n", + "vm = (Zm0*R*T)/(P*10.**5)\n", + "\n", + "# Results\n", + "print \" The molar volume of an equimolar mixture of n-butane and n-octane using the\\\n", + " pseudocritical properties estimated through Kays rule = %0.2e m**3/mol\"%(vm);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of an equimolar mixture of n-butane and n-octane using the pseudocritical properties estimated through Kays rule = 2.81e-03 m**3/mol\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.11 Page No : 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tc = [425.2,569.4];\t\t\t #critical temperature of n-butane and n-octane in K\n", + "Pc = [37.97,24.97];\t\t\t #critical pressure of n-butane and n-octane in bar\n", + "vc = [255.0*10**-6,486.0*10**-6];\t\t\t #critical molar volume of n-butane and n-octane in m**3/mol\n", + "Zc = [0.274,0.256];\t\t\t #compressibility factor of n-butane and n-octane corresponding to Tc,Pc (no unit)\n", + "R = 8.314;\t \t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "Tcm = (y1*Tc[0])+(y2*Tc[1]);\t\t\t \n", + "Pcm = ((R*((y1*Zc[0])+(y2*Zc[1]))*Tcm)/((y1*vc[0])+(y2*vc[1])))*10**-5\n", + "Trm = T/Tcm\n", + "Prm = P/Pcm\n", + "Zm0 = 0.89\n", + "vm = (Zm0*R*T)/(P*10**5)\n", + "\n", + "# Results\n", + "print \" The molar volume of an equimolar mixture of n-butane and n-octane at 600K\\\n", + " and 16bar estimated using the Prausnitz-Gunn rule = %0.2e m**3/mol\"%(vm);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of an equimolar mixture of n-butane and n-octane at 600K and 16bar estimated using the Prausnitz-Gunn rule = 2.77e-03 m**3/mol\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.12 Page No : 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "a_m = 2.4405\t\t\t #van der Waals constant for the mixture as determined in Example 9.8 in Pa(m**3/mol)**2\n", + "b_m = 0.1767*10**-3\t\t #van der Waals constant for the mixture as determined in Example 9.8 in m**3/mol\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "A = (a_m*P*10**5)/(R*T)**2\n", + "B = (b_m*P*10**5)/(R*T)\n", + "alpha = -1-B\n", + "beeta = A\n", + "gaamma = -(A*B)\n", + "p = beeta-((alpha**2)/3)\n", + "q = ((2*alpha**3)/27)-((alpha*beeta)/3)+gaamma\n", + "D = (((q)**2)/4)+(((p)**3)/27)\n", + "\n", + "if D>0 :\n", + " Z = (((-(q)/2)+(math.sqrt(D)))**(1./3))+(((-(q)/2)-(math.sqrt(D)))**(1./3))-(alpha/3);\t\n", + "elif D == 0:\n", + " Z1 = ((-2*(q/2))**(1./3))-(alpha/3)\n", + " Z2 = ((q/2)**(1./3))-(alpha/3)\n", + " Z3 = ((q/2)**(1./3))-(alpha/3)\n", + " Za = [Z1 ,Z2, Z3];\n", + " Z = max(Za);\n", + "else:\n", + " r = math.sqrt((-(p**3)/27));\t\t\t \n", + " theta = amath.cos((-(q)/2)*(1./r));\t\t\n", + " Z1 = (2*(r**(1./3))*math.cos(theta/3))-(alpha/3);\n", + " Z2 = (2*(r**(1./3))*math.cos(((2*math.pi)+theta)/3))-(alpha/3)\n", + " Z3 = (2*(r**(1./3))*math.cos(((4*math.pi)+theta)/3))-(alpha/3)\n", + " Za = [Z1, Z2, Z3];\n", + " Z = max(Za);\n", + "\n", + "vm = (Z*R*T)/(P*10**5)\n", + "\n", + "# Results\n", + "print \" The molar volume of an equimolar mixture of n-butane and n-octane at 600K and 16bar found \\\n", + " using the van der Waals equation of state = %e m**3/mol\"%(vm);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of an equimolar mixture of n-butane and n-octane at 600K and 16bar found using the van der Waals equation of state = 2.780786e-03 m**3/mol\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.13 Page No : 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t\t \t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16.\t\t \t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Bm = -309.*10**-6;\t\t\t #second virial coefficient for the mixture taken from Example(9.7) in m**3/mol\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "Zm = 1+((Bm*P*10**5)/(R*T))\n", + "vm = (Zm*R*T)/(P*10**5)\t\n", + "\n", + "# Results\n", + "print \" The molar volume of an equimolar mixture of n-butane and n-octane\\\n", + " found using the generalized virial coefficient correlation = %0.4e m**3/mol\"%(vm);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of an equimolar mixture of n-butane and n-octane found using the generalized virial coefficient correlation = 2.8088e-03 m**3/mol\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.14 Page No : 337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "am = 2.4405\t\t\t #van der Waals constant for the mixture taken from Example 9.8 in Pa(m**3/mol)**2\n", + "bm = 0.1767*10**-3;\t\t\t #van der Waals constant for the mixture taken from Example 9.8 in m**3/mol\n", + "vm = 2.8933*10**-3;\t\t\t #molar volume of the mixture taken from Example 9.12 in m**3/mol\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "dep_h = ((P*10**5*vm)-(R*T)-(am/vm))*10**-3\n", + "dep_s = R*(math.log ((P*10**5*(vm-bm))/(R*T)))\n", + "\n", + "# Results\n", + "print \" The enthalpy departure of an equimolar mixture of n-butane and n-octane = %0.3f kJ/mol\"%(dep_h);\n", + "print \" The entropy departure of an equimolar mixture of n-butane and n-octane = %0.3f J/mol K\"%(dep_s);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure of an equimolar mixture of n-butane and n-octane = -1.203 kJ/mol\n", + " The entropy departure of an equimolar mixture of n-butane and n-octane = -1.145 J/mol K\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.15 Page No : 338" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600. \t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t \t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tcm = 497.3;\t\t\t #pseudocritical temperature of mixture taken from Example(9.10) in K\n", + "Pcm = 31.47;\t\t\t #pseudocritical pressure of mixture taken from Example(9.10) in bar\n", + "Trm = 1.21;\t\t \t #pseudoreduced temperature of the mixture taken from Example(9.10) (no unit)\n", + "Prm = 0.51;\t\t\t #pseudoreduced pressure of the mixture taken from Example(9.10) (no unit)\n", + "w_butane = 0.199;\t\t #acentric factor for n-butane (no unit)\n", + "w_octane = 0.398;\t\t #acentric factor for n-octane (no unit)\n", + "R = 8.314;\t\t \t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "wm = (y1*w_butane)+(y2*w_octane)\n", + "del_h0 = 0.380;\t\t\t \n", + "del_h1 = 0.188;\t\t\t \n", + "del_s0 = 0.22;\t\t\t \n", + "del_s1 = 0.18;\t\t\t \n", + "dep_h = ((R*Tcm)*(del_h0+(wm*del_h1)))*10**-3;\t\t\t \n", + "dep_s = (R)*(del_s0+(wm*del_s1));\t\t\t \n", + "\n", + "# Results\n", + "print \" The enthalpy departure of an equimolar mixture of n-butane and n-octane using\\\n", + " the generalized compressibility factor correlation = %0.3f kJ/mol\"%(dep_h);\n", + "print \" The entropy departure of an equimolar mixture of n-butane and n-octane using \\\n", + "the generalized compressibility factor correlation = %f J/mol K\"%(dep_s);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure of an equimolar mixture of n-butane and n-octane using the generalized compressibility factor correlation = 1.803 kJ/mol\n", + " The entropy departure of an equimolar mixture of n-butane and n-octane using the generalized compressibility factor correlation = 2.275791 J/mol K\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.16 Page No : 339" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tc = [425.2,569.4];\t\t\t #critical temperature of n-butane and n-octane in K\n", + "Pc = [37.97,24.97];\t\t\t #critical pressure of n-butane and n-octane in bar\n", + "w = [0.199,0.398];\t\t\t #acentric factor of n-butane and n-octane (no unit)\n", + "Tr1 = 1.411;\t\t\t #reduced temperature of n-butane (no unit) taken from Example (9.7)\n", + "Tr2 = 1.054;\t\t\t #reduced temperature of n-octane (no unit) taken from Example (9.7)\n", + "Tr_12 = 1.24;\t\t\t #reduced temperature for computing the mixture interaction virial coefficient (no unit) taken from Example(9.7)\n", + "Pc_12 = 2.978;\t\t\t #Pc_ij in MPa taken from Example(9.7)\n", + "Tc_12 = 483.9;\t\t\t #Tc_ij in K taken from Example(9.7)\n", + "w_12 = 0.2985;\t\t\t # w_ij (no unit) taken from Example(9.7)\n", + "Bm = -309*10**-6;\t\t\t #second virial coefficient in m**3/mol taken from Example (9.7)\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "dB0_dTr1 = 0.675/(Tr1**2.6);\t\t\t \n", + "dB0_dTr2 = 0.675/(Tr2**2.6);\t\t\t \n", + "dB1_dTr1 = 0.722/(Tr1**5.2);\t\t\t \n", + "dB1_dTr2 = 0.722/(Tr2**5.2);\t\t\t \n", + "dB0_dTr12 = 0.675/(Tr_12**2.6);\t\t\t \n", + "dB1_dTr12 = 0.722/(Tr_12**5.2);\t\t\t \n", + "dB1_dT = (R/(Pc[0]*10**5))*((dB0_dTr1)+(w[0]*(dB1_dTr1)));\t\t\t\n", + "dB2_dT = (R/(Pc[1]*10**5))*((dB0_dTr2)+(w[1]*(dB1_dTr2)));\t\t\t\n", + "dB12_dT = (R/(Pc_12*10**6))*((dB0_dTr12)+(w_12*(dB1_dTr12)));\t\t\t\n", + "dBm_dT = ((y1**2)*(dB1_dT))+((2*y1*y2)*(dB12_dT))+((y2**2)*(dB2_dT));\t\n", + "dep_h = ((Bm-(T*dBm_dT))*P*10**5)*10**-3\n", + "dep_s = -P*10**5*(dBm_dT);\t\t\t \n", + "\n", + "# Results\n", + "print \" The enthalpy departure of an equimolar mixture of n-butane and n-octane\\\n", + " using the virial coefficient correlation = %f kJ/mol\"%(dep_h);\n", + "print \" The entropy departure of an equimolar mixture of n-butane and n-octane\\\n", + " using the virial coefficient correlation = %0.3f J/mol K\"%(dep_s);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = -1.908476 kJ/mol\n", + " The entropy departure of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = -2.357 J/mol K\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.17 Page No : 340" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "a_m = 2.4405\t\t\t #van der Waals constant (a_m) in Pa(m**3/mol)**2 taken from Example(9.8)\n", + "b_m = 0.1767*10**-3\t\t #van der Waals constant (b_m) in m**3/mol taken from Example(9.8)\n", + "Z = 0.928;\t\t\t #compressibility factor taken from Example(9.12)\n", + "vm = 2.8933*10**-3;\t\t #molar volume of the equimolar mixture in m**3/mol taken from Example(9.12)\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "phi = math.exp(Z-1-math.log ((P*10**5*(vm-b_m))/(R*T))-(a_m/(R*T*vm)));\t\t\t\n", + "f = phi*P;\t\t\n", + "\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of an equimolar mixture of n-butane and n-octane\\\n", + " using the van der Waals equation of state = %0.4f \"%(phi);\n", + "print \" The fugacity of an equimolar mixture of n-butane and n-octane using the van der Waals \\\n", + "equation of state = %0.2f bar\"%(f);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of an equimolar mixture of n-butane and n-octane using the van der Waals equation of state = 0.9018 \n", + " The fugacity of an equimolar mixture of n-butane and n-octane using the van der Waals equation of state = 14.43 bar\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.18 Page No : 341" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16.\t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tcm = 497.3;\t\t\t #pseudocritical temperature of mixture in K taken from Example(9.10)\n", + "Pcm = 31.47;\t\t\t #pseudocritical pressure of mixture in bar taken from Example(9.10)\n", + "Trm = 1.21;\t\t\t #pseudoreduced temperature of the mixture (no unit) taken from Example(9.10)\n", + "Prm = 0.51;\t\t\t #pseudoreduced pressure of the mixture (no unit) taken from Example(9.10)\n", + "w = [0.199,0.398];\t\t\t #acentric factor of n-butane and n-octane (no unit)\n", + "\n", + "# Calculations\n", + "wm = (w[0]+w[1])/2\n", + "log_phi0 = -0.042\n", + "log_phi1 = 0.01\n", + "phi = 10**(log_phi0+(wm*log_phi1));\t\t\n", + "f = P*phi;\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of an equimolar mixture of n-butane and n-octane \\\n", + "using the pseudocritical constants method = %0.3f \"%(phi);\n", + "print \" The fugacity of an equimolar mixture of n-butane and n-octane using\\\n", + " the pseudocritical constants method = %f bar\"%(f);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of an equimolar mixture of n-butane and n-octane using the pseudocritical constants method = 0.914 \n", + " The fugacity of an equimolar mixture of n-butane and n-octane using the pseudocritical constants method = 14.625307 bar\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.19 Page No : 341" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Bm = -309.*10**-6;\t\t\t #second virial coefficient in m**3/mol taken from Example (9.7)\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "phi = math.exp((Bm*P*10**5)/(R*T))\n", + "f = phi*P;\t\t\t \n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of an equimolar mixture of n-butane and n-octane using\\\n", + " the virial coefficient correlation = %.3f \"%(phi);\n", + "print \" The fugacity of an equimolar mixture of n-butane and n-octane using\\\n", + " the virial coefficient correlation = %f bar\"%(f);\n", + "\n", + "# Note : answers in book is wrong please check manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = 0.906 \n", + " The fugacity of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = 14.490290 bar\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.20 Page No : 344" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "Tc = [425.2,569.4];\t\t\t #critical temperature of n-butane and n-octane in K\n", + "Pc = [37.97,24.97];\t\t\t #critical pressure of n-butane and n-octane in bar\n", + "R = 8.314;\t \t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "a1 = (0.42748*R**2*Tc[0]**2.5)/(Pc[0]*10**5*math.sqrt(T))\n", + "a2 = (0.42748*R**2*Tc[1]**2.5)/(Pc[1]*10**5*math.sqrt(T))\n", + "b1 = (0.08664*R*Tc[0])/(Pc[0]*10**5);\t\t\t \n", + "b2 = (0.08664*R*Tc[1])/(Pc[1]*10**5);\t\t\t \n", + "\n", + "a = ((y1**2)*a1)+(2*y1*y2*math.sqrt(a1*a2))+((y2**2)*a2)\n", + "b = (y1*b1)+(y2*b2)\n", + "\n", + "A = (a*P*10**5)/(R*T)**2\n", + "B = (b*P*10**5)/(R*T);\t\n", + "alpha = -1.\t\t\t \n", + "beeta = A-B-B**2\n", + "gaamma = -(A*B)\n", + "p = beeta-(alpha**2)/3\n", + "q = ((2*alpha**3)/27)-((alpha*beeta)/3)+gaamma\n", + "D = (((q)**2)/4)+(((p)**3)/27)\n", + "\n", + "if D>0:\n", + " Z = ((-q/2)+(math.sqrt(D)))**(1./3)+((-q/2)-(math.sqrt(D)))**(1./3)-(alpha/3);\t\t\t #One real root given by Eq.(3.32)\n", + "elif D == 0:\n", + " Z1 = ((-2*(q/2))**(1./3))-(alpha/3)\n", + " Z2 = ((q/2)**(1./3))-(alpha/3);\n", + " Z3 = ((q/2)**(1./3))-(alpha/3);\n", + " Za = [Z1, Z2, Z3];\n", + " Z = max(Za);\n", + "else:\n", + " r = math.sqrt((-(p**3)/27));\t\t\n", + " theta = amath.cos((-(q)/2)*(1./r));\t\n", + " Z1 = (2*(r**(1./3))*math.cos(theta/3))-(alpha/3);\n", + " Z2 = (2*(r**(1./3))*math.cos(((2*math.pi)+theta)/3))-(alpha/3)\n", + " Z3 = (2*(r**(1./3))*math.cos(((4*math.pi)+theta)/3))-(alpha/3);\n", + " Za = [Z1, Z2, Z3];\n", + " Z = max(Za);\n", + "\n", + "phi1 = math.exp(((b1/b)*(Z-1))-math.log(Z-B)+((a/(b*R*T))*((b1/b)-(2*math.sqrt(a1/a)))*math.log((Z+B)/Z)));\n", + "\n", + "phi2 = math.exp(((b2/b)*(Z-1))-math.log(Z-B)+((a/(b*R*T))*((b2/b)-(2*math.sqrt(a2/a)))*math.log((Z+B)/Z)));\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of n-butane in the equimolar mixture using the\\\n", + " Redlich-Kwong Equation of state = %0.4f \"%(phi1);\n", + "print \" The fugacity coefficient of n-octane in the equimolar mixture using the\\\n", + " Redlich-Kwong Equation of state = %0.4f \"%(phi2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of n-butane in the equimolar mixture using the Redlich-Kwong Equation of state = 0.9644 \n", + " The fugacity coefficient of n-octane in the equimolar mixture using the Redlich-Kwong Equation of state = 0.8326 \n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.21 Page No : 346" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 600.\t\t\t #temperature of the equimolar n-butane and n-octane mixture in K\n", + "P = 16. \t\t\t #pressure of the equimolar n-butane and n-octane mixture in bar\n", + "B_11 = -131*10**-6\t\t\t #pure component (n-butane) second virial coefficient in m**3/mol taken from Example(9.7)\n", + "B_22 = -577*10**-6\t\t\t #pure component (n-octane) second virial coefficient in m**3/mol taken from Example(9.7)\n", + "B_12 = -264*10**-6\t\t\t #mixture interaction virial coefficient in m**3/mol taken from Example(9.7)\n", + "Bm = -309*10**-6\t\t\t #second virial coefficient in m**3/mol taken from Example(9.7)\n", + "R = 8.314 \t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "y1 = 0.5\n", + "y2 = 0.5\n", + "Zm = (1./2)*(1+math.sqrt(1+((4*Bm*P*10**5)/(R*T))))\n", + "phi1 = math.exp((((2*P*10**5)/(Zm*R*T))*((y1*B_11)+(y2*B_12)))-math.log(Zm))\n", + "phi2 = math.exp((((2*P*10**5)/(Zm*R*T))*((y1*B_12)+(y2*B_22)))-math.log(Zm))\n", + "\n", + "# Results\n", + "print \" The fugacity coefficient of n-butane in the equimolar mixture using the\\\n", + " Virial Equation of state = %0.3f \"%(phi1);\n", + "print \" The fugacity coefficient of n-octane in the equimolar mixture using the Virial\\\n", + " Equation of state = %f \"%(phi2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity coefficient of n-butane in the equimolar mixture using the Virial Equation of state = 0.976 \n", + " The fugacity coefficient of n-octane in the equimolar mixture using the Virial Equation of state = 0.830827 \n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.22 Page No : 349" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "T = 427.85 \t\t\t #temperature of n-octane vapour in K\n", + "Psat = 0.215;\t\t\t #saturation pressure of n-octane vapour at T in MPa\n", + "P = 1.\t\t \t #pressure at which the fugacity of liquid n-octane is to be determined in MPa\n", + "f_sat = 0.2368;\t\t\t #fugacity of n-octane vapour at T and Psat taken from Example(9.5) in MPa\n", + "vl = 0.2003*10**-3;\t\t\t #molar volume of n-octane liquid at T and Psat taken from Example(3.16) in m**3/mol\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "f_l = (0.2368*math.exp((vl*(P-Psat)*10**6)/(R*T)));\t\t\t \n", + "\n", + "# Results\n", + "print \" The fugacity of liquid n-octane at 427.85K and 1MPa = %0.4f MPa\"%(f_l);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity of liquid n-octane at 427.85K and 1MPa = 0.2475 MPa\n" + ] + } + ], + "prompt_number": 30 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |