{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter12 - Chemical reaction equillibria" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.1 Page: 471" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.1 - Page: 471\n", "\n", "\n", " This problem involves proving a relation in which no mathematics and no calculations are involved.\n", "\n", "\n", " For prove refer to this example 12.1 on page 471 of the book.\n" ] } ], "source": [ "print \"Example: 12.1 - Page: 471\\n\\n\"\n", "\n", "# This problem involves proving a relation in which no mathematics and no calculations are involved.\n", "# For prove refer to this example 12.1 on page number 471 of the book.\n", "\n", "print \" This problem involves proving a relation in which no mathematics and no calculations are involved.\\n\\n\"\n", "print \" For prove refer to this example 12.1 on page 471 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.2 Page: 473" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.2 - Page: 473\n", "\n", "\n", " This problem involves proving a relation in which no mathematics and no calculations are involved.\n", "\n", "\n", " For prove refer to this example 12.2 on page 473 of the book.\n" ] } ], "source": [ "print \"Example: 12.2 - Page: 473\\n\\n\"\n", "\n", "# This problem involves proving a relation in which no mathematics and no calculations are involved.\n", "# For prove refer to this example 12.2 on page number 473 of the book.\n", "\n", "print \" This problem involves proving a relation in which no mathematics and no calculations are involved.\\n\\n\"\n", "print \" For prove refer to this example 12.2 on page 473 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.3 Page: 479" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.3 - Page: 479\n", "\n", "\n", "Reaction is feasible\n", "\n", "Equilibium Constant is 7.964e+32\n" ] } ], "source": [ "from math import exp\n", "from __future__ import division\n", "print \"Example: 12.3 - Page: 479\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: C2H5OH(g) + (1/2)O2(g) = CH3CHO(g) + H2O(g)\n", "Temp = 298## [K]\n", "G_CH3CHO = -133.978## [kJ]\n", "G_H2O = -228.60## [kJ]\n", "G_C2H5OH = -174.883## [kJ]\n", "R = 8.314## [J/mol K]\n", "#***************#\n", "\n", "G_O2 = 0## [kJ]\n", "G_rkn = G_CH3CHO + G_H2O -(G_C2H5OH + G_O2)## [kJ]\n", "G_rkn = G_rkn*1000## [J]\n", "if G_rkn < 0 :\n", " print \"Reaction is feasible\\n\"\n", " K = exp(-(G_rkn/(R*Temp)))#\n", " print \"Equilibium Constant is %.3e\"%(K)#\n", "else:\n", " print \"Reaction is not feasible\\n\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.4 Page: 479" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.4 - Page: 479\n", "\n", "\n", "Vaporisation of liquid water is not spontaneous\n", "\n" ] } ], "source": [ "print \"Example: 12.4 - Page: 479\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# H2O(l) = H2O(g)\n", "deltaH = 9710## [cal]\n", "deltaS = 26## [e.u.]\n", "Temp = 27 + 273## [K]\n", "P = 1## [atm]\n", "#**************#\n", "\n", "deltaG = deltaH - Temp*deltaS## [cal]\n", "if deltaG > 0:\n", " print \"Vaporisation of liquid water is not spontaneous\\n\"\n", "else:\n", " print \"Vaporisation of liquid water is spontaneous\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.5 Page: 481" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.5 - Page: 481\n", "\n", "\n", "Standard Gibbs free energy change is -33.5 kJ/mol\n", "\n", "Equilibrium constant is 7.45e+05\n" ] } ], "source": [ "print \"Example: 12.5 - Page: 481\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: N2(g) + 3H2(g) = 2NH3(g)\n", "Temp = 298## [K]\n", "G_NH3 = -16.750## [kJ/mol]\n", "R = 8.314## [J/mol K]\n", "#***************#\n", "\n", "G_N2 = 0## [kJ/mol]\n", "G_H2 = 0## [kJ/mol]\n", "G_rkn = 2*G_NH3 - G_N2 - 3*G_H2## [kJ/mol]\n", "print \"Standard Gibbs free energy change is %.1f kJ/mol\\n\"%(G_rkn)#\n", "G_rkn = G_rkn*1000## [J/mol]#\n", "K = exp(-(G_rkn/(R*Temp)))#\n", "print \"Equilibrium constant is %.2e\"%(K)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.6 Page: 481" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.6 - Page: 481\n", "\n", "\n", "Equilibrium Constant is 1.005e+05\n" ] } ], "source": [ "print \"Example: 12.6 - Page: 481\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: CO(g) + H2O(g) = CO2(g) + H2(g)\n", "G_CO = -32.8## [kcal]\n", "G_H2O = -54.64## [kcal]\n", "G_CO2 = -94.26## [kcal]\n", "Temp = 273 + 25## [K]\n", "R = 1.987## [cal/mol.K]\n", "#***************#\n", "\n", "G_H2 = 0## [kcal]\n", "G_rkn = G_CO2 + G_H2 - (G_CO + G_H2O)## [kcal]\n", "G_rkn = G_rkn*1000## [cal]\n", "K = exp(-(G_rkn/(R*Temp)))#\n", "print \"Equilibrium Constant is %.3e\"%(K)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.7 Page: 485" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.7 - Page: 485\n", "\n", "\n", "Equilibrium constant at 1000 K is 0.9190\n" ] } ], "source": [ "print \"Example: 12.7 - Page: 485\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: CO(g) + H2O(g) = CO2(g) + H2(g)\n", "T1 = 298## [K]\n", "T2 = 1000## [K]\n", "P = 1## [bar]\n", "K1 = 1.1582*10**5#\n", "H_CO = -110.532## [kJ]\n", "H_H2O = -241.997## [kJ]\n", "H_CO2 = -393.978## [kJ]\n", "R = 8.314## [J/mol.K]\n", "#***************#\n", "\n", "H_H2 = 0## [kJ]\n", "H_rkn = H_CO2 + H_H2 - (H_CO + H_H2O)## [kJ]\n", "H_rkn = H_rkn*1000## [J]\n", "# From Van't Hoff Equation,\n", "K2 = K1*exp((H_rkn/R)*((1/T1) - (1/T2)))#\n", "print \"Equilibrium constant at 1000 K is %.4f\"%(K2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.8 Page: 485" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.8 - Page: 485\n", "\n", "\n", "Equilibrium constant at 700 K is 3.8878e-04\n" ] } ], "source": [ "print \"Example: 12.8 - Page: 485\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: N2(g) + 3H2(g) = 2NH3(g)\n", "T1 = 298## [K]\n", "T2 = 700## [K]\n", "H_NH3 = -46.1## [kJ]\n", "G_NH3 = -16.747## [kJ]\n", "R = 8.314## [J/mol.K]\n", "#**************#\n", "\n", "H_N2 = 0## [kJ]\n", "H_H2 = 0## [kJ]\n", "G_N2 = 0## [kJ]\n", "G_H2 = 0## [kJ]\n", "H_rkn = 2*H_NH3 - (H_N2 + 3*H_H2)## [kJ]\n", "G_rkn = 2*G_NH3 - (G_N2 + 3*G_H2)## [kJ]\n", "H_rkn = H_rkn*1000## [J]\n", "G_rkn = G_rkn*1000## [J]\n", "K1 = exp(-(G_rkn/(R*T1)))#\n", "K2 = K1*exp((H_rkn/R)*((1/T1) - (1/T2)))#\n", "print \"Equilibrium constant at 700 K is %.4e\"%(K2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.9 Page: 486" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.9 - Page: 486\n", "\n", "\n", "Standard Gibbs free energy at 1000 K -6.055 kJ\n", "\n", "Standard Equilibrium Constant is 2.1\n" ] } ], "source": [ "from math import log\n", "print \"Example: 12.9 - Page: 486\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: CO(g) + H2O(g) ----> CO2(g) + H2(g)\n", "T1 = 298## [K]\n", "T2 = 1000## [K]\n", "deltaH_298 = -41450## [J/mol]\n", "deltaGf_298 = -28888## [J/mol]\n", "alpha_CO2 = 45.369## [kJ/kmol K]\n", "alpha_H2 = 27.012## [kJ/kmol K]\n", "alpha_CO = 28.068## [kJ/kmol K]\n", "alpha_H2O = 28.850## [kJ/kmol K]\n", "beeta_CO2 = 8.688*10**(-3)## [kJ/kmol square K]\n", "beeta_H2 = 3.509*10**(-3)## [kJ/kmol square K]\n", "beeta_CO = 4.631*10**(-3)## [kJ/kmol square K]\n", "beeta_H2O = 12.055*10**(-3)## [kJ/kmol square K]\n", "R = 8.314## [J/mol K]\n", "#*************#\n", "\n", "delta_alpha = alpha_CO2 + alpha_H2 - (alpha_CO + alpha_H2O)#\n", "delta_beeta = beeta_CO2 + beeta_H2 - (beeta_CO + beeta_H2O)#\n", "# To obtain the standard heat of reaction:\n", "deltaH_0 = deltaH_298 - (delta_alpha*T1 + (delta_beeta*T1**2)/2)## [kJ/mol]\n", "# From Eqn. 12.52:\n", "IR = (deltaH_0 - delta_alpha*T1*log(T1) - (delta_beeta*T1**2)/2 - deltaGf_298)/T1## [kJ/mol K]\n", "# Substituting T = T2 and IR in Eqn. 12.51:\n", "deltaG_1000 = deltaH_0 - delta_alpha*T2*log(T2) - (delta_beeta*T2**2)/2 - IR*T2## [kJ/mol]\n", "print \"Standard Gibbs free energy at 1000 K %.3f kJ\\n\"%(deltaG_1000/1000)#\n", "\n", "# Standard Equilibrium Constant at 1000 K\n", "K_1000 = exp(-(deltaG_1000)/(R*T2))#\n", "print \"Standard Equilibrium Constant is %.1f\"%(K_1000)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.10 Page: 489" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.10 - Page: 489\n", "\n", "\n", "Composition of the gas leaving the mixture\n", "\n", "yCO = yH20 = 0.2247\n", "\n", "yCO2 = yH2 = 0.2753\n", "\n" ] } ], "source": [ "print \"Example: 12.10 - Page: 489\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: CO(g) + H2O(g) ------> CO2(g) + H2(g)\n", "P = 10## [bar]\n", "T = 1000## [K]\n", "K_1000 = 1.5#\n", "#***********#\n", "\n", "# Moles in feed:\n", "nCO_feed = 1#\n", "nH20_feed = 1#\n", "# Let e be the degree of completion at equilibrium.\n", "# Moles at Equilibrium:\n", "# nCO_eqb = 1 - e#\n", "# nH20_eqb = 1 - e#\n", "# nCO2_eqb = e#\n", "# nH2_eqb = e#\n", "# Total moles at equilibrium = 1 - e + 1 - e + e + e = 2\n", "# Mole Fractions at Equilibrium:\n", "# yCO_eqb = (1 - e)/2#\n", "# yH20_eqb = (1 - e)/2#\n", "# yCO2_eqb = e/2#\n", "# yH2_eqb = e/2#\n", "# Sum of stoichometric coeffecient:\n", "v = 1 + 1 - 1 - 1#\n", "K = K_1000*P**v#\n", "#deff('[y] = f(e)','y = K - (e/2)*(e/2)/(((1 - e)/2)*(1 - e)/2)')#\n", "def f(e):\n", " y = K - (e/2)*(e/2)/(((1 - e)/2)*(1 - e)/2)\n", " return y\n", "from scipy.optimize import fsolve\n", "e = fsolve(f, 0.5)#\n", "print \"Composition of the gas leaving the mixture\\n\"\n", "print \"yCO = yH20 = %.4f\\n\"%((1 - e)/2)#\n", "print \"yCO2 = yH2 = %.4f\\n\"%(e/2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.11 Page: 489" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.11 - Page: 489\n", "\n", "\n", "Molar Composition of the gases\n", "\n", "yN2 = 0.1103\n", "\n", "yH2 = 0.7207\n", "\n", "yNH3 = 0.1690\n", "\n" ] } ], "source": [ "print \"Example: 12.11 - Page: 489\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: N2(g) + 3H2(g) --------> 2NH3\n", "nN2_feed = 1#\n", "nH2_feed = 5#\n", "T = 800## [K]\n", "P = 250## [bar]\n", "K = 1.106*10**(-5)#\n", "#**************#\n", "\n", "# Let e be the degree of completion at equilibrium.\n", "# Moles at Equilibrium:\n", "# nN2_eqb = 1 - e#\n", "# nH2_eqb = 5 - 3*e#\n", "# nNH3_eqb = 2*e#\n", "# Total moles at equilibrium = 1 - e + 5 - 3*e + 2*e = 2*(3 - e)\n", "# Mole Fractions at Equilibrium:\n", "# yN2_eqb = (1 - e)/(2*(3 - e))#\n", "# yH2_eqb = (5 - 3*e)/(2*(3 - e))#\n", "# yNH3_eqb = 2*e/(2*(3 - e))#\n", "# Sum of stoichometric coeffecient:\n", "v = 2 - 3 - 1#\n", "Ky = K*P**(-v)#\n", "def f(e):\n", " y = Ky - ((2*e/(2*(3 - e)))**2)/(((1-e)/((2*(3 - e))))*((5 - 3*e)/(2*(3 - e)))**3)\n", " return y\n", "e = fsolve(f, 0.5)#\n", "print \"Molar Composition of the gases\\n\"\n", "print \"yN2 = %.4f\\n\"%((1 - e)/(2*(3 - e)))#\n", "print \"yH2 = %.4f\\n\"%((5 - 3*e)/(2*(3 - e)))#\n", "print \"yNH3 = %.4f\\n\"%((2*e)/(2*(3 - e)))#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.12 Page: 490" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.12 - Page: 490\n", "\n", "\n", "Molar Composition of the gases\n", "\n", "nSO2 = 0.52\n", "\n", "nO2 = 3.26\n", "\n", "nSO3 = 9.48\n", "\n" ] } ], "source": [ "print \"Example: 12.12 - Page: 490\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: SO2(g) + (1/2)O2 ------> SO3(g)\n", "P = 1## [bar]\n", "T = 750## [K]\n", "K = 74#\n", "#************#\n", "\n", "# Moles in Feed:\n", "nSO2 = 1#\n", "nO2 = 0.5#\n", "# Let e be the degree of completion at equilibrium.\n", "# Moles at Equilibrium:\n", "# nSO2_eqb = 10 - e#\n", "# nO2_eqb = 8 - 0.5*e#\n", "# nSO3_eqb = e#\n", "# Total no. of moles = 10 - e + 8 - 0.5*e + e = 18 -0.5*e#\n", "# Mole fraction at Equilibrium:\n", "# ySO2_eqb = (10 - e)/(18 - 0.5*e)#\n", "# yO2_eqb = (8 - 0.5*e)/(18 - 0.5*e)#\n", "# ySO3_eqb = e/(18 - 0.8*e)#\n", "# Sum of stoichometric coeffecient:\n", "v = 1 - 1 -0.5#\n", "Ky = K*P**(-v)#\n", "def f(e):\n", " y = Ky - (e*(18 - (0.5*e)))/((10 - e)*(8 - 0.5*e))\n", " return y\n", "e = fsolve(f, 7)#\n", "print \"Molar Composition of the gases\\n\"\n", "print \"nSO2 = %.2f\\n\"%((10 - e))#\n", "print \"nO2 = %.2f\\n\"%((8 - 0.5*e))#\n", "print \"nSO3 = %.2f\\n\"%(e)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.13 Page: 492" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.13 - Page: 492\n", "\n", "\n", "Total Pressure Required for 50 % conversion of PCl5 is 5.4 atm\n" ] } ], "source": [ "print \"Example: 12.13 - Page: 492\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: PCl5 = PCl3 + Cl2\n", "T = 250## [OC]\n", "Kp = 1.8#\n", "e = 0.5#\n", "#**************#\n", "\n", "# Basis: 1 mol of PCl5\n", "# At Equilibrium:\n", "n_PCl5 = 1 - e#\n", "n_PCl3 = e#\n", "n_Cl2 = e#\n", "n_total = n_PCl5 + n_PCl3 + n_Cl2#\n", "# Patrial Pressures:\n", "# P_PCl5 = (n_PCl5/n_total)*P\n", "# P_PCl3 = (n_PCl3/n_total)*P\n", "# P_Cl2 = (n_Cl2/n_total)*P\n", "def f(P):\n", " y = Kp - ((n_PCl3/n_total)*P)*((n_Cl2/n_total)*P)/((n_PCl5/n_total)*P)\n", " return y\n", "P = fsolve(f, 7)## [atm]\n", "print \"Total Pressure Required for 50 %% conversion of PCl5 is %.1f atm\"%(P)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.14 Page: 494" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.14 - Page: 494\n", "\n", "\n", "Degree of Conversion is 0.802\n", "\n", "Equilibrium Composition of the reaction Mixture\n", "\n", "ySO2 = 0.0639\n", "\n", "yO2 = 0.0319\n", "\n", "ySO3 = 0.2588\n", "\n", "yAr = 0.6454\n", "\n" ] } ], "source": [ "print \"Example: 12.14 - Page: 494\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: SO2(g) + (1/2)O2(g) -------> SO3(g)\n", "# Moles in Feed:\n", "nSO2_feed = 1#\n", "nO2_feed = 0.5#\n", "nAr_feed = 2#\n", "P = 30## [bar]\n", "T = 900## [K]\n", "K = 6#\n", "#*************#\n", "\n", "# Let e be the degree of completion at equilibrium.\n", "# nSO2_eqb = 1 - e#\n", "# nO2_eqb = 0.5*(1 - e)#\n", "# nSO3_eqb = e#\n", "# nAr_eqb = 2#\n", "# Total moles at equilibrium = 1 - e + 0.5*(1 - e) + e + 2 = (7 - e)/2\n", "# Mole fractions:\n", "# ySO2_eqb = 2*(1 - e)/(7 - e)\n", "# yO2_eqb = (1 - e)/(7 - e)\n", "# ySO3_eqb = 2*e/(7 - e)\n", "# yAr_eqb = 4/(7 - e)\n", "# Sum of Stoichiometric Coeffecient:\n", "v = 1 - 1 - 1/2#\n", "Ky = K*P**(-v)#\n", "e = 0.8#\n", "err = 1#\n", "while err > 0.2:\n", " Ky_new = (2*e/(7 - e))/(((2*(1 - e))/(7 - e))*(((1 - e)/(7 - e))**0.5))#\n", " err = abs(Ky - Ky_new)#\n", " Ky = Ky_new#\n", " e = e + 0.001#\n", "print \"Degree of Conversion is %.3f\\n\"%(e)#\n", "ySO2_eqb = 2*(1 - e)/(7 - e)#\n", "yO2_eqb = (1 - e)/(7 - e)#\n", "ySO3_eqb = 2*e/(7 - e)#\n", "yAr_eqb = 4/(7 - e)#\n", "print \"Equilibrium Composition of the reaction Mixture\\n\"\n", "print \"ySO2 = %.4f\\n\"%(ySO2_eqb)#\n", "print \"yO2 = %.4f\\n\"%(yO2_eqb)#\n", "print \"ySO3 = %.4f\\n\"%(ySO3_eqb)#\n", "print \"yAr = %.4f\\n\"%(yAr_eqb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.15 Page: 498" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.15 - Page: 498\n", "\n", "\n", "Mole fraction of ethyl acetate is 0.344\n" ] } ], "source": [ "print \"Example: 12.15 - Page: 498\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: CH3COOH(l) + C2H5OH(l) --------> CH3COOC2H5(l) + H2O(l)\n", "T = 373.15## [K]\n", "nCH3COOH_feed = 1#\n", "nC2H5OH_feed = 1#\n", "deltaHf_CH3COOH = -484.5## [kJ]\n", "deltaHf_C2H5OH = -277.69## [kJ]\n", "deltaHf_CH3COOC2H5 = -480## [kJ]\n", "deltaHf_H2O = -285.83## [kJ]\n", "deltaGf_CH3COOH = -389.9## [kJ]\n", "deltaGf_C2H5OH = -174.78## [kJ]\n", "deltaGf_CH3COOC2H5 = -332.2## [kJ]\n", "deltaGf_H2O = -237.13## [kJ]\n", "R = 8.314## [J/mol K]\n", "#******************#\n", "\n", "deltaH_298 = deltaHf_CH3COOC2H5 + deltaHf_H2O - deltaHf_CH3COOH - deltaHf_C2H5OH## [kJ]\n", "deltaG_298 = deltaGf_CH3COOC2H5 + deltaGf_H2O - deltaGf_CH3COOH - deltaGf_C2H5OH## [kJ]\n", "T0 = 298## [K]\n", "K_298 = exp(-(deltaG_298*1000/(R*T0)))#\n", "K_373 = K_298*exp((deltaH_298*1000/R)*((1/T0) - (1/T)))#\n", "# Let e be the degree of completion at equilibrium.\n", "# nCH3COOH_eqb = 1 - e#\n", "# nC2H5OH_eqb = 1 - e#\n", "# nCH3COOC2H5_eqb = e#\n", "# nH2O_eqb = e#\n", "# Total moles at equilibrium = 1 - e + 1 - e + e + e = 2\n", "# Mole fractions:\n", "# ySO2_eqb = (1 - e)/2\n", "# yO2_eqb = (1 - e)/2\n", "# ySO3_eqb = e/2\n", "# yAr_eqb = e/2\n", "# Sum of Stoichiometric Coeffecient:\n", "v = 1 + 1 - 1 - 1#\n", "def f(e):\n", " y = K_373 - ((e/2)*(e/2))/(((1 - e)/2)*((1 - e)/2))\n", " return y\n", "e = fsolve(f, 0.5)#\n", "print \"Mole fraction of ethyl acetate is %.3f\"%(e/2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.16 Page: 501" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.16 - Page: 501\n", "\n", "\n", "The decomposition pressure of limestone is 0.0493 bar at 1000 K\n" ] } ], "source": [ "print \"Example: 12.16 - Page: 501\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: CaCO3(s) = CaO(s) + CO2(g)\n", "T = 1000## [K]\n", "deltaH_1000 = 1.7533*10**5## [J]\n", "deltaS_1000 = 150.3## [J/mol K]\n", "R = 8.314## [J/mol K]\n", "#****************#\n", "\n", "deltaG_1000 = deltaH_1000 - T*deltaS_1000## [J]\n", "K_1000 = exp(-(deltaG_1000/(R*T)))## [bar]\n", "P = K_1000#\n", "print \"The decomposition pressure of limestone is %.4f bar at 1000 K\"%(P)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.17 Page: 501" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.17 - Page: 501\n", "\n", "\n", "The decomposition pressure is 0.0093 bar at 400 K\n", "\n", "The decomposition pressure is 343.20 bar at 700 K\n", "\n", "The decomposition temperature is 493.450 K\n" ] } ], "source": [ "print \"Example: 12.17 - Page: 501\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# Reaction: A(s) ---------> B(s) + C(g)\n", "def f1(T):\n", " deltaG = 85000 - 213.73*T + 6.71*T*log(T) - 0.00028*T**2\n", " return deltaG\n", "T1 = 400## [K]\n", "T2 = 700## [K]\n", "Pc = 1## [bar]\n", "R = 8.314## [J/mol K]\n", "#**************#\n", "\n", "deltaG_400 = f1(400)## [J]\n", "deltaG_700 = f1(700)## [J]\n", "K_400 = exp(-(deltaG_400/(R*T1)))## [bar]\n", "K_700 = exp(-(deltaG_700/(R*T2)))## [bar]\n", "print \"The decomposition pressure is %.4f bar at 400 K\\n\"%(K_400)#\n", "print \"The decomposition pressure is %.2f bar at 700 K\\n\"%(K_700)#\n", "\n", "# Equilibrium constant for solid - gas reaction is:\n", "# K = aB*aC/aA = aC = fC = Pc\n", "def f2(T):\n", " y = Pc - exp(-f1(T)/(R*T))\n", " return y\n", "T = fsolve(f2,900)## [K]\n", "print \"The decomposition temperature is %.3f K\"%(T)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.18 Page: 502" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.18 - Page: 502\n", "\n", "\n", "Equilibrium Composition\n", "\n", "yH2 = 0.34\n", "\n", "y_H2O = 0.66\n", "\n" ] } ], "source": [ "print \"Example: 12.18 - Page: 502\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "T = 875## [K]\n", "K = 0.514#\n", "P = 1## [bar]\n", "#*************#\n", "\n", "# Reaction: Fe(s) + H2O(g) --------->FeO(s) + H2(g)\n", "# K = a_FeO*a_H2/(a_Fe*a_H2O)\n", "# Since the activities of the solid components Fe & FeO at equilibrium may be taken as unity.\n", "# a_Fe = a_FeO = 1\n", "# Ka = a_H2/a_H2O#\n", "# Feed:\n", "nH2O_feed = 1#\n", "nH2feed = 0#\n", "# Let e be the degree of completion at equilibrium.\n", "# Moles at Equilibrium:\n", "# nH2O_eqb = 1 - e#\n", "# nH2_eqb = e#\n", "# Total moles at equilibrium = 1 - e + e = 1\n", "# Mole Fractions at Equilibrium:\n", "# yH20_eqb = 1 - e#\n", "# yH2_eqb = e#\n", "# Sum of stoichometric coeffecient:\n", "v = 1 - 1#\n", "Ky = K*P**(-v)#\n", "# Ky = e/(1 - e)\n", "e = Ky/(Ky + 1)#\n", "yH2_eqb = e#\n", "yH2O_eqb = 1 - e#\n", "print \"Equilibrium Composition\\n\"\n", "print \"yH2 = %.2f\\n\"%(yH2_eqb)#\n", "print \"y_H2O = %.2f\\n\"%(yH2O_eqb)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.19 Page: 503" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.19 - Page: 503\n", "\n", "\n", " Mathematics is involved in proving but just that no numerical computations are involved.\n", "\n", "\n", " For prove refer to this example 12.19 on page 503 of the book.\n" ] } ], "source": [ "print \"Example: 12.19 - Page: 503\\n\\n\"\n", "\n", "# Mathematics is involved in proving but just that no numerical computations are involved.\n", "# For prove refer to this example 12.19 on page number 503 of the book.\n", "\n", "print \" Mathematics is involved in proving but just that no numerical computations are involved.\\n\\n\"\n", "print \" For prove refer to this example 12.19 on page 503 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.20 Page: 505" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.20 - Page: 505\n", "\n", "\n", "No. of independent reaction that occur is 2\n", "\n", "No. of Degree of freedom is 4\n" ] } ], "source": [ "print \"Example: 12.20 - Page: 505\\n\\n\"\n", "\n", "# Solution\n", "\n", "#Reactions:\n", "# CO + (1/2)O2 ------------> CO2 ......................................(1)\n", "# C + O2 ------------------> CO2 ......................................(2)\n", "# H2 + (1/2)O2 ------------> H2O ......................................(3)\n", "# C + 2H2 -----------------> CH4 ......................................(4)\n", "\n", "# Elimination of C:\n", "# Combining Eqn. (2) with (1):\n", "# CO + (1/2)O2 ------------> CO2 ......................................(5)\n", "# Combining Eqn. (2) with (4):\n", "# CH4 + O2 ----------------> 2H2 + CO2 ................................(6)\n", "\n", "# Elimination of O2:\n", "# Combining Eqn. (3) with (4):\n", "# CO2 + H2 ----------------> CO + H2O .................................(7)\n", "# Combining Eqn. (3) with (6):\n", "# CH4 + 2H2O -------------> CO2 + 4H2 .................................(8)\n", "\n", "# Equations 7 & 8 are independent sets. Hence\n", "r = 2## [No. of independent rkn.]\n", "C = 5## [No. of component]\n", "P = 1## [No. of phases]\n", "s = 0## [No special constraint]\n", "# Applying Eqn. 12.81\n", "F = C - P + 2 - r - s## [Degree of freedom]\n", "print \"No. of independent reaction that occur is %d\\n\"%(r)#\n", "print \"No. of Degree of freedom is %d\"%(F)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.21 Page: 506" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.21 - Page: 506\n", "\n", "\n", "No. of Degree of freedom is 1\n" ] } ], "source": [ "print \"Example: 12.21 - Page: 506\\n\\n\"\n", "\n", "# Solution\n", "\n", "# Reaction: CaCO3 -----------> CaO + CO2\n", "r = 1## [No. of independent rkn.]\n", "C = 3## [No. of component]\n", "P = 3## [No. of phases, solid CaO, solid CaCO3, gaseous CO2]\n", "s = 0## [No special constraint]\n", "# Applying Eqn. 12.81\n", "F = C - P + 2 - r - s## [Degree of freedom]\n", "print \"No. of Degree of freedom is %d\"%(F)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 12.22 Page: 508" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 12.22 - Page: 508\n", "\n", "\n", "At Equilibrium\n", "\n", "yC4H10 = 0.0009\n", "\n", "yC2H4 = 0.0535\n", "\n", "yC2H6 = 0.0535\n", "\n", "yC3H6 = 0.4461\n", "\n", "yCH4 = 0.4461\n", "\n" ] } ], "source": [ "print \"Example: 12.22 - Page: 508\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*********Data*********#\n", "# Reaction: \n", "# C4H10 -----------> C2H4 + C2H6 ....................................(A)\n", "# C4H10 -----------> C3H6 + CH4 .................................... (B)\n", "T = 750## [K]\n", "P = 1.2## [bar]\n", "Ka = 3.856#\n", "Kb = 268.4#\n", "#************************#\n", "\n", "# Let\n", "# ea = Degree of conversion of C4H10 in reaction (A)\n", "# eb = Degree of conversion of C4H10 in reaction (B)\n", "\n", "# Moles in Feed:\n", "nC4H10_feed = 1#\n", "nC2H4_feed = 0#\n", "nC2H6_feed = 0#\n", "nC3H6_feed = 0#\n", "nCH4_feed = 0#\n", "\n", "# Moles at Equilibrium:\n", "# nC4H10_eqb = 1 - ea - eb\n", "# nC2H4_eqb = ea\n", "# nC2H6_eqb = ea\n", "# nC3H6_eqb = eb\n", "# nCH4_eqb = eb\n", "\n", "# Total moles at equilibrium = 1 - ea - eb + ea + eb + eb = 1 + ea + eb\n", "\n", "# Mole Fraction:\n", "# yC4H10_eqb = (1 - ea - eb)/(1 + ea + eb)\n", "# yC2H4_eqb = ea/(1 + ea + eb)\n", "# yC2H6_eqb = ea/(1 + ea + eb)\n", "# yC3H6_eqb = eb/(1 + ea + eb)\n", "# yCH4_eqb = eb/(1 + ea + eb)\n", "\n", "# Sum of the stoichometric coeffecient:\n", "va = 1 + 1 - 1#\n", "vb = 1 + 1 - 1#\n", "\n", "# e = [ea eb]\n", "# Solution of simultaneous equation\n", "def F(e):\n", " f1 = (((e[0]/(1 + e[0] + e[1]))*(e[0]/(1 + e[0] + e[1])))/((1 - e[0] - e[1])/(1 + e[0] + e[1])))*P**va - Ka#\n", " f2 = (((e[1]/(1 + e[0] + e[1]))*(e[1]/(1 + e[0] + e[1])))/((1 - e[0] - e[1])/(1 + e[0] + e[1])))*P**vb - Kb#\n", " return [f1, f2]\n", "\n", "# Initial guess:\n", "e = [0.1, 0.8]#\n", "y = fsolve(F, e)#\n", "ea = y[0]#\n", "eb = y[1]#\n", "yC4H10_eqb = (1 - ea - eb)/(1 + ea + eb)#\n", "yC2H4_eqb = ea/(1 + ea + eb)#\n", "yC2H6_eqb = ea/(1 + ea + eb)#\n", "yC3H6_eqb = eb/(1 + ea + eb)#\n", "yCH4_eqb = eb/(1 + ea + eb)#\n", "\n", "print \"At Equilibrium\\n\"\n", "print \"yC4H10 = %.4f\\n\"%(yC4H10_eqb)#\n", "print \"yC2H4 = %.4f\\n\"%(yC2H4_eqb)#\n", "print \"yC2H6 = %.4f\\n\"%(yC2H6_eqb)#\n", "print \"yC3H6 = %.4f\\n\"%(yC3H6_eqb)#\n", "print \"yCH4 = %.4f\\n\"%(yCH4_eqb)#" ] } ], "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.9" } }, "nbformat": 4, "nbformat_minor": 0 }