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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"\n",
"Chapter 2 : Basic Thermodynamics"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 2.1 Page: 27"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"''' Calculate internal energy of the steam\n",
"enthalpy of the steam,entropy of the steam and Piston expanding.\n",
"'''\n",
"import math \n",
"\n",
"m = 1. #[lbm] Mass of the steam\n",
"T_1 = 300. #[F] Initial temperature\n",
"P_1 = 14.7 #[psia] Initial pressure\n",
"P_sorronding = 14.7 #[psia]\n",
"Q = 50. #[Btu] Amount of the energy added to the system as heat\n",
"\n",
"\n",
"u_initial = 1109.6 #[Btu/lbm] Internal energy of the steam\n",
"h_initial = 1192.6 #[Btu/lbm] Enthalpy of the steam\n",
"s_initial = 1.8157 #[Btu/(lbm*R)] Entropy of the steam\n",
"\n",
"\n",
"h_final = h_initial + Q #[Btu/lbm]\n",
"\n",
"T_2 = 405.7 #[F] Final temperature\n",
"\n",
"u_final = 1147.7 #[Btu/lbm]\n",
"s_final = 1.8772 #[Btu/(lbm*R)]\n",
"\n",
"delta_u = u_final - u_initial #[Btu/lbm]\n",
"delta_s = s_final - s_initial #[Btu/(lbm*R)]\n",
"delta_h = Q #[Btu/lbm]\n",
"\n",
"w = delta_h - delta_u #[Btulbm]\n",
"\n",
"print \"The increase in internal energy of the steam by adding the heat is %0.2f Btu/lbm\"%(delta_u)\n",
"print \"The increase in enthalpy of the steam by adding the heat is %0.2f Btu/lbm\"%(delta_h)\n",
"print \"The increase in entropy of the steam by adding the heat is %0.4f Btu/lbm\"%(delta_s)\n",
"print \"Work done by the piston expanding against the atmosphere is %0.2f Btu/lbm\"%(w)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The increase in internal energy of the steam by adding the heat is 38.10 Btu/lbm\n",
"The increase in enthalpy of the steam by adding the heat is 50.00 Btu/lbm\n",
"The increase in entropy of the steam by adding the heat is 0.0615 Btu/lbm\n",
"Work done by the piston expanding against the atmosphere is 11.90 Btu/lbm\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 2.2 Page: 28\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"import math \n",
"\n",
"T_in = 600. #[F] Input steam temperature\n",
"P_in = 200. #[psia] Input steam pressure\n",
"P_exit = 50. #[psia]\n",
"\n",
"\n",
"h_in = 1322.1 #[Btu/lbm]\n",
"s_in = 1.6767 #[Btu/(lb*R)]\n",
"\n",
"\n",
"\n",
"T_in = 307.1 #[R]\n",
"\n",
"h_out = 1188.1 #[Btu/lb]\n",
"\n",
"W_per_pound = (h_in - h_out) #[Btu/lb]\n",
"\n",
"print \" The work output of the turbine of steam is %0.1f Btu/lb\"%(-W_per_pound)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" The work output of the turbine of steam is -134.0 Btu/lb\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 2.3 Page: 38"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"import math \n",
"\n",
"\n",
"T = 500. #[F]\n",
"P = 680. #[psi]\n",
"\n",
"T_c = 647.1*1.8 #[R]\n",
"P_c = 220.55*14.51 #[psia]\n",
"w = 0.345\n",
"T_r = (T+459.67)/T_c\n",
"P_r = P/P_c\n",
"z_0 = 1+P_r/T_r*(0.083-0.422/T_r**(1.6))\n",
"z_1 = P_r/T_r*(0.139-0.172/T_r**(4.2))\n",
"z = z_0+w*z_1\n",
"\n",
"print \"The compressibility factor of steam at the given state is %0.3f\"%(z)\n",
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The compressibility factor of steam at the given state is 0.851\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
|