summaryrefslogtreecommitdiff
path: root/Fundamentals_Of_Thermodynamics/Chapter8_6.ipynb
blob: dce4d1fa75655377f221150fdca24f7bed019c32 (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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
{

 "metadata": {

  "name": "",

  "signature": "sha256:79711d3b5ce866eb594601c655e2c85bdace3e8f861ba88d25f2b6f7e8d8655f"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter8:ENTROPY"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.1:pg-290"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 1\n",

      "#coefficient of performance of refrigerator\n",

      "\n",

      "Th=60 #temperature at which heat is rejected from R-134a\n",

      "Tl=0 #temperature at which heat is absorbed into the R-134a \n",

      "s1=1.7262 #specific entropy at 0 Celsius\n",

      "s2=s1 #process of state change from 1-2 is isentropic \n",

      "s3=1.2857 #specific entropy at 60 celsius\n",

      "s4=s3 #process of state change from 3-4 is isentropic\n",

      "print\"if Pressure is 1400 kPa,then s=1.7360 kJ/kg-K and if P=1600 kPa,then s=1.7135 kJ/kg-K.Therefore\"\n",

      "P2=1400+(1600-1400)*(1.7262-1.736)/(1.7135-1.736) #pressure after compression in kPa\n",

      "B=(Th+273.15)/(Th-Tl) #coefficient of performance of refrigerator\n",

      "print\" \\n hence,pressure after compression is \",round(P2,1),\"kPa\"\n",

      "print\"\\n and coefficient of performance of refrigerator is\",round(B,2)"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "if Pressure is 1400 kPa,then s=1.7360 kJ/kg-K and if P=1600 kPa,then s=1.7135 kJ/kg-K.Therefore\n",

        " \n",

        " hence,pressure after compression is  1487.1 kPa\n",

        "\n",

        " and coefficient of performance of refrigerator is 5.55\n"

       ]

      }

     ],

     "prompt_number": 3

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.2:pg-290"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 2 \n",

      "#heat transfer in a given process\n",

      "\n",

      "u1=87.94 #specific internal energy of R-12 at state 1 in kJ/kg\n",

      "u2=276.44 #specific internal energy of R-12 at state 2 in kJ/kg\n",

      "s1=0.3357 #specific entropy at state 1 in kJ/kg-K\n",

      "s2=1.2108 #specific entropy at state 2 in kJ/kg-K\n",

      "V=0.001 #volume of saturated liquid in m^3\n",

      "v1=0.000923 #specific volume in m^3/kg\n",

      "m=V/v1 #mass of saturated liquid in kg\n",

      "T=20 #temperature of liquid in celsius\n",

      "Q12=m*(T+273.15)*(s2-s1) #heat transfer in kJ to accomplish the process\n",

      "W12=m*(u1-u2)+Q12 #work required to accomplish the process\n",

      "print\" \\n hence,work required to accomplish the process is\",round(W12,1),\"KJ\"\n",

      "print\" \\n and heat transfer is\",round(Q12,1),\"KJ\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " \n",

        " hence,work required to accomplish the process is 73.7 KJ\n",

        " \n",

        " and heat transfer is 277.9 KJ\n"

       ]

      }

     ],

     "prompt_number": 12

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.3:pg-293"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 3\n",

      "#entropy change\n",

      "import math\n",

      "C=4.184 # specific heat of water in kJ/kg-K\n",

      "T1=20 #initial temperature of water in celsius\n",

      "T2=90 #final temperature of water in celsius\n",

      "dS1=C*math.log((T2+273.2)/(T1+273.2)) #change in entropy in kJ/kg-K\n",

      "dS2=1.1925-0.2966 #in kJ/kg-K using steam tables\n",

      "print\"\\n hence,change in entropy assuming constant specific heat is\",round(dS1,4),\"KJ/kg-k\" \n",

      "print\"\\n using steam table is\",round(dS2,4),\"KJ/kg-k\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,change in entropy assuming constant specific heat is 0.8958 KJ/kg-k\n",

        "\n",

        " using steam table is 0.8959 KJ/kg-k\n"

       ]

      }

     ],

     "prompt_number": 17

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.4:pg-295"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 4\n",

      "#entropy change with different assumptions\n",

      "import math\n",

      "T1=300 #initial temperature in kelvins\n",

      "T2=1500 #final temperature in kelvins\n",

      "P1=200.0 #initial pressure in kPa\n",

      "P2=150.0 #final pressure in kPa\n",

      "R=0.2598 # in kJ/kg-K\n",

      "Cp=0.922 #specific heat in kJ/kg-K at constant pressure\n",

      "dsT2=8.0649 #in kJ/kg-K\n",

      "dsT1=6.4168 #in kJ/kg-K\n",

      "dS1=dsT2-dsT1-R*math.log(P2/P1) #entropy change calculated using ideal gas tables\n",

      "dS3=Cp*math.log(T2/T1)-R*math.log(P2/P1) #entropy change assuming constant specific heat in kJ/kg-K\n",

      "dS4=1.0767*math.log(T2/T1)+0.0747 #entropy change assuming specific heat is constant at its value at 990K\n",

      "print\"\\n hence,change in entropy using ideal gas tables is\",round(dS1,4),\"KJ/kg-k\"\n",

      "print\"\\n hence,change in entropy using the value of specific heat at 300K is\",round(dS3,4),\"KJ/kg-k\"\n",

      "print\"\\n hence,change in entropy assuming specific heat is constant at its value at 900K is \",round(dS4,4),\"KJ/kg-k\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,change in entropy using ideal gas tables is 1.7228 KJ/kg-k\n",

        "\n",

        " hence,change in entropy using the value of specific heat at 300K is 1.5586 KJ/kg-k\n",

        "\n",

        " hence,change in entropy assuming specific heat is constant at its value at 900K is  1.8076 KJ/kg-k\n"

       ]

      }

     ],

     "prompt_number": 19

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.5:pg-296\n"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 5\n",

      "#entropy change\n",

      "import math\n",

      "Cp=1.004 #specific heat at constant pressure in kJ/kg-K\n",

      "R=0.287 #gas constant in kJ/kg-K\n",

      "P1=400.0 #initial pressure in kPa\n",

      "P2=300.0 #final pressure in kPa\n",

      "T1=300 #initial temperature in K\n",

      "T2=600 #final temperature in K\n",

      "dS1=Cp*math.log(T2/T1)-R*math.log(P2/P1) #entropy change assuming constant specific heat\n",

      "s1=6.8693 #specific entropy at T1\n",

      "s2=7.5764 #specific entropy at T2\n",

      "dS2=s2-s1-R*math.log(P2/P1) #entropy change assuming variable specific heat\n",

      "print\"\\n hence,entropy change assuming constant specific heat is\",round(dS1,4),\"KJ/kg-k\" \n",

      "print\"\\n and assuming variable specific heat is\",round(dS2,4),\"KJ/kg-k\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,entropy change assuming constant specific heat is 0.7785 KJ/kg-k\n",

        "\n",

        " and assuming variable specific heat is 0.7897 KJ/kg-k\n"

       ]

      }

     ],

     "prompt_number": 1

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.6:pg-297"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 6\n",

      "#work done by air\n",

      "import math\n",

      "T1=600 #initial temperature of air in K\n",

      "P1=400.0 #intial pressure of air in kPa\n",

      "P2=150.0 #final pressure in kPa\n",

      "u1=435.10 #specific internal energy at temperature T1 in kJ/kg\n",

      "sT1=7.5764 #specific entropy at temperature T1 in kJ/kg-K\n",

      "R=0.287 #gas constant in kJ/kg-K\n",

      "ds=0\n",

      "sT2=ds+sT1+R*math.log(P2/P1) #specific entropy at temperature T2 in kJ/kg-K\n",

      "print\"we know the values of s and P for state 2.So,in order to fully determine the state,we will use steam table\"\n",

      "T2=457 #final temperature in K\n",

      "u2=328.14 #specific internal energy at temperature T2 in kJ/kg\n",

      "w=u1-u2 #work done by air in kJ/kg\n",

      "print\"\\n hence,work done by air is\",round(w,4),\"KJ/kg\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "we know the values of s and P for state 2.So,in order to fully determine the state,we will use steam table\n",

        "\n",

        " hence,work done by air is 106.96 KJ/kg\n"

       ]

      }

     ],

     "prompt_number": 2

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.7:pg-300"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 7\n",

      "#work and heat transfer\n",

      "\n",

      "P2=500  #final pressure in cylinder in kPa\n",

      "P1=100 #initial pressure in cylinder in kPa\n",

      "T1=20+273.2 #initial temperature inside cylinder in Kelvins\n",

      "n=1.3 \n",

      "T2=(T1)*(P2/P1)**((n-1)/n) #final temperature inside cylinder in K\n",

      "R=0.2968 #gas constant in kJ/kg-K\n",

      "w12=R*(T2-T1)/(1-n) #work in kJ/kg\n",

      "Cvo=0.745 #specific heat at constant volume in kJ/kg-K\n",

      "q12=Cvo*(T2-T1)+w12 #heat transfer in kJ/kg\n",

      "print\" \\n hence,work done is\",round(w12,2),\"KJ/kg\" \n",

      "print\"\\n and heat transfer are\",round(q12,1),\"KJ/kg\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " \n",

        " hence,work done is -130.47 KJ/kg\n",

        "\n",

        " and heat transfer are -32.2 KJ/kg\n"

       ]

      }

     ],

     "prompt_number": 5

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.8:pg-308"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 3\n",

      "#calculating increase in entropy\n",

      "\n",

      "m=1 #mass of saturated water vapour\n",

      "sfg=6.0480 #in kJ/K\n",

      "T=25 #temperature of surrounding air in celsius\n",

      "dScm=-m*sfg #change in entropy of control mass in kJ/K\n",

      "hfg=2257.0 #in kJ/kg\n",

      "Qtosurroundings=m*hfg #heat transferred to surroundings in kJ\n",

      "dSsurroundings=Qtosurroundings/(T+273.15) #in kJ/K\n",

      "dSnet=dScm+dSsurroundings #net increase in entropy in kJ/K\n",

      "print\" hence,net increase in entropy of water plus surroundings is \",round(dSnet,3),\"KJ/k\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " hence,net increase in entropy of water plus surroundings is  1.522 KJ/k\n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.9:pg-309"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 9\n",

      "#entropy generation\n",

      "\n",

      "Qout=1.0 #value of heat flux generated by 1kW of electric power\n",

      "T=600.0 #temperature of hot wire surface in K\n",

      "Sgen=Qout/T #entropy generation in kW/K\n",

      "print\"\\n hence,entropy generation is\",round(Sgen,5),\"KW/k\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,entropy generation is 0.00167 KW/k\n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.10:pg-310"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 10\n",

      "#Determiining the entropy generated\n",

      "\n",

      "B=4.0#COP of air conditioner\n",

      "W=10.0 #power input of air conditioner in kW\n",

      "Qh=B*W #in kW\n",

      "Ql=Qh-W #in kW\n",

      "Thigh=323 #in Kelvin\n",

      "Tlow=263 #in Kelvin\n",

      "SgenHP=(Qh*1000/Thigh)-(Ql*1000/Tlow) #in W/K\n",

      "Tl=281 # in K\n",

      "Th=294 #in K\n",

      "SgenCV1=Ql*1000/Tlow-Ql*1000/Tl #in W/K\n",

      "SgenCV2=Qh*1000/Th-Qh*1000/Thigh #in W/K\n",

      "SgenTOT=SgenCV1+SgenCV2+SgenHP #in W/K\n",

      "print\" \\n Hence,Total entropy generated is\",round(SgenTOT,1),\"W/k\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " \n",

        " Hence,Total entropy generated is 29.3 W/k\n"

       ]

      }

     ],

     "prompt_number": 16

    }

   ],

   "metadata": {}

  }

 ]

}