diff options
Diffstat (limited to 'Chemical_Engineering_Thermodynamics/ch8.ipynb')
-rwxr-xr-x | Chemical_Engineering_Thermodynamics/ch8.ipynb | 600 |
1 files changed, 600 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics/ch8.ipynb b/Chemical_Engineering_Thermodynamics/ch8.ipynb new file mode 100755 index 00000000..1e8782d9 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/ch8.ipynb @@ -0,0 +1,600 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Thermodynamic properties of real gases" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page No : 275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \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 #volume occupied by n-octane 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", + "dep_h = (P*10**6*v)-(R*T)-(a/v)\n", + "dep_s = R*math.log ((P*10**6*(v-b))/(R*T));\t\n", + "\n", + "# Results\n", + "print \" The enthalpy departure for n-octane vapour = %0.2f J/mol\"%(dep_h);\n", + "print \" The entropy departure for n-octane vapour = %0.4f J/mol K\"%(dep_s);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for n-octane vapour = -428.74 J/mol\n", + " The entropy departure for n-octane vapour = -0.5757 J/mol K\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page No : 276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "T = 100. \t\t\t #temperature of carbon dioxide in degree celsius\n", + "P = 10. \t \t\t #pressure of carbon dioxide in MPa\n", + "A0 = 0.5073;\t\t\t #Beattie-Bridgman constant for carbon dioxide in (Pa m**3)/mol**2\n", + "B0 = 104.76*10**-6;\t\t\t #Beattie-Bridgman constant for carbon dioxide in m**3/mol\n", + "a = 71.32*10**-6;\t\t\t #Beattie-Bridgman constant for carbon dioxide in m**3/mol\n", + "b = 72.35*10**-6;\t\t\t #Beattie-Bridgman constant for carbon dioxide in m**3/mol\n", + "C = 660.0;\t\t \t #Beattie-Bridgman constant for carbon dioxide in (m**3 K**3)/mol\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "\n", + "T = T+273.15\n", + "A1 = (R*T) \n", + "A2 = (B0*R*T)-A0-((C*R)/T**2);\t\t\t \n", + "A3 = (a*A0)-(b*B0*R*T)-((B0*C*R)/T**2);\t\n", + "A4 = ((b*C*B0*R)/T**2);\t\t\t \n", + "vguess = 0.01\n", + "tolerance = 1e-6\n", + "\n", + "def solver_func(vi):\n", + " return (P*10**6)-((A1/vi)+(A2/vi**2)+(A3/vi**3)+(A4/vi**4))\n", + "\n", + "v = fsolve(solver_func,vguess)\n", + "\n", + "Z = (P*10**6*v)/(R*T)\n", + "\n", + "dep_h = (((B0*R*T)-(2*A0)-((4*C*R)/(T**2)))*(1./v))+((((3./2)*a*A0)-(b*B0*R*T)-((5*B0*C*R)/(2*(T**2))))*(1./(v**2)))+((2*b*C*B0*R)/((T**2)*(v**3)));\n", + "\n", + "# Results\n", + "print \" Molar volume of CO2 at %0.f MPa and %0.2f K = %.2e m**3/mol \"%(P,T,v);\n", + "print \" The compressibility factor = %.4f \"%(Z);\n", + "print \" The enthalpy departure for carbon dioxide using the Beattie-Bridgman equation of state = %.f J/mol\"%(dep_h);\n", + "\n", + "# Note: Answer is different because of rounding off error. Please check manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Molar volume of CO2 at 10 MPa and 373.15 K = 2.33e-04 m**3/mol \n", + " The compressibility factor = 0.7518 \n", + " The enthalpy departure for carbon dioxide using the Beattie-Bridgman equation of state = -3210 J/mol\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page No : 278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variables\n", + "T = 353.15 \t \t\t #temperature of carbon dioxide in degree celsius\n", + "P = 10. \t \t \t #pressure of carbon dioxide in MPa\n", + "B0 = 104.76*10**-6;\t\t\t #Beattie-Bridgman constant for carbon dioxide in m**3/mol\n", + "b = 72.35*10**-6;\t\t\t #Beattie-Bridgman constant for carbon dioxide in m**3/mol\n", + "C = 660.0;\t\t\t #Beattie-Bridgman constant for carbon dioxide in (m**3 K**3)/mol\n", + "R = 8.314 \t\t\t #universal gas constant in J/molK\n", + "v = 0.233*10**-3 \t\t #volume calculated in Example (8.3) in m**3/mol\n", + "Z = 0.751;\t\t\t #compressibility factor as calculated in Example (8.3) (no unit)\n", + "\n", + "# Calculations\n", + "A1 = ((B0*R)+((2*C*R)/(T**3)))\n", + "dep_s = (R*math.log (Z))-(A1*(1./v))+(((b*B0*R)-((2*C*B0*R)/(T**3)))*(1./(2*(v**2))))+((2*b*C*B0*R)/(3*(T**3)*(v**3)));\n", + "\n", + "# Results\n", + "print \" The entropy departure for carbon dioxide using the Beattie-\\\n", + "Bridgman equation of state = %.f J/mol K\"%(dep_s);\n", + "\n", + "# Note: Answer is varies because of rounding off error. Please check manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The entropy departure for carbon dioxide using the Beattie-Bridgman equation of state = -7 J/mol K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page No : 281" + ] + }, + { + "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", + "P = 0.215;\t\t\t #pressure of n-octane vapour in MPa\n", + "a = 4.426;\t\t\t #Redlich-Kwong constant taken from Example(3.9) in (m**6 Pa mol**-2)\n", + "b = 164.3*10**-6;\t\t\t #Redlich-Kwong constant taken from Example(3.9) in m**3/mol\n", + "Z = 0.9308;\t\t\t #compressibility factor taken from Example(3.9) (no unit)\n", + "B = 9.9306*10**-3;\t\t\t #value of B, used in the Cardan's method in Example (3.9)\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "dep_h = (R*T*(Z-1))-(((3*a)/(2*b))*math.log ((Z+B)/Z))\n", + "dep_s = (R*math.log(Z-B))-((a/(2*b*T))*math.log((Z+B)/Z))\n", + "\n", + "# Results\n", + "print \" The enthalpy departure for n-octane vapour using the generalized Redlich\\\n", + "-Kwong equation of state = %0.2f J/mol\"%(dep_h);\n", + "print \" The entropy departure for n-octane vapour using the generalized Redlich\\\n", + "-Kwong equation of state = %0.4f J/mol K\"%(dep_s);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for n-octane vapour using the generalized Redlich-Kwong equation of state = -674.98 J/mol\n", + " The entropy departure for n-octane vapour using the generalized Redlich-Kwong equation of state = -1.0195 J/mol K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page No : 281" + ] + }, + { + "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", + "P = 0.215\t\t\t #pressure of n-octane vapour in MPa\n", + "S = 1.0786\t\t\t #constant used in the SRK equation of state,from Example(3.15)\n", + "alpha = 1.3079\t\t #constant used in the SRK equation of state,from Example(3.15)\n", + "a = 5.0180\t\t\t #constant used in the SRK equation of state,from Example(3.15) in (m**6 Pa mol**-2)\n", + "b = 1.6426*10**-4\t\t\t #constant used in the SRK equation of state,from Example(3.15) in m**3/mol\n", + "B = 9.9282*10**-3\t\t\t #factor used in the Cardan's method for solving the SRK equation of state,from Example(3.15) (no unit)\n", + "Z = 0.9191;\t\t\t #compressibility factor taken from Example (3.15) (no unit)\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "Tc = 569.4;\t\t\t #critical temperature of n-octane in K\n", + "\n", + "# Calculations\n", + "da_dT = (-a*S)/(math.sqrt (alpha*T*Tc))\n", + "dep_h = (R*T*(Z-1))+((((T*da_dT)-a)/b)*math.log ((Z+B)/Z));\t\t\t \n", + "dep_s = (R*math.log (Z-B))+((1./b)*(da_dT)*math.log ((Z+B)/Z));\t\t\n", + "\n", + "# Results\n", + "print \" The enthalpy departure for n-octane vapour using the SRK equation of state = %f J/mol\"%(dep_h);\n", + "print \" The entropy departure for n-octane vapour using the SRK equation of state = %0.4f J/mol K\"%(dep_s);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for n-octane vapour using the SRK equation of state = -884.335509 J/mol\n", + " The entropy departure for n-octane vapour using the SRK equation of state = -1.4188 J/mol K\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7 Page No : 282" + ] + }, + { + "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", + "P = 0.215\t\t\t #pressure of n-octane vapour in MPa\n", + "S = 0.9457\t\t\t #constant used in the Peng-Robinson equation of state,from Example(3.16)\n", + "alpha = 1.2677\t\t #constant used in the Peng-Robinson equation of state,from Example(3.16)\n", + "a = 5.2024\t\t\t #constant used in the Peng-Robinson equation of state,from Example(3.16) in (m**6 Pa mol**-2)\n", + "b = 1.4750*10**-4\t #constant used in the Peng-Robinson equation of state,from Example(3.16) in m**3/mol\n", + "B = 8.9151*10**-3\t #factor used in the Cardan's method for solving the Peng-Robinson equation of state,from Example(3.16) (no unit)\n", + "Z = 0.9151\t\t\t #compressibility factor taken from Example (3.16) (no unit)\n", + "R = 8.314\t\t\t #universal gas constant in J/molK\n", + "Tc = 569.4\t\t\t #critical temperature of n-octane in K\n", + "\n", + "# Calculations\n", + "da_dT = (-a*S)/(math.sqrt (alpha*T*Tc))\n", + "\n", + "dep_h = (R*T*(Z-1))+(((((T*da_dT)-a)/(2*math.sqrt(2)*b)))*(math.log ((Z+(B*(1+math.sqrt (2))))/(Z+(B*(1-math.sqrt (2)))))));\n", + "dep_s = (R*math.log (Z-B))+((1./(2*math.sqrt (2)*b))*(da_dT)*(math.log ((Z+(B*(1+math.sqrt (2))))/(Z+(B*(1-math.sqrt (2)))))));\t\t\n", + "\n", + "# Results\n", + "print \" The enthalpy departure for n-octane vapour using the Peng-Robinson \\\n", + " equation of state = %0.1f J/mol\"%(dep_h);\n", + "print \" The entropy departure for n-octane vapour using the Peng-Robinson\\\n", + " equation of state = %0.3f J/mol K\"%(dep_s);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for n-octane vapour using the Peng-Robinson equation of state = -890.1 J/mol\n", + " The entropy departure for n-octane vapour using the Peng-Robinson equation of state = -1.398 J/mol K\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8 Page No : 284" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 339.7\t\t\t #temperature of ethylene in K\n", + "P = 30.7\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", + "R = 8.314\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "Pr = P/Pc\n", + "Tr = T/Tc\n", + "del_h0 = 0.45\n", + "del_h1 = 0.18\n", + "del_s0 = 0.26\n", + "del_s1 = 0.20\n", + "dep_h = ((del_h0)+(w*del_h1))*R*Tc\n", + "dep_s = ((del_s0)+(w*del_s1))*R;\t\n", + "\n", + "# Results\n", + "print \" The enthalpy departure for ethylene using the Edmister charts = %0.3f J/mol\"%(dep_h);\n", + "print \" The entropy departure for ethylene using the Edmister charts = %0.4f J/mol K\"%(dep_s);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for ethylene using the Edmister charts = 1096.868 J/mol\n", + " The entropy departure for ethylene using the Edmister charts = 2.3096 J/mol K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9 Page No : 297" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 339.7;\t\t\t #temperature of ethylene in K\n", + "P = 30.7;\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", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "Pr = P/Pc\n", + "Tr = T/Tc\n", + "del_h0 = 0.474\n", + "del_h1 = 0.232\n", + "del_s0 = 0.277\n", + "del_s1 = 0.220\n", + "dep_h = ((del_h0)+(w*del_h1))*R*Tc\n", + "dep_s = ((del_s0)+(w*del_s1))*R\n", + "\n", + "# Results\n", + "print \" The enthalpy departure for ethylene using the Lee-Kesler data = %f J/mol\"%(dep_h);\n", + "print \" The entropy departure for ethylene using the Lee-Kesler data = %f J/mol K\"%(dep_s);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for ethylene using the Lee-Kesler data = 1164.249733 J/mol\n", + " The entropy departure for ethylene using the Lee-Kesler data = 2.465766 J/mol K\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page No : 299" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\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", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "\n", + "# Calculations\n", + "Pr = P/Pc\n", + "Tr = T/Tc\n", + "dep_h = R*Tc*Pr*((0.083-(1.097/(Tr**1.6)))+(w*(0.139-(0.894/(Tr**4.2)))))\n", + "dep_s = -Pr*R*((0.675/(Tr**2.6))+(w*(0.722/(Tr**5.2))));\t\t\t \n", + "\n", + "# Results\n", + "print \" The enthalpy departure for ethylene using the generalized virial coefficient \\\n", + "correlation = %f J/mol\"%(dep_h);\n", + "print \" The entropy departure for ethylene using the generalized virial coefficient \\\n", + "correlation = %e J/mol K\"%(dep_s);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy departure for ethylene using the generalized virial coefficient correlation = -35.011078 J/mol\n", + " The entropy departure for ethylene using the generalized virial coefficient correlation = -7.232682e-02 J/mol K\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11 Page No : 299" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import cmath\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", + "T_ref = 0.\t\t\t #reference state saturated liquid temperature in degree celsius\n", + "h0 = 0. \t\t\t #enthalpy of saturated liquid in J/mol (reference state)\n", + "s0 = 0. \t\t\t #entropy of saturated liquid in J/molK (reference state)\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", + "NBP = 398.8;\t\t\t #normal boiling point of n-octane (saturated liquid)\n", + "Cp = [6.907,741.770*10**-3,-397.204*10**-6,82.629*10**-9,0]\t\t\t #coefficients to compute the isobaric molar heat capacity, where Cp = a+bT+cT**2+dT**3+eT**-2,in J/molK\n", + "S = 0.9457;\t\t\t #value of S taken from Example (3.16)\n", + "b = 1.4750*10**-4;\t\t\t #value of the Peng-Robinson constant in m**3/mol from Example (3.16)\n", + "v = 15.14*10**-3;\t\t\t #volume of saturated vapour in m**3/mol from Example (3.16)\n", + "R = 8.314;\t\t\t #universal gas constant in J/molK\n", + "P_amb = 101.325;\t\t\t #pressure at which the normal boiling point is computed in kPa\n", + "\n", + "# Calculations\n", + "\n", + "#Step a: Vaporization of n-octane at T_ref\n", + "T_ref = T_ref+273.15\n", + "\n", + "del_hv = ((R*math.log ((Pc*10**5)/(P_amb*10**3)))/((1./NBP)-(1./Tc)))*10**-3;\n", + "P2 = P_amb* math.exp (((del_hv*10**3)/(R))*((1./NBP)-(1./T_ref)))\n", + "Tbr = NBP/Tc\n", + "\t\t\t\n", + "del_hvn = (1.093*R*Tc*(Tbr*(((math.log (Pc))-1.013)/(0.930-Tbr))))*10**-3;\n", + "Tr2 = T_ref/Tc\n", + "\n", + "del_ha = ((del_hvn*10**3)*(((1-Tr2)/(1-Tbr))**(0.38)))*10**-3;\n", + "del_sa = (del_ha*10**3)/T_ref\n", + "\n", + "alpha = (1+(S*(1-math.sqrt (Tr2))))**2\n", + "a = (0.45724*(R**2)*(Tc**2)*alpha)/(Pc*10**5)\n", + "\n", + "A = (a*P2*10**3)/(R*T_ref)**2\n", + "B = (b*P2*10**3)/(R*T_ref);\t\n", + "alpha = -1+B;\t\t\t \n", + "beeta = A-(2*B)-(3*B**2);\n", + "gaamma = -(A*B)+(B**2)+(B**3);\t\t\t \n", + "p = beeta-(alpha**2)/3;\t\t\t \n", + "q = ((2*alpha**3)/27)-((alpha*beeta)/3)+gaamma\n", + "D = (((q)**2)/4)+(((p)**3)/27);\t\t\t\n", + "\n", + "if D>0:\n", + " Z = ((-q/2)+(math.sqrt(D)))**(1./3)+((-q/2)-(math.sqrt(D)))**(1./3)-(alpha/3)\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", + " theta = math.cos((-(q)/2)*(math.sqrt((-27)/(((p)**3)))))\n", + " r = math.sqrt((-(p**3)/27));\t\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", + "da_dT = (-a*S)/(cmath.sqrt(alpha*T_ref*Tc));\t\t\t \n", + "\n", + "dep_h = (R*T_ref*(Z-1))+(((((T_ref*da_dT)-a)/(2*math.sqrt(2)*b)))*(math.log ((Z+(B*(1+math.sqrt (2))))/(Z+(B*(1-math.sqrt (2)))))));\n", + "dep_s = (R*math.log (Z-B))+((1./(2*math.sqrt (2)*b))*(da_dT)*(math.log ((Z+(B*(1+math.sqrt (2))))/(Z+(B*(1-math.sqrt (2)))))));\n", + "del_hb = -dep_h\n", + "del_sb = -dep_s\n", + "\n", + "del_hc = ((Cp[0]*(T-T_ref))+(((Cp[1])/2)*((T**2)-(T_ref**2)))+(((Cp[2])/3)*((T**3)-(T_ref**3)))+(((Cp[3])/4)*((T**4)-(T_ref**4)))-((Cp[4])*((1./T)-(1./T_ref))))*10**-3;\n", + "del_sc = ((Cp[0])*math.log (T/T_ref))+((Cp[1])*(T-T_ref))+(((Cp[2])/2)*((T**2)-(T_ref**2)))+(((Cp[3])/3)*((T**3)-(T_ref**3)))-(((Cp[4])/2)*((1./(T**2))-(1./(T_ref**2))))-(R*math.log((P*10**6)/(P2*10**3)))\t\t\t \n", + "\n", + "Z = 0.9151\n", + "da_dT = (-a*S)/(cmath.sqrt (alpha*T*Tc));\t\t\t \n", + "\n", + "del_hd = (R*T*(Z-1))+((((T*da_dT)-a)/(2*math.sqrt(2)*b))*math.log ((Z+(B*(1+math.sqrt (2))))/(Z+(B*(1-math.sqrt (2))))));\n", + "\n", + "del_sd = (R*math.log (Z-B))+((1./(2*math.sqrt(2)*b))*(da_dT)*(math.log ((Z+(B*(1+math.sqrt (2))))/(Z+(B*(1-math.sqrt (2)))))));\n", + "\n", + "h = h0+del_ha+(del_hb*10**-3)+del_hc+(del_hd*10**-3)\n", + "s = s0+del_sa+del_sb+del_sc+del_sd;\t\t\t \n", + "\n", + "# Results\n", + "print \" The enthalpy of n-octane vapour at 427.85K and 0.215MPa using the Peng-Robinson equation\\\n", + " of state =\",h, \"kJ/mol\"\n", + "print \" The entropy of n-octane vapour at 427.85K and 0.215MPa using the Peng-Robinson\\\n", + " equation of state = \",s,\" J/mol K\"\n", + "print \" The volume of n-octane vapour at 427.85K and 0.215MPa using the Peng-Robinson\\\n", + " equation of state =\",v,\" m**3/mol\"\n", + "\n", + "\n", + "#THE VOLUME OF n-OCTANE VAPOUR AS COMPUTED IN EXAMPLE 3.16 IS 15.14*10**-3 m**3/mol AND NOT \n", + "#15.41*10**-3 m**3/mol AS PRINTED IN THIS EXAMPLE IN THE TEXTBOOK.\n", + "# So ANSWER WOULD BE DIFFERENT\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy of n-octane vapour at 427.85K and 0.215MPa using the Peng-Robinson equation of state = (76.8343786515+0.000518888144511j) kJ/mol\n", + " The entropy of n-octane vapour at 427.85K and 0.215MPa using the Peng-Robinson equation of state = (207.222784016-0.000740500199878j) J/mol K\n", + " The volume of n-octane vapour at 427.85K and 0.215MPa using the Peng-Robinson equation of state = 0.01514 m**3/mol\n" + ] + } + ], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |