diff options
Diffstat (limited to 'Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter16.ipynb')
-rw-r--r-- | Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter16.ipynb | 548 |
1 files changed, 548 insertions, 0 deletions
diff --git a/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter16.ipynb b/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter16.ipynb new file mode 100644 index 00000000..bd0ffde7 --- /dev/null +++ b/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter16.ipynb @@ -0,0 +1,548 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16:Reactive Systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.2:pg-675" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.2\n", + "\n", + "\n", + " K is 0.314529177004 atm\n", + "\n", + " Epsilon is 0.611607081035\n", + "\n", + " The heat of reaction is 60974.6120608 kJ/kg mol\n" + ] + } + ], + "source": [ + "import math\n", + "eps_e = 0.27 # Constant\n", + "P = 1.0 # Atmospheric pressure in bar\n", + "K = (4*eps_e**2*P)/(1-eps_e**2) \n", + "P1 = 100.0/760.0 # Pressure in Pa\n", + "eps_e_1 = math.sqrt((K/P1)/(4.0+(K/P1)))\n", + "T1 = 318.0 # Temperature in K\n", + "T2 = 298.0# Temperature in K\n", + "R = 8.3143 # Gas constant\n", + "K1 = 0.664 # dissociation constant at 318K\n", + "K2 = 0.141# dissociation constant at 298K\n", + "dH = 2.30*R*((T1*T2)/(T1-T2))*(math.log10(K1/K2))\n", + "print \"\\n Example 16.2\\n\"\n", + "print \"\\n K is \",K ,\" atm\"\n", + "print \"\\n Epsilon is \",eps_e_1\n", + "print \"\\n The heat of reaction is \",dH ,\" kJ/kg mol\"\n", + "#The answers vary due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.3:pg-675" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.3\n", + "\n", + "\n", + " Equilibrium constant is 1.61983471074\n", + "\n", + " Gibbs function change is -4812.22485358 J/gmol\n" + ] + } + ], + "source": [ + "v1 = 1.0 # Assumed\n", + "v2 = v1# Assumed \n", + "v3 = v2 # Assumed\n", + "v4 = v2# Assumed\n", + "e = 0.56 # Degree of reaction\n", + "P = 1.0 # Dummy\n", + "T = 1200.0 # Reaction temperature in K\n", + "R = 8.3143 # Gas constant\n", + "x1 = (1-e)/2.0 # \n", + "x2 = (1-e)/2.0\n", + "x3 = e/2.0 \n", + "x4 = e/2.0\n", + "K = (((x3**v3)*(x4**v4))/((x1**v1)*(x2**v2)))*P**(v3+v4-v1-v2) # Equilibrium constant\n", + "dG = -R*T*math.log(K) #Gibbs function change\n", + "\n", + "print \"\\n Example 16.3\\n\"\n", + "print \"\\n Equilibrium constant is \",K\n", + "print \"\\n Gibbs function change is \",dG ,\"J/gmol\"\n", + "#The answers vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.5:pg-678" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.5\n", + "\n", + "\n", + " The value of equillibrium constant is 0.755668681281 atm\n" + ] + } + ], + "source": [ + "Veo = 1.777 # Ve/Vo\n", + "e = 1.0-Veo # Degree of dissociation\n", + "P = 0.124 # in atm\n", + "K = (4*e**2*P)/(1.0-e**2)\n", + "\n", + "print \"\\n Example 16.5\\n\"\n", + "print \"\\n The value of equillibrium constant is \",K ,\" atm\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.6:pg-680" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.6\n", + "\n", + "\n", + " Cp is 4.48364424966 J/g mol K\n" + ] + } + ], + "source": [ + "v1 = 1.0 # Assumed\n", + "v2 = 0 # Assumed\n", + "v3 = 1.0 # Assumed\n", + "v4 = 1.0/2.0# Assumed\n", + "dH = 250560.0 # Enthalpy change in j/gmol\n", + "e = 3.2e-03 # Constant\n", + "R = 8.3143 # Gas constant\n", + "T = 1900.0 # Reaction temperature\n", + "Cp = ((dH**2)*(1+e/2)*e*(1+e))/(R*T**2*(v1+v2)*(v3+v4))\n", + "print \"\\n Example 16.6\\n\"\n", + "print \"\\n Cp is \",Cp ,\" J/g mol K\"\n", + "#The answers vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.7:pg-681" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.7\n", + "\n", + "\n", + " The composition of fuel is 14.7645650439 percent Hydrogen and 85.2354349561 percent Carbon\n", + "\n", + " Air fuel ratio is 23.9829146049\n", + "\n", + " Percentage of excess air used is 67.2268907563 percent\n" + ] + } + ], + "source": [ + "\n", + "a = 21.89 # stochiometric coefficient\n", + "y = 18.5 # stochiometric coefficient\n", + "x = 8.9 # stochiometric coefficient\n", + "PC = 100*(x*12)/((x*12)+(y)) # Carbon percentage\n", + "PH = 100-PC # Hydrogen percentage\n", + "AFR = ((32*a)+(3.76*a*28))/((12*x)+y) #Air fuel ratio\n", + "EAU = (8.8*32)/((21.89*32)-(8.8*32)) # Excess air used\n", + "\n", + "print \"\\n Example 16.7\\n\"\n", + "print \"\\n The composition of fuel is \",PH ,\" percent Hydrogen and \",PC ,\" percent Carbon\"#The answer provided in the textbook is wrong\n", + "print \"\\n Air fuel ratio is \",AFR\n", + "print \"\\n Percentage of excess air used is \",EAU*100 ,\" percent\"\n", + "#The answers vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.8:pg-682" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.8\n", + "\n", + "\n", + " Heat transfer per kg mol of fuel is -965198.0 kJ\n", + "\n", + " Q_cv is -890324.0 kJ\n" + ] + } + ], + "source": [ + "hf_co2 = -393522.0 # Enthalpy of reaction in kJ/kg mol\n", + "hf_h20 = -285838.0# Enthalpy of reaction in kJ/kg mol\n", + "hf_ch4 = -74874.0# Enthalpy of reaction in kJ/kg mol\n", + "D = hf_co2 + (2*hf_h20) #Heat transfer \n", + "QCV = D-hf_ch4 # Q_cv\n", + "\n", + "print \"\\n Example 16.8\\n\"\n", + "print \"\\n Heat transfer per kg mol of fuel is \",D ,\" kJ\"\n", + "print \"\\n Q_cv is \",QCV ,\" kJ\"\n", + "#The answers vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.9:pg-683" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.9 \n", + "\n", + "\n", + " Fuel consumption rate is 38.5131749981 kg/h\n" + ] + } + ], + "source": [ + "# Below values are taken from table\n", + "Hr = -249952+(18.7*560)+(70*540)\n", + "Hp = 8*(-393522+20288)+9*(-241827+16087)+6.25*14171+70*13491\n", + "Wcv = 150.0 # Energy out put from engine in kW\n", + "Qcv = -205.0 # Heat transfer from engine in kW\n", + "n = (Wcv-Qcv)*3600/(Hr-Hp)\n", + "print \"\\n Example 16.9 \\n\"\n", + "print \"\\n Fuel consumption rate is \",n*114 ,\" kg/h\"\n", + "#The answers vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.11:pg-684" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 16.11 \n", + "\n", + "\n", + " Reversible work is 47139 kJ/kg\n", + "\n", + " Increase in entropy during combustion is 3699.6688 kJ/kg mol K\n", + "\n", + " Irreversibility of the process 25056.8559091 kJ/kg\n", + "\n", + " Availability of products of combustion is 22082.1440909 kJ/kg\n" + ] + } + ], + "source": [ + "# Refer table 16.4 for values\n", + "T0 = 298.0 # Atmospheric temperature in K\n", + "Wrev = -23316-3*(-394374)-4*(-228583) # Reversible work in kJ/kg mol\n", + "Wrev_ = Wrev/44 # Reversible work in kJ/kg\n", + "Hr = -103847 # Enthalpy of reactants in kJ/kg\n", + "T = 980.0 # Through trial and error\n", + "Sr = 270.019+20*205.142+75.2*191.611 # Entropy of reactants\n", + "Sp = 3*268.194 + 4*231.849 + 15*242.855 + 75.2*227.485 # Entropy of products\n", + "IE = Sp-Sr # Increase in entropy\n", + "I = T0*3699.67/44 # Irreversibility\n", + "Si = Wrev_ - I# Availability of products of combustion \n", + "\n", + "print \"\\n Example 16.11 \\n\"\n", + "print \"\\n Reversible work is \",Wrev_ ,\" kJ/kg\"\n", + "print \"\\n Increase in entropy during combustion is \",Sp-Sr ,\" kJ/kg mol K\"\n", + "print \"\\n Irreversibility of the process \",I ,\" kJ/kg\"\n", + "print \"\\n Availability of products of combustion is \",Si ,\" kJ/kg\"\n", + "#The answers vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.12:pg-685" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 6.12\n", + "\n", + "\n", + " The chemical energy of carbon is 410541.588354 kJ/k mol\n", + "\n", + " The chemical energy of hydrogen is 235211.889921 kJ/k mol\n", + "\n", + " The chemical energy of methane is 821580.156423 kJ/k mol\n", + "\n", + " The chemical energy of Carbon monoxide is 275364.910207 kJ/k mol\n", + "\n", + " The chemical energy of liquid methanol is 716698.69005 kJ/k mol\n", + "\n", + " The chemical energy of nitrogen is 691.0909601 kJ/k mol\n", + "\n", + " The chemical energy of Oxygen is 3946.64370597 kJ/k mol\n", + "\n", + " The chemical energy of Carbon dioxide is 20108.2320604 kJ/k mol\n", + "\n", + " The chemical energy of Water is 5.21177422707 kJ/k mol\n" + ] + } + ], + "source": [ + "\n", + "T0 = 298.15 # Environment temperature in K\n", + "P0 = 1 # Atmospheric pressure in bar\n", + "R = 8.3143# Gas constant\n", + "xn2 = 0.7567 # mole fraction of nitrogen\n", + "xo2 = 0.2035 # mole fraction of oxygen\n", + "xh2o = 0.0312 # mole fraction of water\n", + "xco2 = 0.0003# mole fraction of carbon dioxide\n", + "# Part (a)\n", + "g_o2 = 0 # Gibbs energy of oxygen\n", + "g_c = 0 # Gibbs energy of carbon\n", + "g_co2 = -394380 # Gibbs energy of carbon dioxide\n", + "A = -g_co2 + R*T0*math.log(xo2/xco2) # Chemical energy\n", + "\n", + "# Part (b)\n", + "g_h2 = 0 # Gibbs energy of hydrogen\n", + "g_h2o_g = -228590# # Gibbs energy of water\n", + "B = g_h2 + g_o2/2 - g_h2o_g + R*T0*math.log(xo2**0.5/xh2o)\n", + "# Chemical energy\n", + "# Part (c)\n", + "g_ch4 = -50790 # Gibbs energy of methane\n", + "C = g_ch4 + 2*g_o2 - g_co2 - 2*g_h2o_g + R*T0*math.log((xo2**2)/(xco2*xh2o))\n", + "# Chemical energy\n", + "# Part (d)\n", + "g_co = -137150# # Gibbs energy of carbon mono oxide\n", + "D = g_co + g_o2/2 - g_co2 + R*T0*math.log((xo2**0.5)/xco2)\n", + "# Chemcal energy\n", + "# Part (e)\n", + "g_ch3oh = -166240 # Gibbs energy of methanol\n", + "E = g_ch3oh + 1.5*g_o2 - g_co2 - 2*g_h2o_g + R*T0*math.log((xo2**1.5)/(xco2*(xh2o**2)))\n", + "# Chemical energy\n", + "# Part (f)\n", + "F = R*T0*math.log(1/xn2)\n", + "# Chemical energy\n", + "# Part (g)\n", + "G = R*T0*math.log(1/xo2)\n", + "# Chemical energy\n", + "# Part (h)\n", + "H = R*T0*math.log(1/xco2)\n", + "# Chemical energy\n", + "# Part (i)\n", + "g_h2o_l = -237180 # Gibbs energy of liquid water\n", + "I = g_h2o_l - g_h2o_g + R*T0*math.log(1/xh2o)\n", + "# Chemical energy\n", + "print \"\\n Example 6.12\\n\"\n", + "print \"\\n The chemical energy of carbon is \",A ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of hydrogen is \",B ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of methane is \",C ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of Carbon monoxide is \",D ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of liquid methanol is \",E ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of nitrogen is \",F ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of Oxygen is \",G ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of Carbon dioxide is \",H ,\" kJ/k mol\"\n", + "print \"\\n The chemical energy of Water is \",I ,\" kJ/k mol\"\n", + "#The answers vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.13:pg-686" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Example 6.13\n", + "\n", + "\n", + " The rate of heat transfer from the engine = -4.33120060702 kW,\n", + " The second law of efficiency of the engine = 13.3396896634 percent\n" + ] + } + ], + "source": [ + "# Environmet\n", + "T0 = 298.15 # Environment temperature in K\n", + "P0 = 1.0 # Atmospheric pressure in atm\n", + "R = 8.3143# Gas constant\n", + "xn2 = 0.7567 # mole fraction of nitrogen\n", + "xo2 = 0.2035 # mole fraction of oxygen\n", + "xh2o = 0.0312 # mole fraction of water\n", + "xco2 = 0.0003# mole fraction of carbon dioxide\n", + "xother = 0.0083 # Mole fraction of other gases\n", + "# Liquid octane\n", + "t1 = 25.0 # Temperature of liquid octane in degree centigrade\n", + "m = 0.57 # Mass flow rate in kg/h\n", + "T2 = 670 # Temperature of combustion product at exit in K\n", + "x1 = 0.114 # Mole fraction of CO2\n", + "x2 = .029 # Mole fraction of CO\n", + "x3 = .016 # Mole fraction of O2\n", + "x4 = .841 # Mole fraction of N2\n", + "Wcv = 1 # Power developed by the engine in kW\n", + "print \"\\n Example 6.13\\n\"\n", + "# By carbon balance \n", + "b = 55.9 \n", + "# By hydrogen balace\n", + "c=9\n", + "# By oxygen balance\n", + "a = 12.58\n", + "Qcv = Wcv- 3845872*(.57/(3600*114.22))\n", + "E = 5407843.0 # Chemical exergy of C8H18\n", + "nII = Wcv/(E*.57/(3600*114.22))\n", + "print \"\\n The rate of heat transfer from the engine = \",Qcv ,\" kW,\\n The second law of efficiency of the engine = \",nII*100 ,\" percent\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |