summaryrefslogtreecommitdiff
path: root/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of_thermodynamics_Rudramani.ipynb
blob: 627999000100564ed8288b762ccfa46f3531e9e9 (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
{
 "metadata": {
  "name": " Chapter 1 Basics of thermodynamics Rudramani"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Basics of Thermodynamics"
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.1 # pageno 34"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "f=-40 # medium temperature in -40 degree\nf1=32 # standard value in 32\nT=(f-f1)*5/9 #temperature in degree\nprint \"hence -40 on the fahrenheit scale is equal to \",T,\" on the degree celsius\"",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "hence -40 on the fahrenheit scale is equal to  -40  on the degree celsius\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.2 # pageno 34"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find density\nmass=1600 #mass in kg\nv=2 # volume in 2m3\nd=mass/v # density in kg/m3\nprint 'Density =mass/volume =',d,'kg/m3'\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Density =mass/volume = 800 kg/m3\n"
      }
     ],
     "prompt_number": 107
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Ex 1.3 # page no 35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find specific weight of oil\nm=1600 # mass of oil\ng=9.81 # acceleration due to gravity\nv=2 # volume\ns=(m*g)/v # specific gravity\nprint s,\"N/m3\"",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "7848.0 N/m3\n"
      }
     ],
     "prompt_number": 106
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.4 #pageno 35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "Do=float(800) #Density of oil\nDW=float(1000) #Density of water\n\n#calculation\nSG=float(Do/DW)  #Specific grav\n#print SG\n#print ('%.1f' %(SG*.1))\n#output\nprint \"Specific gravity \",SG",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Specific gravity  0.8\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.5 # pageno 35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find kinematic viscosity\nu=0.001 #viscosity of oil\np=800  # specific gravity\nk=u/p # kinematic viscosity\nprint \"kinematic viscosity\", k,\"m2/s\"",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "kinematic viscosity 1.25e-06 m2/s\n"
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.6  # pageno 35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find the absolute pressure\np1=13600 # atmospheric pressue\ng=9.81# vaccum pressure\nh=0.76 #barometric pressure of mercury\nBa=p1*g*h\nprint 'Barometric pressure',round(Ba/1000,1),'kN/m2'\ngauge= 5000# gauge pressure\nAb=(Ba/1000)+gauge # Absolute pressure=atmospheric pressure + gauge pressure\nprint 'Absoulte pressure',round(Ab,1),'kPa = or ',round(Ab/1000,1),'bar'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Barometric pressure 101.4 kN/m2\nAbsoulte pressure 5101.4 kPa = or  5.1 bar\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.7 #pageno 35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find absolute temperature\nbar=760 # barometeric pressure\nvac=700 # vacuum pressure\nab=bar-vac\nprint ab,'mm of Hg'\np=13600 # specific gravity \ng=9.81 # accelration due to gravity\nh=0.06 # N/m2\nAb=(p*g*h)\nprint 'Absolute pressure',Ab,'N/m2'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "60 mm of Hg\nAbsolute pressure 8004.96 N/m2\n"
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.8 #pageno 35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#page no35  to find heat required \nt2=1300 # temperature in kelvin\nt1=290 # temperature 290k\nc=.49 # mass 0.49 kj/kg k\nm=200 # mass in kg\nH=(m*c)*(t2-t1)\nprint 'Heat required',H,'kJ'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Heat required 98980.0 kJ\n"
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.9 #pageno 36"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find change in internal energy\nm=-0.3 # mechanical stirrer\nt=5 # min\nt1=5*60 # minutes into seconds\nw=m*t1 # work done by mechanical stirrer\nprint 'work done by mechanical stirrer',w,'kJ'\nq=5*300 # charge  in t*w\nu=q+w # U=Q-W\nprint 'change in internal energy of water U=Q-W',u,'kJ'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "work done by mechanical stirrer -90.0 kJ\nchange in internal energy of water U=Q-W 1410.0 kJ\n"
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.10 # pageno 36"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# from tables h=460.545 \nh=460.545 #kJ/kg \nv=0.066484 # m3/kg\np=400 # pressure from table \nu=h-(p*v) # kJ/kg\nprint 'U=',u,'kJ/kg'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "U= 433.9514 kJ/kg\n"
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.11 #pageno 36"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to calculate total work done\np1=4 # bar 1\np2=1 # bar2\ng=1.4 # gamma\nt1=425 # t1 in temperature 425k\nte=(g-1)/g #gamma-1/gamma\ng1=(p1/p2)**te\nt2=t1/g1 # temperature T2\nprint 'T2 =',round(t2,1),'K'\nv1=0.2 # volume of 0.2 m3\nv3=1/g # 1/gamma\nv2=(0.25)**v3\nprint 'V1/V2',round(v2,4)\nvol=v1/v2\nprint 'V2 = ',round(vol,4),'m3'\nR=1-v3\nprint 'R=cp-cv=',round(R*1000,1),'J/kg K'\nm=(p1*v1*10**5)/(t2*t1)\nprint round(m,3),'kg'\nen=70\nt3=(en/m)+(t2)\nprint 'T3 =',round(t3,1),'K'\nV3=vol*t3/t2\nprint 'V3 =',round(V3,3),'m3'\nW=((p1*v1*10**5)-(p2*vol*10**5))/0.4\nprint 'W1-2  =',round(W/1000,3),'kJ'\nW2=p2*10**5*(V3-vol)\nprint 'W2-3 = ',round(W2*100,2),'kJ'\nW1=W+W2\nprint 'W =W1-2+W2-3 =',round(W1/1000,3),'kJ'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "T2 = 286.0 K\nV1/V2 0.3715\nV2 =  0.5384 m3\nR=cp-cv= 285.7 J/kg K\n0.658 kg\nT3 = 392.4 K\nV3 = 0.739 m3\nW1-2  = 65.41 kJ\nW2-3 =  2002026.54 kJ\nW =W1-2+W2-3 = 85.43 kJ\n"
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex1.12\n"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# pageno 36 to find final temperature\n#from figure ddepicts the process given in book\nT1=300  # temperature in 300K\nv2=float(0.003) #volume in 0.003m3\nv1=float(0.03)\nn=float(1.3)#n\nt=(v2/v1)**(n-1)\nprint round(t,3)\nT2=T1/t # temperature in degree c\np=2\nprint 'T2 =',round(T2),'=' ,round(T2-273),' degree C'\np1=(v2/v1)**n\np2=p/p1\nprint 'P2 =',round(p2),'bar=',round(p2),'10**5 N/m2'\nw=((p2*10**5*v2)-(p*10**5*v1))/(n-1)# work done during compression\nprint 'W1-2= ',round(w),'J',round(w,1)/1000,'kJ' ",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "0.501\nT2 = 599.0 = 326.0  degree C\nP2 = 40.0 bar= 40.0 10**5 N/m2\nW1-2=  19905.0 J 19.9052 kJ\n"
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "EX 1.13 #pageno 38"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "Thigh=float(1200) # temperature in high\nK=float(273) # 273 in kelvin\nth=float(Thigh+K) #convert degree into kelvin\nTlow = float(150)  # temperature in low\ntl=float(Tlow+K) #convert degree into kelvin\nn=float((th-tl)/th) #effiency in percentage of engine\nprint 'Effiency =  ',round(n,3),'=',round(n*100,3),'%'\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Effiency =   0.713 = 71.283 %\n"
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex1.14 #pageno 38"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#to find heat supplied by each source and to effiency of the engine\n# to find reversible engine mentioned in figure in the textbook\nt1=float(1000) # constant temperature\nt2=float(310)# constant temperature\nn1=float((t1-t2)/t1)\nprint 'n1 =',n1\nt3=float(800)# constant temperature\nn2=float((t3-t2)/t3)\nprint 'n2 =',n2\nQ1=25.8 \nQ2=134.2\nW=100# work obtained\nth=W/(Q1+Q2) # heat supllied from the source\nprint 'Thermal efficiency of the engine  = ',th,'=',th*100,'%'\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "n1 = 0.69\nn2 = 0.6125\nThermal efficiency of the engine  =  0.625 = 62.5 %\n"
      }
     ],
     "prompt_number": 104
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.15 "
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#to find power required to drive the plant\ntlow=float(263)  # low temperature\nthigh=float(300) # high temperature\ncop=float(tlow/(thigh-tlow)) #coefficient of performance ideal\nprint 'COP ideal =',round(cop,2)\np=0.6\ncopac=cop*p #coefficient of performance actual\nprint 'COP actual =',round(copac,3)\nhe= 30*10**3\nw=he/copac # power required  to drive  plant\nprint 'power required to run the plant =  ',round(w/1000,3),'kW'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "COP ideal = 7.11\nCOP actual = 4.265\npower required to run the plant =   7.034 kW\n"
      }
     ],
     "prompt_number": 83
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "\nEx 1.16 \n"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find  conduction heat transfer rate through the plate\nT2=600 # high temperature\nT1=100# low temperature\nL=0.1 # thickness of slab\nK=20 # thermal conductivity \nA=1 # area in m2\nQ=(K*A)*(T2-T1)/L\nprint 'Q  =',Q/1000,'kW'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Q  = 100.0 kW\n"
      }
     ],
     "prompt_number": 88
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex1.17"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# To find heat conduction \nt1=1300 #temperature at 1300 degree c\nt3=115 # temperature at 115 degree c\nl1=0.5 # thickneess of slab\nk1=1.4 # thermal conductivity\na=1 # constant a=1\nl2=0.161 # thickness of slab 2\nk2=0.35 # thermal conductivity  of second slab\nQ=(t1-t3)/((l1/(a*k1))+(l2/(a*k2))) # conduction of heat transfer\nprint 'Q=',round(Q,1),'W =',round(Q/1000,2),'kW'\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Q= 1450.2 W = 1.45 kW\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.18 pageno 40"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find conduction transfer\nimport math\nt1=float(300)\nt2=float(200)\nl=float(2)\nk=float(70)\nr2=float(0.1)\nr1=float(0.05)\nQ=float((k*2*3.14*l*(t1-t2))/(math.log((r2/r1))))\nprint 'Q= ',round(Q,2),'W =',round(Q/1000,2),'kW'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Q=  126841.75 W = 126.84 kW\n"
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "EX 1.19 pageno 40"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find internal temperature  and conduction transfer rate\nimport math\nt1=float(225)# temperature in degree\nt4=float(25) # temperature in degree\nL=1 #length in m\nk1=float(50) #thermal conductivity constant\nr1=float(5)#thermal conductivity constant\nr2=float(5.5)#thermal conductivity constant\nk2=float(0.06) #thermal conductivity constant\nr3=float(10.0)#thermal conductivity constant\nr4=float(15.5)#thermal conductivity constant\nk4=float(1/(k1)) #1/k1\nk3=0.12 #thermal conductivity constant\np=float(1/(2*math.pi*L)) #1/2pil\nk5=float(1/(k2))  #1/k2\nk6=float(1/(k3)) #1/k3\nQ=float((t1-t4)/(p*((k4*math.log(r1/r2))+(k5*math.log(r3/r2))+(k6*math.log(r4/r3))))) #Conduction transfer\nprint 'Q= ',round(Q,2),'W'\nprint 'calculation error in textbook' # error in textbook\nT2=(t1-float(Q*p*(k4*math.log(r2/r1)))) # internal temperature T2\nprint 'T2 = ',round(T2,1),'Degree C' \nT3 =(T2-float(Q*p*(k5*math.log(r3/r2)))) # internal temperature T3\nprint 'T3 =',round(T3,2),'Degree C'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Q=  92.3 W\ncalculation error in textbook\nT2 =  225.0 Degree C\nT3 = 78.6 Degree C\n"
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.20 pageno 41"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to find conduction heat transfer rate through hallow sphere\nimport math3\nt1=290 # inner surface temperature\nt3=20 # outter surface temperature\nk1=float(70) # thermal conductivity k1\nr2=float(0.15) # radius r2\nr1=0.05 # radius r1\nk2=float(15) # thermal conductivity k2\nr3= float(0.2) # radius r3\np=float(1/(4*3.14)) #1/4pi\nr5=float((1)/(k1)) # 1/k1\nr4=float((1)/(k2)) #1/k2\nQ=float((t1-t3)/((p)*((r5*((r2-r1)/(r1*r2)))+(r4*((r3-r2)/(r3*r2)))))) # thermal conductivity\nprint 'Q= ',round(Q,2),'W'\n        ",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Q=  11244.51 W\n"
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Ex 1.21 #page no 41"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# to determine  radiation heat exchange between to plates\nsigma=0.567*10**-7 # surface density of square plate\nt1=1273# temperature of plate1\nt2=773 # temperature of plate 2\nf12=0.415  # shape factor\na1=1 # area of size 1mx1m\nQ=a1*f12*sigma*((t1**4)-(t2**4)) # thermal conductivity\nprint 'Q=',round(Q,2),'W =',round(Q/1000,2),'kW'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Q= 53392.43 W = 53.39 kW\n"
      }
     ],
     "prompt_number": 44
    }
   ],
   "metadata": {}
  }
 ]
}