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
|
{
"metadata": {
"name": "",
"signature": "sha256:63761cd2f20f542c8cf7d5599bfa09993cda87c6763136710915fa76185904f1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 21 : Energy Terminology Concepts and Units"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 21.1 Page no : 616"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\n",
"from scipy.integrate import quad\n",
"\n",
"# Variables\n",
"V1 = 0.1 ;\t\t\t# Volume of gas initially -[cubic metres]\n",
"V2 = 0.2 ;\t\t\t# Volume of gas finally -[cubic metres]\n",
"T1 = 300 ;\t\t\t# Temperature of gas initially -[K]\n",
"P1 = 200 ;\t\t\t# Pressure of gas finally -[kPa]\n",
"R = 8.314 ;\t\t\t# Universal gas constant \n",
"n = (P1*V1)/(T1*R) ;\t\t\t# Moles of gas taken-[kg mol]\n",
"#You are asked to calculate work by eqn. 21.1 , but you do not know the F(force) exerted by gas , so write F = P.A, multiply divide A and eqn 21.1 reduces to W= integate(P.dv)\n",
"\n",
"# Calculations and Results\n",
"# Isobaric process see fig E21.1b to see the path followed\n",
"def f(V):\n",
" return -(P1)\n",
"W= quad(f,V1,V2)[0] ;\t\t\t# Work done by gas on piston -[kJ]\n",
"print ' (a)Work done by gas on piston for isobaric process is %.0f kJ . ',W\n",
"\n",
"def f1(V):\n",
" return -(T1*R*n/V)\n",
"W= quad(f1,V1,V2)[0] ;\t\t\t# Work done by gas on piston -[kJ]\n",
"print '(b)Work done by gas on piston for isothermal process is %.2f kJ . ',W\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" (a)Work done by gas on piston for isobaric process is %.0f kJ . -20.0\n",
"(b)Work done by gas on piston for isothermal process is %.2f kJ . -13.8629436112\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 21.2 page no. 624\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\n",
"# Variables\n",
"id_ = 3. ;\t\t\t# Internal diameter of tube-[cm]\n",
"Vf = 0.001 ;\t\t\t# Volume flow rate of water in tube-[cubic meter/s]\n",
"rho = 1000. ;\t\t\t# Assumed density of water-[kg/cubic meter] \n",
"\n",
"# Calculations\n",
"rad = id_/2. ;\t\t\t# Radius of tube -[ cm]\n",
"a = 3.14*rad**2 ;\t\t\t# Area of flow of tube -[squqre centimeter]\n",
"v = Vf*(100)**2/a ;\t\t\t# Velocity of water in tube - [m/s]\n",
"KE = v**2/2. ;\t\t\t# Specific(mass=1kg) kinetic energy of water in tube -[J/kg]\n",
"\n",
"# Results\n",
"print 'Specific kinetic energy of water in tube is %.2f J/kg . '%KE\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Specific kinetic energy of water in tube is 1.00 J/kg . \n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
" Example 21.3 page no. 626\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\n",
"# Variables\n",
"# Let water level in first reservoir be the reference plane\n",
"h = 40. ;\t\t\t# Difference of water-[ft]\n",
"g = 32.2 ;\t\t\t# acceleration due to gravity-[ft/square second]\n",
"\n",
"# Calculations\n",
"PE=g*h/(32.2*778.2) ;\t\t\t#\t\t\t# Specific(mass=1kg) potential energy of water -[Btu/lbm]\n",
"\n",
"# Results\n",
"print 'Specific potential energy of water is %.4f Btu/lbm . '%PE\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Specific potential energy of water is 0.0514 Btu/lbm . \n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 21.4 page no : 629"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"\n",
"\n",
"# Variables\n",
"#Constant volume process \n",
"mol_air = 10. ;\t\t\t# Moles of air-[kg mol]\n",
"T1 = 60.+273 ;\t\t\t# Initial temperature of air-[K]\n",
"T2 = 30.+273 ;\t\t\t# final temperature of air-[K]\n",
"# Additional data needed\n",
"Cv = 2.1*10.**4 ; \t\t\t# Specific heat capacity of air at constant volume-[J/(kg mol*C)]\n",
"\n",
"# Calculations\n",
"def f(T):\n",
" return mol_air*Cv\n",
"del_U = quad(f,T1,T2)[0] ;\t\t\t#Change in internal energy-[J]\n",
"\n",
"# Results\n",
"print 'Change in internal energy is %.1e J . '%del_U\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Change in internal energy is -6.3e+06 J . \n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 21.7 page no : 633"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"# Variables\n",
"#Constant pressure process \n",
"mol_air = 10. ;\t\t\t# Moles of air-[kg mol]\n",
"T1 = 60+273 ;\t\t\t# Initial temperature of air-[K]\n",
"T2 = 30+273 ;\t\t\t# final temperature of air-[K]\n",
"\n",
"# Calculations\n",
"# Additional data needed\n",
"Cp = 2.9*10**4 ;\t\t\t# Specific heat capacity of air at constant pressure-[J/(kg mol*C)]\n",
"# Use eqn. 21.11 for del_H\n",
"def f(T):\n",
" return mol_air*Cp\n",
"\n",
"del_H = quad(f,T1,T2)[0] ;\t\t\t#Change in enthalpy-[J]\n",
"print 'Change in enthalpy is %.1e J . '%del_H\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Change in enthalpy is -8.7e+06 J . \n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
|