summaryrefslogtreecommitdiff
path: root/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER08.ipynb
blob: 4edd77e8aedd001a1e6a8129b8cd2387b41ec090 (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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
{
 "metadata": {
  "name": "",
  "signature": "sha256:71725ceb4c0a99d9e0941e0534b253021a5547aae016d77b23760546a6ae5b10"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER08:NORMAL SHOCK WAVES AND RELATED TOPICS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E01 : Pg 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "import math \n",
      "from math import sqrt,pi\n",
      "R = 287.;\n",
      "gam = 1.4;\n",
      "V_inf = 250.;\n",
      "\n",
      "# (a)\n",
      "# At sea level\n",
      "T_inf = 288.;\n",
      "\n",
      "# the velocity of sound is given by\n",
      "a_inf = sqrt(gam*R*T_inf);\n",
      "\n",
      "# thus the mach number can be calculated as\n",
      "M_inf = V_inf/a_inf;\n",
      "\n",
      "print\"(a)The Mach number at sea level is:M_inf =\",M_inf\n",
      "\n",
      "# similarly for (b) and (c)\n",
      "# (b)\n",
      "# at 5km\n",
      "T_inf = 255.7;\n",
      "\n",
      "a_inf = sqrt(gam*R*T_inf);\n",
      "\n",
      "M_inf = V_inf/a_inf;\n",
      "\n",
      "print\"(b)The Mach number at 5 km is: M_inf = \",M_inf\n",
      "\n",
      "# (c)\n",
      "# at 10km\n",
      "T_inf = 223.3;\n",
      "\n",
      "a_inf = sqrt(gam*R*T_inf);\n",
      "\n",
      "M_inf = V_inf/a_inf;\n",
      "\n",
      "print\"(c)The Mach number at 10 km is: M_inf =\",M_inf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The Mach number at sea level is:M_inf = 0.73491785465\n",
        "(b)The Mach number at 5 km is: M_inf =  0.779955236945\n",
        "(c)The Mach number at 10 km is: M_inf = 0.834623638772\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E02 : Pg 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "import math \n",
      "T = 320;            # static temperature\n",
      "V = 1000;           # velocity\n",
      "gam = 1.4;          # ratio of specific heats\n",
      "R = 287;            # universal gas constant\n",
      "\n",
      "# the speed of sound is given by\n",
      "a = math.sqrt(gam*R*T);\n",
      "\n",
      "# the mach number can be calculated as\n",
      "M = V/a;\n",
      "\n",
      "print\"The Mach number is:\\nM =\",M"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Mach number is:\n",
        "M = 2.78881717658\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E03 : Pg 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "gam = 1.4;                    # ratio of specific heats\n",
      "\n",
      "# (a)\n",
      "M = 2;                        # Mach number\n",
      "\n",
      "# the ratio of kinetic energy to internal energy is given by\n",
      "ratio = gam*(gam-1)*M*M/2;\n",
      "\n",
      "print\"(a)The ratio of kinetic energy to internal energy is:\",ratio\n",
      "\n",
      "# similarly for (b)\n",
      "# (b)\n",
      "M = 20;\n",
      "\n",
      "ratio = gam*(gam-1)*M*M/2;\n",
      "\n",
      "print\"\\n(b)The ratio of kinetic energy to internal energy is:\",ratio"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The ratio of kinetic energy to internal energy is: 1.12\n",
        "\n",
        "(b)The ratio of kinetic energy to internal energy is: 112.0\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E04 : Pg 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "M = 2.79;        # Mach number\n",
      "T = 320;         # static temperature from ex. 7.3\n",
      "p = 1;           # static pressure in atm\n",
      "gam = 1.4;\n",
      "\n",
      "# from eq. (8.40)\n",
      "T0 = T*(1+((gam-1)/2*M*M));\n",
      "\n",
      "# from eq. (8.42)\n",
      "p0 = p*((1+((gam-1)/2*M*M))**(gam/(gam-1)));\n",
      "\n",
      "print\"The total temperature and pressure are:\\nT0 =\",T0,\"K\",\"\\nP0 =\",p0,\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total temperature and pressure are:\n",
        "T0 = 818.1824 K \n",
        "P0 = 26.7270201929 atm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E05 : Pg 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "import math \n",
      "M = 3.5;        # Mach number\n",
      "T = 180;         # static temperature from ex. 7.3\n",
      "p = 0.3;           # static pressure in atm\n",
      "gam = 1.4;\n",
      "R = 287;\n",
      "\n",
      "# from eq. (8.40)\n",
      "T0 = T*(1+((gam-1)/2*M*M));\n",
      "\n",
      "# from eq. (8.42)\n",
      "p0 = p*((1+((gam-1)/2*M*M))**(gam/(gam-1)));\n",
      "\n",
      "a = math.sqrt(gam*R*T);\n",
      "V = a*M;\n",
      "\n",
      "# the values at local sonic point are given by\n",
      "T_star = T0*2/(gam+1);\n",
      "a_star = math.sqrt(gam*R*T_star);\n",
      "M_star = V/a_star;\n",
      "\n",
      "print\"T0 =\",T0,\"K\",\"\\nP0 =\",p0,\"atm\",\"\\nT* =\",T_star,\"k\",\"\\na* =\",a_star,\"m/s\",\"\\nM* =\",M_star"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T0 = 621.0 K \n",
        "P0 = 22.8816894716 atm \n",
        "T* = 517.5 k \n",
        "a* = 455.995065763 m/s \n",
        "M* = 2.06418738617\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E06 : Pg 263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "p_inf = 1;\n",
      "p1 = 0.7545;\n",
      "M_inf = 0.6;\n",
      "gam = 1.4;\n",
      "\n",
      "# from eq. (8.42)\n",
      "p0_inf = p_inf*((1+((gam-1)/2*M_inf*M_inf))**(gam/(gam-1)));\n",
      "\n",
      "p0_1 = p0_inf;\n",
      "\n",
      "# from eq. (8.42)\n",
      "ratio = p0_1/p1;\n",
      "\n",
      "# from appendix A, for this ratio, the Mach number is\n",
      "M1 = 0.9;\n",
      "\n",
      "print\"The mach number at the given point is:\\nM1 =\",M1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mach number at the given point is:\n",
        "M1 = 0.9\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E07 : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "import math \n",
      "T_inf = 288;                                        # freestream temperature\n",
      "p_inf = 1;                                          # freestream pressure\n",
      "p1 = 0.7545;                                        # pressure at point 1\n",
      "M = 0.9;                                            # mach number at point 1\n",
      "gam = 1.4;                                          # ratio of specific heats\n",
      "R=1.;#\n",
      "# for isentropic flow, from eq. (7.32)\n",
      "T1 = T_inf*((p1/p_inf)**((gam-1)/gam));\n",
      "\n",
      "# the speed of sound at that point is thus\n",
      "a1 = math.sqrt(gam*R*T1);\n",
      "\n",
      "# thus, the velocity can be given as\n",
      "V1 = M*a1;\n",
      "\n",
      "print\"The velocity at the given point is:\\nV1 =\",V1,\"m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity at the given point is:\n",
        "V1 = 17.3590326624 m/s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E08 : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "import math \n",
      "u1 = 680;                            # velocity upstream of shock\n",
      "T1 = 288;                            # temperature upstream of shock\n",
      "p1 = 1;                              # pressure upstream of shock\n",
      "gam = 1.4;                           # ratio of specific heats\n",
      "R = 287;                             # universal gas constant\n",
      "\n",
      "# the speed of sound is given by\n",
      "a1 = math.sqrt(gam*R*T1)\n",
      "\n",
      "# thus the mach number is\n",
      "M1 = 2;\n",
      "\n",
      "# from Appendix B, for M = 2, the relations between pressure and temperature are given by\n",
      "pressure_ratio = 4.5;                # ratio of pressure accross shock\n",
      "temperature_ratio = 1.687;           # ratio of temperature accross shock\n",
      "M2 = 0.5774;                         # mach number downstream of shock\n",
      "\n",
      "# thus the values downstream of the shock can be calculated as\n",
      "p2 = pressure_ratio*p1;\n",
      "T2 = temperature_ratio*T1;\n",
      "a2 = math.sqrt(gam*R*T2);\n",
      "u2 = M2*a2;\n",
      "\n",
      "print\"p2 =\",p2,\"atm\",\"\\nT2 =\",T2,\"K\",\"\\nu2 =\",u2,\"m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "p2 = 4.5 atm \n",
        "T2 = 485.856 K \n",
        "u2 = 255.114727639 m/s\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E09 : Pg 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "p1 = 1;                                            # ambient pressure upstream of shock\n",
      "\n",
      "\n",
      "# (a)\n",
      "# for M = 2;\n",
      "p0_1 = 7.824*p1;                                   # total pressure upstream of shock\n",
      "pressure_ratio = 0.7209;                           # ratio of total pressure accross the shock\n",
      "p0_2 = pressure_ratio*p0_1;                        # total pressure downstream of shock\n",
      "\n",
      "# thus the total loss of pressure is given by\n",
      "pressure_loss = p0_1 - p0_2;\n",
      "\n",
      "print\"The total pressure loss is:\\n(a)P0_loss=\",pressure_loss,\"atm\"\n",
      "\n",
      "# similarly\n",
      "# (b)\n",
      "# for M = 4;\n",
      "p0_1 = 151.8*p1;\n",
      "pressure_ratio = 0.1388;\n",
      "p0_2 = pressure_ratio*p0_1;\n",
      "\n",
      "# thus the total loss of pressure is given by\n",
      "pressure_loss = p0_1 - p0_2;\n",
      "\n",
      "print\"\\n(b)P0_loss =\",pressure_loss,\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total pressure loss is:\n",
        "(a)P0_loss= 2.1836784 atm\n",
        "\n",
        "(b)P0_loss = 130.73016 atm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 : Pg 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "M_inf = 2.;                     # freestream mach number\n",
      "p_inf = 2.65e4;                # freestream pressure\n",
      "T_inf = 223.3;                 # freestream temperature\n",
      "\n",
      "# from Appendix A, for M = 2\n",
      "p0_inf = 7.824*p_inf;          # freestream total pressure\n",
      "T0_inf = 1.8*T_inf;            # freestream total temperature\n",
      "\n",
      "# from Appendix B, for M = 2\n",
      "p0_1 = 0.7209*p0_inf;          # total pressure downstream of the shock\n",
      "T0_1 = T0_inf;                 # total temperature accross the shock is conserved\n",
      "\n",
      "# since the flow downstream of the shock is isentropic\n",
      "p0_2 = p0_1;\n",
      "T0_2 = T0_1;\n",
      "\n",
      "# from Appendix A, for M = 0.2 at point 2\n",
      "p2 = p0_2/1.028;\n",
      "T2 = T0_2/1.008;\n",
      "\n",
      "p2_atm = p2/102000;\n",
      "\n",
      "print\"The pressure at point 2 is:p2 =\",p2_atm,\"atm\","
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure at point 2 is:p2 = 1.42546466011 atm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11 : Pg 273"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "M_inf = 10;                    # freestream mach number\n",
      "p_inf = 2.65e4;                # freestream pressure\n",
      "T_inf = 223.3;                 # freestream temperature\n",
      "\n",
      "# from Appendix A, for M = 2\n",
      "p0_inf = 0.4244e5*p_inf;       # freestream total pressure\n",
      "T0_inf = 21*T_inf;             # freestream total temperature\n",
      "\n",
      "# from Appendix B, for M = 2\n",
      "p0_1 = 0.003045*p0_inf;        # total pressure downstream of shock\n",
      "T0_1 = T0_inf;                 # total temperature downstream of shock is conserved\n",
      "\n",
      "# since the flow downstream of the shock is isentropic\n",
      "p0_2 = p0_1;\n",
      "T0_2 = T0_1;\n",
      "\n",
      "# from Appendix A, for M = 0.2 at point 2\n",
      "p2 = p0_2/1.028;\n",
      "T2 = T0_2/1.008;\n",
      "\n",
      "p2_atm = p2/102000;\n",
      "\n",
      "\n",
      "print\"The pressure at point 2 is: p2 =\",p2_atm,\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure at point 2 is: p2 = 32.6599307622 atm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13 : Pg 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "p1 = 4.66e4;                                # ambient pressure\n",
      "M = 8;                                      # mach number\n",
      "\n",
      "# from Appendix B, for M = 8\n",
      "p0_2 = 82.87*p1;                            # total pressure downstream of the shock\n",
      "\n",
      "# since the flow is isentropic downstream of the shock, total pressure is conserved\n",
      "ps_atm = p0_2/101300;                       # pressure at the stagnation point\n",
      "\n",
      "print\"The pressure at the nose is:\\np_s =\",ps_atm,\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure at the nose is:\n",
        "p_s = 38.1218361303 atm\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E14 : Pg 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressedin SI units\n",
      "import math \n",
      "p1 = 2527.3;                    # ambient pressure at the altitude of 25 km\n",
      "T1 = 216.66;                    # ambient temperature at the altitude of 25 km\n",
      "p0_1 = 38800;                   # total pressure\n",
      "gam = 1.4;                      # ratio of specific heats\n",
      "R = 287;                        # universal gas constant\n",
      "pressure_ratio = p0_1/p1;       # ratio of total to static pressure\n",
      "\n",
      "# for this value of pressure ratio, mach number is\n",
      "M1 = 3.4;\n",
      "\n",
      "# the speed of sound is given by\n",
      "a1 = math.sqrt(gam*R*T1)\n",
      "\n",
      "# thus the velocity can be calculated as\n",
      "V1 = M1*a1;\n",
      "\n",
      "print\"The Velocity of the airplane is:\\nV1 =\",V1,\"m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Velocity of the airplane is:\n",
        "V1 = 1003.16703558 m/s\n"
       ]
      }
     ],
     "prompt_number": 13
    }
   ],
   "metadata": {}
  }
 ]
}