diff options
Diffstat (limited to 'Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/11-Thermodynamic_relations.ipynb')
-rw-r--r-- | Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/11-Thermodynamic_relations.ipynb | 644 |
1 files changed, 644 insertions, 0 deletions
diff --git a/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/11-Thermodynamic_relations.ipynb b/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/11-Thermodynamic_relations.ipynb new file mode 100644 index 0000000..df3c288 --- /dev/null +++ b/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/11-Thermodynamic_relations.ipynb @@ -0,0 +1,644 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: Thermodynamic relations" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.10: Example_10.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.10) A mixture consisting of 0.18 kmol of methane (CH4) and 0.274 kmol of butane (C4H10) occupies a volume of 0.241 m3 at a temperature of 238C. The experimental value for the pressure is 68.9 bar. Calculate the pressure, in bar, exerted by the mixture by using (a) the ideal gas equation of state, (b) Kay’s rule together with the generalized compressibility chart, (c) the van der Waals equation, and (d) the rule of additive pressures employing the generalized compressibility chart. Compare the calculated values with the known experimental value.\n", +"\n", +"//solution\n", +"\n", +"//analysis\n", +"V = .241 //volume of the mixture in m^3\n", +"T = 511 //temperature of the mixture in kelvin\n", +"n1 = .18 //number of moles of methane in kmol\n", +"n2 = .274 //number of moles of butane in kmol\n", +"n = n1 + n2 //The total number of moles of mixture\n", +"y1 = n1/n //mole fraction of methane\n", +"y2 = n2/n //mole fraction of butane\n", +"Rbar = 8314 //universal gas constant in (N.m)/(kmol.K)\n", +"vbar = V/(n) //The specific volume of the mixture on a molar basis in m^3/kmol\n", +"\n", +"//part(a)\n", +"p = (Rbar*T/vbar)*10^-5 //in bar\n", +"printf('the pressure in bar obtained using ideal gas equation is: %f',p)\n", +"\n", +"//part(b)\n", +"//from table A-1\n", +"Tc1 = 191 //critical temperature for methane in kelvin \n", +"Pc1 = 46.4 //critical pressure for methane in bar\n", +"Tc2 = 425 //critical temperature for butane in kelvin\n", +"Pc2 = 38 //critical pressure for butane in bar\n", +"\n", +"Tc = y1*Tc1 + y2*Tc2 //critical temperature in kelvin\n", +"Pc = y1*Pc1 + y2*Pc2 //critical pressure in bar\n", +"\n", +"TR = T/Tc //reduced temperature of the mixture\n", +"vRdash= vbar*Pc/(Rbar*Tc)\n", +"\n", +"Z = .88\n", +"p = ((Z*Rbar*T)/vbar)*10^-5 //mixture pressure in bar\n", +"printf('\npressure obtained using Kay’s rule together with the generalized compressibility chart, is: %f',p)\n", +"\n", +"//part(c)\n", +"//Table A-24 gives the following van der Waals constants values for methane\n", +"a1 = 2.293 //in (m^3/kmol)^2\n", +"b1 = .0428 //in m^3/kmol\n", +"//Table A-24 gives the following van der Waals constants values for butane\n", +"a2 = 13.86 //in (m^3/kmol)^2\n", +"b2 = .1162 //in m^3/kmol\n", +"\n", +"a = (y1*a1^.5 + y2*a2^.5)^2 //in bar*(m^3/kmol)^2\n", +"b = y1*b1+y2*b2 //in m^3/kmol\n", +"//from van der Waals equation\n", +"p = ((Rbar*T)/(vbar-b))*10^-5 - a/(vbar^2)\n", +"printf('\nthe pressure in bar from van der Waals equation is: %f ',p)\n", +"\n", +"//part(d)\n", +"//for methane\n", +"TR1 = T/Tc1\n", +"vR1dash = (.241/.18)*10^5*Pc1/(Rbar*Tc1)\n", +"Z1 = 1\n", +"//for butane\n", +"TR2 = T/Tc2\n", +"vR2dash = (.88*10^5*Pc2)/(Rbar*Tc2)\n", +"Z2 = .8\n", +"Z = y1*Z1 + y2*Z2\n", +"//Accordingly, the same value for pressure as determined in part (b) using Kay’s rule results:\n", +"p = 70.4\n", +"printf('\nthe pressure in bar obtained using the rule of additive pressures employing the generalized compressibility chart is: %f',p)\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.1: Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.1) A cylindrical tank containing 4.0 kg of carbon monoxide gas at 50C has an inner diameter of 0.2 m and a length of 1 m. Determine the pressure, in bar, exerted by the gas using (a) the generalized compressibility chart, (b) the ideal gas equation of state, (c) the van der Waals equation of state, (d) the Redlich–Kwong equation of state. Compare the results obtained.\n", +"\n", +"//solution\n", +"\n", +"//variable initialization\n", +"m = 4 //mass of carbon monoxide in kg\n", +"T = 223 //temperature of carbon monoxide in kelvin\n", +"D = .2 //inner diameter of cylinder in meter\n", +"L = 1 //length of the cylinder in meter\n", +"\n", +"//analysis\n", +"V = (%pi*D^2/4)*L //volume occupied by the gas in m^3\n", +"M = 28 //molar mass in kg/kmol\n", +"vbar = M*(V/m) //The molar specific volume in m^3/kmol\n", +"\n", +"//part(a)\n", +"//From Table A-1 for CO\n", +"Tc = 133 //in kelvin\n", +"Pc = 35 //in bar\n", +"Tr = T/Tc //reduced temperature\n", +"Rbar = 8314 //universal gas constant in N.m/kmol.K\n", +"vrdash = (vbar*Pc&10^5)/(Rbar*Tc) //pseudoreduced specific volume\n", +"Z = .9\n", +"\n", +"p = (Z*Rbar*T/vbar)*10^-5 //in bar\n", +"printf('part(a)the pressure in bar is: %f',p)\n", +"\n", +"//part(b)\n", +"//The ideal gas equation of state gives\n", +"p = (Rbar*T/vbar)/10^5 //in bar\n", +"printf('\npart(b)the pressure in bar is: %f',p)\n", +"\n", +"//part(c)\n", +"//For carbon monoxide, the van der Waals constants a and b can be read directly from Table A-24\n", +"a = 1.474 //in (m^3/kmol)^2\n", +"b = .0395 //in m^3/kmol\n", +"\n", +"p = (Rbar*T/(vbar-b))/10^5 - a/vbar^2\n", +"printf('\npart(c)the pressure in bars is: %f',p)\n", +"\n", +"//part(d)\n", +"//For carbon monoxide, the Redlich–Kwong constants can be read directly from Table A-24\n", +"a = 17.22 //in m^6*K^.5/kmol^2\n", +"b = .02737 //in m^3/kmol\n", +"\n", +"p = (Rbar*T/(vbar-b))/10^5 - a/[vbar*(vbar+b)*T^.5]\n", +"printf('\npart(d)the pressure in bar is: %f',p)\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.2: Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"printf('theoretical problem')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.3: Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.3) Evaluate the partial derivative (dels/delv)T for water vapor at a state fixed by a temperature of 240C and a specific volume of 0.4646 m3/kg. (a) Use the Redlich–Kwong equation of state and an appropriate Maxwell relation. (b) Check the value obtained using steam table data.\n", +"\n", +"//solution\n", +"\n", +"//part(a)\n", +"v = .4646 //specific volume in in m^3/kg\n", +"M = 18.02 //molar mass of water in kg/kmol\n", +"//At the specified state, the temperature is 513 K and the specific volume on a molar basis is\n", +"vbar = v*M //in m^3/kmol\n", +"//From Table A-24\n", +"a = 142.59 //(m^3/kmol)^2 * K^.5\n", +"b = .0211 //in m^3/kmol\n", +"\n", +"Rbar = 8314 //universal gas constant in N.m/kmol.K\n", +"T = 513 //in kelvin\n", +"delpbydelT = (Rbar/(vbar-b) + a/[2*vbar*(vbar+b)*T^1.5]*10^5)/10^3 //in kj/(m^3*K)\n", +"\n", +"//by The Maxwell relation\n", +"delsbydelv = delpbydelT\n", +"printf('the value of delpbydelT in kj/(m^3*K) is: %f ',delpbydelT)\n", +"\n", +"//part(b)\n", +"//A value for (dels/delv)T can be estimated using a graphical approach with steam table data, as follows: At 240C, Table A-4 provides the values for specific entropy s and specific volume v tabulated below\n", +"T = 240 //in degree celcius\n", +"//at p =1 bar\n", +"s(1,1) = 7.9949 //in kj/kg.k\n", +"v(1,1) = 2.359 //in m^3/kg\n", +"//at p= 1.5 bar\n", +"s(2,1) = 7.8052 //in kj/kg.k\n", +"v(2,1) = 1.570 //in m^3/kg\n", +"//at p = 3 bar\n", +"s(3,1) = 7.4774 //in kj/kg.k\n", +"v(3,1) = .781 //in m^3/kg\n", +"//at p = 5 bar\n", +"s(4,1) = 7.2307 //in kj/kg.k\n", +"v(4,1) = .4646 //in m^3/kg\n", +"//at p =7 bar\n", +"s(5,1) = 7.0641 //in kj/kg.k\n", +"v(5,1) = .3292 //in m^3/kg\n", +"//at p = 10 bar\n", +"s(6,1) = 6.8817 //in kj/kg.k\n", +"v(6,1) = .2275 //in m^3/kg\n", +"plot(v,s)\n", +"xtitle('','Specific volume, m3/kg','Specific entropy, kJ/kg·K')\n", +"//The pressure at the desired state is 5 bar.The corresponding slope is\n", +"delsbydelv = 1 //in kj/m^3.K\n", +"printf('\n\nfrom the data of the table,delsbydelv = %f',delsbydelv) \n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.4: Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.4)Using p–v–T data for saturated water, calculate at 100C (a) hg - hf, (b) ug - uf, (c) sg - sf. Compare with the respective steam table value.\n", +"\n", +"//solution\n", +"\n", +"//analysis\n", +"//For comparison, Table A-2 gives at 100C,\n", +"hgf =2257 //in kj/kg\n", +"ugf = 2087.6 //in kj/kg\n", +"sgf = 6.048 //in kj/kg.K\n", +"printf('from table, hg-hf = %f',hgf)\n", +"printf('\nfrom table, ug-uf = %f',ugf)\n", +"printf('\nfrom table, sg-sf = %f',sgf)\n", +"\n", +"//(a)\n", +"T = 373.15 //in kelvin\n", +"//If we plot a graph between temperature and saturation pressure using saturation pressure–temperature data from the steam tables, the desired slope is:\n", +"delpbydelT = 3570 //in N/(m^2.K)\n", +"\n", +"vg = 1.673 //in m^3/kg\n", +"vf = 1.0435e-3 //in m^3/kg\n", +"//from the Clapeyron equation\n", +"hgf = T*(vg-vf)*delpbydelT*10^-3 //in kj/kg\n", +"\n", +"printf('\n\npart(a)using Clapeyron equation, hg-hf = %f',hgf)\n", +"//(b)\n", +"psat = 1.014e5 //in N/m^2\n", +"hgf = 2256 //can be obtained using IT software in kj/kg\n", +"ugf = hgf - psat*(vg-vf)/10^3 //in kj/kg\n", +"printf('\npart(b)ug-uf = %f',ugf)\n", +"//(c)\n", +"sgf =hgf/T //in kj/kg.K \n", +"printf('\npart(c)sg-sf = %f',sgf)\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.5: Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"printf('theoretical problem')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.6: Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.6) For liquid water at 1 atm and 20C, estimate (a) the percent error in cv that would result if it were assumed that cp = cv, (b) the velocity of sound, in m/s.\n", +"\n", +"//solution\n", +"\n", +"//part(a)\n", +"funcprot(0)\n", +"v = 1/998.21 //specific volume of water in m^3/kg\n", +"T = 293 //given temperature in kelvin\n", +"beta = 206.6e-6 //volume expansivity in /K\n", +"k = 45.90e-6 //isothermal compressibility in /bar\n", +"\n", +"cpv = (v*T*beta^2/k)*10^2 //in kj/kg.k\n", +"\n", +"//Interpolating in Table A-19\n", +"cp = 4.188 //in kj/kg.k\n", +"cv = cp-cpv //in kj/kg.k\n", +"\n", +"errorPercentage = 100*(cp-cv)/cv\n", +"printf('the percentage error is: %f',errorPercentage)\n", +"\n", +"//part(b)\n", +"\n", +"K = cp/cv //specific heat ratio\n", +"c = sqrt((K*v/k)*10^5) //velocity of sound in m/s\n", +"printf('\nthe velocity of sound in m/s is: %f',c)\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.7: Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"printf('theoretical problem')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.8: Example_8.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.8) Nitrogen enters a turbine operating at steady state at 100 bar and 300 K and exits at 40 bar and 245 K. Using the enthalpy departure chart, determine the work developed, in kJ per kg of nitrogen flowing, if heat transfer with the surroundings can be ignored. Changes in kinetic and potential energy from inlet to exit also can be neglected.\n", +"\n", +"//solution\n", +"\n", +"//variable initialization\n", +"p1 = 100 //in bar\n", +"T1 = 300 //in kelvin\n", +"p2 = 40 //in bar\n", +"T2 = 245 //in kelvin\n", +"\n", +"\n", +"//from table A-23\n", +"h1starbar = 8723 //in kj/kmol\n", +"h2starbar = 7121 //in kj/kmol\n", +"//From Tables A-1\n", +"Tc = 126 //critical temperature in kelvin\n", +"pc = 33.9 //critical pressure in bar\n", +"TR1 = T1/Tc //reduced temperature at the inlet\n", +"PR1 = p1/pc //reduced pressure at the inlet\n", +"TR2 = T2/Tc //reduced temperature at the exit\n", +"PR2 = p2/pc //reduced pressure at the exit\n", +"\n", +"M = 28 //molar mass in kg/kmol\n", +"Rbar = 8.314 //universal gas constant in kj/(kmol.K)\n", +"\n", +"Term1 = .5 \n", +"Term2 = .31\n", +"\n", +"wcvdot = (1/M)*[h1starbar-h2starbar-Rbar*Tc*(Term1-Term2)] //in kj/kg\n", +"printf('the work developed, in kJ per kg of nitrogen flowing is : %f',wcvdot)\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.9: Example_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//(11.9) For the case of Example 11.8, determine (a) the rate of entropy production, in and (b) the isentropic turbine efficiency.\n", +"\n", +"//solution\n", +"\n", +"//part(a)\n", +"//With values from Table A-23\n", +"sT2bar = 185.775 //in kj/(kmol.K)\n", +"sT1bar = 191.682 //in kj/(kmol.K)\n", +"\n", +"Rbar = 8.314 //universal gas constant\n", +"M = 28 //molar mass in kg/kmol \n", +"p2 = 40 //in bar\n", +"p1 = 100 //in bar\n", +"\n", +"S2StarBarMinusS1StarBar = sT2bar-sT1bar-Rbar*log(p2/p1) //The change in specific entropy in kj/(kmol.K)\n", +"\n", +"Term1 = .21\n", +"Term2 = .14\n", +"\n", +"sigmacvdot = (1/M)*(S2StarBarMinusS1StarBar-Rbar*(Term2-Term1))\n", +"printf('the rate of entropy production in kj/kg.K is: %f',sigmacvdot)\n", +"\n", +"//part(b)\n", +"//From Table A-23,\n", +"h2starbar = 6654 //in kj/kmol\n", +"h1starbar = 8723 //in kj/kmol\n", +"Tc = 126 //critical temperature in kelvin\n", +"Term2 = .36\n", +"Term1 = .5\n", +"\n", +"wcvdots = (1/M)*[h1starbar-h2starbar-Rbar*Tc*(Term1-Term2)] //isentropic work in kj/kg\n", +"wcvdot = 50.1 //from example 11.8\n", +"\n", +"etat = wcvdot/wcvdots //turbine efficiency\n", +"printf('\nthe isentropic turbine efficiency is: %f',etat)\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\n", +"\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 +} |