summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_C_P_Arora/Chapter4.ipynb
blob: a94e74df0e8ba58f0e98d92d6b33fa524b87cee4 (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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
{
 "metadata": {
  "name": "",
  "signature": "sha256:a96d6bb31c1b3d7ae1ce5516661e1ba259f94d24cfffad925aea849eb83692cf"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:WORK AND HEAT"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1, Page No:114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "p1=5; # Pressure of Helium gas at initial state in bar\n",
      "T1=222; # Temperature of Helium gas at initial state in K\n",
      "V1=0.055; # Volume of Helium gas at initial state in m^3\n",
      "n=1.5; # Index of expansion process\n",
      "R=2.078;# Characteristic gas constant of Helium gas in kJ/kg K\n",
      "p2=2; # Pressure of Helium gas at final state (after expansion) in bar\n",
      "\n",
      "#Calculation for Method I\n",
      "V2=V1*(p1/p2)**(1/n);# From Polytropic process relation for final volume\n",
      "W=((p2*10**2*V2)-(p1*10**2*V1))/(n-1); # Work done from Polytropic process relation\n",
      "\n",
      "#Result for Method I\n",
      "print \"Method I\"\n",
      "print \"\\nWork done =\",round(W,2),\"kJ\"\n",
      "\n",
      "#Calculation for Method II\n",
      "m=(p1*10**2*V1)/(R*T1); # ideal gas equation\n",
      "T2=T1*(p2/p1)**((n-1)/n); # From Polytropic process relation of final temperature\n",
      "W=(m*R*(T1-T2))/(1-n); # Work done from Polytropic process relation\n",
      "\n",
      "#Result for Method II\n",
      "print \"\\n\\nMethod II\"\n",
      "print \"\\nWork done =\",round(W,2),\"kJ\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Method I\n",
        "\n",
        "Work done = -14.48 kJ\n",
        "\n",
        "\n",
        "Method II\n",
        "\n",
        "Work done = -14.48 kJ\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page No:115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "p1=1.3; # Initial pressure of gas in bar\n",
      "V1=0.03; # Initial volume of gas in m^3\n",
      "V2=0.1; # Final volume of gas in m^3\n",
      "\n",
      "#Calculation for (a)\n",
      "W=p1*10**2*(V2-V1); # work done by gas\n",
      "\n",
      "#Result for (a)\n",
      "print \"(a).Constant pressure process\"\n",
      "print \"\\nwork done by gas =\",W,\"kJ\"\n",
      "\n",
      "#Calculation for (b)\n",
      "W=p1*10**2*V1*math.log(V2/V1);# Work done by gas\n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n\\n(b).Constant Temperature process\"\n",
      "print \"\\nwork done by gas =\",W,\"kJ\"\n",
      "\n",
      "#Calculation for (c)\n",
      "n=1.3; #index of polytropic process \n",
      "p2=p1*(V1/V2)**n; # From Polytropic process relation for final pressure\n",
      "W=((p2*10**2*V2)-(p1*10**2*V1))/(1-n); # Work done by gas\n",
      "\n",
      "#Result for (c)\n",
      "print \"\\n\\n(c).polytropic process of index 1.3\"\n",
      "print \"\\nwork done by gas =\",round(W,3),\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).Constant pressure process\n",
        "\n",
        "work done by gas = 9.1 kJ\n",
        "\n",
        "\n",
        "(b).Constant Temperature process\n",
        "\n",
        "work done by gas = 4.69549393687 kJ\n",
        "\n",
        "\n",
        "(c).polytropic process of index 1.3\n",
        "\n",
        "work done by gas = 3.941 kJ\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page No:120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "patm=1; # Atmospheric pressure in bar\n",
      "V1=0.0135; # Volume of Freon 12 at initial state in m^3\n",
      "D=9; # Diameter of the cylinder in cm\n",
      "m=90; # Mass of the piston in kg\n",
      "g=9.80665; # acceleration due to gravity in m/s^2\n",
      "\n",
      "#Calculation for (a)\n",
      "# (a). Determination of the final pressure and volume of the system\n",
      "A=3.14/4 * (D*10**-2)**2; # Area of the cylinder\n",
      "p1=0.7449; # Initial pressure of saturated vapour at 30 degree celcius in MPa\n",
      "v1=0.023508; # Initial specific volume of saturated vapour at 30 degree celcius in m^3/kg\n",
      "p2=(patm*10**5)+(m*g)/A; # Final pressure of Freon 12\n",
      "v2=0.084022; # Final specific volume from superheated table at p2 and 30 degree celcius in m^3/kg\n",
      "mf=V1/v1; # Mass of Freon 12\n",
      "V2=mf*v2; # Final volume of Freon 12\n",
      "\n",
      "#Result for (a)\n",
      "print \"(a)\",\"\\nFinal pressure = \",p2,\"Pa\",\"\\nFinal volume = \",round(V2,5),\"m^3   (round off error)\"\n",
      "\n",
      "#Calculation for (b)\n",
      "# (b). Calculation of workdone by Freon 12 during this process\n",
      "Wirrev=p2*(V2-V1);  # P dv Work done \n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n\\n(b)\",\"\\nWork done = \",round(Wirrev/1000,3),\"kJ   (round off error)\"\n",
      "\n",
      "#Calculation for (c)\n",
      "# (c). Calculation of workdone by Freon 12 during reversible process\n",
      "Wrev=p1*10**6*V1*math.log (V2/V1);#From reversible process relation for work done\n",
      "\n",
      "#Result for (c)\n",
      "print \"\\n\\n(c)\",\"\\nWork done in reveersible process = \",round(Wrev/1000,2),\"kJ   (round off error)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) \n",
        "Final pressure =  238806.086341 Pa \n",
        "Final volume =  0.04825 m^3   (round off error)\n",
        "\n",
        "\n",
        "(b) \n",
        "Work done =  8.299 kJ   (round off error)\n",
        "\n",
        "\n",
        "(c) \n",
        "Work done in reveersible process =  12.81 kJ   (round off error)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5, Page No:129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "p1=0.1; # Initial pressure (before compression) of air in MPa\n",
      "T1=30; # Initial temperature (before compression) of air in degree celcius\n",
      "p2=0.9; # Final pressure (after compression) of air in MPa\n",
      "R=0.287; # Characteristic constant of air in kJ/kg k\n",
      "\n",
      "# (i) Actual work in the flow process\n",
      "\n",
      "#Calculation for (a)\n",
      "# (a).Isothermal Process\n",
      "w=-R*(T1+273)*math.log (p2/p1); # work done for isothermal process\n",
      "\n",
      "#Result for (a)\n",
      "print \"(i) Actual work in the flow process\",\"\\n(a).Isothermal Process\",\"\\nwork done = \",round(w,1),\"kJ/kg\"\n",
      "\n",
      "#Calculation for (b)\n",
      "# (b).Polytropic process\n",
      "n=1.4; # Index of polytropic process\n",
      "T2=(T1+273)*(p2/p1)**((n-1)/n); # From Polytropic process relation for final temperature\n",
      "w=(n/(1-n))*R*(T2-(T1+273)); # work done for polytropic process\n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n\\n(b).Polytropic process\",\"\\ncompression work = \",round(w,1),\"kJ/kg\"\n",
      "\n",
      "# (ii).Nonflow work\n",
      "\n",
      "#Calculation for (a)\n",
      "# (a).Isothermal Process\n",
      "w=-R*(T1+273)*math.log (p2/p1); # work done for isothermal process\n",
      "\n",
      "#Result for (a)\n",
      "print \"\\n\\n\\n(ii).Nonflow work\",\"\\n(a).Isothermal Process\",\"\\nwork done = \",round(w,1),\"kJ/kg\"\n",
      "\n",
      "#Calculation for (b)\n",
      "# (b).Polytropic process\n",
      "w=(1/(1-n))*R*(T2-(T1+273));# work done for polytropic process\n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n\\n(b).Polytropic process\",\"\\ncompression work = \",round(w,1),\"kJ/kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Actual work in the flow process \n",
        "(a).Isothermal Process \n",
        "work done =  -191.1 kJ/kg\n",
        "\n",
        "\n",
        "(b).Polytropic process \n",
        "compression work =  -265.8 kJ/kg\n",
        "\n",
        "\n",
        "\n",
        "(ii).Nonflow work \n",
        "(a).Isothermal Process \n",
        "work done =  -191.1 kJ/kg\n",
        "\n",
        "\n",
        "(b).Polytropic process \n",
        "compression work =  -189.9 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6, Page No:135"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "p1=1; # Initial pressure (before compression) of air in bar\n",
      "p2=8; # Final pressure (after compression) of air in bar\n",
      "Vp=15; # Displacement volume of reciprocating air compressor in litres\n",
      "Vc=0.05*Vp; # Clearance volume of reciprocating air compressor in litres\n",
      "N=600; # Speed of compressor in rpm\n",
      "V1=Vc+Vp; # Total volume of reciprocating air compressor in litres\n",
      "p3=p2; # constant pressure process\n",
      "p4=p1; # constant pressure process\n",
      "V3=Vc;# Clearance volume of reciprocating air compressor in litres\n",
      "n=1.3; # Index of reversible adiabatic compression process\n",
      "m=1.4; # Index of reversible adiabatic expansion process\n",
      "V4=V3*(p3/p4)**(1/m);\n",
      "\n",
      "#Calculation for (a)\n",
      "# (a).Work per machine cycle\n",
      "Wcycle = ((n/(n-1))*p1*10**2*V1*10**-3*(1-(p2/p1)**((n-1)/n)))-((m/(m-1))*p4*10**2*V4*10**-3*(1-(p3/p4)**((m-1)/m)));\n",
      "# Work per machine cycle\n",
      "Wpower=abs (Wcycle)*(N/60); # Power consumption of the compressor\n",
      "\n",
      "#Result for (a)\n",
      "print \"(a)\",\"\\nWork per machine cycle = \",round(Wcycle,3),\"kJ   (Error in textbook)\"\n",
      "print \"\\nPower consumption of the compressor\",round(Wpower,2),\"kW\"\n",
      "\n",
      "#Calculation for (b)\n",
      "# (b).Work of the cycle if m=n\n",
      "m=n;\n",
      "W_cycle=(n/(n-1))*p1*10**2*(V1-V4)*10**-3*(1-(p2/p1)**((n-1)/n)); # Work per machine cycle\n",
      "er=((W_cycle-Wcycle)/Wcycle) * 100 # Error involved in calculating work if m=n\n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n\\n(b)\",\"\\nWork per machine cycle\",round(W_cycle,3),\"kJ  (round off error)\"\n",
      "print \"\\nError = \",round(er,3),\"%   (Error in textbook)\"\n",
      "\n",
      "#Calculation for (c)\n",
      "# (c).Clearance volumetric efficiency\n",
      "C=Vc/Vp;\n",
      "eff = 1+C+-C*(p2/p1)**(1/n); # Clearance volumetric efficiency\n",
      "\n",
      "#Result for (c)\n",
      "print \"\\n\\n(c).\",\"\\nClearance volumetric efficiency = \",round(eff*100,0),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) \n",
        "Work per machine cycle =  -3.263 kJ   (Error in textbook)\n",
        "\n",
        "Power consumption of the compressor 32.63 kW\n",
        "\n",
        "\n",
        "(b) \n",
        "Work per machine cycle -3.319 kJ  (round off error)\n",
        "\n",
        "Error =  1.739 %   (Error in textbook)\n",
        "\n",
        "\n",
        "(c). \n",
        "Clearance volumetric efficiency =  80.0 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7, Page No:137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "D=150; # Cylinder Diameter in mm\n",
      "L=200; # Piston stroke in mm\n",
      "C=0.05; # Clearance factor\n",
      "p1=15; # Steam inlet conditions (saturated) in bar\n",
      "p4=1; # Exhaust or back pressure in bar\n",
      "p2=p1; # Constant pressure process\n",
      "p5=p4; # Constant pressure process\n",
      "\n",
      "#Calculation\n",
      "Vp=(3.14*(D*10**-3)**2*L*10**-3)/4; # Swept volme of cylinder\n",
      "Vc=C*Vp; # Clearance volume of cylinder\n",
      "V3=Vc+Vp; # Total volume of cylinder\n",
      "V1=Vc; # Clearance volume\n",
      "V6=V1; # constant volume process\n",
      "V4=V3; # constant volume process\n",
      "V5=Vc+0.3*Vp; # Compression begins at 30% of stroke\n",
      "V2=Vc+0.4*Vp; # Cut-off occurs at 40% of stroke\n",
      "p6=p5*(V5/V6); # Pressure after compression\n",
      "Wcycle=(p1*10**2*(V2-V1))+(p2*10**2*V2*math.log (V3/V2))-(p4*10**2*(V4-V5))-(p5*10**2*V5* math.log(V5/V6)); # Work per Cycle\n",
      "\n",
      "#Result\n",
      "print \"Work per cycle =\",round(Wcycle,3),\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work per cycle = 3.652 kJ\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8, Page No:142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "D=10; #Bore in cm\n",
      "L=12.5; #Stroke length in cm\n",
      "a=9.68; # Area of indicator card in cm^2\n",
      "l=5.33; # Card length in cm\n",
      "Ks=21.7; # Indicator spring constant per meter of card length\n",
      "\n",
      "#Calculation\n",
      "A=(3.14*(D*10**-2)**2)/4; # Area of pisaton\n",
      "Pm=(a/l)*10**-2*Ks*10**6; # Mean effective pressure\n",
      "W=Pm*A*L*10**-2; # Work done by cycle\n",
      "\n",
      "#Result\n",
      "print \"Work done by cycle = \",round(W,0),\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done by cycle =  387.0 kJ\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9, Page No:142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "D=152; # Bore of steam engine in mm\n",
      "l=89; # Stroke length of steam engine in mm\n",
      "a1=8;a2=10; # area of indicatior diagram on two sides\n",
      "Ks=50; # Indicator spring constant in lbf/in^2/in\n",
      "N=310; # Engine speed in rpm\n",
      "d=0.664; # Diameter of flywheel in m\n",
      "\n",
      "#Calculation for (a)\n",
      "# (a)\n",
      "a=(a1+a2)/2; # Average area of indicator diagram\n",
      "Ks=50*4.44822/(0.0254)**3; # Unit conversion from lbf/in^2/in to N/m^2\n",
      "pm=(a/(l/10))*10**-2*Ks; # Mean effective pressure \n",
      "A=(3.14*(D*10**-3)**2)/4; # Area of the piston\n",
      "IP=2*pm*l*10**-3*A*N/60; # Indicated power\n",
      "\n",
      "#Result for (a)\n",
      "print \"(a)\",\"\\nIndicated power of Engine =\",round(IP/1000,2),\"kW\"\n",
      "\n",
      "#Calculation for (b)\n",
      "# (b)\n",
      "F=12-1.5; # Tangential force on the brake drum in kgf\n",
      "BP=F*9.81*d/2*2*3.14*N/60; # Brake power of Engine\n",
      "eff=BP/IP *100 ; # Mechanical efficiency \n",
      "\n",
      "#Result for (b)\n",
      "print \"\\n\\n(b)\",\"\\nBrake power of Engine = \",round(BP/1000,2),\"kW\",\"\\nMechanical efficiency of Engine =\",round(eff,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) \n",
        "Indicated power of Engine = 2.29 kW\n",
        "\n",
        "\n",
        "(b) \n",
        "Brake power of Engine =  1.11 kW \n",
        "Mechanical efficiency of Engine = 48.47 %\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page No:156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "Tc1=10; # Feed water inlet temperature in degree celcius\n",
      "Tc2=77; # Feed water outlet temperature in degree celcius\n",
      "th1=166; # Initial temperature of flue gas in degree celcius\n",
      "r=4; # Ratio of mass flow rates of flue gases and water\n",
      "Ch=1.05; # The specific heat of flue gas in kJ/kg K\n",
      "Cc=4.187; # The specific heat of feed water in kJ/kg K\n",
      "U=114; # Overall heat transfer coefficient in W/m^2\n",
      "mc=1; # massflowrate of feed water in kg/s\n",
      "\n",
      "#Calculation for Parallel flow\n",
      "th2=th1-((Cc*(Tc2-Tc1))/(r*Ch)); # Outlet temperature of flue gas in degree celcius\n",
      "Q=mc/3600*Cc*(Tc2-Tc1); # Heat transfer rate per kg/h of water flow\n",
      "# Parallel flow    \n",
      "del_Tm=((th1-Tc1)-(th2-Tc2))/math.log ((th1-Tc1)/(th2-Tc2)); # Logarthamic Mean Temperature Difference in degree celcius\n",
      "A=Q*10**3/(U*del_Tm); # Economiser surface area\n",
      "\n",
      "#Result for Parallel flow\n",
      "print \" (a)Parallel flow\",\"\\nLogarthamic Mean Temperature Difference=\",round(del_Tm,1),\"degree celcius\",\n",
      "print \"\\nEconomiser surface area =\",round(A,2),\"m^2\"\n",
      "\n",
      "#Calculation for Counter flow\n",
      "# Counter flow\n",
      "del_Tm=((th1-Tc2)-(th2-Tc1))/math.log ((th1-Tc2)/(th2-Tc1)); # Logarthamic Mean Temperature Difference in degree celcius\n",
      "A=Q*10**3/(U*del_Tm); # Economiser surface area\n",
      "\n",
      "#Result for Counter flow\n",
      "print\" \\n\\n(b) Counter flow\",\"\\nLogarthamic Mean Temperature Difference=\",round(del_Tm,1),\"degree celcius\",\n",
      "print \"\\nEconomiser surface area =\",round(A,5),\"m^2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (a)Parallel flow \n",
        "Logarthamic Mean Temperature Difference= 68.6 degree celcius \n",
        "Economiser surface area = 0.01 m^2\n",
        " \n",
        "\n",
        "(b) Counter flow \n",
        "Logarthamic Mean Temperature Difference= 89.1 degree celcius \n",
        "Economiser surface area = 0.00767 m^2\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}