summaryrefslogtreecommitdiff
path: root/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch1.ipynb
blob: a8b9ed7630e1c5f210941c3db013a1facd855f83 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:c8eaf5948eadfe6d1b6a7dc0019961e94ca5ac36c2e0b4b3d3661a7c7823315b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Introduction and Basic Concepts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.1, Page no:5 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "F = 300; \t\t\t    #[N]\n",
      "g_local = 4.5; \t\t\t#local gravitational acceleration[m/s**2]\n",
      "g_earth = 9.81; \t\t#earth's gravitational acceleration[m/s**2]\n",
      "\n",
      "# Calculations\n",
      "#To find man's mass and weight on earth\n",
      "m = F/g_local;\t\t\t#mass of man[kg]\n",
      "w = m*g_earth; \t\t\t# weight of man on earth[N]\n",
      "\n",
      "# Results\n",
      "print 'Mass of man is %f kg'%m\n",
      "print '\\nWeight of man on earth is %f N'%w\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of man is 66.666667 kg\n",
        "\n",
        "Weight of man on earth is 654.000000 N\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.2, Page no:6 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "p1 = 1.15*10**5; \t\t\t#measured pressure[N/m**2]\n",
      "p2 = 1.01325*10**5; \t\t#atmospheric pressure[N/m**2]\n",
      "rho = 2.95*10**3; \t\t\t#specific gravity of fluid\n",
      "g = 9.8067\n",
      "\n",
      "# Calculations\n",
      "#To find height of manometer fluid\n",
      "p = p1-p2; \t     \t\t#difference in pressure\n",
      "h = p/(rho*g); \t\t\t#height of manometer fluid[m]\n",
      "\n",
      "# Results\n",
      "print 'Height of manometer fluid is %f m'%h\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Height of manometer fluid is 0.472697 m\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.3, Page no:8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "PE = 1.5*10**3; \t#potential energy[J]\n",
      "m = 10; \t\t\t#mass in kg\n",
      "u = 50; \t\t\t# velocity in m/s\n",
      "g = 9.8067\n",
      "\n",
      "# Calculations\n",
      "h = PE/(m*g);\t\t\t# height from ground in m\n",
      "#Using equation 1.9 (Page no. 8)\n",
      "KE = 0.5*m*(u**2);\t\t\t# Kinetic energy in J\n",
      "\n",
      "# Results\n",
      "print 'Height from ground is %f m'%h\n",
      "print '\\nKinetic Energy of body is %3.2e J'%KE\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Height from ground is 15.295665 m\n",
        "\n",
        "Kinetic Energy of body is 1.25e+04 J\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.4, Page no:9 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "#Given\n",
      "F = 600.; \t\t\t#weight in N\n",
      "t = 120.; \t\t\t#time in sec\n",
      "h = 0.18; \t\t\t#height of stairs in m\n",
      "\n",
      "# Calculations\n",
      "#To determine the power developed in man\n",
      "S = 20*h; \t\t\t#total vertical displacement in m\n",
      "W = F*S; \t\t\t#work done in J\n",
      "P = W/t; \t\t\t#power developed\n",
      "\n",
      "# Results\n",
      "print 'Power developed is %i W'%P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power developed is 18 W\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.5, Page no:9 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "\n",
      "import math\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "A = (math.pi/4)*(0.1**2); \t\t\t#area in m**2\n",
      "P = 1.01325*10**5; \t\t\t#pressure in N/m**2\n",
      "m = 50; \t\t\t#mass of piston and weight in kg\n",
      "g = 9.81; \t\t\t#acceleration due to gravity (N/m**2)\n",
      "\n",
      "\n",
      "# Calculations and Results\n",
      "#To determine the force exerted pressure work done and change in potential energy\n",
      "#(a)\n",
      "Fa = P*A; \t\t\t#force exerted by atmosphere in N\n",
      "Fp = m*g; \t\t\t#force exerted by piston and weight in N\n",
      "F = Fp+Fa; \t\t\t#total force exerted in N\n",
      "print 'Total force exerted by the atmosphere, the piston and the weight is %f N'%F\n",
      "\n",
      "#(b)\n",
      "Pg = F/A; \t\t\t#pressure of gas in N/m**2\n",
      "print 'Pressure of gas is %5.4e N/m^2'%Pg\n",
      "\n",
      "#(c)\n",
      "S = 0.4; \t\t\t#displacement of gas in m\n",
      "W = F*S; \t\t\t#work done by gas in J\n",
      "print 'Work done by gas is %f J'%W\n",
      "\n",
      "#(d)\n",
      "PE = m*g*S; \t\t\t#change in potential energy in J\n",
      "print 'Change in potential energy is %f J'%PE\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total force exerted by the atmosphere, the piston and the weight is 1286.304689 N\n",
        "Pressure of gas is 1.6378e+05 N/m^2\n",
        "Work done by gas is 514.521876 J\n",
        "Change in potential energy is 196.200000 J\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6, Page no:10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "\n",
      "# Variables\n",
      "#P =(2*10**5)*D\n",
      "Df = 2.5; \t\t\t#final diameter (m)\n",
      "Di = 0.5; \t\t\t#initial diameter(m)\n",
      "\n",
      "# Calculations\n",
      "#To determine work done by gas\n",
      "W = (math.pi/4)*10**5*((Df**4)-Di**4);\n",
      "\n",
      "# Results\n",
      "print 'Work done by gas is %6.4e J'%W\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done by gas is 3.0631e+06 J\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.7, Page no:19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "T = 300.; \t\t\t    #temperature in K\n",
      "P = 6.5*10**5; \t\t\t#pressure in N/m**2\n",
      "Pa = 1.01325*10**5; \t#atmospheric pressure in N/m**2\n",
      "R = 8.314; \t\t\t    #ideal gas constant\n",
      "m = 2.; \t\t\t    #mass of gas (kg)\n",
      "M = 44.; \t\t\t    #molecular weihgt of gas\n",
      "\n",
      "# Calculations\n",
      "#To find the work done on surrounding\n",
      "n = m/M; \t\t\t            # n is number of kmoles\n",
      "Vi = (n*R*10**3*T)/P; \t\t\t# initial volume in m**3\n",
      "Vf = 2*Vi; \t\t            \t#final volume in m**3\n",
      "V = Vf-Vi; \t\t\t            #change in volume\n",
      "Ps = Pa+(5000*9.8067); \t\t\t#pressure on surroundings\n",
      "W = Ps*V; \t\t\t            #work done on the surroundings\n",
      "\n",
      "# Results\n",
      "print 'Work done on surroundings is %5.2e J'%W\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done on surroundings is 2.62e+04 J\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from scipy import integrate\n",
      "\n",
      "#Taking 3rd and 2nd order derivative respectively, we get the following expression \n",
      "#x = ((2*10**5*math.pi)/2)*\n",
      "D = lambda x: x**3\n",
      "integ,err = integrate.quad(D,0.5,2.5)\n",
      "print integ\n",
      "#integ,err = integrate.quad(D**3,0.5,2.5)\n",
      "#print integ"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "9.75\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}