summaryrefslogtreecommitdiff
path: root/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter22.ipynb
blob: 228b303ab7fd3e4e31201ea4f3cd99f1fdf60263 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 22: Transport Processes in Gas"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.1:pg-911"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.1 \n",
      "\n",
      "\n",
      " Mean free path = math.exp m,\n",
      " The fraction of molecules have free path longer than 2*lambda =  13.5335283237  percent\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "p = 1.013e5 # Pressure in Pa\n",
    "t = 300 # Temperature in K\n",
    "d = 3.5 # Effective diameter of oxygen molecule in Angstrom \n",
    "r = 2 # Ratio of free path of molecules with the lambda\n",
    "print \"\\n Example 22.1 \\n\"\n",
    "sigma = math.pi*(d*(10**-10))**2\n",
    "n = p/(t*1.38*(10**-23))\n",
    "R = math.exp(-r)\n",
    "print \"\\n Mean free path = math.exp m,\\n The fraction of molecules have free path longer than 2*lambda = \",R*100, \" percent\"\n",
    "# Answer given in the book contain round off error for mean free path."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.2:pg-912"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.2 \n",
      "\n",
      "\n",
      " Pressure of the gas =  134.236067593  Pa,\n",
      " No of collisions made by a molecule per meter of path = math.exp 38022.8136882\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "lambda1 = (2.63e-5) # Mean free path of the molecules of the gas in m\n",
    "t = 25 # Temperature in degree centigrade\n",
    "r = 2.56e-10 # Radius of the molecules in m\n",
    "print \"\\n Example 22.2 \\n\"\n",
    "sigma = 4*math.pi*r**2\n",
    "n = 0.707/(sigma*lambda1)\n",
    "p = n*(t+273)*(1.38*10**-23)\n",
    "N = 1.0/lambda1\n",
    "print \"\\n Pressure of the gas = \",p,\" Pa,\\n No of collisions made by a molecule per meter of path = math.exp\",N\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.3:pg-912"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.3 \n",
      "\n",
      "\n",
      " The no of free paths which are longer than, \n",
      " 10 cm =  3679.0 ,\n",
      " 20 cm =  1354.0 ,\n",
      " 50 cm =  68.0 ,\n",
      "\n",
      " The no of free paths which are between,\n",
      " 5 cm and 10 cm =  -2387.0 ,\n",
      " 9.5 cm and 10.5 cm =  -369.0 ,\n",
      " 9.9 cm and 10.1 cm =  -74.0 ,\n",
      "\n",
      " The no of free paths which are exactly 10 cm =  -0.0\n"
     ]
    }
   ],
   "source": [
    "# Given that\n",
    "import math\n",
    "from scipy import integrate \n",
    "lambda1 = 10.0 # Mean free path of the gas in cm\n",
    "N0 = 10000.0 # No of free paths\n",
    "x1 = 10.0 # In cm\n",
    "x2 = 20.0 # In cm\n",
    "x3 = 50.0 # In cm\n",
    "x4 = 5.0 # In cm\n",
    "x5 = 9.5 # In cm\n",
    "x6 = 10.5 # In cm\n",
    "x7 = 9.9 # In cm\n",
    "x8 = 10.1 # In cm\n",
    "print \"\\n Example 22.3 \\n\"\n",
    "# For x>10 cm\n",
    "N1 = N0*(math.exp(-1))\n",
    "# For x>20 cm\n",
    "N2 = N0*(math.exp(-2))\n",
    "# For x>50 cm\n",
    "N3 = N0*(math.exp(-5))\n",
    "def f(x): \n",
    "    y = (-N0/lambda1)*(math.exp((-x)/lambda1)),\n",
    "    return y\n",
    "# For 5>x>10 cm\n",
    "N4,er = integrate.quad( lambda x: (-N0/lambda1)*(math.exp((-x)/lambda1)),x4,x1)\n",
    "# For 9.5>x>10.5 cm\n",
    "N5,e = integrate.quad( lambda x: (-N0/lambda1)*(math.exp((-x)/lambda1)),x5,x6)\n",
    "# For 9.9>x>10.1 cm\n",
    "N6,eor = integrate.quad( lambda x: (-N0/lambda1)*(math.exp((-x)/lambda1)),x7,x8)\n",
    "# For x=10 cm\n",
    "N7,eer = integrate.quad( lambda x: (-N0/lambda1)*(math.exp((-x)/lambda1)),x1,x1)\n",
    "print \"\\n The no of free paths which are longer than, \\n 10 cm = \",math. ceil(N1) ,\",\\n 20 cm = \",math. ceil(N2) ,\",\\n 50 cm = \",math. ceil(N3) ,\",\\n\\n The no of free paths which are between,\\n 5 cm and 10 cm = \",math.floor(N4) ,\",\\n 9.5 cm and 10.5 cm = \",math.floor(N5) ,\",\\n 9.9 cm and 10.1 cm = \",math.floor(N6) ,\",\\n\\n The no of free paths which are exactly 10 cm = \",N7 \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.4:pg-913"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.4 \n",
      "\n",
      "\n",
      " Coefficient of viscosity = math.exp Ns/m**2 2.051171875e-05\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "p = 1.0 # Pressure in atm\n",
    "t = 300.0 # Temperature in K\n",
    "print \"\\n Example 22.4 \\n\"\n",
    "# From previous example, we have\n",
    "m = 5.31e-26 # In kg/molecule\n",
    "v = 445.0 # In m/s\n",
    "sigma = 3.84e-19 # In m**2\n",
    "# Therefore\n",
    "mu = (1.0/3.0)*(m*v/sigma)\n",
    "print \"\\n Coefficient of viscosity = math.exp Ns/m**2\",mu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.5:pg-913"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.5 \n",
      "\n",
      "\n",
      " Thermal conductivity  =  0.0  W/mK,\n",
      " If the gas has Maxwellian velocity distribution,\n",
      " Thermal conductivity =  5.98958333333e-05  W/mK\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "p = 1.0 # Pressure in atm\n",
    "t = 300.0 # Temperature in K\n",
    "F = 5.0 # For oxygen gas degree of freedom\n",
    "print \"\\n Example 22.5 \\n\"\n",
    "v = 445.0 # In m/s as given in the book\n",
    "m = 5.31e-26 # Mass of oxygen molecule in kg\n",
    "sigma = 3.84e-19 # As given in the book in m**2\n",
    "k = (1/6)*(v*F*(1.38*10**-23))/sigma\n",
    "# If the gas has Maxwellian velocity distribution,\n",
    "k_ = (1.0/3.0)*(F*(1.38*10**-23)/sigma)*((1.38*10**-23)*t/(math.pi*m))**(1/2)\n",
    "print \"\\n Thermal conductivity  = \",k ,\" W/mK,\\n If the gas has Maxwellian velocity distribution,\\n Thermal conductivity = \",k_ ,\" W/mK\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.6:pg-914"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.6 \n",
      "\n",
      "\n",
      " Pressure in the cathode ray tube =  0.142844028924  Pa\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "F = .90 # Fraction of electrons leaving the cathode ray reach the anode without making a collision\n",
    "x = 0.2 # Distance between cathode ray and anode in m\n",
    "d = 3.6e-10 # Diameter of ion in m\n",
    "t = 2000.0 # Temperature of electron in K\n",
    "print \"\\n Example 22.6 \\n\"\n",
    "lambda1 = x/(math.log(1/F))\n",
    "sigma = math.pi*(d**2)\n",
    "n = 4/(sigma*lambda1)\n",
    "p = n*(1.38*10**-23)*(t)\n",
    "print \"\\n Pressure in the cathode ray tube = \",p ,\" Pa\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.7:pg-914"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.7 \n",
      "\n",
      "\n",
      " No of collisions per sec are made by one molecule with the other molecule = 9962400.07749 \n",
      "The no of molecules strike the flask per sq. cm = 6.11714975845e+20 \n",
      " No of molecules in the flask = 2.44685990338e+22\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "V = 1.0 # Volume of the flask in litre\n",
    "p = 1.0 # Pressure in atm\n",
    "t = 300.0 # Temperature in K\n",
    "r = 1.8e-10 # Radius of oxygen gas molecule in m\n",
    "m = 5.31e-26 # Mass of oxygen molecule in kg\n",
    "print \"\\n Example 22.7 \\n\"\n",
    "n = (p*(1.013e5))/((1.38e-23)*(t)*1000)\n",
    "sigma = 4*math.pi*(r**2)\n",
    "v = ((8*(1.38e-23)*t)/(math.pi*m))**(1/2)\n",
    "z = sigma*n*v*1000\n",
    "N = (1.0/4.0)*(n*0.1*v)\n",
    "print \"\\n No of collisions per sec are made by one molecule with the other molecule =\", z,\"\\nThe no of molecules strike the flask per sq. cm =\",N,\"\\n No of molecules in the flask =\",n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.8:pg-915"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.8 \n",
      "\n",
      "\n",
      " Time = 1.00003111262 s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "lambda1 = 2.0 # Mean free path in cm\n",
    "T = 300.0 # Temperature in K\n",
    "r = 0.5 # As half of the molecules did not make any collision\n",
    "print \"\\n Example 22.8 \\n\"\n",
    "x = lambda1*(math.log(1/r))\n",
    "v = 445.58 # For oxygen at 300K in m/s\n",
    "t = x/(v*100)\n",
    "print \"\\n Time =\", math.exp(t), \"s\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.9:pg-915"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 22.9 \n",
      "\n",
      "\n",
      " Pressure = 1.03636998072 N/m**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "f = 0.9 # Fraction of electrons leaving the cathode ray and reaching the anode without making any collision\n",
    "x = 20.0 # Distance between cathode ray tube and anode in cm\n",
    "sigma = 4.07e-19 # Collision cross section of molecules in m**2\n",
    "T = 2000 # Temperature in K\n",
    "print \"\\n Example 22.9 \\n\"\n",
    "lambda1 = (x*0.01)/(math.log(1.0/f))\n",
    "n = 1/(sigma*lambda1)\n",
    "p = n*(1.38e-23)*T\n",
    "print \"\\n Pressure =\", math.exp(p), \"N/m**2\"\n",
    "# The answer given in the book contains round off error.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex22.10:pg-916"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " \n",
      " Example 22.10 \n",
      "\n",
      "\n",
      " Initial concentration gradient of reactive molecules = 0.0  molecules/m**4, \n",
      " The no of reactive molecules per sec cross a cross section at the mid point of the tube from left to right = 0.9 molecules/m**2,\n",
      " The no of reactive molecules per sec cross a cross section at the mid point of the tube from right to left = 2.71828182846  molecule/m**2,\n",
      " Initial net rate of diffusion =  0.0112863158384 g/m**2-s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Given that\n",
    "l = 2.0 # Length of tube in m\n",
    "a = 1e-4 # Cross section of the tube in m**2\n",
    "p = 1.0 # Pressure in atm\n",
    "t = 0 # Temperature in degree centigrade\n",
    "r = 0.5 # Fraction of the carbon atoms which are radioactive C14\n",
    "sigma = 4e-19 # Collision cross section area in m**2\n",
    "print \"\\n Example 22.10 \\n\"\n",
    "n = (p*1.01325e+5)/((1.38e-23)*(t+273))\n",
    "C_g = -n/l\n",
    "m = (46/6.023)*10**-26 # In kg/molecule\n",
    "v = (2.55*(1.38e-23)*(t+273)/m)**(1/2.0)\n",
    "lambda1 = (1.0/(sigma*n))\n",
    "gama = (1.0/4)*(v*n) - (1/6.0)*(v*lambda1*(C_g))\n",
    "gama_ = (1/4.0)*(v*n) + (1.0/6.0)*(v*lambda1*(C_g))\n",
    "x = (1.0/4)*(v*n)\n",
    "y = (1.0/6)*(v*lambda1*(C_g))\n",
    "d = (1.0/6)*(v*lambda1*(-1*C_g))*2*(m)\n",
    "a=x+y\n",
    "b=x-y\n",
    "print \"\\n Initial concentration gradient of reactive molecules =\",math.exp (C_g),\" molecules/m**4, \\n The no of reactive molecules per sec cross a cross section at the mid point of the tube from left to right =\",f , \"molecules/m**2,\\n The no of reactive molecules per sec cross a cross section at the mid point of the tube from right to left =\",math.e ,\" molecule/m**2,\\n Initial net rate of diffusion = \",d*1000 ,\"g/m**2-s\"\n",
    "# The answer for lambda given in the book conatains calculation error\n",
    "# The answers contains calculation error\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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}