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
|
{
"metadata": {
"name": "",
"signature": "sha256:f533717d02de2958b8edaf7535383653f756ad9b4060abf4f556950fcb3e683e"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 3: Importance of State Functions: Internal Energy and Enthalpy"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 3.2, Page Number 45"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"#Variable Declaration\n",
"betaOH = 11.2e-4 #Thermal exapnasion coefficient of ethanol, \u00b0C\n",
"betagl = 2.00e-5 #Thermal exapnasion coefficient of glass, \u00b0C\n",
"kOH = 11.0e-5 #Isothermal compressibility of ethanol, /bar\n",
"dT = 10.0 #Increase in Temperature, \u00b0C\n",
"\n",
"#Calcualtions\n",
"vfbyvi = (1+ betagl*dT)\n",
"dP = betaOH*dT/kOH-(1./kOH)*log(vfbyvi)\n",
"\n",
"#Results\n",
"print 'Pressure increase in capillary %4.1f bar'%dP"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Pressure increase in capillary 100.0 bar\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 3.4, Page Number 49"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Declaration\n",
"cpsubysy = 1000 #Specific heat ration of surrounding and system\n",
"Tpreci = 0.006 #Precision in Temperature measurement, \u00b0C\n",
"\n",
"#Calcualtions\n",
"dtgas = -cpsubysy*(-Tpreci)\n",
"\n",
"#Results\n",
"print 'Minimum detectable temperature change of gas +-%4.1f \u00b0C'%dtgas"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Minimum detectable temperature change of gas +- 6.0 \u00b0C\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 3.6, Page Number 50"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sympy import symbols, integrate\n",
"\n",
"#Variable Declaration\n",
"n = 1.0 #number of mole of N2, mol \n",
"Ti = 200.0 #Intial Temperature, K\n",
"Pi = 5.00 #Initial pressure, bar\n",
"Tf = 400.0 #Intial Temperature, K\n",
"Pf = 20.0 #Initial pressure, bar\n",
"a = 0.137 #van der Waals constant a, Pa.m3/(mol2)\n",
"b = 3.87e-5 #van der Waals constant b, m3/(mol)\n",
"A, B, C, D = 22.5, -1.187e-2,2.3968e-5, -1.0176e-8\n",
" #Constants in Cvm equation J, K and mol\n",
"vi = 3.28e-3 #initial volume, m3/mol\n",
"vf = 7.88e-3 #Final volume, m3/mol\n",
"\n",
"#Calculations\n",
"T = symbols('T')\n",
"dUT = n**2*a*(1./vi-1./vf)\n",
"dUV = integrate( A + B*T + C*T**2 + D*T**3, (T,Ti,Tf))\n",
"\n",
"#Results\n",
"print 'dUT = %4.1f J: This is wrongly reported in book'%dUT\n",
"print 'dUV = %4.1f J'%dUV"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"dUT = 24.4 J: This is wrongly reported in book\n",
"dUV = 4174.1 J\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 3.7, Page Number 53"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sympy import symbols, integrate\n",
"\n",
"#Variable Declaration\n",
"m = 143.0 #Mass of graphite, g \n",
"Ti = 300.0 #Intial Temperature, K\n",
"Tf = 600.0 #Intial Temperature, K\n",
"A, B, C, D, E = -12.19,0.1126,-1.947e-4,1.919e-7,-7.8e-11\n",
" #Constants in Cvm equation J, K and mol\n",
"M = 12.01\n",
"\n",
"#Calculations\n",
"\n",
"T = symbols('T')\n",
"dH = (m/M)*integrate( A + B*T + C*T**2 + D*T**3 + E*T**4, (T,Ti,Tf))\n",
"expr = A + B*T + C*T**2 + D*T**3 + E*T**4\n",
"cpm = expr.subs(T,300.)\n",
"qp = (m/M)*cpm*(Tf-Ti)\n",
"err = abs(dH-qp)/dH\n",
"#Results\n",
"print 'dH = %6.1f kJ'%(dH/1000)\n",
"print 'qp = %6.1f kJ'%(qp/1000)\n",
"print 'Error in calculations %4.1f'%(err*100)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"dH = 46.8 kJ\n",
"qp = 30.8 kJ\n",
"Error in calculations 34.3\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 3.9, Page Number 56"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Declaration\n",
"m = 124.0 #Mass of liquid methanol, g\n",
"Pi = 1.0 #Initial Pressure, bar\n",
"Ti = 298.0 #Intial Temperature, K\n",
"Pf = 2.5 #Final Pressure, bar\n",
"Tf = 425.0 #Intial Temperature, K\n",
"rho = 0.791 #Density, g/cc\n",
"Cpm = 81.1 #Specifi heat, J/(K.mol)\n",
"M = 32.04\n",
"\n",
"#Calculations\n",
"n = m/M\n",
"DH = n*Cpm*(Tf-Ti)+ m*(Pf-Pi)*1e-6/rho\n",
"\n",
"#Results\n",
"print 'Enthalpy change for change in state of methanol is %4.1f kJ'%(DH/1000)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Enthalpy change for change in state of methanol is 39.9 kJ\n"
]
}
],
"prompt_number": 8
}
],
"metadata": {}
}
]
}
|