summaryrefslogtreecommitdiff
path: root/sample_notebooks/ChaitanyaPotti/Chapter2_1.ipynb
blob: 0734d6090f8a9ba36aef56b30a469035e200ea6c (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 - First law"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 - pg 34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 2.1\n",
      "The Change in total energy is, del_E (kJ) =  1100\n",
      "Since del_E is positive, so there is an increase in total energy\n",
      "There is mistake in the book's results unit\n"
     ]
    }
   ],
   "source": [
    "print 'Example 2.1'\n",
    "#calculate the Change in total energy\n",
    "\n",
    "#  Given values\n",
    "Q = 2500; # Heat transferred into the system, [kJ]\n",
    "W = 1400; #  Work transferred from the system,  [kJ]\n",
    "\n",
    "# solution\n",
    "\n",
    "#  since process carried out on a closed system, so using equation [4]\n",
    "del_E = Q-W; #  Change in total energy, [kJ]\n",
    "\n",
    "# results\n",
    "\n",
    "print 'The Change in total energy is, del_E (kJ) = ',del_E\n",
    "\n",
    "if del_E >= 0:\n",
    "    print 'Since del_E is positive, so there is an increase in total energy'\n",
    "else:\n",
    "    print 'Since del_E is negative, so there is an decrease in total energy'\n",
    "\n",
    "\n",
    "print \"There is mistake in the book's results unit\"\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 - pg 34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 2.2\n",
      "The Heat transfer is, Q (kJ) =  -700.0\n",
      "Since Q < 0, so heat is transferred from the system\n"
     ]
    }
   ],
   "source": [
    "print 'Example 2.2'\n",
    "#calculate the heat transfer\n",
    "\n",
    "#  Given values\n",
    "del_E = 3500.; # Increase in total energy of the system, [kJ]\n",
    "W = -4200.; # Work transfer into the system, [kJ]\n",
    "\n",
    "# solution\n",
    "#  since process carried out on a closed system, so using equation [3]\n",
    "Q = del_E+W;# [kJ]\n",
    "\n",
    "# results\n",
    "print 'The Heat transfer is, Q (kJ) = ',Q\n",
    "\n",
    "if Q >=0:\n",
    "    print 'Since Q > 0, so heat is transferred into the system'\n",
    "else:\n",
    "    print 'Since Q < 0, so heat is transferred from the system'\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 - pg 38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 2.3\n",
      "The Work done is, W (kJ/kg) =  250\n",
      "Since W > 0, so Work done by the engine per kilogram of working substance\n"
     ]
    }
   ],
   "source": [
    "print 'Example 2.3'\n",
    "#calculate the Work done\n",
    "\n",
    "\n",
    "#  Given values\n",
    "Q = -150; # Heat transferred out of the system, [kJ/kg]\n",
    "del_u = -400; # Internal energy decreased ,[kJ/kg]\n",
    "\n",
    "#  solution\n",
    "#  using equation [3],the non flow energy equation\n",
    "#  Q=del_u+W\n",
    "W = Q-del_u; #  [kJ/kg]\n",
    "\n",
    "# results\n",
    "print 'The Work done is, W (kJ/kg) = ',W\n",
    "\n",
    "if W >=0:\n",
    "      print 'Since W > 0, so Work done by the engine per kilogram of working substance'\n",
    "else:\n",
    "      print 'Since W < 0, so Work done on the engine per kilogram of working substance'\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 - pg 39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 2.4\n",
      "workdone is, W (kJ/kg) =  550.6875\n",
      "Since W>0, so Power is output from the system\n",
      "The power output from the system is (kW) =  2202.75\n"
     ]
    }
   ],
   "source": [
    "print 'Example 2.4'\n",
    "#calculate the power output and workdone\n",
    "#  Given values\n",
    "m_dot = 4.; #  fluid flow rate, [kg/s]\n",
    "Q = -40.;  #  Heat loss to the surrounding, [kJ/kg]\n",
    "\n",
    "#  At inlet \n",
    "P1 = 600.;  # pressure  ,[kn/m**2]\n",
    "C1 = 220.;  # velocity  ,[m/s]\n",
    "u1 = 2200.;  # internal energy,  [kJ/kg]\n",
    "v1 = .42; # specific volume, [m**3/kg]\n",
    "\n",
    "#  At outlet\n",
    "P2 = 150.; # pressure, [kN/m**2]\n",
    "C2 = 145.;  # velocity,  [m/s]\n",
    "u2 = 1650.;  # internal energy,  [kJ/kg]\n",
    "v2 = 1.5;  # specific volume,  [m**3/kg]\n",
    "\n",
    "#  solution\n",
    "#  for steady flow energy equation for the open system is given by\n",
    "#  u1+P1*v1+C1**2/2+Q=u2+P2*v2+C2**2/2+W\n",
    "#  hence\n",
    "\n",
    "W = (u1-u2)+(P1*v1-P2*v2)+(C1**2/2-C2**2/2)*10**-3+Q; # [kJ/kg]\n",
    "\n",
    "P_out = W*m_dot; # power out put from the system, [kW]\n",
    "\n",
    "# results\n",
    "print 'workdone is, W (kJ/kg) = ',W\n",
    "\n",
    "if W >= 0:\n",
    "      print 'Since W>0, so Power is output from the system'\n",
    "else:\n",
    "      print 'Since W<0, so Power is input to the system'\n",
    "\n",
    "#  Hence\n",
    "\n",
    "print 'The power output from the system is (kW) = ',P_out\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 - pg 39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 2.5\n",
      "The temperature rise of the lead is (C) =  104.58\n"
     ]
    }
   ],
   "source": [
    "print 'Example 2.5'\n",
    "#calculate the temperature rise\n",
    "\n",
    "\n",
    "#  Given values\n",
    "del_P = 154.45; # pressure difference across the die, [MN/m**2]\n",
    "rho = 11360.; # Density of the lead, [kg/m**3]\n",
    "c = 130; # specific heat capacity of the lead, [J/kg*K]\n",
    "\n",
    "#  solution\n",
    "#  since there is no cooling and no externel work is done, so energy balane becomes\n",
    "#  P1*V1+U1=P2*V2+U2 ,so\n",
    "#  del_U=U2-U1=P1*V1-P2*V2\n",
    "\n",
    "#  also, for temperature rise, del_U=m*c*t, where, m is mass; c is specific heat capacity; and t is temperature rise\n",
    "\n",
    "#  Also given that lead is incompressible, so V1=V2=V and assuming one m**3 of lead\n",
    "\n",
    "#  using above equations\n",
    "t = del_P/(rho*c)*10**6 ;# temperature rise [C]\n",
    "\n",
    "# results \n",
    "print 'The temperature rise of the lead is (C) = ',round(t,2)\n",
    "\n",
    "#  End\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 - pg 42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 2.6\n",
      "(a) The inlet area is, A1 (m^2) =  0.0425\n",
      "(b) The exit velocity is, C2 (m/s) =  171.71\n",
      "(c) The power developed by the turbine system is (kW) =  671.88\n"
     ]
    }
   ],
   "source": [
    "print 'Example 2.6'\n",
    "#calculate the power developed, exit velocity and inlet area\n",
    "\n",
    "#  Given values\n",
    "m_dot = 4.5; # mass flow rate of air, [kg/s]\n",
    "Q = -40.; # Heat transfer loss, [kJ/kg]\n",
    "del_h = -200.; # specific enthalpy reduce, [kJ/kg]\n",
    "\n",
    "C1 = 90; # inlet velocity, [m/s]\n",
    "v1 = .85; # inlet specific volume, [m**3/kg]\n",
    "\n",
    "v2 = 1.45; #  exit specific volume, [m**3/kg]\n",
    "A2 = .038;  #  exit area of turbine, [m**2]\n",
    "\n",
    "#  solution\n",
    "\n",
    "#  part (a)\n",
    "#  At inlet, by equation[4], m_dot=A1*C1/v1\n",
    "A1 = m_dot*v1/C1;#inlet area, [m**2]\n",
    "print '(a) The inlet area is, A1 (m^2) = ',A1\n",
    "\n",
    "#  part (b), \n",
    "#  At outlet, since mass flow rate is same, so m_dot=A2*C2/v2, hence\n",
    "C2 = m_dot*v2/A2; # Exit velocity,[m/s]\n",
    "print '(b) The exit velocity is, C2 (m/s) = ',round(C2,2)\n",
    "\n",
    "#  part (c)\n",
    "#  using steady flow equation, h1+C1**2/2+Q=h2+C2**2/2+W\n",
    "W = -del_h+(C1**2/2-C2**2/2)*10**-3+Q; #  [kJ/kg]\n",
    "\n",
    "#  Hence power developed is\n",
    "P = W*m_dot;#  [kW]\n",
    "print '(c) The power developed by the turbine system is (kW) = ',round(P,2)\n",
    "\n",
    "#  End\n",
    "\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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}