summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Thermodynamics_by_A._Venkatesh/ch8.ipynb
blob: c856536e4bb6d14b33549f127719734ca97b8158 (plain)
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
{
 "metadata": {
  "name": "",
  "signature": "sha256:6ced269b2d83adfe9e452136249f918e5748b410340744d57a784dbf4aa451de"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 : Entropy - Available and Unavailable Energy"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2 Page No : 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "Q = 10. \t\t\t#kJ \t\t\t#heat transfered from reservoir\n",
      "T = 100.+273 \t\t\t#K \t\t\t#isothermal expansion temperature\n",
      "T_res = 300.+273 \t\t\t#K \t\t\t#reservoir temperature\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "delta_S_sys = (Q/T) \t\t\t#kJ/K \t\t\t#delta S for the system\n",
      "print \"Change in entropyDelta S) for the system = %.2e kJ/K\"%(delta_S_sys);\n",
      "\n",
      "delta_S_res = -1*(Q/T_res) \t\t\t#kJ/K \t\t\t#delta S for the reservoir\n",
      "print \"Change in entropyDelta S) for the reservoir = %.4e kJ/K\"%(delta_S_res);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropyDelta S) for the system = 2.68e-02 kJ/K\n",
        "Change in entropyDelta S) for the reservoir = -1.7452e-02 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3 Page No : 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "Q = 10. \t\t\t#kJ \t\t\t#heat transfered from reservoir\n",
      "T = 100.+273 \t\t\t#K \t\t\t#isothermal expansion temperature\n",
      "T_res = 100.+273 \t\t\t#K \t\t\t#reservoir temperature\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "delta_S_sys = (Q/T) \t\t\t#kJ/K \t\t\t#delta S for the system\n",
      "print \"Change in entropyDelta S) for the system = %.2e kJ/K\"%(delta_S_sys)\n",
      "\n",
      "delta_S_res = -1*(Q/T_res) \t\t\t#kJ/K \t\t\t#delta S for the reservoir\n",
      "print \"Change in entropyDelta S) for the reservoir = %.2e kJ/K\"%(delta_S_res);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropyDelta S) for the system = 2.68e-02 kJ/K\n",
        "Change in entropyDelta S) for the reservoir = -2.68e-02 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4 Page No : 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "Q = 1.; \t\t\t#kJ \t\t\t#heat transfered from reservoir\n",
      "T = 100.+273; \t\t\t#K \t\t\t#isothermal expansion temperature\n",
      "T_res = 100.+273; \t\t\t#K \t\t\t#reservoir temperature\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "delta_S_res = -1*(Q/T_res); \t\t\t#kJ/K \t\t\t#delta S for the reservoir\n",
      "print \"Change in entropyDelta S) for the reservoir = %.2e kJ/K\"%(delta_S_res);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropyDelta S) for the reservoir = -2.68e-03 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.12 Page No : 225"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "pA = 120. \t\t\t#kPa \t\t\t#Pressure at location A\n",
      "TA = 50.+273 \t\t\t#K \t\t\t#Temperature at location A\n",
      "VA = 150. \t\t\t#m/s \t\t\t#Velocity at location A\n",
      "\n",
      "pB = 100. \t\t\t#kPa \t\t\t#Pressure at location B\n",
      "TB = 30.+273 \t\t\t#K \t\t\t#Temperature at location B\n",
      "VB = 250. \t\t\t#m/s \t\t\t#Velocity at location B\n",
      "\n",
      "Cp = 1.005 \t\t\t#kJ/kg\n",
      "R = 0.287 \t\t\t#kJ/kgK\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "delta_S_sys = (Cp*math.log(TB/TA))-(R*math.log(pB/pA)) \t\t\t#kJ/kgK \t\t\t#Entropy of system\n",
      "if delta_S_sys < 0 :\n",
      "    print \"Flow is from B to A.\";\n",
      "else:\n",
      "    print \"Flow is from A to B.\"    \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow is from B to A.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.13 Page No : 226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "mi = 5. \t\t\t#kg \t\t\t#mass of ice\n",
      "Ti = 273. - 10 \t\t\t#K \t\t\t#Temperature of ice\n",
      "ci = 2.1 \t\t\t#kJ/kgK \t\t\t#specific heat of ice\n",
      "L = 330. \t\t\t#kJ/kg \t\t\t#Latent heat\n",
      "mw = 20. \t\t\t#kg \t\t\t#mass of water\n",
      "Tw = 273.+80 \t\t\t#K \t\t\t#Temperatur of water\n",
      "cw = 4.2 \t\t\t#kJ/kgK \t\t\t#specific heat of water\n",
      "\n",
      "# calculatins and results\n",
      "\n",
      "#Part(a)\n",
      "print \"Part a\";\n",
      "Tmix = ((mi*ci*(Ti-273))-(L*mi)+(mw*cw*Tw)+(mi*cw*273))/(mw*cw+mi*cw)\n",
      "print \"Temperature of the mixture when equilibrium is established between ice and water = %.f K\"%(Tmix)\n",
      "#Part (b)\n",
      "print \"Part b\";\n",
      "delta_S_ice = mi*(ci*math.log(273/Ti)+L/273+cw*math.log(Tmix/273))\t\t\t#kJ/K \t\t\t#Entropy of ice\n",
      "print \"Entropy of ice = %.2f kJ/K\"%(delta_S_ice)\n",
      "#Part (c)\n",
      "print \"Part c\";\n",
      "delta_S_water = mw*(cw*math.log(Tmix/Tw))\t\t\t#kJ/K \t\t\t#Entropy of water\n",
      "print \"Entropy of water = %.2f kJ/K\"%(delta_S_water)\n",
      "#Part (d)\n",
      "print \"Part d\";\n",
      "delta_S_uni = delta_S_water+delta_S_ice\t\t\t#kJ/K \t\t\t#Entropy of universe\n",
      "print \"Entropy of universe = %.2f kJ/K\"%(delta_S_uni)\n",
      "\n",
      "# note : rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part a\n",
        "Temperature of the mixture when equilibrium is established between ice and water = 320 K\n",
        "Part b\n",
        "Entropy of ice = 9.79 kJ/K\n",
        "Part c\n",
        "Entropy of water = -8.17 kJ/K\n",
        "Part d\n",
        "Entropy of universe = 1.62 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.14 Page No : 230"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "Q1 = 100. \t\t\t#kJ \t\t\t#Heat input\n",
      "T0 = 300. \t\t\t#K \t\t\t#Surrounding temperature\n",
      "\n",
      "\t\t\t#Part(a)\n",
      "print \"Part a\";\n",
      "T1 = 1000. \t\t\t#K \t\t\t#reservoir temperature\n",
      "print \"Avalable enery of 100 kJ of heat from a reservoir at 1000K = %.f kJ\"%(Q1*1-T0/T1)\n",
      "print \"Unvalable enery of 100 kJ of heat from a reservoir at 1000K = %.1f kJ\"%(Q1*(1-(T0/T1)))\n",
      "\t\t\t#Part(b)\n",
      "print \"Part b\";\n",
      "T1 = 600 \t\t\t#K \t\t\t#reservoir temperature\n",
      "print \"Avalable enery of 100 kJ of heat from a reservoir at 1000K = %.f kJ\"%(Q1*1-T0/T1)\n",
      "print \"Unvalable enery of 100 kJ of heat from a reservoir at 1000K = %.1f kJ\"%(Q1*(1-(T0/T1)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part a\n",
        "Avalable enery of 100 kJ of heat from a reservoir at 1000K = 100 kJ\n",
        "Unvalable enery of 100 kJ of heat from a reservoir at 1000K = 70.0 kJ\n",
        "Part b\n",
        "Avalable enery of 100 kJ of heat from a reservoir at 1000K = 100 kJ\n",
        "Unvalable enery of 100 kJ of heat from a reservoir at 1000K = 50.0 kJ\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.15 Page No : 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "T0 = 300. \t\t\t#K \t\t\t#Surrounding temperature\n",
      "T1 = 1000. \t\t\t#K \t\t\t#Temperature of final reservoir\n",
      "T2 = 600. \t\t\t#K \t\t\t#Temperature of intermediate reservoir\n",
      "Q1 = 100. \t\t\t#kJ \t\t\t#Heat input\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "print \"Increase in unavaliable energy due to irreversible heat transfer = %.1f kJ\"%(Q1*(1-T0/T1)-Q1*(1-T0/T2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Increase in unavaliable energy due to irreversible heat transfer = 20.0 kJ\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.16 Page No : 234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "T1 = 500. \t\t\t#K\n",
      "T0 = 300. \t\t\t#K\n",
      "T2 = 350. \t\t\t#K\n",
      "W = 250. \t\t\t#kJ\n",
      "Q1 = 1000. \t\t\t#kJ\n",
      "\n",
      "# Results\n",
      "print \"Available energy = %.1f kJ\"%(((1-T0/T1))*Q1);\n",
      "print \"Unavailable energy = %.1f kJ\"%(Q1 - (((1-T0/T1))*Q1));\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Available energy = 400.0 kJ\n",
        "Unavailable energy = 600.0 kJ\n"
       ]
      }
     ],
     "prompt_number": 20
    }
   ],
   "metadata": {}
  }
 ]
}