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
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 3 : Zeroth Law of Thermodynamics and Temperature Scales"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.1 Page No : 72"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"When the temperature is 303 K then the thermometer reading in °F is : 86\n",
"The absolute value of the temperature in Rankine scale in °R is : 546\n"
]
}
],
"source": [
"\n",
"# Variables\t\t\t\n",
"t_c = 303-273;\t\t\t# in °C\n",
"\n",
"# Calculations and Results\n",
"t_f = 9./5* t_c+32;\t\t\t# in °F\n",
"print \"When the temperature is 303 K then the thermometer reading in °F is : %.0f\"%t_f\n",
"\n",
"T_R = 460 + t_f;\t\t\t# °R\n",
"print \"The absolute value of the temperature in Rankine scale in °R is : %.0f\"%T_R\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.2 Page No : 73"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Temperature in kelvin is : 274.29\n",
"Temperature in °R is : 460.81\n",
"Temperature in °C is : 1.14\n",
"Temperature in °F is : 1.14\n"
]
}
],
"source": [
"\n",
"\n",
"# Variables\n",
"# t_C= t_F or T_K-T_R= -186.52 (i)\n",
"# T_R/T_K = 1.68 (ii)\n",
"# From eq (i) and (ii)\n",
"T_K= -186.52/(1-1.68);\t\t\t# temp. in kelvin in K\n",
"\n",
"# Calculations\n",
"T_R= 1.68*T_K;\t\t\t # in temp. in rankine in °R\n",
"t_C= T_K-273.15;\t\t\t# in °C\n",
"t_F= T_R-459.67;\t\t\t# in °F\n",
"\n",
"# Results\n",
"print \"Temperature in kelvin is : %.2f\"%T_K\n",
"print \"Temperature in °R is : %.2f\"%T_R\n",
"print \"Temperature in °C is : %.2f\"%t_C\n",
"print \"Temperature in °F is : %.2f\"%t_F\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.9 Page No : 75"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The temperature at p=2.5 in °unit is : 73.014\n"
]
}
],
"source": [
"import math \n",
"\n",
"# Variables\n",
"p0 = 1.86;\n",
"p100 = 6.81;\n",
"T1=32;\n",
"T2= 212;\n",
"\n",
"# Calculations\n",
"# Relation of T in terms of p for ice point T1= a*math.log(p0)+b (i)\n",
"# Relation of T in terms of p for steam point T2= a*math.log(p100)+b (ii)\n",
"# From eq(i) and (ii)\n",
"a= (T2-T1)/math.log(p100/p0);\n",
"b= T1-a*math.log(p0);\n",
"# The temp at \n",
"p=2.5;\n",
"T= a*math.log(p)+b;\t\t\t# in °unit\n",
"\n",
"# Results\n",
"print \"The temperature at p=2.5 in °unit is : %.3f\"%T\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.10 Page No : 76"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"When P reads 20°C, then the readings of Q in °C are 18.76 C \n",
"The realistic value of Tq in °C is : 18.76\n"
]
}
],
"source": [
"\n",
"from numpy import roots\n",
"\n",
"# Variables\t\t\t\n",
"Tp0=0.;\t\t\t#in °C (at ice point)\n",
"Tq0=0.;\t\t\t#in °C (at ice point)\n",
" # Putting these values in relation, we get\n",
"a=0.;\n",
"Tp100=100.;\t\t\t#in °C ( at steam point)\n",
"Tq100=100.;\t\t\t#in °C ( at steam point)\n",
" # Tp100= b*Tq100+lamda*Tq100**2 (i)\n",
"Tp=45.;\t\t\t# in °C (in oil path)\n",
"Tq=43.;\t\t\t# in °C (in oil path)\n",
"\n",
"# Calculations\n",
"# Tp= b*Tq+lamda*Tq**2 (ii)\n",
"b= (Tp100-Tp*Tq100**2/Tq**2)/(Tq100-Tq100**2/Tq);\t\t\t# From eq (i) and (ii)\n",
"lamda= (Tp-b*Tq)/Tq**2;\n",
"Tp=20;\n",
"\n",
"#lamda*Tq**2+b*Tq-Tp=0\n",
"P= [lamda, b, -Tp];\n",
"Tq= roots(P);\t\t\t# in °C\n",
"\n",
"# Results\n",
"print \"When P reads 20°C, then the readings of Q in °C are %.2f C \"%(Tq[1])\n",
"print \"The realistic value of Tq in °C is : %.2f\"%Tq[1]\n"
]
}
],
"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
}
|