summaryrefslogtreecommitdiff
path: root/Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb
blob: 836097b98ac6814df7bba18d6f70f61765fd6dbe (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 13:One Dimensional Compressible Fluid Flow"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 13.1;pg no: 525"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 13.1, Page:525  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n",
      "mass flow rate(m)=rho*A*C\n",
      "so rho*C=4*m/(%pi*d^2)\n",
      "so rho=165.79/C\n",
      "now using perfect gas equation,p=rho*R*T\n",
      "T=P/(rho*R)=P/((165.79/C)*R)\n",
      "C/T=165.79*R/P\n",
      "so C=1.19*T\n",
      "we know,C^2=((2*y*R)/(y-1))*(To-T)\n",
      "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n",
      "C^2=602.7*10^3-2009*T\n",
      "C^2+1688.23*C-602.7*10^3=0\n",
      "solving we get,C=302.72 m/s and T=254.39 K\n",
      "using stagnation property relation,\n",
      "To/T=1+(y-1)*M^2/2\n",
      "so M= 0.947\n",
      "stagnation pressure,Po in bar= 0.472\n",
      "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n"
     ]
    }
   ],
   "source": [
    "#cal of mach number,stagnation pressure,velocity\n",
    "#intiation of all variables\n",
    "# Chapter 13\n",
    "import math\n",
    "print\"Example 13.1, Page:525  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n",
    "To=(27+273);#stagnation temperature in K\n",
    "P=0.4*10**5;#static pressure in pa\n",
    "m=3000/3600;#air flowing rate in kg/s\n",
    "d=80*10**-3;#diameter of duct in m\n",
    "R=287;#gas constant in J/kg K\n",
    "y=1.4;#expansion constant\n",
    "print(\"mass flow rate(m)=rho*A*C\")\n",
    "print(\"so rho*C=4*m/(%pi*d^2)\")\n",
    "4*m/(math.pi*d**2)\n",
    "print(\"so rho=165.79/C\")\n",
    "print(\"now using perfect gas equation,p=rho*R*T\")\n",
    "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n",
    "print(\"C/T=165.79*R/P\")\n",
    "165.79*R/P\n",
    "print(\"so C=1.19*T\")\n",
    "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n",
    "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n",
    "print(\"C^2=602.7*10^3-2009*T\")\n",
    "print(\"C^2+1688.23*C-602.7*10^3=0\")\n",
    "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n",
    "C=302.72;\n",
    "T=254.39;\n",
    "print(\"using stagnation property relation,\")\n",
    "print(\"To/T=1+(y-1)*M^2/2\")\n",
    "M=math.sqrt(((To/T)-1)/((y-1)/2))\n",
    "print(\"so M=\"),round(M,3)\n",
    "M=0.947;#approx.\n",
    "Po=P*(1+(y-1)*M**2/2)/10**5\n",
    "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n",
    "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 13.2;pg no: 525"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 13.2, Page:525  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n",
      "mach number,M_a=(1/sin(a))=sqrt(2)\n",
      "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n",
      "T=To*0.6717 in K\n",
      "and C_max=M*sqrt(y*R*T) in m/s\n",
      "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n",
      "so T=0.7145*To in K\n",
      "and C_av=M_a*sqrt(y*R*T) in m/s\n",
      "ratio of kinetic energy= 0.869\n",
      "so ratio of kinetic energy=0.869\n"
     ]
    }
   ],
   "source": [
    "#cal of ratio of kinetic energy\n",
    "#intiation of all variables\n",
    "# Chapter 13\n",
    "import math\n",
    "print\"Example 13.2, Page:525  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n",
    "To=(273.+1100.);#stagnation temperature in K\n",
    "a=45.;#mach angle over exit cross-section in degree\n",
    "Po=1.01;#pressure at upstream side of nozzle in bar\n",
    "P=0.25;#ststic pressure in bar\n",
    "y=1.4;#expansion constant \n",
    "R=287.;#gas constant in J/kg K\n",
    "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n",
    "M_a=math.sqrt(2)\n",
    "M_a=1.414;#approx.\n",
    "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n",
    "M=1.564;\n",
    "print(\"T=To*0.6717 in K\")\n",
    "T=To*0.6717\n",
    "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n",
    "C_max=M*math.sqrt(y*R*T)\n",
    "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n",
    "print(\"so T=0.7145*To in K\")\n",
    "T=0.7145*To\n",
    "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n",
    "C_av=M_a*math.sqrt(y*R*T)\n",
    "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n",
    "print(\"so ratio of kinetic energy=0.869\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 13.3;pg no: 526"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 13.3, Page:526  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n",
      "From bernoulli equation,Po-P=(1/2)*rho*C^2\n",
      "so Po=P+(1/2)*rho*C^2 in N/m^2\n",
      "speed indicator reading shall be given by mach no.s\n",
      "mach no.,M=C/a=C/sqrt(y*R*T)\n",
      "using perfect gas equation,P=rho*R*T\n",
      "so T=P/(rho*R)in K\n",
      "so mach no.,M 0.95\n",
      "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n",
      "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n",
      "also Po-P=(1+k)*(1/2)*rho*C^2\n",
      "substitution yields,k= 0.2437\n",
      "so compressibility correction factor,k=0.2437\n"
     ]
    }
   ],
   "source": [
    "#cal of mach no,compressibility correction factor\n",
    "#intiation of all variables\n",
    "# Chapter 13\n",
    "import math\n",
    "print\"Example 13.3, Page:526  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n",
    "C=300.;#aircraft flying speed in m/s\n",
    "P=0.472*10**5;#altitude pressure in Pa\n",
    "rho=0.659;#density in kg/m^3\n",
    "y=1.4;#expansion constant\n",
    "R=287.;#gas constant in J/kg K\n",
    "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n",
    "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n",
    "Po=P+(1/2)*rho*C**2\n",
    "print(\"speed indicator reading shall be given by mach no.s\")\n",
    "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n",
    "print(\"using perfect gas equation,P=rho*R*T\")\n",
    "print(\"so T=P/(rho*R)in K\")\n",
    "T=P/(rho*R)\n",
    "M=C/math.sqrt(y*R*T)\n",
    "print(\"so mach no.,M\"),round(M,2)\n",
    "M=0.947;#approx.\n",
    "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n",
    "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n",
    "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n",
    "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n",
    "k=((Po-P)/((1./2.)*rho*C**2))-1.\n",
    "print(\"substitution yields,k=\"),round(k,4)\n",
    "print(\"so compressibility correction factor,k=0.2437\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 13.4;pg no: 527"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 13.4, Page:527  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n",
      "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n",
      "so M= 1.897\n",
      "so mach number,M=1.89\n"
     ]
    }
   ],
   "source": [
    "#cal of mach number\n",
    "#intiation of all variables\n",
    "# Chapter 13\n",
    "import math\n",
    "print\"Example 13.4, Page:527  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n",
    "Po=2;#total pressure in bar\n",
    "P=0.3;#static pressure in bar\n",
    "y=1.4;#expansion constant\n",
    "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n",
    "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n",
    "print(\"so M=\"),round(M,3)\n",
    "print(\"so mach number,M=1.89\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 13.5;pg no: 527"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 13.5, Page:527  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n",
      "actual static pressure(P)=1+0.3 in bar\n",
      "It is also given that,Po-P=0.6,\n",
      "so Po=P+0.6 in bar\n",
      "air velocity,ao=sqrt(y*R*To)in m/s\n",
      "density of air,rho_o=Po/(R*To)in \n",
      "considering air to be in-compressible,\n",
      "Po=P+rho_o*C^2/2\n",
      "so C in m/s= 235.13\n",
      "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n",
      "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n",
      "compressibility correction factor,k\n",
      "k=(M^2/4)+((2-y)/24)*M^4\n",
      "stagnation temperature,To/T=1+((y-1)/2)*M^2\n",
      "so T=To/(1+((y-1)/2)*M^2) in K\n",
      "density,rho=P/(R*T) in kg/m^3\n",
      "substituting Po-P=(1/2)*rho*C^2(1+k)\n",
      "C in m/s= 250.94\n",
      "so C=250.95 m/s\n"
     ]
    }
   ],
   "source": [
    "#cal of air stream velocity\n",
    "#intiation of all variables\n",
    "# Chapter 13\n",
    "import math\n",
    "print\"Example 13.5, Page:527  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n",
    "To=305.;#stagnation temperature of air stream in K\n",
    "y=1.4;#expansion constant\n",
    "R=287.;#gas constant in J/kg K\n",
    "print(\"actual static pressure(P)=1+0.3 in bar\")\n",
    "P=1.+0.3\n",
    "print(\"It is also given that,Po-P=0.6,\")\n",
    "print(\"so Po=P+0.6 in bar\")\n",
    "Po=P+0.6\n",
    "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n",
    "ao=math.sqrt(y*R*To)\n",
    "print(\"density of air,rho_o=Po/(R*To)in \")\n",
    "rho_o=Po*10.**5/(R*To)\n",
    "print(\"considering air to be in-compressible,\")\n",
    "print(\"Po=P+rho_o*C^2/2\")\n",
    "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n",
    "print(\"so C in m/s=\"),round(C,2)\n",
    "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n",
    "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n",
    "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n",
    "M=0.7567;#approx.\n",
    "print(\"compressibility correction factor,k\")\n",
    "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n",
    "k=(M**2/4.)+((2.-y)/24.)*M**4\n",
    "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n",
    "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n",
    "T=To/(1+((y-1)/2)*M**2)\n",
    "print(\"density,rho=P/(R*T) in kg/m^3\")\n",
    "rho=P*10**5/(R*T)\n",
    "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n",
    "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n",
    "print(\"C in m/s=\"),round(C,2)\n",
    "print(\"so C=250.95 m/s\")"
   ]
  }
 ],
 "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
}