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
|
{
"metadata": {
"name": "",
"signature": "sha256:15d0388b2c544d629a9ec990a9a36b6e26ea291bc7812312e5319e0c4bde1ab8"
},
"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 112"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the entropy in parts ab,ac and efficiency\n",
"#Initialization of variables\n",
"import math\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 115"
]
},
{
"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 119"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the change in available energy\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",
"#results\n",
"print '%s %.1f %s' %(\"Change in available energy =\",dE,\"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",
"The answer is a bit different due to rounding off error in textbook\n"
]
}
],
"prompt_number": 3
}
],
"metadata": {}
}
]
}
|