summaryrefslogtreecommitdiff
path: root/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch5.ipynb
blob: df919019dccec287b3fb3e4826ae5dfb5902a241 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:45c34efa92ef22d9ef4ef3ec497299bfe0d1792fe0aef4bcd0da61b878004248"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 :  Vapor Pressure The Clapeyron Equation And Single Pure Chemical Species Phase Equilibrium"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 5.1  Page: 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import math \n",
      "\n",
      "\n",
      "# Variables\n",
      "T=212.          # [F]\n",
      "\n",
      "#**********#\n",
      "#From the steam table, we have \n",
      "delta_h=970.3           #[Btu/lbm]\n",
      "delta_v=26.78           #[ft**(3)/lbm] and\n",
      "\n",
      "# Calculations\n",
      "# changing the units\n",
      "delta_h1=delta_h*778        #[ft*lbf/lbm]\n",
      "delta_v1=delta_v*144        #[ft*in**(2)/lbm]\n",
      "T=671.7                     #[R]\n",
      "\n",
      "# We have dP/dT = delta_h/(T*delta_v)\n",
      "#Thus\n",
      "dP_by_dT=delta_h1/(T*delta_v1)          #[psi/R]\n",
      "\n",
      "# Results\n",
      "print \"The value of dP/dT is %f psi/R\"%(dP_by_dT)\n",
      "#Using the nearest adjacent steam table entries for vapour pressure, wee have \n",
      "#dP_by_dT = delta_P_by_delta_T=(15.291-14.125)/(214-210)=0.2915 psi/R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of dP/dT is 0.291432 psi/R\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 5.2  Page: 90\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import math \n",
      "\n",
      "# Variables\n",
      "p_2=0.005           # [psia]\n",
      "R=1.987/18.         #[1/R]\n",
      "\n",
      "#From the steam tables at the tripple point, we find \n",
      "T_1=460+32.018      #[R]\n",
      "p_1=0.0887          #[psia]\n",
      "\n",
      "#delta_h(solid to gas) = delta_h(sublimation) = 1218.7#[Btu/lbm]\n",
      "delta_H=1218.7      #[Btu/lbm]\n",
      "#Assuming that the enthalpy change of vaporization is independent of temperature (a fairly good approximation in this case)\n",
      "#we start with Eq. 5.10 and rearrange:\n",
      "#1/T_2 = 1/T_1-(math.log(p_2/p_1))*R/delta_H\n",
      "#So\n",
      "\n",
      "# Calculations\n",
      "T_2=1/(1/T_1-(math.log(p_2/p_1))*R/delta_H)         #[R]\n",
      "#Changing the temperature in farenheit\n",
      "T_2F=T_2-460        #[F]\n",
      "\n",
      "# Results\n",
      "print \"The temperature is %.2f F\"%(T_2F)\n",
      "#BY linear interpolation in the steam tables, one finds -23.8 F. Because of imprecision of linear interpolation, these values are approximately equal.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature is -23.88 F\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 5.3  Page: 91\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import math \n",
      "from numpy import *\n",
      "\n",
      "# Variables\n",
      "T_3=1155.2      #[R]\n",
      "T_2=652.9       #[R]\n",
      "T_1=787.5       #[R]\n",
      "p_2=10.         #[psia]\n",
      "p_1=100.        #[psia]\n",
      "\n",
      "# Calculations\n",
      "#******#\n",
      "#Here we can write Eq. 5.9 as reported in the book in the form most often seen.\n",
      "# math.log(p)=A-B/T\n",
      "#Where A and B are consmath.tants to be determined from the pair of T and p values above.\n",
      "\n",
      "#we simply write \n",
      "#math.log(10)=A-B/652.9\n",
      "#math.log(100)=A-B/787.5\n",
      "# We have to solve the above two simulmath.taneous equations having two vaiables A and B.\n",
      "\n",
      "M = matrix([[1, -1/652.9],[1,-1/787.5]])\n",
      "C = array([[math.log(10)],[math.log(100)]])\n",
      "X = linalg.inv(M) * C\n",
      "\n",
      "A=X[0]\n",
      "B=X[1]\n",
      "\n",
      "# By straightforward algebra we find the values of A and B. Thus, for 1155.2 R we have \n",
      "p_3=math.exp(A-B/T_3)\n",
      "\n",
      "# Results\n",
      "print \"Vapuor pressure of water at given temperature is %f psia\"%(p_3)\n",
      "\n",
      "# p_3=3499 psia. \n",
      "# Note : \"It has been reported in the book that from table 5.1 we see that the correct value is 3000 psia. Thus there is an error of 16% in the predicted pressure.\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vapuor pressure of water at given temperature is 3499.187053 psia\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 5.4  Page: 94\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import math \n",
      "\n",
      "# Variables\n",
      "# At Tr = 0.7, we read \n",
      "Pr=0.023\n",
      "# and thus accentric factor is given by\n",
      "\n",
      "# Calculations\n",
      "w=-math.log10(0.023)-1\n",
      "\n",
      "# Results\n",
      "print \"The accentric factor based on the given data is %f\"%(w)\n",
      "#It has been reported in the book that table A.1 shows that the value based on the best data is 0.645.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The accentric factor based on the given data is 0.638272\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 5.5  Page: 94\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import math \n",
      "\n",
      "# Variables\n",
      "#From Antoine equation we have \n",
      "# math.log(p) = A-B/(T+C)\n",
      "#Solving above equation for T, we have\n",
      "# T = B/(A-math.log(p))-C\n",
      "#Inserting the values of the consmath.tants for the water which are reported in the given book in the table A.2 (page 419),\n",
      "# and the value of 1.00 atm expressed in torr, we find that \n",
      "A=7.96681\n",
      "B=1668.21\n",
      "C=228.0\n",
      "p=760.          #[torr]\n",
      "\n",
      "# Calculations\n",
      "#Thus\n",
      "T=B/(A-math.log10(p))-C\n",
      "\n",
      "# Results\n",
      "print \"NBP of water umath.sing antoine equation and table A.2 is %f C\"%(T)\n",
      "\n",
      "#This does not prove the overall accuracy of the Antoine equation, but does show that whoever fitted the consmath.tants to the experimental data for water made them represent the NBP (100C) very well.  \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "NBP of water umath.sing antoine equation and table A.2 is 100.000625 C\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 5.6  Page: 96\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import math \n",
      "\n",
      "# Variables\n",
      "T_2=-22.            #[C]\n",
      "# converting temperature in farenheit\n",
      "T_2F=T_2*9/5+32     #[F]\n",
      "#Expressing T_2 in Rankine\n",
      "T_2R=460+T_2F       #[R]\n",
      "#delta_h = delta_h(fusion)\n",
      "delta_h=143.35*778.         #[ft*lbf/lbm]\n",
      "#delta_v = v_water-v_ice\n",
      "delta_v=0.01602-0.01747     #[ft**(3)/lbm]\n",
      "# changing the unit \n",
      "delta_v1=delta_v*144        #[ft*in/lbm]\n",
      "\n",
      "# Calculations\n",
      "#and\n",
      "T_1=460+32.                 #[R]\n",
      "dP_by_dT=delta_h/(T_1*delta_v1)         #[psi/R] at 32F\n",
      "delta_T=T_2R-T_1\n",
      "\n",
      "#This gives the rigorously correct slope of the liquid-solid curve at 32F on a P-T diagram.\n",
      "#Here we use P instead of p  because neither phase is a gas, so this is not a vapour pressure. \n",
      "#If we further assume that the solid-liquid curve is a straight line, which is equivalent to assuming that delta_h/(T*deta_v)is a consmath.tant over the region of interest, then we can estimate the pressure at -22C = -7.6F by\n",
      "#So\n",
      "\n",
      "delta_P=(dP_by_dT)*delta_T              #[psi]\n",
      "\n",
      "# From this we can estimate the final pressure as\n",
      "delta_P=delta_P+0.09                    #[psi]\n",
      "\n",
      "# Results\n",
      "print \"Freezing preesure of water at given temperature is %f psi\"%(delta_P)\n",
      "# In this case, the experimental pressure is well known, because this temperature corresponds to the tripple point between liquid and water, \n",
      "# ice I(the common variety), and ice III, a variety that does not exist at pressure below about 30000 psia (see figure 1.10 in the book). \n",
      "# The measured value is 30000 psia, which shows that our assumption of a straight line on a P-T plot (delta_h/(T*delta_v)=consmath.tant) is only approximately correct.\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Freezing preesure of water at given temperature is 42991.024258 psi\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}