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
|
{
"metadata": {
"name": "",
"signature": "sha256:8d95c094e950bc8cd1f4bbc97c09344d22cf81b1ba4d6101a144be7a5e1e83dc"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter13-thermodynamic relations"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example2-pg284"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate entropy wrt pressures and volume wrt temerature\n",
"##initialisation of variables\n",
"S1= 6.539 ##kJ/kg K\n",
"S2= 6.7664 ##kJ/kg K\n",
"v1= 0.10976 ##m^3\n",
"v2= 0.08700 ##m^3\n",
"P= 3. ##Mpa\n",
"P1= 2. ##Mpa\n",
"T= 350. ##K\n",
"T1= 250. ##K\n",
"S3= 3.1741 ##kJ/kg K\n",
"S4= 3.2071 ##kJ/kg K\n",
"P2= 30. ##Mpa\n",
"P3= 20. ##Mpa\n",
"v3= 0.0014217 ##m^3\n",
"v4= 0.0012860 ##m^3\n",
"T2= 320. ##K\n",
"T3= 280. ##K\n",
"##CALCULATIONS\n",
"r= (S1-S2)/(P*10*10*10-P1*10*10*10)\n",
"r1= (v1-v2)/(T-T1)\n",
"R= (S3-S4)/(P2*10*10*10-P3*10*10*10)\n",
"R1= (v3-v4)/(T2-T3)\n",
"##RESULTS\n",
"print'%s %.7f %s'% ('entropy wrt pressre=',r,'kJ/kg K kpa')\n",
"print'%s %.e %s'% ('entropy wrt pressre=',R,'kJ/kg K kpa')\n",
"print'%s %.7f %s'% ('volume wrt temperature=',r1,'m^3/kg K ')\n",
"print'%s %.2e %s'% ('volume wrt temperature=',R1,'m^3/kg K ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy wrt pressre= -0.0002274 kJ/kg K kpa\n",
"entropy wrt pressre= -3e-06 kJ/kg K kpa\n",
"volume wrt temperature= 0.0002276 m^3/kg K \n",
"volume wrt temperature= 3.39e-06 m^3/kg K \n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example3-pg286"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#saturation pressure\n",
"##initialisation of variables\n",
"hfg= 2406.7 ##kJ/kg\n",
"Psat40= 7.384 ##kPa\n",
"R= 8.314 ##J/mol K\n",
"T= 40. ##C\n",
"T1= 50. ##C\n",
"M= 18.##kg\n",
"##CALCULATIONS\n",
"Psat50= Psat40*math.e**((hfg*M/R)*((1/(273.15+T))-(1/(273.15+T1))))\n",
"##RESULTS\n",
"print'%s %.3f %s' %('Saturation pressure=',Psat50,'kPa')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Saturation pressure= 12.357 kPa\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example4-pg287"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calcualte lowest temprature\n",
"##initialisation of variables\n",
"W= 800. ##N\n",
"A= 0.4 ##cm^2\n",
"p= 0.611 ##Mpa\n",
"P1= 0.1 ##Mpa\n",
"T= 0.01 ##C\n",
"vs= 0.0010908 ##m^3/kg\n",
"hs= -333.40 ##kJ/kg\n",
"vf= 0.0010002 ##m^3/kg\n",
"hf= 0 ##kJ/kg\n",
"vg= 206.14 ##m^3/kg\n",
"hg= 2501.4 ##kJ/kg\n",
"##CALCULATIONS\n",
"P2= P1+(W/A)*math.pow(10,(4-6))\n",
"dT= (273.15++T)*(vf-vs)*(P2*10*10*10-p)/(0-hs)\n",
"Tmin= dT+T\n",
"##RESULTS\n",
"print'%s %.2f %s'% ('lowest temperature=',Tmin,'C')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"lowest temperature= -1.48 C\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example7-pg292"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate volume exapansion coefficent and isothermal compressibilitiy and isotherma modulus of elasticity\n",
"##initialisation of variables\n",
"vi= 0.0009992 ##m^3\n",
"T= 60. ##C\n",
"T1= 20. ##C\n",
"T2= 40. ##C\n",
"vi1= 0.0010042 ##m^3\n",
"vi2= 0.0009886 ##m^3\n",
"v= 0.000951 ##m^3\n",
"v1= 0.0009992 ##m^3\n",
"v2= 0.0009956 ##m^3\n",
"##CALCULATIONS\n",
"B= (vi1-vi2)/(vi*(T-T1))\n",
"Kt= (v1-v2)/(v*(T2-T1))\n",
"Et= 1/Kt\n",
"##RESULTS\n",
"print'%s %.2e %s'% ('volume exapansion coefficient=',B,'L/s')\n",
"print'%s %.3e %s'% ('isothermal compressibility=',Kt,'Mpa')\n",
"print'%s %.f %s'% ('isothermal modulus of elasticity=',Et,'Mpa')\n",
"\n",
"\n",
"##ANSWER FOR Et GIVEN IN THE TEXTBOOK IS WRONG\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"volume exapansion coefficient= 3.90e-04 L/s\n",
"isothermal compressibility= 1.893e-04 Mpa\n",
"isothermal modulus of elasticity= 5283 Mpa\n"
]
}
],
"prompt_number": 4
}
],
"metadata": {}
}
]
}
|