summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_C_P_Arora/Chapter11.ipynb
blob: 06493c9c5c924438a6350ed57a23bad072a450b3 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:07129d26d6d361c6256f48cf43ea30152b9d8cd21fc1703b7734f18388f313fe"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11:THERMODYNAMIC PROPERTY RELATIONS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1, Page No:510"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "p1=150; p2=200; p3=250; p4=300; p5=350; p6=400; p7=450; p8=500; p9=550; p10=600; p11=650; p12=700;\n",
      "p13=750; p14=800; p15=850; p16=900; # Pressures of merect's  boiler experiment in kPa\n",
      "t1=111.4; t2=120.2; t3=127.4; t4=133.6; t5=138.9; t6=143.6; t7=147.9; t8=151.9;  t9=155.5; t10=158.9; t11=162;\n",
      "t12=165; t13=167.8; t14=170.4; t15=173; t16=175.4; # Temperatures of merect's boiler experiment in degree celcius\n",
      "n=16;# Total number of readings taken  \n",
      "\n",
      "#Calculation for constants\n",
      "# Values of constant A & B\n",
      "s_y= math.log10 (p1*p2*p3*p4*p5*p6*p7*p8*p9*p10*p11*p12*p13*p14*p15*p16);\n",
      "s_x=1/(t1+273)+1/(t2+273)+1/(t3+273)+1/(t4+273)+1/(t5+273)+1/(t6+273)+1/(t7+273)+1/(t8+273)+1/(t9+273)+1/(t10+273)+1/(t11+273)+1/(t12+273)+1/(t13+273)+1/(t14+273)+1/(t15+273)+1/(t16+273);\n",
      "s_xy=((math.log10 (p1))*1/(t1+273))+ ((math.log10 (p2))*1/(t2+273))+ ((math.log10 (p3))*1/(t3+273))+ ((math.log10 (p4))*1/(t4+273))+ ((math.log10 (p5))*1/(t5+273))+ ((math.log10 (p6))*1/(t6+273))+ ((math.log10 (p7))*1/(t7+273))+ ((math.log10 (p8))*1/(t8+273))+ ((math.log10 (p9))*1/(t9+273))+ ((math.log10 (p10))*1/(t10+273))+ ((math.log10 (p11))*1/(t11+273)) + ((math.log10 (p12))*1/(t12+273)) + ((math.log10 (p13))*1/(t13+273)) + ((math.log10 (p14))*1/(t14+273)) + ((math.log10 (p15))*1/(t15+273)) + ((math.log10 (p16))*1/(t16+273));\n",
      "s_x2=(1/(273+t1))**2+(1/(273+t2))**2+(1/(273+t3))**2+(1/(273+t4))**2+(1/(273+t5))**2+(1/(273+t6))**2+(1/(273+t7))**2+(1/(273+t8))**2+(1/(273+t9))**2+(1/(273+t10))**2+(1/(273+t11))**2+(1/(273+t12))**2+(1/(273+t13))**2+(1/(273+t14))**2+(1/(273+t15))**2+(1/(273+t16))**2;\n",
      "B= ((n*s_xy)-(s_x*s_y))/((n*s_x2)-((s_x)**2)); # Constant B\n",
      "A=((s_y)-(B*s_x))/n; # Constant A\n",
      "\n",
      "#Result for constants\n",
      "print \"Values of constant A & B\"\n",
      "print \"A =\",round(A,5)\n",
      "print \"B =\",round(B,1),\"   (roundoff error)\"\n",
      "\n",
      "#Calculation for latent heat of vapourization\n",
      "# The latent heat of vapourization\n",
      "T=150; # The latent heat of vapourization at this temperature in degree celcius\n",
      "d_T=20; d_p=258.7; # Temperature and pressure difference\n",
      "vg=0.3928; vf=0.0011; # specific volume in m^3/kg\n",
      "hfg=(T+273)*(vg-vf)*d_p/d_T; # Clapeyron equztion\n",
      "\n",
      "#Result for latent heat of vapourization\n",
      "print \"The latent heat of vapourization at 150 oC =\",round(hfg,2),\"kJ/kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Values of constant A & B\n",
        "A = 7.62068\n",
        "B = -2091.6    (roundoff error)\n",
        "The latent heat of vapourization at 150 oC = 2143.19 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3, Page No:517"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "p5=6000; # Pressure of superheated steam in kPa\n",
      "T5=723.15; # Temperature of superheated steam in kelvin\n",
      "p1=0.6113; # Pressure at reference state in kPa\n",
      "T1=273.16; # Temperature at reference state in kelvin\n",
      "hfg1=2501.3; # Latent heat of vapourization of water at reference state in kJ/kg\n",
      "R_1=8.3143; # Universal gas constant of air in kJ/kmol K\n",
      "# The critical state properties of water\n",
      "pc=2.09; # pressure in MPa\n",
      "Tc=647.3; # Temperature in kelvin\n",
      "h1=0; # Reference state in kJ/kg\n",
      "\n",
      "#Calculation\n",
      "h2=h1+hfg1; # specific enthalpy in kJ/kg \n",
      "# At point 2\n",
      "p2=p1; T2=T1;\n",
      "z=0.9986;\n",
      "r=18.015;\n",
      "A2=(0.4278/(pc*10**4))*(Tc/T2)**2.5; # Constants\n",
      "B=(0.0867/(pc*10**4))*(Tc/T2); # Constants\n",
      "h2_h3=R_1*(T2/r)*(((-3/2)*(A2/B)*math.log (1+(B*p2/z)))+z-1); # Enthalpy difference between state 2 & 3\n",
      "# At point 5\n",
      "z1=0.9373;\n",
      "A2=(0.4278/(pc*10**4))*(Tc/T5)**2.5; # Constants\n",
      "B=(0.0867/(pc*10**4))*(Tc/T5); # Constants\n",
      "h5_h4=R_1*(T5/r)*(((-3/2)*(A2/B)*math.log (1+(B*p5/z1)))+z1-1); # Enthalpy difference between state 5 & 4\n",
      "a=1.6198;b=6.6*10**-4; # Constants\n",
      "h4_h3=a*(T5-T1)+b*(T5**2-T1**2)/2; # Enthalpy difference between state 3 & 4\n",
      "h5=h2-h2_h3+h5_h4+h4_h3; # Specific enthalpy at state 5 \n",
      "\n",
      "#Result\n",
      "print \"Specific enthalpy at state 5 = \",round(h5,1),\"kJ/kg    (roundoff error)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific enthalpy at state 5 =  3308.3 kJ/kg    (roundoff error)\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.4, Page No:527"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "T2=373; # Temperature of CO2 gas in kelvin\n",
      "p2=100; # Pressure of CO2 gas in atm\n",
      "T1=0; # Reference state temperature in kelvin\n",
      "# The crictical constants for CO2 are \n",
      "Tc=304.2; # Temperature in kelvin\n",
      "Pc=72.9; # Pressure in atm\n",
      "zc=0.275;\n",
      "\n",
      "#Calculation\n",
      "# Refer figure 11.7 for state definition\n",
      "h1_0=((-3.74*T2)+((30.53/(100**0.5))*((T2**1.5)/1.5))-((4.1/100)*((T2**2)/2))+((0.024/(100**2))*((T2**3)/3)));\n",
      "Tr=T2/Tc; Pr=p2/Pc; # Reduced properties\n",
      "# From generalized chart figure 11.6\n",
      "hR_Tc=10.09;\n",
      "h1_2=hR_Tc*Tc;\n",
      "M=44; # Molecular weight\n",
      "h10=h1_0/M; h12=h1_2/M;\n",
      "h373=h10-h12; # The required enthalpy of CO2 gas at 373 K and 100 atm\n",
      "\n",
      "#Result\n",
      "print \"The required enthalpy of CO2 gas at 373 K and 100 atm = \",round(h373,0),\"kJ/kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required enthalpy of CO2 gas at 373 K and 100 atm =  168.0 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5, Page No:531"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "p1=11; # Initial pressure in bar\n",
      "T1=40; # Initial temperature in degree celcius\n",
      "p2=60; #  Final pressure in bar\n",
      "R_1=8.3143; # Universal gas constant  in kJ/kmol K\n",
      "# The crictical properties for natural gas \n",
      "Tc=161; # Temperature in kelvin\n",
      "Pc=46.4; # Pressure in bar\n",
      "\n",
      "#Calculation\n",
      "# Reduced properties are\n",
      "Pr1=p1/Pc; Pr2=p2/Pc;\n",
      "Tr1=(T1+273)/Tc;\n",
      "# T2=T1, The ideal gas enthalpy h2*=h1*=h1\n",
      "h21=-47.5; # From generalized enthalpy departure chart\n",
      "M=16; # Molecular weight\n",
      "Sp2_1=(R_1/M)*math.log (p2/p1)# for the difference in ideal gas entropies\n",
      "Sp2_Sp_2=-0.1125; Sp_2_Sp_1=-2.1276; # Entropies in kJ/kg K\n",
      "s2_s1=(Sp2_Sp_2)+(Sp_2_Sp_1);\n",
      "q=(T1+273)*s2_s1; # Heat transfer\n",
      "w=q-h21; # Work of compression\n",
      "\n",
      "#Result\n",
      "print \"Heat transfer = \",round(q,1),\"kJ/kg\",\"\\nWork of compression = \",round(w,0),\"kJ/kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer =  -701.2 kJ/kg \n",
        "Work of compression =  -654.0 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.8, Page No:538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "p1=10; # Initial pressure in MPa\n",
      "T1=263; # Initial temperature in Kelvin\n",
      "p2=1.5; #  Final pressure in MPa\n",
      "R_1=8.3143; # Universal gas constant  in kJ/kmol K\n",
      "M=28; # Molecular mass\n",
      "# The crictical properties for nitrogen gas \n",
      "Tc=126.2; # Temperature in kelvin\n",
      "Pc=3.39; # Pressure in MPa\n",
      "\n",
      "#Calculation\n",
      "# Reduced properties are\n",
      "Pr1=p1/Pc; Pr2=p2/Pc;\n",
      "Tr1=T1/Tc;\n",
      "# From the generalized chart for enthalpy departure at Pr1 & Tr1\n",
      "h_11=8.7*Tc/M;\n",
      "# The solution involves iteration procedure. Assume T2 and check if h2_h1=0\n",
      "# First approximation T2=200 K\n",
      "T2=200; # In K\n",
      "Tr2=T2/Tc;\n",
      "Cpr=1.046;\n",
      "h_21=Cpr*(T2-T1);\n",
      "# From the generalized chart for enthalpy departure at Pr1 & Tr1\n",
      "h_22=1*Tc/M;\n",
      "h2_h1=h_11-T2+T1-h_22;\n",
      "# Second approximation \n",
      "T2=190; # In K\n",
      "Tr2=T2/Tc;\n",
      "Cpr=1.046;\n",
      "h_21=Cpr*(T2-T1);\n",
      "# From the generalized chart for enthalpy departure at Pr1 & Tr1\n",
      "h_22=1.5*Tc/M;\n",
      "h2_h1=h_11-T2+T1-h_22;\n",
      "\n",
      "#Result\n",
      "print \"Here also h2-h1 != 0. Therefore the temperature is dropping. Thus Joule-Thomson coefficient is positive.\"\n",
      "print \"There is cooling in this process\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Here also h2-h1 != 0. Therefore the temperature is dropping. Thus Joule-Thomson coefficient is positive.\n",
        "There is cooling in this process\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.9, Page No:544"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Tcammonia=405.9;\n",
      "Tcwater=647.3;\n",
      "Tr=0.576; # Condition of similarity\n",
      "\n",
      "#Calculation\n",
      "Twater=Tcwater*Tr; # At reduced temperature Temperature of water\n",
      "Tammonia=Tcammonia*Tr;#At reduced temperature Temperature of  ammonia\n",
      "# From steam table at Twater\n",
      "hfgwater=2257;# specific enthalpy in kJ/kg \n",
      "hfgammonia=Tcammonia/Tcwater *hfgwater; # Latent heat of vaporization of ammonia\n",
      "\n",
      "#Result\n",
      "print \"Latent heat of vaporization of ammonia =\",round(hfgammonia,0),\"kJ/kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Latent heat of vaporization of ammonia = 1415.0 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}