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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 7 - The second law"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2 - Pg 134"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the entropy in each part and efficiency of the cycle\n",
"import math\n",
"#Initialization of variables\n",
"cv=0.175 #Btu/lbm R\n",
"R0=1.986\n",
"M=29.\n",
"T2=1040. #R\n",
"T1=520. #R\n",
"#calculations\n",
"cp=cv+R0/M\n",
"sab=cv*math.log(T2/T1)\n",
"sac=cp*math.log(T2/T1)\n",
"dqab=cv*(T2-T1)\n",
"dqca=cp*(T1-T2)\n",
"dqrev=T2*(sac-sab)\n",
"eta=(dqab+dqrev+dqca)/(dqab+dqrev)*100\n",
"#results\n",
"print '%s %.4f %s' %(\"Entropy in ab part =\",sab,\" Btu/lbm R\")\n",
"print '%s %.4f %s' %(\"\\n Entropy in ac part =\",sac,\"Btu/lbm R\")\n",
"print '%s %.2f %s' %(\"\\n Efficiency =\",eta,\" percent\")\n",
"print '%s' %(\"The answers are a bit different due to rounding off error in textbook\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entropy in ab part = 0.1213 Btu/lbm R\n",
"\n",
" Entropy in ac part = 0.1688 Btu/lbm R\n",
"\n",
" Efficiency = 9.80 percent\n",
"The answers are a bit different due to rounding off error in textbook\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3 - Pg 137"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the change in entropy of the process\n",
"#Initialization of variables\n",
"import math\n",
"tc=32. #F\n",
"th=80. #F\n",
"mw=5 #lbm\n",
"mi=1 #lbm\n",
"P=14.7 #psia\n",
"cp=1\n",
"#calculations\n",
"t= (-144*mi+tc*mi+th*mw)/(mw+mi)\n",
"ds1=144/(tc+460)\n",
"ds2=cp*math.log((460+t)/(460+tc))\n",
"dsice=ds1+ds2\n",
"dswater=mw*cp*math.log((t+460)/(460+th))\n",
"ds=dsice+dswater\n",
"#results\n",
"print '%s %.4f %s' %(\"Change in entropy of the process =\",ds,\"Btu/R\")\n",
"print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Change in entropy of the process = 0.0192 Btu/R\n",
"The answer is a bit different due to rounding off error in textbook\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4 - Pg 140"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Calculate the thermal efficiency of the process\n",
"#Initialization of variables\n",
"import math\n",
"cp=0.25 #Btu/lbm R\n",
"T2=520. #R\n",
"T1=3460. #R\n",
"#calculations\n",
"dq=cp*(T2-T1)\n",
"ds=cp*math.log(T2/T1)\n",
"dG=dq-T2*ds\n",
"eff=dG/dq*100\n",
"#results\n",
"print '%s %.1f %s' %(\"Thermal efficiency =\",eff,\"percent\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Thermal efficiency = 66.5 percent\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5 - Pg 142"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the change in available energy and also the decrease in energy of isolated system\n",
"#Initialization of variables\n",
"import math\n",
"cp=1\n",
"T2=60. #F\n",
"T1=100. #F\n",
"ta=32. #F\n",
"#calculations\n",
"dq=cp*(T2-T1)\n",
"ds=cp*math.log((460+T2)/(460+T1))\n",
"dE=dq-ds*(ta+460)\n",
"dec=dq-dE\n",
"#results\n",
"print '%s %.1f %s' %(\"Change in available energy =\",dE,\" Btu/lbm\")\n",
"print '%s %.1f %s' %(\"\\n The available energy of the isolated system decreased in the amount of\",dec, \"Btu/lbm\")\n",
"print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Change in available energy = -3.5 Btu/lbm\n",
"\n",
" The available energy of the isolated system decreased in the amount of -36.5 Btu/lbm\n",
"The answer is a bit different due to rounding off error in textbook\n"
]
}
],
"prompt_number": 4
}
],
"metadata": {}
}
]
}
|