summaryrefslogtreecommitdiff
path: root/Thermodynamics_Demystified_by_Merle_C_Potter/Chapter2_2.ipynb
blob: d8357657ad3f4a5718fe98fc90b1c9dc39c14eef (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:63ec806cc789e6d4e52abc481b4c69dbae196d3a1063d71df1549638fb7b9752"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2:Properties of Pure Substances"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.1, PG-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "m=10;  #mass of saturated water in kg\n",
      "\n",
      "    # All the necessary values are taken from table C.2\n",
      " \n",
      "# part (a)\n",
      " \n",
      "P=0.001; # Pressure in MPa\n",
      "vf=0.001; #specific volume of saturated liquid at 0.001 Mpa in Kg/m^3\n",
      "vg=129.2; # specific volume of saturated vapour at 0.001 Mpa in Kg/m^3\n",
      "deltaV=m*(vg-vf) # by properties of pure substance \n",
      "# result\n",
      "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV),\" m^3 \\n\"\n",
      "\n",
      "# part (b) \n",
      "\n",
      "P=0.26;  # Pressure in MPa\n",
      "vf=0.0011; #   specific volume of saturated liquid at 0.26 MPa( it is same from at 0.2 and 0.3 MPa upto 4 decimals)\n",
      "vg=(P-0.2)*(0.6058-0.8857)/(0.3-0.2)+0.8857;  # specific volume of saturated vapour by interpolation of Values at 0.2 MPa and 0.3 MPa\n",
      "deltaV=m*(vg-vf) # by properties of pure substance \n",
      "# result\n",
      "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,2),\" m^3 \\n\"\n",
      "\n",
      "# part (c) \n",
      "P=10;  # Pressure in MPa\n",
      "vf=0.00145; # specific volume of saturated liquid at 10 MPa\n",
      "vg=0.01803; # specific volume of saturated vapour at 10 MPa\n",
      "deltaV=m*(vg-vf) # by properties of pure substance \n",
      "# result\n",
      "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,4),\" m^3 \\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Volume change at pressure  0.001  MPa is 1292.0  m^3 \n",
        "\n",
        "The Volume change at pressure  0.26  MPa is 7.17  m^3 \n",
        "\n",
        "The Volume change at pressure  10  MPa is 0.1658  m^3 \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.2, PG-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#    initialization of variables\n",
      "m=4.0 # mass of water in kg\n",
      "V=1.0 # volume in m^3\n",
      "T=150 # temperature of water in degree centigrade\n",
      "\n",
      "# TABLE C.1 is used for values in wet region\n",
      "# Part (a)\n",
      "P=475.8 # pressure in KPa in wet region at temperature of 150 *C\n",
      "print \" The pressure is\",round(P,2),\" kPa \\n\"\n",
      "\n",
      "# Part (b)\n",
      "#first we determine the dryness fraction\n",
      "v=V/m # specific volume of water\n",
      "vg=0.3928 #  specific volume of saturated vapour @150 degree celsius\n",
      "vf=0.00109 # specific volume of saturated liquid @150 degree celsius\n",
      "x=(v-vf)/(vg-vf); # dryness fraction\n",
      "mg=m*x; # mass of vapour\n",
      "print \" The mass of vapour present is\",round(mg,3),\" kg \\n\"\n",
      "\n",
      "# Part(c) \n",
      "Vg=mg*vg; # volume of vapour\n",
      "print \" The volume of vapour is\",round(Vg,3),\" m^3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pressure is 475.8  kPa \n",
        "\n",
        " The mass of vapour present is 2.542  kg \n",
        "\n",
        " The volume of vapour is 0.998  m^3\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.3, PG-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#    initialization of variables\n",
      "m=2 # mass of water in kg\n",
      "P=220 # pressure in KPa\n",
      "x=0.8 # quality of steam\n",
      "\n",
      "# Table C.2 is used for values\n",
      "\n",
      "vg=(P-200)*(0.6058-0.8857)/(300-200)+0.8857 # specific volume of saturated vapour @ given pressure by interpolating\n",
      "vf=0.0011 # specific volume of saturated liquid @ 220 KPa\n",
      "v=vf+x*(vg-vf)# property of pure substance\n",
      "V=m*v # total volume\n",
      "#result\n",
      "print \"The Total volume of the mixture is \",round(V,3),\" m^3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Total volume of the mixture is  1.328  m^3\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.4, PG-30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#   initialization of variables\n",
      "m=2 # mass of water in kg\n",
      "P=2.2 # pressure in Mpa\n",
      "T=800 # temperature in degree centigrade\n",
      " # Table C.3 is used for values\n",
      "v=0.2467+(P-2)*(0.1972-0.2467)/(2.5-2) # specific volue by interpolatin between 2 and 2.5 MPa\n",
      "V=m*v # final volume\n",
      "print \"The Final Volume is\",round(V,3),\" m^3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Final Volume is 0.454  m^3\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5, PG-32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#    initialization of variables\n",
      "V=0.6 # volume of tyre in m^3\n",
      "Pgauge=200 # gauge pressure in KPa\n",
      "T=20+273 # temperature converted to kelvin\n",
      "Patm=100 # atmospheric pressure in KPa\n",
      "R=287 # gas constant in Nm/kg.K\n",
      "Pabs=(Pgauge+Patm)*1000 # calculating absolute pressue in Pa \n",
      "\n",
      "m=Pabs*V/(R*T)# mass from ideal gas equation\n",
      "print \"The Mass of air is\",round(m,2),\" Kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Mass of air is 2.14  Kg\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.6, PG-33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#    initialization of variables\n",
      "T=500+273 # temperature of steam in kelvin\n",
      "rho=24.0 # density in Kg/m^3\n",
      "R=0.462 # gas constant from Table B.2\n",
      "v=1/rho # specific volume and density relation\n",
      "# PART (a)\n",
      "P=rho*R*T # from Ideal gas equation\n",
      "print \" PART (a) The Pressure is \",int(P),\" KPa \\n\"\n",
      "# answer is approximated in textbook\n",
      "\n",
      "# PART (b)\n",
      "a=1.703 #  van der Waal's constant a value from Table B.7\n",
      "b=0.00169 # van der Waal's constant b value from Table B.7\n",
      "P=(R*T/(v-b))-(a/v**2) # Pressure from van der Waal's equation\n",
      "print \" PART (b) The Pressure is \",int(P),\" KPa \\n\"\n",
      "# answer is approximated in textbook\n",
      "\n",
      "# PART (c)\n",
      "a=43.9 # van der Waal's constant a value from Table B.7\n",
      "b=0.00117 # van der Waal's constant b value from Table B.7\n",
      "\n",
      "P=(R*T/(v-b))-(a/(v*(v+b)*math.sqrt(T))) # Redlich-Kwong equation\n",
      "print \" PART (c) The Pressure is \",int(P),\" KPa \\n\"\n",
      "# answer is approximated in textbook\n",
      "\n",
      "# PART (d)\n",
      "Tcr=947.4 # compressibilty temperature from table B.3\n",
      "Pcr=22100 # compressibility pressure from table B.3\n",
      "\n",
      "TR=T/Tcr # reduced temperature\n",
      "PR=P/Pcr # reduced pressure\n",
      "Z=0.93 # from compressiblility chart\n",
      "P=Z*R*T/v # Pressure in KPa\n",
      "print \" PART (d) The Pressure is \",int(P),\" KPa \\n\"\n",
      "# answer is approximated in textbook\n",
      "\n",
      "# PART (e)\n",
      "P=8000 # pressure from steam table @ 500*c and v= 0.0417 m^3\n",
      "print \" PART (e) The Pressure is \",int(P),\" KPa \\n\"\n",
      "# answer is approximated in textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " PART (a) The Pressure is  8571  KPa \n",
        "\n",
        " PART (b) The Pressure is  7952  KPa \n",
        "\n",
        " PART (c) The Pressure is  7934  KPa \n",
        "\n",
        " PART (d) The Pressure is  7971  KPa \n",
        "\n",
        " PART (e) The Pressure is  8000  KPa \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 23
    }
   ],
   "metadata": {}
  }
 ]
}