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
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 4: Aerodynamics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 4.1"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Work done during the isobaric process is: 12.0 KJ\n",
"Work done in isothermal process is: 7.33 KJ\n",
"Work done during the described process is: 6.41 KJ\n",
"Work done in the isovolumic process is: 0.0 KJ\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 4.1\n",
"'''Consider as a system the gas in the cylinder shown in Fig. 4.7; the cylinder is fitted with\n",
"a piston on which a number of small weights are placed. The initial pressure is 200 kPa,\n",
"and the initial volume of the gas is 0.04 m3.'''\n",
"from math import log\n",
"\n",
"#Variable Declaration: \n",
"P1 = 200 \t\t#Initial pressure inside cylinder in kPa\n",
"V2 = 0.1 \t\t#in m**3\n",
"V1 = 0.04 \t\t#Initial volume of gas in m**3\n",
"W4 = 0 \t\t#Work done in isovolumic process\n",
"\n",
"#Calculation:\n",
"W1 = P1*(V2-V1) \t#Work done in isobaric process in kJ\n",
"W2 = P1*V1*log(V2/V1) #Work done in isothermal process in kJ\n",
"P2 = P1*(V1/V2)**(1.3)\t#Final pressure according to the given process\n",
"W3 = (P2*V2-P1*V1)/(1-1.3)\n",
"\n",
"#Result:\n",
"print \"Work done during the isobaric process is: \",round(W1,2),\"KJ\"\n",
"print \"Work done in isothermal process is: \",round(W2,2),\"KJ\"\n",
"print \"Work done during the described process is: \",round(W3,2),\"KJ\"\n",
"print \"Work done in the isovolumic process is: \",round(W4,2),\"KJ\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 4.3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Work produced by ammonia is: 12.71 KJ\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 4.3\n",
"'''The cylinder/piston setup of Example 4.2 contains 0.5 kg of ammonia at −20◦C with\n",
"a quality of 25%. The ammonia is now heated to +20◦C, at which state the volume\n",
"is observed to be 1.41 times larger. Find the final pressure and the work the ammonia\n",
"produced.'''\n",
"\n",
"#Variable Declaration: \n",
"Psat = 190.2 \t\t#in kPa\n",
"vf = 0.001504 \t\t#in m**3/kg\n",
"vfg = 0.62184 \t\t#in m**3/kg\n",
"x1 = 0.25 \t\t #Quality\n",
"P2 = 600 \t\t #Pressure in state 2 in kPa\n",
"m = 0.5 \t\t #Mass of ammonia in kg\n",
"\n",
"#Calculation:\n",
"P1 = Psat \t\t #Saturation pressure in state 1\n",
"v1 = vf+x1*vfg \t\t#Specific volume at state 1 in m**3/kg\n",
"v2 = 1.41*v1 \t\t#Specific volume at state 2 in m**3/kg\n",
"W = m*(P1+P2)*(v2-v1)/2#Work produced by ammonia in kJ\n",
"\n",
"#Result:\n",
"print \"Work produced by ammonia is: \",round(W,2),\"KJ\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 4.4"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Work in the overall process is: -17.71 KJ\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 4.4\n",
"'''The piston/cylinder setup shown in Fig. 4.12 contains 0.1 kg of water at 1000 kPa, 500◦C.\n",
"The water is now cooled with a constant force on the piston until it reaches half the initial\n",
"volume. After this it cools to 25◦C while the piston is against the stops. Find the final water\n",
"pressure and the work in the overall process, and show the process in a P–v diagram.'''\n",
"\n",
"#Variable Declaration: \n",
"v1 = 0.35411 \t#Specific volume at state 1 in m**3/kg\n",
"m = 0.1 \t\t#Mass of water in kg\n",
"P1 = 1000 \t\t#Pressure inside cylinder in kPa\n",
"\n",
"#Calculation:\n",
"v2 = v1/2 \n",
"W = m*P1*(v2-v1) \t#in kJ\n",
"\n",
"#Result:\n",
"print \"Work in the overall process is: \",round(W,2),\"KJ\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 4.7"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rate of heat transfer in the glass and convective layer is: 1105.0 KW\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 4.7\n",
"'''Consider the constant transfer of energy from a warm room at 20◦C inside a house to the\n",
"colder ambient temperature of −10◦C through a single-pane window, as shown in Fig.\n",
"4.19. The temperature variation with distance from the outside glass surface is shown\n",
"by an outside convection heat transfer layer, but no such layer is inside the room (as a\n",
"simplification). The glass pane has a thickness of 5 mm (0.005 m) with a conductivity of\n",
"1.4W/mKand a total surface area of 0.5m2. The outside wind is blowing, so the convective\n",
"heat transfer coefficient is 100 W/m2 K.With an outer glass surface temperature of 12.1◦C,\n",
"we would like to know the rate of heat transfer in the glass and the convective layer'''\n",
"\n",
"#Variable Declaration: \n",
"k = 1.4 \t\t#Conductivity of glass pane in W/m-K\n",
"A = 0.5 \t\t#Total surface area of glass pane\n",
"dx = 0.005 \t\t#Thickness of glasspane in m\n",
"dT1 = 20-12.1 \t#Temperature difference between room air and outer glass surface temperature in celsius\n",
"h = 100 \t\t#Convective heat transfer coefficient in W/m**2-K \n",
"dT = 12.1-(-10) \t#Temperature difference between warm room and colder ambient in celsius\n",
"\n",
"#Calculation:\n",
"Q = -k*A*dT1/dx \t#Conduction through glass slab in W\n",
"Q2 = h*A*dT \t#Heat transfer in convective layer in W\n",
"\n",
"#Result:\n",
"print \"Rate of heat transfer in the glass and convective layer is: \",round(Q2,2),\"KW\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|