summaryrefslogtreecommitdiff
path: root/Thermodynamics/Chapter15.ipynb
blob: 537afb5985bba09e32caf9b4c6d338226f326f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
{
 "metadata": {
  "name": "",
  "signature": "sha256:aba24805b98ee0919f2ef39d5927b5007d2ce98264adcd2e65263a9fbffd1f67"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15:CHEMICAL EQUILIBRIUM"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.1, Page No:676"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "# (b).Number of moles of each constituents\n",
      "nCH4=2; # Number of moles of CH4\n",
      "\n",
      "#Calculation\n",
      "E=3-nCH4; # Amount of reaction from (a) and refer example 15.1 (a)\n",
      "nH2O=1-E;# Number of moles of H2O\n",
      "nCO=1+E;# Number of moles of CO\n",
      "nH2=4+3*E;# Number of moles of H2\n",
      "\n",
      "#Results\n",
      "print \"(b).Number of moles of each constituents\",\"\\nNumber of moles of H2O = \",nH2O\n",
      "print \"Number of moles of CO = \",nCO,\"\\nNumber of moles of H2 = \",nH2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(b).Number of moles of each constituents \n",
        "Number of moles of H2O =  0\n",
        "Number of moles of CO =  2 \n",
        "Number of moles of H2 =  7\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.2, Page No:680"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T0=298; # Given temperature in kelvin\n",
      "R_1=8.314; # Universal gas constant in kJ/kg mol K\n",
      "# (a).CO+1/2 O2 = CO2\n",
      "# From table of properties of combustion\n",
      "del_hfco2=-393509;# Enthalpy of heat \n",
      "del_hfco=-110525;# Enthalpy of heat \n",
      "s_co2=213.795;# Entropy of heat \n",
      "s_co=197.652;# Entropy of heat \n",
      "s_o2=205.142;# Entropy of heat \n",
      "\n",
      "#Calculation for (a)\n",
      "del_Ga=(del_hfco2-del_hfco-T0*(s_co2-s_co-(1/2*s_o2)));\n",
      "Ka=math.exp (abs (del_Ga)/(R_1*1000*T0));\n",
      "\n",
      "#Result for (a)\n",
      "print \"(a).CO+1/2 O2 = CO2\"\n",
      "print (\" The equilibrium constant at 298 K = %0.3f (Error in textbook) \")%Ka\n",
      "\n",
      "#Calculation for (b)\n",
      "# (b).2CO + O2 = 2CO2\n",
      "Kb=math.exp (2*abs (del_Ga)/(R_1*1000*T0));\n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n(b).2CO + O2 = 2CO2\"\n",
      "print (\"The equilibrium constant at 298 K = %0.3f (Error in textbook)\")%Kb\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).CO+1/2 O2 = CO2\n",
        " The equilibrium constant at 298 K = 1.123 (Error in textbook) \n",
        "\n",
        "(b).2CO + O2 = 2CO2\n",
        "The equilibrium constant at 298 K = 1.262 (Error in textbook)\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.3, Page No:686"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "T0=298; # Temperature of surroundings in kelvin\n",
      "R_1=8.314; # Universal gas constant in kJ/kg mol K\n",
      "T=2800; # Given Temperature in kelvin\n",
      "\n",
      "#Calculation\n",
      "# From table of properties of combustion\n",
      "del_hfco2=-393509; # Enthalpy of heat \n",
      "del_hfco=-110525; # Enthalpy of heat \n",
      "del_H=del_hfco2-del_hfco; # Standard enthalpy of reaction\n",
      "Ka=1.202*10**45; # The equilibrium constant From the example 15.2\n",
      "K1=math.log (Ka);\n",
      "K=math.exp(-(del_H/R_1)*((1/T)-(1/T0))+K1);\n",
      "\n",
      "#Result\n",
      "print\"K =\",round(K,3),\"  (roundoff error)\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "K = 5.687   (roundoff error)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.5, Page No:689"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T=2800; # Temperature of combustion in kelvin\n",
      "p=1; # Pressure of combustion in atm\n",
      "# For this reverse reaction at 2800K and 1atm, from Table 15.1\n",
      "K=44.168; # K=e^3.788;\n",
      "\n",
      "#Calculation\n",
      "K=math.sqrt (K); # For stoichiometric equation CO+1/2 O2 = CO2 which is halved\n",
      "# From equation 15.24a and by the iteration process we get the following\n",
      "a=0.198;\n",
      "b=(1+a)/2;\n",
      "c=1-a;\n",
      "\n",
      "#Results\n",
      "print \"The balance for the actual reaction equation CO + O2 \u2192 aCO + bO2 + cCO2 is given by \"\n",
      "print \"a =\",a,\"\\nb =\",b,\"\\nc =\",c\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The balance for the actual reaction equation CO + O2 \u2192 aCO + bO2 + cCO2 is given by \n",
        "a = 0.198 \n",
        "b = 0.599 \n",
        "c = 0.802\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.6, Page No:691"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "# By driving the equation for equilibrium constant as shown in example 15.6 we get 6.646(6)^(1/6)=((1-a)/a)((3+a)/(1+a))^1/2\n",
      "# by simple iteration process we get\n",
      "a=0.095;\n",
      "\n",
      "#Calculations\n",
      "b=(1+a)/2;\n",
      "c=1-a;\n",
      "\n",
      "#Results\n",
      "print \"The equilibrium composition of CO = \",a,\"mol   (roundoff error)\"\n",
      "print \"The equilibrium composition of O2 = \",b,\"mol   (roundoff error)\"\n",
      "print \"The equilibrium composition of CO2 = \",c,\"mol   (roundoff error)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equilibrium composition of CO =  0.095 mol   (roundoff error)\n",
        "The equilibrium composition of O2 =  0.5475 mol   (roundoff error)\n",
        "The equilibrium composition of CO2 =  0.905 mol   (roundoff error)\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.7, Page NO:691"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T=2800; # Temperature of combustion in kelvin\n",
      "p=1; # Pressure of combustion in atm\n",
      "# For this reverse reaction at 2800K and 1atm, from Table 15.1\n",
      "K=44.168; # K=e^3.788;\n",
      "\n",
      "#Calculations\n",
      "K=math.sqrt (K); # For stoichiometric equation CO+1/2 O2 = CO2 which is halved\n",
      "# From equation 15.24a and by the iteration process we get the following\n",
      "a=0.302;\n",
      "b=(1+a)/2;\n",
      "c=1-a;\n",
      "\n",
      "#Results\n",
      "print \"The balance for the actual reaction equation CO + 1/2O2 + 1.88N2 \u2194 aCO + bO2 + cCO2 +3.76N2 is given  by \"\n",
      "print  \"a =\",a,\"\\nb =\",b,\"\\nc =\",c"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The balance for the actual reaction equation CO + 1/2O2 + 1.88N2 \u2194 aCO + bO2 + cCO2 +3.76N2 is given  by \n",
        "a = 0.302 \n",
        "b = 0.651 \n",
        "c = 0.698\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.8, Page No:693"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T=3000; # Temperature of combustion in kelvin\n",
      "p=1; # Pressure of combustion in atm\n",
      "T0=298; # Temperature of surroundings in kelvin\n",
      "R_1=8.314; # Universal gas constant in kJ/kg mol K\n",
      "# Gibbs functions at 298K from Table 14.1\n",
      "del_gNO=86550; # In kJ/kmol\n",
      "del_gNO2=51310; # In kJ/kmol\n",
      "# From table of properties of combustion\n",
      "del_hfNO=90250; # Enthalpy of heat \n",
      "del_hfNO2=33180; # Enthalpy of heat \n",
      "\n",
      "#Calculations\n",
      "K1=math.exp (-(del_hfNO/R_1)*((1/T)-(1/T0))-((del_gNO)/(R_1*T0)));\n",
      "K2=math.exp (-(del_hfNO2/R_1)*((1/T)-(1/T0))-((del_gNO2)/(R_1*T0)));\n",
      "# By solving equilibrium equations by iteration method\n",
      "E1=0.228; E2=0.0007;\n",
      "yNO=E1/4.76; # Mole fraction of NO in exhaust gas\n",
      "yNO2=E2/4.76; # Mole fraction of NO2 in exhaust gas\n",
      "\n",
      "#Results\n",
      "print \"Percentage of NOx present in the exhaust gas \",\"\\nMole fraction of NO in exhaust gas = \",round(yNO*100,2),\"%\"\n",
      "print \"Mole fraction of NO2 in exhaust gas = \",round(yNO2*100,4),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of NOx present in the exhaust gas  \n",
        "Mole fraction of NO in exhaust gas =  4.79 %\n",
        "Mole fraction of NO2 in exhaust gas =  0.0147 %\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}