{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 9: Multicomponent mixtures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.10: Molar_volume_of_an_equimolar_mixture_using_pseudocritical_properties.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 10,Page 334\n", "//Title: Molar volume of an equimolar mixture using pseudocritical properties\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tc=[425.2;569.4];//critical temperature of n-butane and n-octane in K\n", "Pc=[37.97;24.97];//critical pressure of n-butane and n-octane in bar\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "Tcm=(y1*Tc(1,:))+(y2*Tc(2,:));//calculation of pseudocritical temperature of mixture using Eq.(9.100) in K\n", "Pcm=(y1*Pc(1,:))+(y2*Pc(2,:));//calculation of pseudocritical pressure of mixture using Eq.(9.101) in bar\n", "Trm=T/Tcm;//calculation of pseudoreduced temperature of the mixture using Eq.(9.102) (no unit)\n", "Prm=P/Pcm;//calculation of pseudoreduced pressure of the mixture using Eq.(9.103) (no unit)\n", "Zm0=0.9;//value of Zm0 is taken from the generalized compressibility chart, Figure(3.11) corresponding to Trm and Prm (no unit)\n", "vm=(Zm0*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n The molar volume of an equimolar mixture of n-butane and n-octane using the pseudocritical properties estimated through Kays rule = %0.2e m^3/mol\n',vm);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "\n", " " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.11: Molar_volume_of_mixture_using_Prausnitz_Gunn_rule.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 11,Page 335\n", "//Title: Molar volume of mixture using Prausnitz-Gunn rule\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tc=[425.2;569.4];//critical temperature of n-butane and n-octane in K\n", "Pc=[37.97;24.97];//critical pressure of n-butane and n-octane in bar\n", "vc=[255.0*10^-6;486.0*10^-6];//critical molar volume of n-butane and n-octane in m^3/mol\n", "Zc=[0.274;0.256];//compressibility factor of n-butane and n-octane corresponding to Tc,Pc (no unit)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "Tcm=(y1*Tc(1,:))+(y2*Tc(2,:));//calculation of pseudocritical temperature of mixture using Eq.(9.104) in K\n", "Pcm=((R*((y1*Zc(1,:))+(y2*Zc(2,:)))*Tcm)/((y1*vc(1,:))+(y2*vc(2,:))))*10^-5;//calculation of the pseudocritical pressure of mixture using Eq.(9.105) in bar\n", "Trm=T/Tcm;//calculation of pseudoreduced temperature using Eq.(9.102) (no unit)\n", "Prm=P/Pcm;//calculation of pseudoreduced pressure using Eq.(9.103) (no unit)\n", "Zm0=0.89;//value of Zm0 is taken from the generalized compressibility chart, Figure(3.11) corresponding to Trm and Prm (no unit)\n", "vm=(Zm0*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n The molar volume of an equimolar mixture of n-butane and n-octane at 600K and 16bar estimated using the Prausnitz-Gunn rule = %0.2e m^3/mol\n',vm);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "\n", " " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.12: Molar_volume_of_mixture_using_van_der_Waals_equation_of_state.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 12,Page 335\n", "//Title: Molar volume of mixture using van der Waals equation of state\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "a_m=2.4405;//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;//van der Waals constant for the mixture as determined in Example 9.8 in m^3/mol\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//The problem is solved by using the Cardan's method\n", "A=(a_m*P*10^5)/(R*T)^2;//calculation of A to determine alpha,beeta and gaamma by using Eq.(3.25)\n", "B=(b_m*P*10^5)/(R*T);//calculation of B to determine alpha,beeta and gaamma by using Eq.(3.26)\n", "alpha=-1-B;//calculation of alpha for van der Waals equation of state using Table (3.2)\n", "beeta=A;//calculation of beeta for van der Waals equation of state using Table (3.2)\n", "gaamma=-(A*B);//calculation of gaamma for van der Waals equation of state using Table (3.2)\n", "p=beeta-((alpha^2)/3);//calculation of p to determine the roots of the cubic equaton using Eq.(3.29)\n", "q=((2*alpha^3)/27)-((alpha*beeta)/3)+gaamma;//calculation of q to determine the roots of the cubic equaton using Eq.(3.30)\n", "D=(((q)^2)/4)+(((p)^3)/27);//calculation of D to determine the nature of roots using Eq.(3.31)\n", "\n", "if D>0 then\n", " Z=(((-(q)/2)+(sqrt(D)))^(1/3))+(((-(q)/2)-(sqrt(D)))^(1/3))-(alpha/3);//One real root given by Eq.(3.32)\n", "else if D==0 then\n", " Z1=((-2*(q/2))^(1/3))-(alpha/3);//Three real roots and two equal given by Eq.(3.33)\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=sqrt((-(p^3)/27));//calculation of r using Eq.(3.38)\n", " theta=acos((-(q)/2)*(1/r));//calculation of theta in radians using Eq.(3.37)\n", " Z1=(2*(r^(1/3))*cos(theta/3))-(alpha/3);\n", " Z2=(2*(r^(1/3))*cos(((2*%pi)+theta)/3))-(alpha/3);//Three unequal real roots given by Eqs.(3.34,3.35 and 3.36)\n", " Z3=(2*(r^(1/3))*cos(((4*%pi)+theta)/3))-(alpha/3);\n", " Za=[Z1 Z2 Z3];\n", " Z=max(Za);\n", " end\n", "end\n", "vm=(Z*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n 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 = %e m^3/mol\n',vm);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "// DISCLAIMER: VALUE OF Z COMPUTED IN PROGRAM IS NOT AS THAT REPORTED IN THE TEXTBOOK. HOWEVER, VALUES OF ALL OTHER PERTINENT VARIABLES A, B, alpha, beeta, p, q etc. AGREE WELL WITH THE TEXTBOOK ANSWER. COMPUTATION WAS ALSO VERIFIED MANUALLY AND GAVE THE ANSWER AS COMPUTED IN PROGRAM. ONE POSSIBLE REASON FOR DEVIATION COULD BE ROUND OFF ERROR." ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.13: Molar_volume_of_mixture_using_the_generalized_virial_coefficient_correlation.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 13,Page 336\n", "//Title: Molar volume of mixture using the generalized virial coefficient correlation\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Bm=-309*10^-6;//second virial coefficient for the mixture taken from Example(9.7) in m^3/mol\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "Zm=1+((Bm*P*10^5)/(R*T));//calculation of the compressibility factor for the mixture (no unit)\n", "vm=(Zm*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n The molar volume of an equimolar mixture of n-butane and n-octane found using the generalized virial coefficient correlation = %0.4e m^3/mol\n',vm);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.14: Enthalpy_and_entropy_departure.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 14,Page 337\n", "//Title: Enthalpy and entropy departure\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "am=2.4405;//van der Waals constant for the mixture taken from Example 9.8 in Pa(m^3/mol)^2\n", "bm=0.1767*10^-3;//van der Waals constant for the mixture taken from Example 9.8 in m^3/mol\n", "vm=2.8933*10^-3;//molar volume of the mixture taken from Example 9.12 in m^3/mol\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "dep_h=((P*10^5*vm)-(R*T)-(am/vm))*10^-3;//calculation of the enthalpy departure using Example(8.1) in kJ/mol\n", "dep_s=R*(log ((P*10^5*(vm-bm))/(R*T)));//calculation of the entropy departure using Example(8.1) in J/molK\n", "\n", "//OUTPUT\n", "mprintf('\n The enthalpy departure of an equimolar mixture of n-butane and n-octane = %0.3f kJ/mol\n',dep_h);\n", "mprintf('\n The entropy departure of an equimolar mixture of n-butane and n-octane = %0.3f J/mol K\n',dep_s);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.15: EX9_15.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 15,Page 338\n", "//Title: Enthalpy and entropy departure using the generalized compressibility factor correlation\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tcm=497.3;//pseudocritical temperature of mixture taken from Example(9.10) in K\n", "Pcm=31.47;//pseudocritical pressure of mixture taken from Example(9.10) in bar\n", "Trm=1.21;//pseudoreduced temperature of the mixture taken from Example(9.10) (no unit)\n", "Prm=0.51;//pseudoreduced pressure of the mixture taken from Example(9.10) (no unit)\n", "w_butane=0.199;//acentric factor for n-butane (no unit)\n", "w_octane=0.398;//acentric factor for n-octane (no unit)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "wm=(y1*w_butane)+(y2*w_octane);//calculation of the acentric factor for the mixture (no unit)\n", "del_h0=0.380;//value of ((h0-h)/RTcm)_0 read from Fig.(8.6) corresponding to Prm and Trm (no unit)\n", "del_h1=0.188;//value of ((h0-h)/RTcm)_1 read from Fig.(8.8) corresponding to Prm and Trm (no unit)\n", "del_s0=0.22;//value of ((s0-s)/R)_0 read from Fig.(8.10) corresponding to Prm and Trm (no unit)\n", "del_s1=0.18;//value of ((s0-s)/R)_1 read from Fig.(8.12) corresponding to Prm and Trm (no unit)\n", "dep_h=((R*Tcm)*(del_h0+(wm*del_h1)))*10^-3;//calculation of the enthalpy departure using Eq.(8.62) in kJ/mol\n", "dep_s=(R)*(del_s0+(wm*del_s1));//calculation of the entropy departure using Eq.(8.65) in J/molK\n", "\n", "//OUTPUT\n", "mprintf('\n The enthalpy departure of an equimolar mixture of n-butane and n-octane using the generalized compressibility factor correlation = %0.3f kJ/mol\n',dep_h);\n", "mprintf('\n The entropy departure of an equimolar mixture of n-butane and n-octane using the generalized compressibility factor correlation = %f J/mol K\n',dep_s);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.16: Enthalpy_and_entropy_departure_using_the_virial_coefficient_correlation.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 16,Page 339\n", "//Title: Enthalpy and entropy departure using the virial coefficient correlation\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tc=[425.2;569.4];//critical temperature of n-butane and n-octane in K\n", "Pc=[37.97;24.97];//critical pressure of n-butane and n-octane in bar\n", "w=[0.199;0.398];//acentric factor of n-butane and n-octane (no unit)\n", "Tr1=1.411;//reduced temperature of n-butane (no unit) taken from Example (9.7)\n", "Tr2=1.054;//reduced temperature of n-octane (no unit) taken from Example (9.7)\n", "Tr_12=1.24;//reduced temperature for computing the mixture interaction virial coefficient (no unit) taken from Example(9.7)\n", "Pc_12=2.978;//Pc_ij in MPa taken from Example(9.7)\n", "Tc_12=483.9;//Tc_ij in K taken from Example(9.7)\n", "w_12=0.2985;// w_ij (no unit) taken from Example(9.7)\n", "Bm=-309*10^-6;//second virial coefficient in m^3/mol taken from Example (9.7)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "dB0_dTr1=0.675/(Tr1^2.6);//calculation of dBij0/dTrij using Eq.(8.73) (no unit)\n", "dB0_dTr2=0.675/(Tr2^2.6);//calculation of dBij0/dTrij using Eq.(8.73) (no unit)\n", "dB1_dTr1=0.722/(Tr1^5.2);//calculation of dBij1/dTrij using Eq.(8.74) (no unit)\n", "dB1_dTr2=0.722/(Tr2^5.2);//calculation of dBij1/dTrij using Eq.(8.74) (no unit)\n", "dB0_dTr12=0.675/(Tr_12^2.6);//calculation of dBij0/dTrij using Eq.(9.114) (no unit)\n", "dB1_dTr12=0.722/(Tr_12^5.2);//calculation of dBij1/dTrij using Eq.(9.115) (no unit)\n", "dB1_dT=(R/(Pc(1,:)*10^5))*((dB0_dTr1)+(w(1,:)*(dB1_dTr1)));//calculation of dBij/dT using Eq.(9.112) (m^3/molK)\n", "dB2_dT=(R/(Pc(2,:)*10^5))*((dB0_dTr2)+(w(2,:)*(dB1_dTr2)));//calculation of dBij/dT using Eq.(9.112) (m^3/molK)\n", "dB12_dT=(R/(Pc_12*10^6))*((dB0_dTr12)+(w_12*(dB1_dTr12)));//calculation of dBij/dT using Eq.(9.112) (m^3/molK)\n", "dBm_dT=((y1^2)*(dB1_dT))+((2*y1*y2)*(dB12_dT))+((y2^2)*(dB2_dT));//calculation of dBm/dT using Eq.(9.110) (m^3/molK)\n", "dep_h=((Bm-(T*dBm_dT))*P*10^5)*10^-3;//calculation of enthalpy departure using Eq.(8.69) in kJ/mol\n", "dep_s=-P*10^5*(dBm_dT);//calculation of entropy departure using Eq.(8.70) in J/molK\n", "\n", "//OUTPUT\n", "mprintf('\n The enthalpy departure of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = %f kJ/mol\n',dep_h);\n", "mprintf('\n The entropy departure of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = %0.3f J/mol K\n',dep_s);\n", "\n", "//===============================================END OF PROGRAM=================================================== \n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.17: Fugacity_and_fugacity_coefficient_using_van_der_Waals_equation_of_state.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 17,Page 340\n", "//Title: Fugacity and fugacity coefficient using van der Waals equation of state\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "a_m=2.4405;//van der Waals constant (a_m) in Pa(m^3/mol)^2 taken from Example(9.8)\n", "b_m=0.1767*10^-3;//van der Waals constant (b_m) in m^3/mol taken from Example(9.8)\n", "Z=0.928;//compressibility factor taken from Example(9.12)\n", "vm=2.8933*10^-3;//molar volume of the equimolar mixture in m^3/mol taken from Example(9.12)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "phi=exp (Z-1-log ((P*10^5*(vm-b_m))/(R*T))-(a_m/(R*T*vm)));//calculation of the fugacity coefficient (f/P) using the expression derived in Example 9.3 (no unit)\n", "f=phi*P;//calculation of fugacity using Eq.(9.37) in bar\n", "\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of an equimolar mixture of n-butane and n-octane using the van der Waals equation of state = %0.4f \n',phi);\n", "mprintf('\n The fugacity of an equimolar mixture of n-butane and n-octane using the van der Waals equation of state = %0.2f bar\n',f);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.18: Fugacity_and_fugacity_coefficient_using_the_pseudocritical_constants_method.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 18,Page 341\n", "//Title: Fugacity and fugacity coefficient using the pseudocritical constants method\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tcm=497.3;//pseudocritical temperature of mixture in K taken from Example(9.10)\n", "Pcm=31.47;//pseudocritical pressure of mixture in bar taken from Example(9.10)\n", "Trm=1.21;//pseudoreduced temperature of the mixture (no unit) taken from Example(9.10)\n", "Prm=0.51;//pseudoreduced pressure of the mixture (no unit) taken from Example(9.10)\n", "w=[0.199;0.398];//acentric factor of n-butane and n-octane (no unit)\n", "\n", "//CALCULATION\n", "wm=(w(1,:)+w(2,:))/2;//calculation of the acentric factor for the mixture (no unit)\n", "log_phi0=-0.042;//value of log_phi0 taken from Figure(9.2) (no unit)\n", "log_phi1=0.01;//value of log_phi1 taken from Figure(9.4) (no unit)\n", "phi=10^(log_phi0+(wm*log_phi1));//calculation of the fugacity coefficient using Eq.(9.54) (no unit)\n", "f=P*phi;//calculation of the fugacity using Eq.(9.37) in bar\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of an equimolar mixture of n-butane and n-octane using the pseudocritical constants method = %0.3f \n',phi);\n", "mprintf('\n The fugacity of an equimolar mixture of n-butane and n-octane using the pseudocritical constants method = %f bar\n',f);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.19: Fugacity_and_fugacity_coefficient_using_the_virial_coefficient_correlation.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 19,Page 341\n", "//Title: Fugacity and fugacity coefficient using the virial coefficient correlation\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Bm=-309*10^-6;//second virial coefficient in m^3/mol taken from Example (9.7)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//Using Eq.(3.91) and Eq.(9.58) ln(phi)=BP/RT, which is used to compute phi\n", "phi=(exp((Bm*P*10^5)/(R*T)));//calculation of the fugacity coefficient using the above expression (no unit)\n", "f=phi*P;//calculation of the fugacity using Eq.(9.37) in bar\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = %f \n',phi);\n", "mprintf('\n The fugacity of an equimolar mixture of n-butane and n-octane using the virial coefficient correlation = %f bar\n',f);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "\n", "//DISCLAIMER: THE VALUE OF FUGACITY COEFFICIENT AS CALCULATED IN THE TEXTBOOK IS WRONG.THIS HAS BEEN CORRECTED IN THIS PROGRAM." ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.1: Partial_molar_volume.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 1,Page 313\n", "//Title: Partial molar volume\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "per_ethanol=60;//mole percent of ethanol in a ethanol-water system\n", "per_water=40;//mole percent of water in a ethanol-water system\n", "v1=57.5*10^-6;//partial molar volume of ethanol in the ethanol-water system in m^3\n", "rho=849.4;//density of the mixture in kg/m^3\n", "M_ethanol=46*10^-3;//molar mass of ethanol in kg/mol\n", "M_water=18*10^-3;//molar mass of ethanol in kg/mol\n", "\n", "//CALCULATION\n", "X1=per_ethanol/100;//calculation of the mole fraction of ethanol (no unit)\n", "X2=per_water/100;//calculation of the mole fraction of water (no unit)\n", "M=(X1*M_ethanol)+(X2*M_water);//calculation of the molar mass of the ethanol-water mixture in kg/mol\n", "v=M/rho;//calculation of the molar volume of the mixture in m^3/mol\n", "v2=(v-(X1*v1))/(X2);//calculation of the partial molar volume of water using Eq.(9.10) in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n The partial molar volume of water = %f m^3/mol\n',v2);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.20: EX9_20.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 20,Page 344\n", "//Title: Fugacity coefficients of the components in a mixture using Redlich-Kwong Equation of state\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tc=[425.2;569.4];//critical temperature of n-butane and n-octane in K\n", "Pc=[37.97;24.97];//critical pressure of n-butane and n-octane in bar\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "a1=(0.42748*R^2*Tc(1,:)^2.5)/(Pc(1,:)*10^5*sqrt(T));//calculation of Redlich-Kwong constant for n-butane in (m^6 Pa mol^-2)\n", "a2=(0.42748*R^2*Tc(2,:)^2.5)/(Pc(2,:)*10^5*sqrt(T));//calculation of Redlich-Kwong constant for n-octane in (m^6 Pa mol^-2)\n", "b1=(0.08664*R*Tc(1,:))/(Pc(1,:)*10^5);//calculation of Redlich-Kwong constant for n-butane in m^3/mol\n", "b2=(0.08664*R*Tc(2,:))/(Pc(2,:)*10^5);//calculation of Redlich-Kwong constant for n-octane in m^3/mol\n", "//Set Kij=0 and evaluate a using Eq.(9.64)\n", "a=((y1^2)*a1)+(2*y1*y2*sqrt(a1*a2))+((y2^2)*a2);//calculation of Redlich-Kwong constant for the mixture using Eq.(9.64) in (m^6 Pa mol^-2)\n", "b=(y1*b1)+(y2*b2);//calculation of Redlich-Kwong constant for the mixture using Eq.(9.65) in m^3/mol\n", "\n", "//The Cardans method can be used to determine Z\n", "A=(a*P*10^5)/(R*T)^2;//calculation of A to determine alpha,beeta and gaamma by using Eq.(3.25)\n", "B=(b*P*10^5)/(R*T);//calculation of B to determine alpha,beeta and gaamma by using Eq.(3.26)\n", "alpha=-1;//calculation of alpha for Redlich-Kwong equation of state using Table (3.2)\n", "beeta=A-B-B^2;//calculation of beeta for Redlich-Kwong equation of state using Table (3.2)\n", "gaamma=-(A*B);//calculation of gaamma for Redlich-Kwong equation of state using Table (3.2)\n", "p=beeta-(alpha^2)/3;//calculation of p to determine the roots of the cubic equation using Eq.(3.29)\n", "q=((2*alpha^3)/27)-((alpha*beeta)/3)+gaamma;//calculation of q to determine the roots of the cubic equation using Eq.(3.30)\n", "D=(((q)^2)/4)+(((p)^3)/27);//calculation of D to determine the nature of roots using Eq.(3.31)\n", "\n", "if D>0 then\n", " Z=((-q/2)+(sqrt(D)))^(1/3)+((-q/2)-(sqrt(D)))^(1/3)-(alpha/3);//One real root given by Eq.(3.32)\n", "else if D==0 then\n", " Z1=((-2*(q/2))^(1/3))-(alpha/3);//Three real roots and two equal given by Eq.(3.33)\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=sqrt((-(p^3)/27));//calculation of r using Eq.(3.38)\n", " theta=acos((-(q)/2)*(1/r));//calculation of theta in radians using Eq.(3.37)\n", " Z1=(2*(r^(1/3))*cos(theta/3))-(alpha/3);\n", " Z2=(2*(r^(1/3))*cos(((2*%pi)+theta)/3))-(alpha/3);//Three unequal real roots given by Eqs.(3.34,3.35 and 3.36)\n", " Z3=(2*(r^(1/3))*cos(((4*%pi)+theta)/3))-(alpha/3);\n", " Za=[Z1 Z2 Z3];\n", " Z=max(Za);\n", " end\n", "end\n", "//calculation of the fugacity coefficient of n-butane in the mixture using Eq.(9.126) (no unit)\n", "phi1=exp (((b1/b)*(Z-1))-log(Z-B)+((a/(b*R*T))*((b1/b)-(2*sqrt(a1/a)))*log((Z+B)/Z)));\n", "//calculation of the fugacity coefficient of n-octane in the mixture using Eq.(9.126) (no unit)\n", "phi2=exp (((b2/b)*(Z-1))-log(Z-B)+((a/(b*R*T))*((b2/b)-(2*sqrt(a2/a)))*log((Z+B)/Z)));\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of n-butane in the equimolar mixture using the Redlich-Kwong Equation of state = %0.4f \n',phi1);\n", "mprintf('\n The fugacity coefficient of n-octane in the equimolar mixture using the Redlich-Kwong Equation of state = %0.4f \n',phi2);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.21: EX9_21.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 21,Page 346\n", "//Title: Fugacity coefficients of the components in a mixture using the Virial Equation of state\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "B_11=-131*10^-6;//pure component (n-butane) second virial coefficient in m^3/mol taken from Example(9.7)\n", "B_22=-577*10^-6;//pure component (n-octane) second virial coefficient in m^3/mol taken from Example(9.7)\n", "B_12=-264*10^-6;//mixture interaction virial coefficient in m^3/mol taken from Example(9.7)\n", "Bm=-309*10^-6;//second virial coefficient in m^3/mol taken from Example(9.7)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "Zm=(1/2)*(1+sqrt(1+((4*Bm*P*10^5)/(R*T))));//calculation of compressibility for the mixture(Zm) using Eq.(9.136) (no unit)\n", "phi1=exp((((2*P*10^5)/(Zm*R*T))*((y1*B_11)+(y2*B_12)))-log(Zm));//calculation of the fugacity coefficient of n-butane in the mixture using Eq.(9.135) (no unit)\n", "phi2=exp((((2*P*10^5)/(Zm*R*T))*((y1*B_12)+(y2*B_22)))-log(Zm));//calculation of the fugacity coefficient of n-octane in the mixture using Eq.(9.135) (no unit)\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of n-butane in the equimolar mixture using the Virial Equation of state = %0.3f \n',phi1);\n", "mprintf('\n The fugacity coefficient of n-octane in the equimolar mixture using the Virial Equation of state = %f \n',phi2);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.22: Fugacity_of_liquid_n_octane.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 22,Page 349\n", "//Title: Fugacity of liquid n-octane\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=427.85;//temperature of n-octane vapour in K\n", "Psat=0.215;//saturation pressure of n-octane vapour at T in MPa\n", "P=1;//pressure at which the fugacity of liquid n-octane is to be determined in MPa\n", "f_sat=0.2368;//fugacity of n-octane vapour at T and Psat taken from Example(9.5) in MPa\n", "vl=0.2003*10^-3;//molar volume of n-octane liquid at T and Psat taken from Example(3.16) in m^3/mol\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "f_l=(0.2368*exp((vl*(P-Psat)*10^6)/(R*T)));//calculation of fugacity of n-octane liquid using Eq.(9.150) in MPa\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity of liquid n-octane at 427.85K and 1MPa = %0.4f MPa\n',f_l);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.2: Volumes_to_be_mixed.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 2,Page 313\n", "//Title: Volumes to be mixed\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "V=3;//volume of mixture to be prepared in m^3\n", "per_ethanol=60;//mole percent of ethanol in a ethanol-water system\n", "per_water=40;//mole percent of water in a ethanol-water system\n", "v1=57.5*10^-6;//partial molar volume of ethanol in the ethanol-water system in m^3/mol\n", "v2=16*10^-6;//partial molar volume of water in the ethanol-water system in m^3/mol\n", "v1_pure=57.9*10^-6;//molar volume of pure ethanol in m^3/mol\n", "v2_pure=18*10^-6;//molar volume of pure water in m^3/mol\n", "\n", "//CALCULATION\n", "X1=per_ethanol/100;//calculation of the mole fraction of ethanol (no unit)\n", "X2=per_water/100;//calculation of the mole fraction of water (no unit)\n", "v=(X1*v1)+(X2*v2);//calculation of the molar volume of the solution using Eq.(9.10) in m^3/mol\n", "N=V/v;//calculation of the mole number of solution required in mol\n", "N1=N*X1;//calculation of the mole number of ethanol in solution in mol\n", "N2=N*X2;//calculation of the mole number of water in solution in mol\n", "V1=N1*v1_pure;//calculation of the volume of pure ethanol required in m^3\n", "V2=N2*v2_pure;//calculation of the volume of pure water required in m^3\n", "\n", "//OUTPUT\n", "mprintf('\n The volume of pure ethanol required = %0.3f m^3\n',V1);\n", "mprintf('\n The volume of pure water required = %0.3f m^3\n',V2);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.3: Fugacity_and_fugacity_coefficient.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 3,Page 318\n", "//Title: Fugacity and fugacity coefficient\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=427.85;//temperature of n-octane vapour in K\n", "P=0.215;//pressure of n-octane vapour in MPa\n", "a=3.789;//van der Waals constant in Pa(m^3/mol)^2\n", "b=2.37*10^-4;//van der Waals constant in m^3/mol\n", "v=15.675*10^-3;//molar volume of n-octane saturated vapour taken from Example 3.8 in m^3/mol\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "Z=(P*10^6*v)/(R*T);//calculation of the compressibility factor (no unit)\n", "//calculation of the fugacity coefficient (f/P) using the expression derived in Example 9.3 (no unit)\n", "phi=exp (Z-1-log (((P*10^6)*(v-b))/(R*T))-a/(R*T*v));\n", "f=(P*10^6*phi)*10^-6;//calculation of fugacity using Eq.(9.37) in MPa\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of n-octane vapour = %0.2f \n',phi);\n", "mprintf('\n The fugacity of n-octane vapour = %0.4f MPa\n',f);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.5: Fugacity_and_fugacity_coefficient_from_the_Lee_Kesler_data.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 5,Page 322\n", "//Title: Fugacity and fugacity coefficient from the Lee-Kesler data\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=427.85;//temperature of n-octane vapour in K\n", "P=0.215;//pressure of n-octane vapour in MPa\n", "Tc=569.4;//critical temperature of n-octane in K\n", "Pc=24.97;//critical pressure of n-octane in bar\n", "w=0.398;//acentric factor (no unit)\n", "\n", "//CALCULATION\n", "Tr=T/Tc;//calculation of reduced temperature (no unit)\n", "Pr=(P*10^6)/(Pc*10^5);//calculation of reduced pressure (no unit)\n", "log_phi0=-0.032;//value of log_phi0 taken from Figure(9.2) (no unit)\n", "log_phi1=-0.025;//value of log_phi1 taken from Figure(9.4) (no unit)\n", "phi=10^(log_phi0+(w*log_phi1));//calculation of the fugacity coefficient using Eq.(9.54) (no unit)\n", "f=P*phi;//calculation of the fugacity using Eq.(9.37) in MPa\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of n-octane vapour = %f \n',phi);\n", "mprintf('\n The fugacity of n-octane vapour = %f MPa\n',f);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "\n", "// DISCLAIMER: THE VALUE OF FUGACITY COEFFICIENT AS CALCULATED IN THE TEXTBOOK UPON TAKING THE ANTILOG IS WRONG. THE ANTILOG OF -0.042 IS A VALUE LESS THAN 1. THIS HAS BEEN CORRECTED ACCORDINGLY IN THIS PROGRAM AND THE VALUE OF FUGACITY COEFFICIENT AND FUGACITY HAVE BEEN COMPUTED." ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.6: Fugacity_and_fugacity_coefficient_using_the_virial_coefficient_correlation.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 6,Page 327\n", "//Title: Fugacity and fugacity coefficient using the virial coefficient correlation\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=339.7;//temperature of ethylene in K\n", "P=1;//pressure of ethylene in bar\n", "Tc=283.1;//critical temperature of ethylene in K\n", "Pc=51.17;//critical pressure of ethylene in bar\n", "w=0.089;//acentric factor (no unit)\n", "\n", "//CALCULATION\n", "Tr=T/Tc;//calculation of reduced temperature (no unit)\n", "Pr=P/Pc;//calculation of reduced pressure (no unit)\n", "B0=0.083-(0.422/(Tr^1.6));//calculation of B0 using Eq.(3.95) so as to compute fugacity coefficient using Eq.(9.58)\n", "B1=0.139-(0.172/(Tr^4.2));//calculation of B1 using Eq.(3.96) so as to compute fugacity coefficient using Eq.(9.58)\n", "phi=exp ((B0+(w*B1))*(Pr/Tr));//calculation of the fugacity coefficient using Eq.(9.58) (no unit)\n", "f=P*phi;//calculation of the fugacity using Eq.(9.37) in bar\n", "\n", "//OUTPUT\n", "mprintf('\n The fugacity coefficient of ethylene = %0.4f \n',phi);\n", "mprintf('\n The fugacity of ethylene = %0.4f bar\n',f);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.7: Second_virial_coefficient.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 7,Page 330\n", "//Title: Second virial coefficient\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "Tc=[425.2;569.4];//critical temperature of n-butane and n-octane in K\n", "Pc=[37.97;24.97];//critical pressure of n-butane and n-octane in bar\n", "vc=[255.0*10^-6;486.0*10^-6];//critical molar volume of n-butane and n-octane in m^3/mol\n", "Zc=[0.274;0.256];//compressibility factor of n-butane and n-octane corresponding to Tc,Pc (no unit)\n", "w=[0.199;0.398];//acentric factor of n-butane and n-octane (no unit)\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "K_12=1-((8*((vc(1,:)*vc(2,:))^(1/2)))/((((vc(1,:))^(1/3))+((vc(2,:))^(1/3)))^3));//calculation of the binary interaction parameter using Eq.(9.94)\n", "Tc_12=(((Tc(1,:))*(Tc(2,:)))^(1/2))*(1-K_12);//calculation of Tc_ij using Eq.(9.89) in K\n", "w_12=(w(1,:)+w(2,:))/2;//calculation of w_ij using Eq.(9.92) (no unit)\n", "Zc_12=(Zc(1,:)+Zc(2,:))/2;//calculation of Zc_ij using Eq.(9.91) (no unit)\n", "vc_12=((((vc(1,:))^(1/3))+((vc(2,:))^(1/3)))/2)^3;//calculation of vc_ij using Eq.(9.90) in m^3/mol\n", "Pc_12=((Zc_12*R*Tc_12)/vc_12)*10^-6;//calculation of Pc_ij using Eq.(9.93) in MPa\n", "Tr_12=T/Tc_12;//calculation of reduced temperature for computing the mixture interaction virial coefficient (no unit)\n", "B_12_0=0.083-(0.422/(Tr_12^(1.6)));//calculation of B_ij0 using Eq.(9.87)\n", "B_12_1=0.139-(0.172/(Tr_12^(4.2)));//calculation of B_ij1 using Eq.(9.88)\n", "B_12=((R*Tc_12)/(Pc_12*10^6))*(B_12_0+(w_12*B_12_1));//calculation of the mixture interaction virial coefficient using Eq.(9.86) in m^3/mol\n", "Tr1=T/Tc(1,:);//calculation of reduced temperature of n-butane (no unit)\n", "B_11_0=0.083-(0.422/(Tr1^(1.6)));//calculation of B_i0 for the pure component (n-butane) using Eq.(9.87)\n", "B_11_1=0.139-(0.172/(Tr1^(4.2)));//calculation of B_i1 for the pure component (n-butane) using Eq.(9.88)\n", "B_11=((R*Tc(1,:))/(Pc(1,:)*10^5))*(B_11_0+(w(1,:)*B_11_1));//calculation of the pure component (n-butane) second virial coefficient using Eq.(9.86) in m^3/mol\n", "Tr2=T/Tc(2,:);//calculation of reduced temperature of n-octane (no unit)\n", "B_22_0=0.083-(0.422/(Tr2^(1.6)));//calculation of B_i0 for the pure component (n-octane) using Eq.(9.87)\n", "B_22_1=0.139-(0.172/(Tr2^(4.2)));//calculation of B_i1 for the pure component (n-octane) using Eq.(9.88)\n", "B_22=((R*Tc(2,:))/(Pc(2,:)*10^5))*(B_22_0+(w(2,:)*B_22_1));//calculation of the pure component (n-octane) second virial coefficient using Eq.(9.86) in m^3/mol\n", "Bm=((y1^2)*B_11)+((2*y1*y2)*B_12)+((y2^2)*B_22);//calculation of the second virial coefficient using Eq.(9.85) in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n The second virial coefficient for an equimolar mixture of n-butane and n-octane at 600K = %f m^3/mol\n',Bm);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.8: van_der_Waals_constants.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 8,Page 331\n", "//Title: van der Waals constants\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "a=[1.3874;3.7890];//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];//van der Waals constant of n-butane and n-octane in m^3/mol\n", "\n", "//CALCULATION\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "//Set K_ij=0 in Eq.(9.64) to compute the van der Waals constant (a_m) for an equimolar mixture of n-butane and n-octane\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture\n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "a_m=((y1^2)*a(1,:))+((2*y1*y2)*sqrt (a(1,:)*a(2,:)))+((y2^2)*a(2,:));//calculation of the van der Waals constant (a_m) using Eq.(9.64) in Pa(m^3/mol)^2\n", "b_m=(y1*b(1,:))+(y2*b(2,:));//calculation of the van der Waals constant (b_m) using Eq.(9.65) in m^3/mol\n", "\n", "//OUTPUT\n", "mprintf('\n The van der Waals constant for an equimolar mixture of n-butane and n-octane, a_m = %0.4f Pa(m^3/mol)^2\n',a_m);\n", "mprintf('\n The van der Waals constant for an equimolar mixture of n-butane and n-octane, b_m = %f m^3/mol\n',b_m);\n", "\n", "//===============================================END OF PROGRAM===================================================" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.9: Molar_volume_of_an_equimolar_mixture.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Y.V.C.Rao ,1997.Chemical Engineering Thermodynamics.Universities Press,Hyderabad,India.\n", "\n", "//Chapter-9,Example 9,Page 333\n", "//Title: Molar volume of an equimolar mixture\n", "//================================================================================================================\n", "clear \n", "clc\n", "\n", "//INPUT\n", "T=600;//temperature of the equimolar n-butane and n-octane mixture in K\n", "P=16;//pressure of the equimolar n-butane and n-octane mixture in bar\n", "Tc=[425.2;569.4];//critical temperature of n-butane and n-octane in K\n", "Pc=[37.97;24.97];//critical pressure of n-butane and n-octane in bar\n", "R=8.314;//universal gas constant in J/molK\n", "\n", "//CALCULATION\n", "//Calculation by Amagat's law of additive volumes\n", "//For convenience, n-butane is taken as 1 and n-octane as 2\n", "y1=0.5;//mole fraction of n-butane in the equimolar mixture \n", "y2=0.5;//mole fraction of n-octane in the equimolar mixture\n", "Tr1=T/Tc(1,:);//calculation of reduced temperature of n-butane (no unit)\n", "Pr1=P/Pc(1,:);//calculation of reduced pressure of n-butane (no unit)\n", "Z1_0=0.95;//value of Z1_0 taken from the generalized compressibility chart, Figure(3.11) corresponding to Tr1 and Pr1 (no unit)\n", "Tr2=T/Tc(2,:);//calculation of reduced temperature of n-octane (no unit)\n", "Pr2=P/Pc(2,:);//calculation of reduced pressure of n-octane (no unit)\n", "Z2_0=0.785;//value of Z2_0 taken from the generalized compressibility chart, Figure(3.11) corresponding to Tr2 and Pr2 (no unit)\n", "//Part a: Using the Amagat's law of additive volumes\n", "Zm=(y1*Z1_0)+(y2*Z2_0);//calculation of the compressibility of the mixture using Eq.(9.96) (no unit)\n", "vm=(Zm*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "\n", "//Calculation by Dalton's law of additive pressures\n", "//The compressibility factors for the pure components are to be evaluated at the mixture temperature and pure component pressure in Dalton's law of additive pressures. As the pure component pressures are not known, they are assumed to be equal to the partial pressure\n", "P1=y1*P;//pure component pressure in bar\n", "P2=y2*P;//pure component pressure in bar\n", "Pr1=P1/Pc(1,:);//calculation of reduced pressure of n-butane (no unit)\n", "Pr2=P2/Pc(2,:);//calculation of reduced pressure of n-octane (no unit)\n", "Z1_0=0.97;//value of Z1_0 taken from the generalized compressibility chart, Figure(3.11) corresponding to Tr1 and Pr1 (no unit)\n", "Z2_0=0.91;//value of Z2_0 taken from the generalized compressibility chart, Figure(3.11) corresponding to Tr2 and Pr2 (no unit)\n", "Zm=(y1*Z1_0)+(y2*Z2_0);//calculation of the compressibility of the mixture using Eq.(9.96) (no unit)\n", "vm_dalton=(Zm*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "//Recalculation of P1 and P2 to verify the initial assumption\n", "P1=((Z1_0*y1*R*T)/(vm_dalton))*10^-2;//P1 recalculated in bar\n", "P2=((Z2_0*y2*R*T)/(vm_dalton))*10^-2;//P2 recalculated in bar\n", "Pr1=P1/Pc(1,:);//recalculation of reduced pressure of n-butane (no unit)\n", "Pr2=P2/Pc(2,:);//recalculation of reduced pressure of n-octane (no unit)\n", "Z1_0_new=0.97;//value of Z1_0_new taken from the generalized compressibility chart, Figure(3.11) corresponding to Tr1 and Pr1 (no unit)\n", "Z2_0_new=0.91;//value of Z2_0_new taken from the generalized compressibility chart, Figure(3.11) corresponding to Tr2 and Pr2 (no unit)\n", "if Z1_0_new==Z1_0 & Z2_0_new==Z2_0 then\n", " vm_new=vm_dalton;//molar volume of the equimolar mixture in m^3/mol\n", "else\n", " Zm=(y1*Z1_0_new)+(y2*Z2_0_new);//calculation of the compressibility of the mixture using Eq.(9.96) (no unit)\n", " vm_new=(Zm*R*T)/(P*10^5);//calculation of the molar volume of the equimolar mixture in m^3/mol\n", "end\n", "\n", "//OUTPUT\n", "mprintf('\n The molar volume of an equimolar mixture of n-butane and n-octane found using the Amagats law of additive volumes = %0.4e m^3/mol\n',vm);\n", "mprintf('\n The molar volume of an equimolar mixture of n-butane and n-octane found using the Daltons law of additive pressures = %0.2e m^3/mol\n',vm_new);\n", "\n", "//===============================================END OF PROGRAM===================================================\n", "\n", "" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }