Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics...

116
Scilab Code for Introduction to Fluid Mechanics by Fox and McDonald 1 Created by Eswar Prasad 4th Year Student B.E. (Mech. Engg.) National Institute of Technology, Trichy College Teacher and Reviewer Shivraj Deshmukh Ph.D student IIT Bombay 29 June 2010 1 Funded by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Textbook companion and scilab codes written in it can be downloaded from the website www.scilab.in

Transcript of Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics...

Page 1: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Scilab Code forIntroduction to Fluid Mechanics

by Fox and McDonald1

Created byEswar Prasad

4th Year StudentB.E. (Mech. Engg.)

National Institute of Technology, Trichy

College Teacher and ReviewerShivraj Deshmukh

Ph.D studentIIT Bombay

29 June 2010

1Funded by a grant from the National Mission on Education through ICT,http://spoken-tutorial.org/NMEICT-Intro. This Textbook companion and scilabcodes written in it can be downloaded from the website www.scilab.in

Page 2: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Book Details

Authors: Robert W. Fox and Alan T. McDonald

Title: Introduction to Fluid Mechanics

Publisher: John Wiley & Sons

Edition: 5th

Year: 2001

Place: New Delhi

ISBN: 9971-51-355-2

1

Page 3: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Contents

List of Scilab Code 4

1 Introduction 101.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2 Fundamental Concepts 122.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Fluid Statics 143.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4 Basic Equations in Integral form for a Control Volume 234.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5 Introducton to Differential Analysis of Fluid Motion 385.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6 Incompressible Inviscid Flow 426.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

7 Dimensional Analysis and Simlitude 497.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

2

Page 4: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

8 Internal Incompressible Viscous Flow 558.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

9 External Incompressible Viscous Flow 669.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

10 Fluid Machinery 7510.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7510.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

11 Introduction to Compressible Flow 9511.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9511.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

12 Steady One-Dimensional Compressible Flow 10012.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10012.2 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

3

Page 5: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

List of Scilab Code

1.01 1.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.01d 1.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 101.02 1.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.02d 1.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 112.02 2.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.02d 2.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 133.01 3.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.01d 3.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 153.03 3.03.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.03d 3.03-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 173.04 3.04.sci . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.04d 3.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 183.05 3.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.05d 3.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 203.06 3.06.sci . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.06d 3.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 203.07 3.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.07d 3.07-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 214.01 4.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.01d 4.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 244.02 4.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244.02d 4.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 254.03 4.03.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.03d 4.03-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 264.04 4.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.04d 4.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 274.05 4.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.05d 4.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4

Page 6: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

4.06 4.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.06d 4.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 284.07 4.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.07d 4.07-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 294.08 4.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.08d 4.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 304.09 4.09.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.09d 4.09-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 304.10 4.10.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.10d 4.10-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 314.11 4.11.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.11d 4.11-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 324.12 4.12.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.12d 4.12-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 344.14 This is some example . . . . . . . . . . . . . . . . . . . . . 344.14d 4.14-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 354.16 4.16.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354.16d 4.16-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 364.17 4.17.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364.17d 4.17-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 365.02 5.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385.02d 5.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 385.07 5.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395.07d 5.07d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395.08 5.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395.08d 5.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 405.09 5.09.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415.09d 5.09-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 416.01 6.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426.01d 6.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 426.02 6.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436.02d 6.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 436.03 6.03.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436.03d 6.03-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 446.04 6.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446.04d 6.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 446.05 6.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456.05d 6.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5

Page 7: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

6.06 6.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456.06d 6.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 466.08 6.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466.08d 6.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 476.09 6.09.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476.09d 6.09-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 487.04 7.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497.04d 7.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 507.05 7.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507.05d 7.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 517.06 7.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527.06d 7.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 538.01 8.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558.01d 8.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 568.02 8.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568.02d 8.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 578.04 8.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578.04d 8.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 578.05 8.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588.05d 8.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 588.06 8.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598.06d 8.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 598.07 8.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608.07d 8.07-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 608.08 8.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608.08d 8.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 618.09 8.09.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628.09d 8.09-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 628.10 8.10.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638.10d 8.10-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 638.11 8.11.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648.11d 8.11-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 649.01 9.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669.01d 9.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 669.04 9.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679.04d 9.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 689.05 9.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689.05d 9.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 69

6

Page 8: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

9.06 9.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699.06d 9.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 709.07 9.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709.07d 9.07-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 709.08 9.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719.08d 9.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 729.09 9.09.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729.09d 9.09-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . . 7410.01 10.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7510.01d 10.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 7610.02 10.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7610.02d 10.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 7710.03 10.03.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7710.03d 10.03-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 7810.06 10.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7910.06d 10.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 8010.07 10.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8110.07d 10.07-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 8110.08 10.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8210.08d 10.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 8510.11 10.11.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8610.11d 10.11-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 8810.12 10.12.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9110.12d 10.12-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 9210.14 10.14.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9210.14d 10.14-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 9310.16 10.16.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9310.16d 10.16-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 9411.01 11.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9511.01d 11.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 9611.03 11.03.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9611.03d 11.03-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 9711.04 11.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9711.04d 11.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 9912.01 12.01.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10012.01d 12.01-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 10112.02 12.02.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10212.02d 12.02-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 103

7

Page 9: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

12.03 12.03.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10312.03d 12.03-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 10412.04 12.04.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10412.04d 12.04-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 10512.05 12.05.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10612.05d 12.05-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 10612.06 12.06.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10712.06d 12.06-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 10812.07 12.07.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10812.07d 12.07-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 10912.08 12.08.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11012.08d 12.08-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 11112.09 12.09.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11112.09d 12.09-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 11312.10 12.10.sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11312.10d 12.10-data.sci . . . . . . . . . . . . . . . . . . . . . . . . . 115

8

Page 10: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

List of Figures

3.1 Output graph of S 3.01 . . . . . . . . . . . . . . . . . . . . . 16

4.1 Output graph of S 4.11 . . . . . . . . . . . . . . . . . . . . . 33

7.1 Output graph of S 7.05 . . . . . . . . . . . . . . . . . . . . . 52

9.1 Output graph of S 9.08 . . . . . . . . . . . . . . . . . . . . . 73

10.1 Output graph of S 10.03 . . . . . . . . . . . . . . . . . . . . 7910.2 Output graph of S 10.07 . . . . . . . . . . . . . . . . . . . . 8310.3 Output graph-1 of S 10.08 . . . . . . . . . . . . . . . . . . . 8610.4 Output graph-2 of S 10.08 . . . . . . . . . . . . . . . . . . . 8710.5 Output graph-1 of S 10.11 . . . . . . . . . . . . . . . . . . . 8910.6 Output graph-2 of S 10.11 . . . . . . . . . . . . . . . . . . . 8910.7 Output graph-3 of S 10.11 . . . . . . . . . . . . . . . . . . . 90

11.1 Output graph of S 11.03 . . . . . . . . . . . . . . . . . . . . 98

9

Page 11: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 1

Introduction

1.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

1.2 Scilab Code

Example 1.01 1.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 1.01−data . s c i ’3 exec ( f i l ename )4 / / H e a t a d d e d d u r i n g t h e p r o c e s s ( i n k J ) :

5 Q12=m∗cp ∗(T2−T1)6 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nHeat added during the proce s s : %f kJ\n\n” ,

Q12/1000)

Example 1.01d 1.01-data.sci

1 / / M a s s o f o x y g e n p r e s e n t ( i n k g ) :

2 m=0.95;

10

Page 12: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

3 / / I n i t i a l t e m p e r a t u r ( i n K ) :

4 T1=300;5 / / F i n a l t e m p e r a t u r e o f o x y g e n ( i n K ) :

6 T2=900;7 / / P r e s s u r e o f o x y g e n ( i n k P a ) :

8 p=150;9 / / S p e c i f i c h e a t a t c o n s t a n t p r e s s u r e ( i n J / k g −K ) :

10 cp =909.4;

Example 1.02 1.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 1.02−data . s c i ’3 exec ( f i l ename )4 / / S p e e d a t w h i c h t h e b a l l h i t s t h e g r o u n d ( i n m/ s e c ) :

5 V=sqrt (m∗g/k∗(1−%eˆ(2∗k/m∗(−y0 ) ) ) )6 / / T e r m i n a l s p e e d ( i n m/ s e c ) :

7 Vt=sqrt (m∗g/k )8 / / R a t i o o f a c t u a l s p e e d t o t h e t e r m i n a l s p e e d :

9 r=V/Vt ;10 printf ( ”\n\nRESULTS\n\n” )11 printf ( ”\n\nSpeed at which the b a l l h i t s he ground : %f

m/ sec \n\n” ,V)12 printf ( ”\n\nRatio o f a c tua l speed to the te rmina l speed

: %f\n\n” , r )

Example 1.02d 1.02-data.sci

1 / / M a s s o f b a l l ( i n k g ) :

2 m=0.2;3 / / H e i g h t f o m w h i c h b a l l i s d r o p p e d ( i n m ) :

4 y0=500;5 / / V a l u e o f k :

6 k=2∗10ˆ−4;7 / / A c c l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

8 g =9.81;

11

Page 13: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 2

Fundamental Concepts

2.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

2.2 Scilab Code

Example 2.02 2.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 2 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 2.02−data . s c i ’3 exec ( f i l ename )4

5 / / V i s c o s i t y i n u n i t s o f l b f − s / f t ˆ 2 :

6 u1=u /100/454/32 .2∗30 .57 / / K i n e m a t i c v i s c o s i t y ( i n m/ s e c ˆ 2 ) :

8 v=u1/SG/d ∗ ( 0 . 305 ) ˆ29 / / S h e a r s t r e s s o n t h e u p p e r p l a t e ( l b f / f t ˆ 2 ) :

10 tu=u1∗U/D∗100011 / / S h e a r s t r e s s o n t h e l o w e r p l a t e ( i n Pa )

12 t l=tu ∗4 .45/0 .305ˆ213 printf ( ”\n\nRESULTS\n\n” )

12

Page 14: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

14 printf ( ”\n\ nVi s co s i ty in un i t s o f lb f−s / f t ˆ2 : %1. 8 f$ lb f−s / f t ˆ2\n\n” , u1 )

15 printf ( ”\n\nKinematic v i s c o s i t y : %1. 8 f m/ sec ˆ2\n\n” , v )16 printf ( ”\n\nShear s t r e s on the upeer p l a t e : %f l b f / f t

ˆ2\n\n” , tu )17 printf ( ”\n\nSear s t r e s s on the lower p l a t e : %f Pa\n\n” ,

t l )

Example 2.02d 2.02-data.sci

1 / / M a s s o f o x y g e n p r e s e n t ( i n k g ) :

2 m=0.95;3 / / I n i t i a l t e m p e r a t u r ( i n K ) :

4 T1=300;5 / / F i n a l t e m p e r a t u r e o f o x y g e n ( i n K ) :

6 T2=900;7 / / P r e s s u r e o f o x y g e n ( i n k P a ) :

8 p=150;9 / / S p e c i f i c h e a t a t c o n s t a n t p r e s s u r e ( i n J / k g −K ) :

10 cp =909.4;

13

Page 15: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 3

Fluid Statics

3.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

When we execute S 3.01, we get Fig. 3.1.

3.2 Scilab Code

Example 3.01 3.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 3 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 3.01−data . s c i ’3 exec ( f i l ename )4 / / T u b e d i a m e t e r ( i n mm ) :

5 D=1:25;6 D1=D/10007 [m n]= s ize (D1)8 for i =1:n9 / / C h a n g e i n l i q u i d l e v e l f o r w a t e r ( i n mm ) :

10 dhw( i )=4∗STw∗ cosd ( thetaw ) /dw/g/D1( i ) ;11 / / C h a n g e i n l i q u i d l e v e l f o r m e r c u r y ( i n mm ) :

12 dhm( i )=4∗STm∗ cosd ( thetam ) /dm/g/D1( i ) ;

14

Page 16: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

13 end ;14

15 / / P l o t t i n g t u b e d a i m e t e r a n d w a t e r l e v e l :

16 plot (D1∗1000 ,dhw , ’−o ’ )17 / / P l o t t i n g t u b e d a i m e t e r a n d m e r c u r y l e v e l :

18 plot (D1∗1000 ,dhm, ’−∗ ’ )19 l egend ( [ ’ Water ’ ; ’ Mercury ’ ] ) ;20 xt i t le ( ’ Liquid l e v e l vs Tube diameter ’ , ’ L iquid l e v e l ( in

mm) ’ , ’Tube diameter ( in mm) ’ )

Example 3.01d 3.01-data.sci

1 / / S u r f a c e t e n s i o n o f w a t e r ( i n mN /m ) :

2 STw=72.8∗10ˆ−3;3 / / S u r f a c e T e n s i o n o f m e r c u r y ( i n mN /m ) :

4 STm=375∗10ˆ−3;5 / / C o n t a c t a n g l e f o r w a t e r :

6 thetaw =0;7 / / C O n t a c t a n g l e f o r m e r c u r y :

8 thetam =140;9 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

10 dw=1;11 / / D e n s i t y o f m e r c u r y ( i n k g /m ˆ 3 ) :

12 dm=13.6;13 / / A c c e l e r a t i o n d e t o g r a v i t y ( i n m/ s e c ) :

14 g =9.81;

Example 3.03 3.03.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 3 . 0 3 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 3.03−data . s c i ’3 exec ( f i l ename )4 / / P r e s s u r e d i f f e r e n c e ( i n l b f / i n ˆ 2 ) :

5 dp=g∗d∗(−d1+SGm∗d2−SGo∗d3+SGm∗d4+d5 ) /12/1446 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nPressure d i f f e r e n c e between A and B: %f l b f

/ in ˆ2\n\n” ,dp)

15

Page 17: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 3.1: Output graph of S 3.01

16

Page 18: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 3.03d 3.03-data.sci

1 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

2 g =32.2;3 / / S p e c i f i c g r a v i t y o f m e r c u r y :

4 SGm=13.6;5 / / S p e c i f i c g r a v i t y o f o i l :

6 SGo=0.88;7 / / S p e c i f i c g r a v i t y o f w a t e r :

8 SGw=1;9 / / D e n s i t y o f w a t e r ( i n s l u g / f t ˆ 3 ) :

10 d=1.94;11 / / H e i g h t s o f l i q u i d i n v a r i o u s t u b e s ( i n i n c h e s ) :

12 d1=10;13 d2=3;14 d3=4;15 d4=5;16 d5=8;

Example 3.04 3.04.sci

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 3 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 3.04−data . s c i ’3 exec ( f i l ename )4 / / A s s u m i n g t e m p e r a t u r e v a r i e s l i n e a r l y w i t h a l t i t u d e :

5 / / T e m p e r a t u r e g r a d i e n t ( i n F / f t ) :

6 m=(T1−T2) /( z2−z1 )7 / / V a l u e o f g / ( m ∗R ) :

8 v=g/m/R/32 .29 / / P r e s s u r e a t V a i l P a s s ( i n i n c h e s o f Hg ) :

10 p12=p1 ∗ ( (T2+460) /(T1+460) ) ˆv11 / / P e r c e n t a g e c h a n g e i n d e n s i t y :

12 pc1=(p12/p1∗(T1+460) /(T2+460)−1)∗10013 / / A s s u m i n g d e n s i t y i s c o n s t a n t :

14 / / P r e s s u r e a t V a i l P a s s ( i n i n c h e s o f Hg ) :

15 p22=p1∗(1−(g∗( z2−z1 ) /(R∗32 .2 ) /(T1+460) ) )

17

Page 19: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

16 / / P e r c e n t a g e c h a n g e i n d e n s i t y :

17 pc2=0;18 / / A s s u m i n g t e m p e r a t u r e i s c o n s t a n t :

19 / / P r e s s u r e a t V a i l P a s s ( i n i n c h e s o f Hg ) :

20 p32=p1∗%eˆ(−g∗( z2−z1 ) /(R∗32 .2 ) /(T2+460) )21 / / P e r c e n t a g e c h a n g e i n d e n s i t y :

22 pc3=(p32/p1∗(T1+460) /(T1+460)−1)∗10023 / / F o r a n a d i a b a t i c a t m o s p h e r e :

24 p42=p1∗((62+460) /(80+460) ) ˆ( k /(k−1) )25 / / P e r c e n t a g e c h a n g e i n d e n s i t y :

26 pc4=(p42/p1∗(T1+460) /(T2+460)−1)∗10027 printf ( ”\n\nRESULTS\n\n” )28 printf ( ”\n\n1 ) I f temperature v a r i e s l i n e a r l y with

a l t i t u d e \n\n” )29 printf ( ”\n\n\ tAtmospheric p r e s su r e at Vai l Pass : %f

inche s o f Hg\n\n” , p12 )30 printf ( ”\n\n\ tPercentage change in dens i ty wrt Denver :

%f percent \n\n” , pc1 )31 printf ( ”\n\n2 ) I f dens i ty i s constant \n\n” )32 printf ( ”\n\n\ tAtmospheric p r e s su r e at Vai l Pass : %f

inche s o f Hg\n\n” , p22 )33 printf ( ”\n\n\ tPercentage change in dens i ty wrt Denver :

%f percent \n\n” , pc2 )34 printf ( ”\n\n3 ) I f temperature i s constant \n\n” )35 printf ( ”\n\n\ tAtmospheric p r e s su r e at Vai l Pass : %f

inche s o f Hg\n\n” , p32 )36 printf ( ”\n\n\ tPercentage change in dens i ty wrt Denver :

%f percent \n\n” , pc3 )37 printf ( ”\n\n4 ) For an a d i a b a t i c atmosphere\n\n” )38 printf ( ”\n\n\ tAtmospheric p r e s su r e at Vai l Pass : %f

inche s o f Hg\n\n” , p42 )39 printf ( ”\n\n\ tPercentage change in dens i ty wrt Denver :

%f percent \n\n” , pc4 )

Example 3.04d 3.04-data.sci

1 / / E l e v a t i o n o f D e n v e r ( i n f t ) :

2 z1 =5280;

18

Page 20: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

3 / / P r e s s u r e a t D e n v e r ( i n mm o f Hg ) :

4 p1 =24.8 ;5 / / T e m p e r a t u r e a t D e n v e r ( i n F ) :

6 T1=80;7 / / E l e v a t i o n a t V a i l P a s s ( i n f t ) :

8 z2 =10600;9 / / T e m p e r a t u r e a t V s i l P a s s ( i n F ) :

10 T2=62;11 / / V a l u e o f R i n f t − l b f / l bm −R ) :

12 R=53.3;13 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

14 g =32.2;15 / / V a l u e o f a d i a b a t i c c o n s t a n t :

16 k =1.4 ;

Example 3.05 3.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 3 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 3.05−data . s c i ’3 exec ( f i l ename )4 / / N e t f o r c e o n t h e g a t e ( i n kN ) :

5 Fr=d∗g∗w∗(D∗L+Lˆ2/2∗ s ind ( theta ) )6 / / C e n t r e o f p r e s s u r e :

7 / / C a l c u l a t i o n f o r y c o o r d i n a t e :

8 yc=D/ s ind ( theta )+L/29 / / A r e a ( i n m ˆ 2 ) :

10 A=L∗w11 / / M o m e n t o f i n e r t i a o f r e c t a n g u l a r g a t e ( i n m ˆ 4 ) :

12 Ixx=w∗Lˆ3/1213 / / y c o o r d i n a t e ( i n m ) :

14 y=yc+Ixx /A/yc15 / / C a l c u l a t i o n f o r x c o o r d i n a t e :

16 Ixy=017 xc=w/218 / / x c o o r d i n a t e ( i n m ) :

19 x=xc+Ixy /A/xc20 printf ( ”\n\nRESULTS\n\n” )21 printf ( ”\n\nNet f o r c e on the gate : %f kN\n\n” , Fr /1000)

19

Page 21: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

22 printf ( ”\n\nCoordinate o f c en t r e o f p r e s su r e : (%0. 1 f ,%0. 1 f )\n\n” ,x , y )

Example 3.05d 3.05-data.sci

1 / / L e n g t h o f g a t e ( i n m ) :

2 L=4;3 / / W i d t h o f g a t e ( i n m ) :

4 w=5;5 / / D e p t h o f g a t e u n d e r w a t e r ( i n m ) :

6 D=2;7 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 :

8 d=999;9 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

10 g =9.81;11 / / A n g l e o f g a t e w i t h h o r i z o n t a l :

12 theta =30;

Example 3.06 3.06.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 3 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 3.06−data . s c i ’3 exec ( f i l ename )4 / / F o r c e r e q u i r e d t o k e e p t h e d o o r s h u t ( i n l b f ) :

5 function y=f ( z ) , y=b/L∗p0∗z+d∗b/L∗(L∗z−z ˆ2) , endfunction6 Ft=intg (0 ,L , f )7 printf ( ”\n\nRESULTS\n\n” )8 printf ( ”\n\nForce r equ i r ed to kep the door shut : %. 1 f

l b f \n\n” , Ft )

Example 3.06d 3.06-data.sci

1 / / P r e s s u r e a p l l i e d o n t h e d o o r ( i n p s f g ) :

2 p0=100;3 / / L e n g t h o f d o o r ( i n f e e t ) :

4 L=3;5 / / B r e a d t h o f t h e d o o r ( i n f e e t ) :

20

Page 22: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

6 b=2;7 / / D e n s i t y o f l i q i u i d ( i n l b f / f t ˆ 3 ) :

8 d=100;

Example 3.07 3.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 3 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 3.07−data . s c i ’3 exec ( f i l ename )4 / / H o r i z o n t a l c o m p o n e n t o f r e s u l t a n t f o r c e ( i n kN ) :

5 Frh=0.5∗d∗g∗w∗Dˆ26 / / L i n e o f a c t i o n o f F r h ( i n m ) :

7 y1=0.5∗D+w∗Dˆ3/12/(0 .5∗D) /(w∗D)8 / / V e r t i c a l c o m p o n e n t o f r e s u l t a n t f o r c e ( i n kN ) :

9 function y=q ( x ) , y=d∗g∗w∗(D−sqrt ( a∗x ) ) , endfunction10 Frv=intg (0 ,Dˆ2/a , q )11 / / L i n e o f a c i o n o f F r v ( i n m ) :

12 function k=f ( x ) , k=d∗g∗w/Frv∗x∗(D−sqrt ( a∗x ) ) ,endfunction

13 xa=intg (0 ,Dˆ2/a , f )14 / / F o r c e r e q u i r e d t o k e e p t h e g a t e i n e q u i l i b r i u m ( i n kN )

:

15 Fa=1/ l ∗( xa∗Frv+(D−y1 )∗Frh )16 printf ( ”\n\nRESULTS\n\n” )17 printf ( ”\n\nForce r equ i r ed to keep the gate at

equ i l i b r i um : %f kN\n\n” ,Fa/1000)

Example 3.07d 3.07-data.sci

1 / / W i d t h o f g a t e ( i n m ) :

2 w=5;3 / / D e p t h o f w a t e r ( i n m ) :

4 D=4;5 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) ;

6 d=999;7 / / A c c e l r a t i o n d e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

8 g =9.81;9 / / V a l u e o f a ( i n m ) :

21

Page 23: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

10 a=4;11 / / P o i n t w h e r e f o r c e a c t s ( i n m ) :

12 l =5;

22

Page 24: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 4

Basic Equations in Integralform for a Control Volume

4.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

When we execute S 4.11, we get Fig. 4.1.

4.2 Scilab Code

Example 4.01 4.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.01−data . s c i ’3 exec ( f i l ename )4 / / I f I = i n t e g r a l o f ( pV . dA ) :

5 / / F o r s y s t e m : I c s = I A 1 + I A 2 + I A 3 + I A 4 .

6 / / F o r a r e a 1

7 IA1=−d∗V1∗A18 / / F o r a r e a 3 : I A 2 =d ∗ V3 ∗ A3=m3

9 IA3=m310 / / F o r a r e a 4 : I A 4 =−d ∗ V4 ∗ A4=−d ∗ Q4

23

Page 25: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 IA4=−d∗Q412 / / F o r a r e a 2 :

13 IA2=−IA1−IA3−IA414 / / V e l o c i t y a t s e c t i o n 2 ( i n f t / s e c ) :

15 V2=IA2/d/A216 / / V2 i s i n t h e n e g a t i v e y d i r e c t i o n

17 printf ( ”\n\nRESULTS\n\n” )18 printf ( ”\n\ nVeloc i ty at s e c t i o n 2 : −%. 0 f j f t / s ec \n\n” ,

V2)

Example 4.01d 4.01-data.sci

1 / / A r e a o f 1 ( i n f t ˆ 2 ) :

2 A1=0.2;3 / / A r e a o f 2 ( i n f t ˆ 2 ) :

4 A2=0.5;5 / / A r e a o f 3 ( i n f t ˆ 2 ) :

6 A3=0.4;7 / / A r e a o f 4 ( i n f t ˆ 2 ) :

8 A4=0.4;9 / / D e n s i t y o f w a t e r ( i n s l u g / f t ˆ 3 ) :

10 d=1.94;11 / / M a s s f l o w r a t e o u t o f s e c t i o n 3 ( i n s l u g / s e c ) :

12 m3=3.88;13 / / V o l m e f l o w r a t e i n s e c t i o n 4 ( i n f t ˆ 3 / s e c ) :

14 Q4=1;15 / / V e l o c i t y a t 1 ( i n f t / s e c ) :

16 V1=10;

Example 4.02 4.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.02−data . s c i ’3 exec ( f i l ename )4 / / I f I = i n t e g r a l o f ( pV . dA ) :

5 / / F o r s y s t e m : I C S = I a b + I b c + I c d + I d a

6 / / B u t I C S =0

7

24

Page 26: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

8 / / F o r A a b :

9 function p=f ( y ) ,p=−d∗U∗w∗y ˆ0 , endfunction10 IAab=intg (0 , t , f )11

12 / / F o r A c d :

13 function q=g ( y ) , q=d∗U∗w∗(2∗y/t−(y/ t ) ˆ2) , endfunction14 IAcd=intg (0 , t , g )15

16 / / M a s s f l o w r a t e a c r o s s s u r f a c e b c ( i n k g / s e c ) :

17 mbc=(−IAab−IAcd ) /100018 printf ( ”\n\nRESULTS\n\n” )19 printf ( ”\n\nMass f low ra t e a c r o s s s u r f a c e bc : %. 4 f kg/

sec \n\n” ,mbc)

Example 4.02d 4.02-data.sci

1 / / F l o w v e l o c i t y a h e a d o f t h e p l a t e ( i n m/ s e c ) :

2 U=30;3 / / B o u n d a r y l a y e r t c k n e s s a t l o c a t i o n d ( i n mm ) :

4 t =5;5 / / D e n s i t y o f f l u i d a i r ( i n k /m ˆ 3 ) :

6 d=1.24;7 / / P l a t e w d t h p e r p e n d i c u l a r t o t h e p l a t e ( i n m ) :

8 w=0.6;

Example 4.03 4.03.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 3 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.03−data . s c i ’3 exec ( f i l ename )4 / / R a t e o f c h a n g e o f a i r d e n s i t y i n t a n k ( i n ( k g /m ˆ 3 ) / s ) :

5 r=−d∗v∗A/V/10ˆ66 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nRate o f change o f a i r dens i ty in tank : %. 3 f

kg/mˆ3\n\n” , r )8 printf ( ”\n\nThe dens i ty de c r ea s e s as i s i n d i c a t e d by

the negat ive s i gn \n\n” )

25

Page 27: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 4.03d 4.03-data.sci

1 / / V o l u m e o f t a n k ( i n m ˆ 3 ) :

2 V=0.05;3 / / P r e s s u r e o f a i r ( I n k P a ) :

4 p=800;5 / / T e m p e r a t u r e o f t a n k ( i n C ) :

6 T=15;7 / / V e l o c i t y o f l e a v i g a i r ( i n m/ s e c ) :

8 v=311;9 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

10 d=6.13;11 / / A r e a o f v a l v e e x i t ( i n mm ˆ 2 ) :

12 A=65;

Example 4.04 4.04.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.04−data . s c i ’3 exec ( f i l ename )4 / / 1 ) C o n t r o l V o l u m e s e l e c t e d s o t h a t a r e a o f l e f t

s u r f a c e i s e q u a l t o t h e a r e a o f t h e r i g h t s u r f a c e

5 u1=15;6 / / F o r c e o f s u p p o r t o n c o n t r o l v o l u m ( i n kN ) :

7 function y=f (A) , y=−u1∗d∗V, endfunction8 Rx1=intg ( 0 , 0 . 0 1 , f )9 / / H o r i z o n t a l f o r c e o n s u p p o r t ( i n kN ) :

10 Kx=−Rx111 / / 2 ) C o n t r o l v o l u m e s a r e s e l e c t e d d o t h a t t h e a r e a o f

t h e l e f t a n d r i g h t s u r f a c e s a r e e q u i a l t o t h e a r e a

o f t h e p l a t e

12

13 function z=g (A) , z=−u1∗d∗V, endfunction14 Fsx=intg ( 0 , 0 . 0 1 , g )15 / / N e t f o r c e o n p l a t e : F x =0=−Bx − p a ∗ Ap+Rx

16 / / Rx= p a ∗ Ap+ Bx

17 / / F r o m t h e a b o v e , i t i s o b t a i n e d t h a t :

18 Rx2=−2.25

26

Page 28: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

19 / / H o r i z o n t a l f o r c e o n s u p p o r t ( i n kN ) :

20 Kx2=−Rx221 printf ( ”\n\nRESULTS\n\n” )22 printf ( ”\n\nHor izonta l f o r c e on support : %. 3 f kN\n\n” ,

Kx/1000)

Example 4.04d 4.04-data.sci

1 / / V e l o c i t y o f w a t e r l e a v i n g t h e n o z l e ( i n m/ s e c ) :

2 V=15;3 / / A r e a o f n o z z l e ( i n m ˆ 2 ) :

4 A=0.01;5 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

6 d=999;

Example 4.05 4.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.05−data . s c i ’3 exec ( f i l ename )4 / / W e i g h t o f w a t e r i n t h e t a n k ( i n l b f ) :

5 d1 =62.4 ;6 WH2O=d1∗A∗h7 v=−5;8 / / T o t a l b o d y f o r c e i n n e g a t i v e y d i r e c t i o n ( l b f ) :

9 function y=f (A) , y=−v∗d2∗V1 , endfunction10 F=intg (0 ,A1 , f )11 / / F o r c e o f s c a l e o n c o n t r o l v o l u m e ( i n kN ) :

12 Ry=W+WH2O−F13 printf ( ”\n\nRESULTS\n\n” )14 printf ( ”\n\nSca le Reading : %. 3 f l b f \n\n” ,Ry)

Example 4.05d 4.05-data.sci

1 / / H e i g h t o f t h e c o n t a i n e r ( i n f t ) :

2 l =2;3 / / A r e a o f c r o s s s e c t i o n ( i n f t ˆ 2 ) :

27

Page 29: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

4 A=1;5 / / W e i g h t o f c o n t a i n e r ( i n l b f ) :

6 W=5;7 / / W a t e r d e p t h ( i n f t ) :

8 h=1.9;9 / / A r e a o f o p e n i n g 1 ( i n f t ˆ 2 ) :

10 A1=0.1;11 / / V e l o c i t y a t o p e n i n g 1 ( i n f t / s e c ) :

12 V1=−5;13 / / A r e a o f o p e n i n g 2 ( i n f t ˆ 2 ) :

14 A2=0.1;15 / / A r e a o f o p e n i n g 1 ( i n f t ˆ 2 ) :

16 A3=0.1;17 / / D e n s i t y o f w a t e r ( i n s l u g / f ˆ 3 ) :

18 d2 =1.94;

Example 4.06 4.06.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.06−data . s c i ’3 exec ( f i l ename )4 / / X− c o m p o n e n t o f r e a c t i o n f o r c e p e r u n i t w i d t h o f t h e

g a t e ( i n N /m ) :

5 Rxw=(d∗(V2ˆ2∗D2−V1ˆ2∗D1) )−(d∗g /2∗(D1ˆ2−D2ˆ2) )6 / / H o r i z o n t a l f o r c e e x e r t e d p e r u n t w i d t h o n t h e g a t e ( i n

N /m ) :

7 Kxw=−Rxw8 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\nHor izonta l f o r c e exer ted per unt width on

the gate : %. 3 f kN/m\n\n” ,Kxw/1000)

Example 4.06d 4.06-data.sci

1 / / D i a m e t e r o f c h a n n e l ( i n m ) :

2 D1=1.5;3 / / V e l c i t y o f f l o w i n c h a n n e l ( i n m/ s e c ) :

4 V1=0.2;5 / / D i a m e t e r a t s e c t i o n 2 ( i n m ) :

28

Page 30: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

6 D2=0.0563;7 / / V e l o c i t y a s e c t i o n 2 ( i n m/ s e c ) :

8 V2=5.33;9 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

10 d=999;11 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c 2 ) :

12 g =9.81;

Example 4.07 4.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.07−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y a t s e c t i o n 1 ( i n m/ s e c ) :

5 V1=V2∗A2/A16 / / G a u g e p r e s s u r e ( i n k P a ) :

7 p1g=p1−patm8 u1=V1 ; u2=−V2 ;9 / / R e a c t i o n f o r c e c o m p o n e n t i n t h e x d i r e c t i o n ( i n N ) :

10 Rx=−p1g∗A1−u1∗d∗V1∗A111 / / R e a c t i o n f o r c e c o m p o n e n t i n t h e y d i r e c t i o n ( i n N ) :

12 Ry=u2∗d∗V2∗A213 printf ( ”\n\nRESULTS\n\n” )14 printf ( ”\n\nForce to hold elbow act ing to the l e f t : %. 3

f kN\n\n” ,Rx/1000)15 printf ( ”\n\nForce to hold elbow act ing downwards : %. 3 f

N\n\n” ,Ry)

Example 4.07d 4.07-data.sci

1 / / P r e s s u r e a t i n l e t t o t h e e l b o w ( i n N /m ˆ 2 ) :

2 p1 =2.21∗10ˆ5;3 / / A r e a o f c r o s s s e c t i o n ( i n m ˆ 2 ) :

4 A1=0.01;5 / / V e l o c i t y a t s e c t o n 2 ( i n m/ s e c ) :

6 V2=16;7 / / A r e a o f c r o s s s e c t i o n o f s e c t i o n 2 ( i n m ˆ 2 ) :

8 A2=0.0025;

29

Page 31: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

9 / / A t m o s p h e r i c p r e s s u r e ( i n k P a ) :

10 patm=1.012∗10ˆ5;

Example 4.08 4.08.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.08−data . s c i ’3 exec ( f i l ename )4 / / T e n s i o n r e q u i r e d t o p u l l t h e b e l t ( i n l b f ) :

5 T=Vbelt∗m/32.26 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nTension r equ i r ed to p u l l the b e l t : %. 3 f l b f

\n\n” ,T)

Example 4.08d 4.08-data.sci

1 / / V e l o c i t y o f c o n v e y o r b e l t ( i n f t / s e c ) :

2 Vbelt =3;3 / / V e l o c i t y o f s a n d a l l i n g o n t o b e l t ( i n f t / s e c ) :

4 Vsand=5;5 / / F l o w r a t e ( i n l b m / s e c ) :

6 m=500;

Example 4.09 4.09.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 0 9 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.09−data . s c i ’3 exec ( f i l ename )4 / / M i n i m u m g a u g e p r e s s u r e r e q u i r e d ( i n l b f / i n ˆ 2 ) :

5 pg=8/%piˆ2∗d/D1ˆ4∗Qˆ2∗ ( (D1/D2) ˆ4−1)∗1446 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”Minimum gauge p r e s su r e r equ i r ed : %. 3 f l b f / in ˆ2”

, pg )

Example 4.09d 4.09-data.sci

1 / / N o z z l e i n l e t d i a m e t e r ( i n i n c h e s s ) :

30

Page 32: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

2 D1=3;3 / / N o z z l e e x i t d i a m e t e r ( i n i n c h e s ) :

4 D2=1;5 / / D e s i r e d v o l u m e f l o w r a t e ( i n f t ˆ 3 / s e c ) :

6 Q=0.7;7 / / D e n s i t y o f w a t e r ( i n s l u g / f t ˆ 3 ) :

8 d=1.94;

Example 4.10 4.10.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 1 0 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.10−data . s c i ’3 exec ( f i l ename )4 u1=V−U5 u2=(V−U)∗ cosd ( theta )6 v2=(V−U)∗ s ind ( theta )7 V1=V−U8 V2=V19 / / X c o m p o n e n t o f m o m e n t e q u a t i o n ( i n N ) :

10 function y=f (A) , y=u1∗−(d∗V1) , endfunction11 function z=g (A) , z=u2∗d∗V2 , endfunction12 Rx=intg (0 ,A, f )+intg (0 ,A, g )13

14 / / Y c o m p o n e n t o f m o m e n t e q u a t i o n ( i n N ) :

15 function a=h(A) , a=v2∗d∗V1 , endfunction16 Ry=intg (0 ,A, h) / / T h i s i s a f t e r n e g l e c t i n g w e i g h t o f

v a n e a n d t h e w a t e r .

17 printf ( ”\n\nRESULTS\n\n” )18 printf ( ”\n\nNet f o r c e on the vane : %. 3 f i+%. 2 f j kN\n\n

” ,Rx/1000 ,Ry/1000)

Example 4.10d 4.10-data.sci

1 / / V a n e t u r n i n g a n g l e :

2 theta =60;3 / / S p e e d o f v a n e ( i n m/ s e c ) :

4 U=10;5 / / A r e a o f n o z z l e ( i n m2 ) :

31

Page 33: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

6 A=0.003;7 / / F l o w v e l o c i t y o f w a t e r ( i n m/ s e c ) :

8 V=30;9 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

10 d=999;

Example 4.11 4.11.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 1 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.11−data . s c i ’3 exec ( f i l ename )4 / / E v a l u a t i n g t h e v a l u e o f Vb :

5 Vb=V∗(1− cosd ( theta ) )∗d∗A/M6 / / V a l u e o f U / V f o r v a r i o u s v a l u e s o f t

7 t =0:20;8 [m n]= s ize ( t )9 for i =1:n

10 U V( i )=Vb∗ t ( i ) /(1+Vb∗ t ( i ) ) ;11 end12

13 / / P l o t t i n g U / V v s t :

14 plot ( t , U V)15 xt i t le ( ’U/V vs t ’ , ’ t ( in sec ) ’ , ’U/V ’ )

Example 4.11d 4.11-data.sci

1 / / M a s s o f v a n e a n d c a r t ( i n k g ) :

2 M=75;3 / / T u r n i n g a n g l e o f v a n e :

4 theta =60;5 / / S p e e d o f w a t e r l e a v i n g n o z z l e h o r i z o n t a l l y ( i n m/ s e c ) :

6 V=35;7 / / E x i t a r e a o f n o z z l e ( i n m ˆ ) :

8 A=0.003;9 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

10 d=999;

32

Page 34: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 4.1: Output graph of S 4.11

33

Page 35: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 4.12 4.12.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 1 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.12−data . s c i ’3 exec ( f i l ename )4 / / A c c e l e r a t i o n o f r o c k e t a t t = 0 ( i n m/ s e c ˆ 2 ) :

5 Ve∗me/M0−g6 / / V e l o c i t y o f r o c k e t a t t = 1 0 ( i n m/ s e c ) :

7 function y=f ( t ) , y=Ve∗me/(M0−me∗ t )−g , endfunction8 Vcv=intg (0 , t , f )9 printf ( ”\n\nRESULTS\n\n” )

10 printf ( ”\n\ nVeloc i ty o f rocke t at t =10: %. 1 f m/ sec \n\n”,Vcv)

Example 4.12d 4.12-data.sci

1 / / I n i t i a l m a s s o f t h r o c k e t ( i n k g ) :

2 M0=400;3 / / R a t e o f f u e l c o n s u m p t i o n ( i n k g / s e c ) :

4 me=5;5 / / E x h a u s t v e l o c i t y ( i n m/ s e c ) :

6 Ve=3500;7 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

8 g =9.81;9 / / T i m e a f t e r w h i c h v e l o c i t y i s t o b e c a l c u l a t e d ( i n s e c )

:

10 t =10;

Example 4.14 4.14.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 1 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.14−data . s c i ’3 exec ( f i l ename )4 / / A r e a o f j e t ( i n mm ˆ 2 ) :

5 Ajet=%pi/4∗Dˆ26 / / J e t s p e e d r e l a t i v e t o t h e n o z z l e ( i n m/ s e c ) :

7 Vrel=Q/2/ Ajet ∗10ˆ6/60/10008 / / V a l u e o f w ∗R i n m/ s e c :

34

Page 36: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

9 wR=w∗R∗2∗%pi/60/100010 / / F r i c t i o n t o r q u e a t p i v o t ( i n N−m ) :

11 Tf=R∗( Vrel∗ cosd ( alpha )−wR)∗d∗Q/1000/60/100012 printf ( ”\n\nRESULTS\n\n” )13 printf ( ”\n\nJet speed r e l a t i v e to each nozz l e : %. 2 f m/

sec \n\n” , Vrel )14 printf ( ”\n\ nFr i c t i on torque at p ivot : %. 5 f N−m\n\n” , Tf )

Example 4.14d 4.14-data.sci

1 / / I n l e t g a u g e p r e s s u r e ( i n k P a ) :

2 p=20;3 / / V o l u m e f l o w r a t e o f w a t e r t h r o u g h t h e s p r i n k l e r ( i n l /

m i n ) :

4 Q=7.5;5 / / S p e e d o f r o t s t i o n o f s p r i n k l e r ( i n r p m ) :

6 w=30;7 / / D i a m e t e r o f j e t f s p r i n k l e ( i n mm ) :

8 D=4;9 / / R a d i u s o f s p r i n k l e r ( i n mm ) :

10 R=150;11 / / S u p p l y p r e s s u r e t o s p r i n k l e r ( i n k P a ) :

12 p=20;13 / / A n g l e a t w h i c h j e t i s s p r a y e d w r t h o r i z o n t a l :

14 alpha =30;15 / / D e n s i t y o f w a t e r ( i n k g /m ˆ ) :

16 d=999;

Example 4.16 4.16.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 1 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.16−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y a t e x i t ( i n f t / s e c ) :

5 V2=m∗R∗(T2+460)/A2/p2/1446 / / A s p o w e r i n p u t i s t o CV , Ws = − 6 0 0

7 / / R a t e o f h e a t t r a n s f e r ( i n B t u / s e c ) :

8 Q=Ws∗550/778+m∗cp ∗(T2−T1)+m∗V2ˆ2/2/32.2/778

35

Page 37: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

9 printf ( ”\n\nRESULTS\n\n” )10 printf ( ”\n\nRate o f heat t r a n s f e r : %. 3 f Btu/ sec \n\n” ,Q)

Example 4.16d 4.16-data.sci

1 / / P r e s s u r e a t e n t r y ( i n p s i a ) :

2 p1 =14.7 ;3 / / T e m p e r a t u r e a t e n t r y ( i n F ) :

4 T1=70;5 / / P r e s s u r e a t e x i t ( i n p s i a ) :

6 p2=50;7 / / T e m p r a t u r e a e x i t ( i n F ) :

8 T2=100;9 / / C r o s s s e c t i o n a l a r e a o f t h e p i p e a t e x i t ( i n f t ˆ 2 ) :

10 A2=1;11 / / M a s s f l o w r a t e ( i n l b f / s e c ) :

12 m=20;13 / / P o w e r i n p u t t o t h e c o m p r e s s o r ( i n h p ) :

14 Ws=−600;15 / / V a l u e o f c p ( i n B t u / l bm −R ) :

16 cp =0.24;17 / / V a l u e o f g a s c o n s t a n t ( i n f t − l b f / ( l bm −R ) )

18 R=53.3;

Example 4.17 4.17.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 4 . 1 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 4.17−data . s c i ’3 exec ( f i l ename )4 / / D e n s i t y o f t a n k ( i n k g /m ˆ 3 ) :

5 d=(p1+patm) /R/T6 / / M a s s f l o w r a t e o f a i r i n t o t h e t a n k ( i n k g / s e c ) :

7 m=d∗V∗cv∗ r /R/T∗10008 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\nMass f low ra t e o f a i r i n to the tank : %. 3 f g

/ sec \n\n” ,m)

Example 4.17d 4.17-data.sci

36

Page 38: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / V o l u m e o f t a k ( i n m ˆ 3 ) :

2 V=0.1;3 / / T e m p e r a t u r e o f l i n e a n d t a n k ( i n K ) :

4 T=293;5 / / I n i t i a l t a n k g a u g e p r e s s u r e ( i n N /m ˆ 2 ) :

6 p1=1∗10ˆ5;7 / / A b s o l u t e l i n e p r e s s u r e ( i n N /m ˆ 2 ) :

8 p=2∗10ˆ6;9 / / R a t e o f r i s e o f t e m p e r a t u r e a f t e r o p e n i n g o f t h e

v a l v e ( i n C / s e c ) :

10 r =0.05;11 / / A t m o s p h e r i c p r e s s u r e ( i n N /m ˆ 2 ) :

12 patm=1.01∗10ˆ5;13 / / G a s C o n s t a n t ( i n N−m / ( k g −K ) ) :

14 R=287;15 / / V a l u e o f c v ( i n N−m/ kg −K ) :

16 cv =717;

37

Page 39: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 5

Introducton to DifferentialAnalysis of Fluid Motion

5.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

5.2 Scilab Code

Example 5.02 5.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 5 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 5.02−data . s c i ’3 exec ( f i l ename )4 / / R a t e o f c h a n g e o f d e n s i t y w i t h t i m e ( i n k g /mˆ3 − s ) :

5 r=−d∗V/L6 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nRate o f change o f dens i ty with time : %. 1 f

kg/mˆ3−s\n\n” , r )

Example 5.02d 5.02-data.sci

38

Page 40: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / D i s t a n c e f p i s t o n f r o m c l o s e d e n d o f t h e c y l i n d e r a t

t h e g i v e i n s t a n t ( i n m ) :

2 L=0.15;3 / / D e n s i t y o f g a s ( i n k g /m ˆ 3 ) :

4 d=18;5 / / V e l o c i t y o f p i s t o n ( i n m/ s e c ) :

6 V=12;

Example 5.07 5.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 5 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 5.07−data . s c i ’3 exec ( f i l ename )4 / / A t p o i n t b , u =3 mm/ s e c

5 u=3;6 / / D i s p l a c e m e t o f b ( i n mm ) :

7 xb=u∗ t8 / / R a t e o f a n g u l a r d e f o r m a t i o n ( i n s ˆ − 1 ) :

9 de f=U/h10 / / R a t e o f r o t a t i o n ( i n s ˆ − 1 ) :

11 ro t =−0.5∗U/h12 printf ( ”\n\nRSULTS\n\n” )13 printf ( ”\n\nRate o f angular deformation : %. 1 f / s ec \n\n”

, de f )14 printf ( ”\n\nRate o f r o t a t i o n : %. 1 f / s ec \n\n” , ro t )

Example 5.07d 5.07d

1 / / V a l u e o f ( i n mm/ s e c ) :

2 U=4;3 / / V a l u e o f h ( i n mm ) :

4 h=4;5 / / Tme a t w h i c h t o f i n d p o s i t i o n ( i n s e c ) :

6 t =1.5 ;

Example 5.08 5.08.sce

39

Page 41: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 5 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 5.08−data . s c i ’3 exec ( f i l ename )4 / / V a l u e o f T :

5 T=log (3/2) /A6 x0 =1:2;7 y0 =1:2;8 for i =1:29 for j =1:2

10 / / F o r X c o o r d i n a t e :

11 X( i ) ( j )=x0 ( i )∗%eˆ(A∗T)12 / / F o r Y c o o r d i n a t e :

13 Y( i ) ( j )=y0 ( j )∗%eˆ(−A∗T)14 end15 end16 plot (X,Y)17 / / R a t e s o f l i n e a r d e f o r m a t i o n i n X d i r e c t i o n :

18 Ax=0.3;19 / / R a t e o f l i n e a r d e f o r m a t i o n i n t h e y d i r e c t i o n :

20 Ay=−0.3;21 / / R a t e o f v o l u m e d i l a t i o n ( s ˆ − 1 ) :

22 v=A−A23 / / A r e a o f a b c d :

24 A1=1;25 / / A r e a o f a ’ b ’ c ’ d ’ :

26 A2=(3−3/2)∗(4/3−2/3)27 printf ( ”\n\nRESULTS\n\n” )28 printf ( ”\n\nRates o f l i n e a r deformation in X and Y

d i r e c t i o n : %. 1 f / s , %. 1 f / s\n\n” ,Ax,Ay)29 printf ( ”\n\nRate o f volume d i l a t i o n : %. 0 f / s ec \n\n” , v )30 printf ( ”\n\nArea o f abcd and a , b , c , d :%. 1 f mˆ2 , %. 1 f mˆ\

n\n” ,A1 , A2)

Example 5.08d 5.08-data.sci

1 / / V a l u e o f A ( i n s e c ˆ − 1 ) :

2 A=0.3;

40

Page 42: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 5.09 5.09.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 5 . 0 9 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 5.09−data . s c i ’3 exec ( f i l ename )4 / / V o l u m e f l o w r a t e ( i n m ˆ 3 / s e c ) :

5 Q=d∗g∗ s ind ( theta )∗b∗(h/1000) ˆ3∗1000/u/36 printf ( ”RESULTS” )7 printf ( ”\n\nVolume f low ra t e : %. 4 f mˆ3/ sec \n\n” ,Q)

Example 5.09d 5.09-data.sci

1 / / T h i c k n e s s o f w a t e r f i l m ( i n mm ) :

2 h=1;3 / / W i d t h o f s u r f a c e ( i n m ) :

4 b=1;5 / / A n g l e o f i n c l i n a t i o n o f s u r f a c e :

6 theta =15;7 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

8 d=999;9 / / A c c e l e r a t i o n d u t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

10 g =9.81;11 / / V i s c o s i t y ( k g /m− s ) :

12 u=10ˆ−3;

41

Page 43: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 6

Incompressible Inviscid Flow

6.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

6.2 Scilab Code

Example 6.01 6.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.01−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y o f f l o w ( i n m/ s e c ) :

5 V=sqrt (dw/ log ( ( r+w) / r )∗g/da∗p/1000)6 / / V o l u m e f l o w r a t e ( i n m ˆ 3 / s e c ) :

7 Q=V∗(d∗w)8 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\nVolume f low ra t e : %. 3 f mˆ3/ sec \n\n” ,Q)

Example 6.01d 6.01-data.sci

1 / / D e p t h o f t h e d u c t ( i n m ) :

42

Page 44: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

2 d=0.3;3 / / W i d t h o f t h e d u c t ( i n m ) :

4 w=0.1;5 / / I n n e r r a d i u s o f t h e b e n d ( i n m ) :

6 r =0.25;7 / / P r e s s u r e d i f f e r e n c e b e t w e e n t h e t a p s ( i n mm o f Hg ) :

8 p=40;9 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

10 dw=999;11 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

12 g =9.8 ;13 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

14 da =1.23;

Example 6.02 6.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.02−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y o f f l o w ( i n m/ s e c ) :

5 V=sqrt (2∗dw∗g∗p/1000∗SG/da )6 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\ nVeloc i ty o f f low : %. 3 f m/ sec \n\n” ,V)

Example 6.02d 6.02-data.sci

1 / / P r e s s u r e d i f e r e n c e ( i n mm o f m e c u r y ) :

2 p=30;3 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

4 dw=1000;5 / / A c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

6 g =9.81;7 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

8 da =1.23;9 / / S p e c i f i c g r a v i t y o f m e r c u r y :

10 SG=13.6;

Example 6.03 6.03.sce

43

Page 45: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 3 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.03−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y o f f l w a t t h e i n l e t ( i n m/ s e c ) :

5 V1=Ae/Ai∗V26 / / G a u g e p r e s s u r e r e q u i r e d a t t h e i n l e t ( i n k P a ) :

7 p=0.5∗da∗(V2ˆ2−V1ˆ2)8 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\nGauge pr s su r e r equ i r ed at the i n l e t : %. 3 f

kPa\n\n” ,p/1000)

Example 6.03d 6.03-data.sci

1 / / A r e a o f n o z z l e a t i n p u t ( i n m ˆ 2 ) :

2 Ai =0.1 ;3 / / A r e a o f n o z z l e a t e x i t ( i n m ˆ 2 ) :

4 Ae=0.02;5 / / O u t l e t v e l o c i t y o f f l o w ( i n m/ s e c ) :

6 V2=50;7 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

8 da =1.23;

Example 6.04 6.04.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.04−data . s c i ’3 exec ( f i l ename )4 / / S p e e d o f w a t e r a t e x i t ( i n m/ s e c ) :

5 V2=sqrt (2∗ g∗z )6 / / P r e s s u r e a t p o i n t A i n t h e f l o w ( k P a ) :

7 pA=p1+d∗g∗(0− l )−0.5∗d∗V2ˆ28 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\nSpeed o f water at e x i t : %. 3 f m/ sec \n\n” ,V2)

10 printf ( ”\n\nPressure at po int A in the f low : %3f kPa\n\n” ,pA/1000)

Example 6.04d 6.04-data.sci

44

Page 46: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / L e n g t h o f t u b e a b o v e s u r f a c e ( i n m ) :

2 l =1;3 / / D e p t h o f e x i t b e l o w w a t e r s u r f a c e ( i n m ) :

4 z=7;5 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

6 g =9.81;7 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

8 d=999;9 / / A t m o s p h e r i c p r e s s u r e ( i n N /m ˆ 2 ) :

10 p1 =1.01∗10ˆ5;

Example 6.05 6.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.05−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y o f f l o w a t t h e e x i t ( i n f t / s e c ) :

5 V2=sqrt (2∗ g∗(Du−Dd/12) )6 / / V o l u m e f l o w r a t e / w i d t h ( f t ˆ 2 / s e c ) :

7 Q=V2∗Dd/128 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\ nVeloc i ty o f f low at the e x i t : %. 3 f f t / s ec \n

\n” ,V2)10 printf ( ”\n\nVolume f low ra t e /width : %. 3 f f t ˆ2/ sec \n\n” ,

Q)

Example 6.05d 6.05-data.sci

1 / / D e p t h o f w a t e r a t t h e u p s t r e a m ( o n f e e t ) :

2 Du=1.5;3 / / D e p t h o f w a t e r a t t h e v e n a c o n t r a c t a d o w n s t r e a m f r o m

t h e g a t e ( i n i n c h e s ) :

4 Dd=2;5 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

6 g =32.2;

Example 6.06 6.06.sce

45

Page 47: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.06−data . s c i ’3 exec ( f i l ename )4 / / P r e s s u r e o f a i r a t 1 0 0 0 m ( i n N /m ˆ 2 ) :

5 p=P1∗pa6 / / D e n s i t y o f a i r a t 1 0 0 0 m ( i n k g /m ˆ 3 ) :

7 d=D1∗da8 / / S t a g n a t i o n p r e s s u r e a t A ( i n k P a ) :

9 p0A=p+0.5∗d∗(V∗1000/3600) ˆ210 / / S t a t i c p r e s s u r e a t B ( i n k P a ) :

11 pB=p+d /2∗ ( (V∗1000/3600)ˆ2−Vbˆ2)12 printf ( ”\n\nRESULTS\n\n” )13 printf ( ”\n\nStagnat ion pr e s su r e at A: %. 3 f kPa\n\n” ,p0A

/1000)14 printf ( ”\n\ nSta t i c p r e s su r e at B: %. 3 f kPa\n\n” ,pB

/1000)

Example 6.06d 6.06-data.sci

1 / / S p e e d o f p l a n e ( i n km / h r ) :

2 V=150;3 / / S p e e d a t p o i n t B r e l a t i v e t o t h e w i n g ( i n m/ s e c ) :

4 Vb=60;5 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

6 da =1.23;7 / / A t m o s p h e r i s p r e s s u r e ( i n N /m ˆ 2 ) :

8 pa =1.01∗10ˆ5;9 / / A t 1 0 0 0 m ,

10 / / p / p S L :

11 P1=0.8870;12 / / d / d S L :

13 D1=0.9075;

Example 6.08 6.08.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.08−data . s c i ’3 exec ( f i l ename )

46

Page 48: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

4 / / V e l o c i t y o f f l o w a t e x i t ( i n f t / s e c ) :

5 V4=sqrt (2∗ g∗( z3−0) )6 / / M a s s f l o w r a t e o f w a t e r ( i n s l u g / s e c ) :

7 m=d∗V4∗A4/1448 / / R i s e i n t e m p e r a t u r e b e t w e e n p o i n t s 1 a n d 2 ( i n R ) :

9 T=Q∗3413/3600/m/32 .210 printf ( ”\n\nRESULTS\n\n” )11 printf ( ”\n\nRise in temperature between po in t s 1 and 2 :

%. 3 f R\n\n” ,T)

Example 6.08d 6.08-data.sci

1 / / A r e a o f c r o s s s e c t i o n o f t h e n o z z l e ( i n i n ˆ 2 ) :

2 A4=0.864;3 / / C a p a c i t y o f h e a t e r ( i n kW ) :

4 Q=105 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

6 g =32.2;7 / / W a t e r l e v e l i n r e s e r v o i r a b o v e d a t u m l i n e ( i n f t ) :

8 z3 =10;9 / / D e n s i t y o f w a t e r ( I n s l u g / f t ˆ 3 ) :

10 d=1.94;

Example 6.09 6.09.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 0 6 . 0 9 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 06.09−data . s c i ’3 exec ( f i l ename )4 t =0:55 / / V a l u e o f s q r t ( 2 g h ) :

6 x=sqrt (2∗ g∗h)7 / / V a l u e o f 1 / 2 L ∗ s q r t ( 2 g h ) :

8 y=1/2/L∗x9 [m n]= s ize ( t )

10 i =1:n ;11 / / V e l o c i t y ( i n m/ s e c ) :

12 V2=x∗tanh ( y∗ t ( i ) )13 plot ( t , V2) ;

47

Page 49: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

14 xt i t le ( ’ St reaml ine f low from 1 to 2 ’ , ’Time( in s ) ’ , ’V2(in m/ sec ) ’ )

Example 6.09d 6.09-data.sci

1 / / D e p t h t o w h i c h w a t e r i s f i l l e d ( i n m ) :

2 h=3;3 / / L e n g t h o f p i p e ( i n m ) :

4 L=6;5 / / D i a m e t e r o f p i p e ( i n mm ) :

6 D=150;7 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

8 g =9.81;

48

Page 50: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 7

Dimensional Analysis andSimlitude

7.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

When we execute S 7.05, we get Fig. 7.1.The .sci files of the respective problems contain the input parameters of

the question

7.2 Scilab Code

Example 7.04 7.04.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 7 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 7.04−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y o f p r o t o t y p e i n f t / s e c

5 Vp1=Vp∗6080/36006 / / R e y n o l d s n u m b e r o f p r o t o t y p e :

7 Rep=Vp1∗Dp/vp8 / / R e p =Rem

9 / / T h e r e f o r e :

10 Rem=Rep ;

49

Page 51: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 / / V e l o c i t y o f a i r f o r w i n d t u n n e l ( i n f t / s e c ) :

12 Vm=Rem∗vm/(Dm/12)13 / / D r a g f o r c e o n p r o t o t y p e ( i n l b f ) :

14 Fp=Fm∗(dp/dm) ∗(Vp1/Vm) ˆ2∗(Dp/(Dm/12) ) ˆ215 printf ( ”\n\nRESULTS\n\n” )16 printf ( ”\n\nTest speed in a i r : %. 3 f f t / sec \n\n” ,Vm)17 printf ( ”\n\nDrag f o r c e on prototype : %. 3 f l b f \n\n” ,Fp)

Example 7.04d 7.04-data.sci

1 / / D i a m e t e r o f t h e p r o t o t y p e ( i n f t ) :

2 Dp=1;3 / / S p e e d o f t o w i n g o f p r o t o t y p e ( i n k n o t s ) :

4 Vp=5;5 / / D i a m e t e r o f m o d e l ( i n i n c h e s ) :

6 Dm=6;7 / / D r a g f o r m o d e l a t t e s t c o n d i t i o n ( i n l b f ) :

8 Fm=5.58;9 / / D e n s i t y o f s e a w a t e r a t 5 C f o r p r o t o t y p e ( i n s l u g / f t

ˆ 3 ) :

10 dp=1.99;11 / / K i n e m a t i c v i s c o s i t y a t 5 C f o r p r o t o t y p e ( i n f t ˆ 2 / s e c )

:

12 vp=1.69∗10ˆ−5;13 / / D e n s i t y o f a i r a t STP f o r m o d e l ( i n s l u g / f t ˆ 3 ) :

14 dm=0.00238;15 / / K i n e m a t i c v i s c o s i t y o f a i r a t STP f o r m o d e l ( i n f t ˆ 2 /

s e c ) :

16 vm=1.57∗10ˆ−4;

Example 7.05 7.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 7 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 7.05−data . s c i ’3 exec ( f i l ename )4 / / W i d t h o f t h e m o d e l ( i n m ) :

5 wm=S∗wp∗0.30486 / / A r e a o f m o d e l ( i n m ˆ 2 ) :

50

Page 52: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

7 Am=Sˆ2∗Ap∗0.305ˆ28 [m n]= s ize (V)9 i =1:n

10 / / A e r o d y n a m i c d r a g c o e f f i c i e n t ( ) :

11 Cd=2.∗Fd( i ) /d . / (V( i ) ) ˆ2/0.030512 / / R e y n o l d s n u m b e r :

13 Re=V( i )∗wm/v14 plot (Re ,Cd) ;15 a=gca ( )16 a . data bounds = [100000 , 0 . 4 ; 500000 , 0 . 6 ]17 xt i t le ( ’ Aerodynamic drag c o e f f i c i e n t vs drag f o r c e ’ , ’

Reynolds number ’ , ’ Model Drag Coef f . ’ )18 / / I t i s s e e n t h a t d r a g c o e f f i c i e n t b e c o m e s c o n s t a n t a t

CD = 0 . 4 6 a b o v e R e = 4 ∗ 1 0 ˆ 5 a t w h i c h s p e e d o f a i r i s 4 0 m/

s

19 CDc=0.46;20 Va=40;21 / / D r a g f o r c e ( i n N ) :

22 FDp=CDc/2∗d∗(Vp∗5/18) ˆ2∗Ap∗0.305ˆ223 / / P o w e r r e q u i r e d t o p u l l p r o t o t y p e a t 1 0 0 k m p h ( i n W)

24 Pp=FDp∗Vp∗5/1825 printf ( ”\n\nRESULTS\n\n” )26 printf ( ”\n\nSpeed above which Cd i s constant : %. 3 f m/

sec \n\n” ,Va)27 printf ( ”\n\nDrag Force : %. 3 f kN\n\n” ,FDp/1000)28 printf ( ”\n\nPower r equ i r ed to p u l l prototype at 100

kmph : %. 3 f kW\n\n” ,Pp/1000)

Example 7.05d 7.05-data.sci

1 / / W i d t h o f t h e p r o t o t y p e ( i n f t ) :

2 wp=8;3 / / F r o n t a l a r e a o f t h e p r o t o t y p e ( i n f t ˆ 2 ) :

4 Ap=84;5 / / M o d e l S c a l e :

6 S=1/16;7 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

8 d=1.23;

51

Page 53: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 7.1: Output graph of S 7.05

9 / / A i r s p e e d i n w i n d t u n n e l ( i n m/ s e c ) :

10 V=[18 21 .8 26 30 .1 35 38 .5 40 .9 44 .1 4 6 . 7 ] ;11 / / D r a g f o r c e ( i n N ) :

12 Fd=[3.1 4 .41 6 .09 7 .97 10 .7 12 .9 14 .7 16 .9 1 8 . 9 ] ;13 / / K i n e m a t i c v i s c o s i t y ( i n m ˆ 2 / s e c ) :

14 v=1.46∗10ˆ−5;15 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

16 d=1.23;17 / / S p e e d o f p r o t o t y p e ( i n km / h r ) : \

18 Vp=100;

52

Page 54: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 7.06 7.06.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 7 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 7.06−data . s c i ’3 exec ( f i l ename )4 / / T h e s a m e pump i s u s e d f o r b o t h t h e c o n d i t i o n s . H e n c e :

5 D2=D1 ;6 / / T h e s a m e w a t e r i s u s e d f o r b o t h t h e c o n d i t i o n s . H e n c e

:

7 d2=d1 ;8 / / F l o w r a t e a t c o n d i t i o n 2 ( i n gpm ) :

9 Q2=Q1∗N2/N1∗(D2/D1) ˆ310 / / H e a d a t c o n d i t i o n 1 ( i n f t ) :

11 H1=(N1∗sqrt (Q1) /Nscu1 ) ˆ(4/3)12 / / H e a d a t c o n d i t i o n 1 ( i n f t ) :

13 H2=H1∗(N2/N1) ˆ2∗(D2/D1) ˆ214 / / Pump o u t p u t p o w e r a t c o n d i t i o n 1 ( i n h p ) :

15 P1=d1∗g∗Q1∗H1/7.48/60/55016 / / Pump o u t p u t p o w e r a t c o n d i t i o n 2 ( i n h p ) :

17 P2=P1∗( d2/d1 ) ∗(N2/N1) ˆ3∗(D2/D1) ˆ518 / / R e q u i r e d i n p u t p o w e r ( i n h p ) :

19 Pin=P2/ Effp20 / / S p e c i f i c s p e e d a t c o n d i t i o n 2 :

21 Nscu2=N2∗sqrt (Q2) /H2ˆ(3/4)22 printf ( ”\n\nRESULTS\n\n\n” )23 printf ( ”\n\nVolume f low ra t e at cond i t i on 2 : %. 3 f gpm\n

\n\n” ,Q2)24 printf ( ”\n\nHead at cond i t i on : %. 3 f f t \n\n\n” ,H2)25 printf ( ”\n\nPump output power at cond i t i on : %. 3 f hp\n\n

\n” ,P2)26 printf ( ”\n\nRequired input power : %. 3 f hp\n\n\n” , Pin )27 printf ( ”\n\ n S p e c i f i c speed at cond i t i on 2 : %. 3 f \n\n\n” ,

Nscu2 )

Example 7.06d 7.06-data.sci

1 / / E f f i c i n c o f p ump :

2 Effp =0.8 ;

53

Page 55: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

3 / / D e s i g n s p e c i f i c s p e e d ( i n r p m ) :

4 Nscu1=2000;5 / / I m p e l l e r d i a m e t e r ( i n i n c h e s ) :

6 D1=8;7 / / O p e r t i o n s p e d a t e s i g n p o i n t f l o w c o n d i t i o n ( i n r p m ) :

8 N1=1170;9 / / F l o w r a t e a t d e s i g n p o i n t f l o w c o n d i t i o n ( i n gpm ) :

10 Q1=300;11 / / D e n s i t y o f w a t e r ( i n s l u g / f t ˆ 3 ) :

12 d1 =1.94;13 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t ˆ 2 / s e c ) :

14 g =32.2;15 / / W o r k i n g s p e e d 2 ( i n r p m ) :

16 N2=1750;

54

Page 56: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 8

Internal Incompressible ViscousFlow

8.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

8.2 Scilab Code

Example 8.01 8.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.01−data . s c i ’3 exec ( f i l ename )4 / / L e a k a g e f l o w r a t e ( i n mm ˆ 3 / s e c ) :

5 Q=%pi/12∗D∗a ˆ3∗(p1−p2 ) ∗10ˆ3/u/L6 / / V e l o c i t y o f f l o w ( i n m/ s e c ) :

7 V=Q/%pi/D/a/10008 / / S p e c i f i c g r a v i t y o f SAE 1 0W o i l :

9 SG=0.92;10 / / R e y n o l d s N u m b e r :

11 Re=SG∗dw∗V∗a/u/1000

55

Page 57: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

12 / / A s Re < 1 4 0 0 , f l o w i s l a m i n a r .

13 printf ( ”\n\nRESULTS\n\n” )14 printf ( ”\n\nLeakage f low ra t e : %. 3 f mmˆ3/ sec \n\n” ,Q)

Example 8.01d 8.01-data.sci

1 / / O p e r a t i o n p r e s s u r e o f h y d r a u l i c s y s t e m ( i n k P a ) :

2 p1=20000;3 / / O p e r a t i o n t e m p e r a t u r e o f h y d r a u l i c s y s t e m ( i n C ) :

4 T=55;5 / / P i s t o n d i a m e t e r ( i n mm ) :

6 D=25;7 / / V i s c o s i t y o f SAE 1 0W a t 5 5 C ( i n k g / ( m− s ) :

8 u=0.018;9 / / M e a n r a d i a l c l e a r a n c e o f a c y l i n d e r ( i n mm ) :

10 a =0.005;11 / / G a u g e p r e s s u r e o n l o w e r p r e s s u r e s i d e o f p i s t o n ( i n

k P a ) :

12 p2=1000;13 / / L e n t h o f p i s t o n ( i n mm ) :

14 L=15;15 / / D e n i t y o f w a t e r ( i n k g /m ˆ 3 ) :

16 dw=1000;

Example 8.02 8.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.02−data . s c i ’3 exec ( f i l ename )4 / / S h e a r s t r e s ( i n l b f / f t ˆ 2 ) :

5 Tyx=u∗N∗2∗%pi/60∗D/2/( a /2)6 / / T o r q e ( i n i n c h e s − l b f ) :

7 T=%pi/2∗Tyx∗Dˆ2∗L/1448 / / P o w e r d i s s i p a t e d i n t h e b e a r i n g ( i n h p ) :

9 P=T∗N/60∗2∗%pi/12/55010 / / R e y n o l d s n u m b e r :

11 Re=SG∗p∗N∗2∗%pi /60∗1.5∗ a/2/u/14412 printf ( ”\n\nRESULTS\n\n” )

56

Page 58: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

13 printf ( ”\n\nTorque : %. 3 f inches−l b f \n\n” ,T)14 printf ( ”\n\nPower d i s s i p a t e d in the bear ing : %. 3 f hp\n\

n” ,P)

Example 8.02d 8.02-data.sci

1 / / t e m p e r a t u r e f o o p e r a t i o n ( i n F ) :

2 T=210;3 / / D i a m e t e r o f t e b e a r i n g ( i n i n c h e s ) :

4 D=3;5 / / D i a m e t r a l c l e a r a n c e ( i n i n c h e s ) :

6 a =0.0025;7 / / L e n g t h o f s h a f t ( i n i n h e s ) :

8 L=1.25;9 / / S p e e d o f r o t a t i o n o f t h e s h a f t ( i n r p m ) :

10 N=3600;11 / / V i s c o s i t y o f t h e o i l ( i n l b f − s / f t ˆ 2 ) :

12 u=2.01∗10ˆ−4;13 / / S p e c i f i c g r a v i t y o f SAE 1 0W :

14 SG=0.92;15 / / D e n s i t y o f w a t e r ( i n s l u g / f t ˆ 3 )

16 p=1.94;

Example 8.04 8.04.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.04−data . s c i ’3 exec ( f i l ename )4 / / V i s c o s i t y o f t h e l i q u i d ( i n N− s /m ˆ 2 ) :

5 u=%pi/128∗p∗1000∗Dˆ4/Q/L/10006 / / V e l o c i t y ( i n m/ s e c )

7 V=Q/(%pi/4∗Dˆ2) /10008 / / R e y n o l d s n u m b e r :

9 Re=d∗V∗D/u/100010 printf ( ”\n\nRESULTS\n\n” )11 printf ( ”\n\ nVi s co s i ty o f f l u i d %. 3 f N−s /mˆ2\n\n” ,u)

Example 8.04d 8.04-data.sci

57

Page 59: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / F l o w r a t e t h r o u g h c a p i l a r r y v i s c o m e t e r ( i n mm ˆ 3 / s e c ) :

2 Q=880;3 / / T u b e l e n g t h ( i n m ) :

4 L=1;5 / / T u b e d i a m e t e r ( i n mm ) :

6 D=0.5;7 / / P r e s s u r e d r o p ( i n k P a ) :

8 p=1000;9 / / D e n s i t y o f o i l ( i n k g /m ˆ 3 ) :

10 d=999;

Example 8.05 8.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.05−data . s c i ’3 exec ( f i l ename )4 / / R e s e r v o i r d e p t h r e q u i r e d t o m a i n t a i n f l o w ( i n m ) :

5 D1=8∗Qˆ2/(%pi ) ˆ2/Dˆ4/g∗( f ∗L/D+K+1)6 / / R e y n o l d s n u m b e r :

7 Re=4∗d∗Q/(( %pi )∗u∗D)8 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\ nReservo i r depth r equ i r ed to maintain f low :

%. 3 f m\n\n” ,D1)

Example 8.05d 8.05-data.sci

1 / / V o l m e f l o w r a t e o f w a t e r ( i n m ˆ 3 / s e c ) :

2 Q=0.0084;3 / / L e n g t h o f h o r i z o n t a l p i p e ( i n m ) :

4 L=100;5 / / D i a m e t e r o f p i p e ( i n m ) :

6 D=0.075;7 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

8 d=999;9 / / F r i c t i o n f a c t o r :

10 f =0.017;11 / / M i n o r l o s s s e s c o e f f i c i e n t :

12 K=0.5;

58

Page 60: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

13 / / V i s c o s i t y ( i n k g /m− s ) :

14 u=10ˆ−3;15 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n / s e c ˆ 2 ) :

16 g =9.8 ;

Example 8.06 8.06.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.06−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y o f f l o w ( i n f t / s e c ) :

5 V=Q/24/3600/(%pi/4∗(D/12) ˆ2) ∗42/7.486 / / M a x i m u m s p a c i n g ( i n f t ) :

7 L=2/ f ∗D/12∗(p2−p1 ) /(SG∗d) /Vˆ2∗1448 / / P o w e r n e e d e d a t e a c h p ump ( i n h p ) :

9 Win=1/Effp ∗V∗%pi/4∗(D/12) ˆ2∗(p2−p1 ) /550∗14410 printf ( ”\n\nRESULTS\n\n” )11 printf ( ”\n\nMaximum spac ing : %. 3 f f e e t \n\n” ,L)12 printf ( ”\n\nPower needed at each pump : %. 3 f hp\n\n” ,Win

)

Example 8.06d 8.06-data.sci

1 / / F l o w r a t e o f c r u d e o i l ( i n b b l ) :

2 Q=1.6∗10ˆ6;3 / / I n s i d e d i a m e t e o f p i p e ( i i n c h e s ) :

4 D=48;5 / / M a x i m u m a l l o w a b l e p r e s s u r e ( i n p s i ) :

6 p2=1200;7 / / M i n i m u m p r e s s u r e r e q u i r e d t o k e e p g a s e s d i s s o l v e s ( i n

p s i ) :

8 p1=50;9 / / S p e c i f i c g r a v i t y o f c r d e o i l :

10 SG=0.93;11 / / V i s c o s i t y a t 1 4 0 F ( i n l b f − s / f t ˆ 2 ) :

12 u=3.5∗10ˆ−4;13 / / E f f i c i n c y o f p ump :

14 Effp =0.85;

59

Page 61: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

15 / / D e n s i t y ( i n s l u g / f t ˆ 3 ) :

16 d=1.94;17 / / V i s c o s i t y ( i n l b f − s e c ) :

18 u=3.5∗10ˆ−4;19 / / F r i c t i o n f a c t o r :

20 f =0.017;

Example 8.07 8.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.07−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y ( i n f t / s e c ) :

5 V2=sqrt (2∗ g∗ l /( f ∗ ( (L+l ) /D∗12+8)+1) )6 / / V o l u m e f l o w r a t e ( i n gpm ) :

7 Q=V2∗%pi∗(D/12) ˆ2/4∗7.48∗608 printf ( ”\n\nRESULTS\n\n” )9 printf ( ”\n\nVolume low ra t e : %. 3 f \n\n” ,Q)

Example 8.07d 8.07-data.sci

1 / / H e i g h t o f s t a n d p i p e ( i n f t ) :

2 l =80;3 / / L e n g t h o f l o n g e s t p i p e ( i n f t ) :

4 L=600;5 / / D i a m e t e r o f p i p e ( i n i n c h e s ) :

6 D=4;7 / / F r i c t i o n f a c t o r :

8 f =0.031;9 / / A c c e l e r a t i o n d u e t o g r a v i t y i n f t / s e c ˆ 2 ) :

10 g =32.2;

Example 8.08 8.08.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.08−data . s c i ’3 exec ( f i l ename )

60

Page 62: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

4 / / V a l u e o f d P m a x ( i n p s i ) :

5 dPmax=p1−p26 / / Q i n c u b i c f e e t / s e c :

7 Q1=1500/60/7.48;8 / / I n i t i a l l y a s s u m e d i a m e t e r t o b e 4 i n c h e s :

9 D=4;10 / / R e y n o l d s n u m b e r :

11 Re=4∗Q1/%pi/v/D∗1212 / / F o r t h i s v a l u e ,

13 f =0.012;14 dP=8∗ f ∗L∗p∗Q1ˆ2/(%pi ) ˆ2/Dˆ5∗1728;15 while (dP>dPmax)16 dP=8∗ f ∗L∗p∗Q1ˆ2/(%pi ) ˆ2/Dˆ5∗1728;17 i f (dP<dPmax)18 break19 else20 D=D+1;21 end22 end23 printf ( ”\n\nRESULTS\n\n” )24 printf ( ”Minimum diameter that can be used :%. 1 f inche s \n

\n” ,D)

Example 8.08d 8.08-data.sci

1 / / L e n g t h o f A l t u b i n g ( i n f t ) :

2 L=500;3 / / V o l u m e f l o w r a t e o f p ump o u t p u t ( i n gpm ) :

4 Q=1500;5 / / D i s c h a r g e p r e s s u r e ( i n p s i g ) :

6 p1=65;7 / / S p r i n k l e r p r e s s u r e ( i n p s i g ) :

8 p2=30;9 / / K i n e m a t i c v i s c o s i t y ( i n f t ˆ 2 / s e c ) :

10 v=1.21∗10ˆ−5;11 / / D e n s i t y ( i n s l u g / f t ˆ 3 ) :

12 p=1.94;

61

Page 63: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 8.09 8.09.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 0 9 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.09−data . s c i ’3 exec ( f i l ename )4 / / A v e r a g e v e l o c i t y ( i n f t / s ) :

5 V2=4/%pi∗Q/Dˆ2∗1446 / / R e y n o l d s n u m b e r :

7 Re=V2∗D/v/128 / / F o r t h i s v a l u e ,

9 f =0.013;10 / / P o w e r l a w e x p o n e n t :

11 n=−1.7+1.8∗ log10 (Re)12 / / V a l u e o f V / U :

13 v u=2∗nˆ2/(n+1)/(2∗n+1)14 / / V a l u e o f a l p h a :

15 alpha =(1/v u ) ˆ3∗2∗nˆ2/(3+n) /(3+2∗n)16 / / L o s s C o e f f i c i e n t f o r a s q u a r e e d g e d e n t r a n c e :

17 K=2∗g∗h/V2ˆ2− f ∗L/D∗12−alpha ;18 printf ( ”\n\nRESULTS\n\n” )19 printf ( ”\n\nLoss C o e f f i c i e n t f o r a square edged

entrance : %. 3 f \n\n” ,K)

Example 8.09d 8.09-data.sci

1 / / L e n g t h o f c o p p e r w i r e ( i n f t ) :

2 L=10;3 / / I n n e r d i a m e e r o f p i p e ( i n i n c h e s ) :

4 D=1.5;5 / / D i s c h a r e ( i n f t ˆ 3 / s e c ) :

6 Q=0.566;7 / / L e v e l o f r e s e r v o i r a b o v e p i p e c e n t r e l i n e ( i n n f e e t ) :

8 h=85.1;9 / / K i n e m a t i c v i s c o s i t y a t 7 0 F ( i n f t ˆ 2 / s ) :

10 v=1.05∗10ˆ−5;11 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

12 g =32.2;

62

Page 64: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 8.10 8.10.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 1 0 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.10−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y V1 ( i n m/ s ) :

5 V1=sqrt (2∗ g∗z0 /1 . 04 )6 / / V o l u m e f l o w r a t e ( i n m ˆ 3 / s e c ) :

7 Q=V1∗%pi∗Dˆ2/48 Kdi f f=1−1/A Rˆ2−Cp9 / / F o r 2 n d c a s e :

10 / / V e l o c i t y ( i n m/ s ) :

11 V1=sqrt (2∗ g∗z0 /0 . 59 )12 / / V o l u m e f l o w r a t e ( i n m ˆ 3 / s ) :

13 Qd=V1∗%pi∗Dˆ2/414 / / I n c r e a s e i n d i s c h a r g e a f t e r a d d i t i o n o f d i f f u s e r i s :

15 dQ=(Qd−Q) /Q∗10016 printf ( ”\n\nRESULTS\n\n” )17 printf ( ”\n\nVolume f low ra t e in case1 : %. 3 f mˆ3/ sec \n\n

” ,Q)18 printf ( ”\n\nVolume f low ra t e in case 2 : %. 3 f mˆ3/ sec \n\

n” ,Qd)19 printf ( ”\n\ nInc rea se in d i s cha rge a f t e r add i t i on o f

d i f f u s e r i s : %. 3 f percent \n\n” ,dQ)

Example 8.10d 8.10-data.sci

1 / / N o z z l e e x i t d i a m e t e r ( i n mm ) :

2 D=25;3 / / N / R1 v a l u e v a l u e :

4 N R=3;5 / / AR v a l u e :

6 A R=2;7 / / S t a t i c h e a d a v a i l a b l e f r o m t h e m a i n ( i n m ) :

8 z0 =1.5 ;9 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

10 g =9.8 ;11 / / V a l u e o f Cp :

63

Page 65: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

12 Cp=0.45;

Example 8.11 8.11.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 8 . 1 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 8.11−data . s c i ’3 exec ( f i l ename )4

5 / / V a l u e o f K ∗ B ˆ 2 :

6 K B=Q/(%pi/4∗Dˆ2)∗sqrt ( 0 . 5∗ d1/g/d2/h)7 / / R e y n o d s n u m b e r :

8 ReD1=4/%pi∗Q/D/v9 / / By t r i a l a n d e r r o r m e t h o d , t h e v a l u e o f b e t a i s f i x e d

a t :

10 betta =0.66;11 / / K i s t h e n :

12 K=K B/ betta ˆ213 / / D i a m e t e r o f o r i f i c e p l a t e ( i n m ) :

14 Dt=betta ∗D15 / / V a l u e o f p 3 − p 2 ( i n N /m ˆ 2 ) :

16 P1=d1∗Qˆ2/(%pi/4∗Dˆ2) ˆ2∗ (1/0 .65/ betta ˆ2−1)17 / / V a l u e o f p 1 − p 2 ( i n N /m ˆ 2 ) :

18 P2=d2∗g∗h19 / / H e a d l o s s b e t w e e n s e c t i o n s 1 a n d 3 ( i n N−m/ k g ) :

20 hLT=(P2−P1) /d121 / / E x p r e s s i n g t h e p e r m a n e n t p r e s s u r e a s a f r a c t i o o f t h e

m e t e r d i f f e r e n t i a l :

22 C=(P2−P1) /P223 printf ( ”\n\n\nRESULTS\n\n” )24 printf ( ”\n\nDiameter o f the o r i f i c e : %. 3 f m\n\n” ,Dt)25 printf ( ”\n\nHead l o s s between s e c i o n s 1 and 3 : %. 3 f N−m

/kg\n\n” ,hLT)

Example 8.11d 8.11-data.sci

1 / / V o l u m e f l w r a t e o f a i ( i n m ˆ 3 / s e c ) :

2 Q=1;3 / / D i a m e t e r o f p i p e ( i n m ) :

64

Page 66: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

4 D=0.25;5 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

6 d1 =1.23;7 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s ˆ 2 ) :

8 g =9.8 ;9 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

10 d2=999;11 / / Maxmum r a n g e o f m a n o m e t e r ( i n m ) :

12 h=0.3;13 / / K i n e m a t i c v i s c o s i t y ( i n m ˆ 2 / s ) :

14 v=1.46∗10ˆ−5;

65

Page 67: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 9

External IncompressibleViscous Flow

9.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

When we execute S 9.08, we get Fig. 9.1.

9.2 Scilab Code

Example 9.01 9.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.01−data . s c i ’3 exec ( f i l ename )4 / / C h a n g e i n s t a t i c p r e s s u r e b e t w e e n s e c t i o n s 1 a n d 2 :

5 C=(((L−2∗d1 ) /(L−2∗d2 ) ) ˆ4−1) ∗100 ;6 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nChange in s t a t i c p r e s su r e between the

s e c t i o n s 1 and 2 : %. 3 f percent \n\n” ,C)

Example 9.01d 9.01-data.sci

66

Page 68: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / L e n g h o f s i d e o f t h e t e s t s e c t i o n ( i n mm ) :

2 L=305;3 / / F r e e s t e a m s p e e d a t s e c t i o n 1 ( i n m/ s e c ) :

4 U1=26;5 / / D i s p l a c e m e n t t h i c k n e s s a t s e c t i o n 1 ( i n mm ) :

6 d1 =1.5 ;7 / / D i s p l a c m e n t t h i c k n e s s a t s e c t i o n 2 ( i n mm ) :

8 d2 =2.1 ;

Example 9.04 9.04.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.04−data . s c i ’3 exec ( f i l ename )4 / / R e y n o l d s n u m b e r :

5 ReL=U∗L/v6 / / FOR TURBULENT FLOW

7 / / D i s t u r b a n c e t h i c k n e s s ( i n m ) :

8 dL1=0.382/ReLˆ0.2∗L9 / / D i s p l a c e m e n t t h i c k n e s s ( i n m ) :

10 function y=f (n) , y=dL1∗(1−n ˆ(1/7) )11 endfunction12 dl1=intg (0 , 1 , f )13 / / S k i n f r i c t i o n c o e f f i c i e n t :

14 Cf1 =0.0594/ReLˆ0 .215 / / W a l l s h e a r s t r e s s ( i n N /m ˆ 2 ) :

16 tw1=Cf1 ∗0.5∗d∗Uˆ217 / / F o r LAMINAR FLOW :

18 / / D i s t u r b a n c e t h i c k n e s s ( i n m )

19 dL2=5/sqrt (ReL)∗L20 / / D i s p l a c e m e n t t h i c k n e s s ( i n m ) :

21 dl2 =0.344∗dL222 / / S k i n f r i c t i o n c o e f f i c i e n t :

23 Cf2 =0.664/ sqrt (ReL)24 / / W a l l s h e a r s t r e s s ( i n N /m ˆ 2 ) :

25 tw2=Cf2 ∗0.5∗d∗Uˆ226 / / COMPARISON OF VALUES WITH LAMINAR FLOW

27 / / D i s t u r b a n c e t h i c k n e s s

67

Page 69: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

28 D=dL1/dL229 / / D i s p l a c e m e n t t h i c k n e s s

30 DS=dl1 / dl231 / / W a l l s h e a r s t r e s s

32 WSS=tw1/tw233 printf ( ”\n\nRESULTS\n\n” )34 printf ( ”\n\nDisturbace t h i c k n e s s : %. 3 f m\n\n” ,dL1)35 printf ( ”\n\nDisplacement t h i c k n e s s : %. 3 f m\n\n” , d l1 )36 printf ( ”\n\nWall shear s t r e s s : %f N/mˆ2\n\n” , tw1 )37 printf ( ”\n\nCOMPARISON WIH LAMINAR FLOW\n\n\n” )38 printf ( ”\n\n Disturbance th i ckne s : %. 3 f \n\n” ,D)39 printf ( ”\n\nDisplacement t h i c k n e s s : %. 3 f \n\n” ,DS)40 printf ( ”\n\nWall shear s t r e s s : %. 3 f \n\n” ,WSS)

Example 9.04d 9.04-data.sci

1 / / V e o c i t y o f f l o w ( i n m/ s e c ) :

2 U=1;3 / / L e n g t h o f f l a t p l a t e ( i n m ) :

4 L=1;5 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

6 d=999;7 / / K i n e m a t i c v i s c o s i t y o f w a t e r ( i n m ˆ 2 / s e c ) :

8 v=10ˆ−6;

Example 9.05 9.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.05−data . s c i ’3 exec ( f i l ename )4 / / S p e e d i n m/ s :

5 U=s ∗6076∗0.305/36006 / / R e y n o l d s n u m b e r :

7 Re=U∗L/v8 / / D r a g c o e f f i c i e n t :

9 Cd=0.455/ log10 (Re) ˆ2.58−1610/Re10 / / A r e a ( i n m ˆ 2 ) :

11 A=L∗(W+D)

68

Page 70: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

12 / / D r a g f o r c e ( i n N )

13 Fd=Cd∗A∗0.5∗d∗Uˆ214 / / P o w e r r e q u i r e d t o o v e r c o m e s k i n f r i c t i o n d r a g ( i n W) :

15 P=Fd∗U16 printf ( ”\n\nRESULTS\n\n” )17 printf ( ”\n\nDrag f o r c e : %f N\n\n” ,Fd)18 printf ( ”\n\nPower r equ i r ed to overcome sk in f r i c t i o n

drag : %. 3 f W\n\n” ,P)

Example 9.05d 9.05-data.sci

1 / / L e n g t h o f t h e s u p e r t a n k e r ( i n m ) :

2 L=360;3 / / W i d t h o f s u p e r t a n k e r ( i n m ) :

4 W=70;5 / / D r a f t o f t h e s u p e r t a n k e r ( i n m ) :

6 D=50;7 / / C r u i s i n g s p e e d i n w a t e r ( i n k n o t s ) :

8 s =13;9 / / K i n e m a t i c v i s c o s i t y a t 1 0 C

10 v=1.37∗10ˆ−6;11 / / D e n s i t y o f s e a w a t e r ( i n k g /m ˆ 3 ) :

12 d=1020;

Example 9.06 9.06.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.06−data . s c i ’3 exec ( f i l ename )4 / / V e l o c i t y i n m/ s e c :

5 V=s ∗5/186 / / R e y n o l d s n u m b e r :

7 Re=d∗V∗D/u8 / / V a l u e o f Cd i s o b t a i n e d a s :

9 Cd=0.35;10 / / A r e a ( i n m ˆ 2 ) :

11 A=Lˆ2 ;12 / / M o m e n t a b o u t t h e c h i m n e y b a s e ( i n N−m ) :

69

Page 71: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

13 M0=Cd∗A∗D/4∗d∗Vˆ214 printf ( ”\n\nRESULTS\n\n” )15 printf ( ”\n\nBending moment at the bottom of the chimney

: %. 3 f N−m\n\n” ,M0)

Example 9.06d 9.06-data.sci

1 / / D i a m e t e r o f c h i m n e y ( i n m ) :

2 D=1;3 / / H e i g h t o f c h i m n e y ( i n m ) :

4 L=25;5 / / S p e e d o f w i n d ( i n k m p h ) :

6 s =50;7 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

8 d=1.23;9 / / V i s c o s i t y o f a i r ( i n k g / ( m− s ) ) :

10 u=1.79∗10ˆ−5;11 / / P r e s s u r e ( i n k P a ) :

12 p=101;

Example 9.07 9.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.07−data . s c i ’3 exec ( f i l ename )4 / / T i m e r e q u i r e d t o d e c e l e r a t e t o 1 0 0 mph ( i n s e c o n d s ) :

5 t=(s1−s2 ) ∗2∗w/( s1∗ s2 ) /Cd/d/A/g∗3600/52806 printf ( ”\n\nRESULTS\n\n” )7 printf ( ”\n\nTime requ i r ed to d e c e l e r a t e to 100 mph: %. 3

f seconds \n\n” , t )

Example 9.07d 9.07-data.sci

1 / / W e i g h t o f t h e d r a g s t e r ( i n l b f ) :

2 w=1600;3 / / S p e e d o f d r a g s t e r ( i n mph ) :

4 s1 =270;

70

Page 72: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

5 / / A r e a o f d r a g c h u t e ( i n f t ˆ 2 ) :

6 A=25;7 / / S p e e d o f d r a g s t e r a f t e r d e c e l e r a t o n ( i n mph ) :

8 s2 =100;9 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

10 g =32.2;11 / / D e n s i t y o f a i r ( i n s l u g / f t ˆ 3 ) :

12 d=0.00238;13 / / V a l u e o f c o e f f i c i e n t o f d r a g :

14 Cd=1.42;

Example 9.08 9.08.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.08−data . s c i ’3 exec ( f i l ename )4 / / P l o t t i n g v e l o c i t y w i t h d r a g f o r c e

5 V=175 :25 :455 ;6

7 [m n]= s ize (V) ;8 for i =1:n9 CL( i )=2∗W/p∗(3600/V( i ) /5280) ˆ2/A;

10 Cd( i )=Cd0+CL( i ) ˆ2/%pi/ ar ;11 Fd( i )=Cd( i ) /CL( i )∗W;12 FD( i )=Fd( i ) /1000 ;13 end14 plot (V,FD)15 xt i t le ( ’ F l i gh t speed vs th rus t ’ , ’ F l i gh t Speed ( in mph) ’ ,

’ Drag Force ( in 1000 l b f ) ’ )16 / / O p t i m u m c u i s e s p e e d a t s p e e d l e v e l i s o b t a i n e d t o b e

3 2 0 mph f r o m t h e g r a p h .

17 Vosl =320;18 / / R a t i o o f s p e e d s a t 3 0 0 0 0 f t a n d a t s e a l e v e l i s g i v e n

b y :

19 r=sqrt ( 1/0 . 375 ) ;20 / / S t a l l s p e e d a t 3 0 0 0 0 f t i s ( i n mph ) :

21 Vs3=Vss l ∗ r ;22 / / O p t i m u m C r u i s e s p e e d a t 3 0 0 0 0 f t ( i n mph ) :

71

Page 73: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

23 Vo3=Vosl∗ r ;24 printf ( ”\n\nRESULTS\n\n” )25 printf ( ”\n\nOptimum c r u i s e speed at sea l e v e l : %. 3 f mph

\n\n” , Vosl )26 printf ( ”\n\ n S t a l l speed at 30000 f t : %. 3 f mph\n\n” , Vs3 )27 printf ( ”\n\nOptimum c r u i s e speed at 30000 f t : %. 3 f \n\n”

,Vo3)

Example 9.08d 9.08-data.sci

1 / / W i n g a r e a ( i n f t ˆ 2 ) :

2 A=1600;3 / / A s p e c t r a t i o :

4 ar =6.5 ;5 / / G r o o s w e i g h t o f a i r c r a f t ( i n l b f ) :

6 W=150000;7 / / C o e f f i c i e n t o f d r a g a t z e r o l i f t :

8 Cd0=0.0182;9 / / S o n i c s p e e d a t s e a l e v e l ( i n mph ) :

10 c =759;11 / / D e n s i t y o f a i r ( i n s l u g / f t ˆ 3 ) :

12 p=0.00238;13 / / S r a l l s p e e d a t s e a l e v e l ( i n mph ) :

14 Vss l =175;

Example 9.09 9.09.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 9 . 0 9 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 9.09−data . s c i ’3 exec ( f i l ename )4 / / R e y n o l d s n u m b e r :

5 / / V a l u e o f wD / 2 V :

6 W=0.5∗N∗D/1000/V∗2∗%pi/607 Red=V∗D/v ;8 / / F o r t h i s v a l u e , CL i s o b t a i n e d a s :

9 CL=0.3;10 / / A e r o d y n a m i c l i f t ( i n N ) :

72

Page 74: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 9.1: Output graph of S 9.08

73

Page 75: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 FL=%pi/8∗CL∗(D/1000) ˆ2∗d∗Vˆ2 ;12 / / R a d i u s o f c u r v a t u r e o f t h e p a t h i n t h e v e r t i c a l p l a n e

( i n m ) w i t h t o p s p i n :

13 Rts=Vˆ2/( g+FL/(m/1000) ) ;14 / / R a d i u s o f c u r v a t u r e w i t h o u t t o p s p i n ( i n m ) :

15 Rwts=Vˆ2/g ;16 printf ( ”\n\nRESULTS\n\n” )17 printf ( ”\n\nAerodynamic l i f t a c t ing on the b a l l :%. 3 f N\

n\n” ,FL)18 printf ( ”\n\nRadius o f curvature o f the path when b a l l

has topsp in :%. 3 f m\n\n” , Rts )19 printf ( ”\n\nRadius o f curvature o f the path when b a l l

has topsp in : %. 3 f m\n\n” ,Rwts )

Example 9.09d 9.09-data.sci

1 / / M a s s o f t h e t e n n i s b a l l ( i n g r a m s ) :

2 m=57;3 / / D i a m e t e r o f t h e b a l l ( i n mm ) :

4 D=64;5 / / V e l o c i t y w i t h w h i c h t e b a l l i s h i t ( i n m/ s ) : \

6 V=25;7 / / T o p s p i n g i v e n o n t h e b a l l ( i n r p m ) :

8 N=7500;9 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s ˆ 2 ) :

10 g =9.81;11 / / K i n e m a t i c v i s c o s i t y ( i n m ˆ 2 / s ) :

12 v=1.46∗10ˆ−513 / / D e s i t y o f a i r ( i n k g /m ˆ 3 ) :

14 d=1.23;

74

Page 76: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 10

Fluid Machinery

10.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

When S 10.03 is executed, we get Fig. 10.1. When S 10.07 is executed,we get Fig. 10.2. When S 10.08 is executed, we get Fig. 10.3 and Fig. 10.4.When S 10.11 is executed, we get Fig. 10.5 to Fig. 10.7.

10.2 Scilab Code

Example 10.01 10.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.01−data . s c i ’3 exec ( f i l ename )4 / / I m p e l l e r e x i t w i d t h b 2 ( i n f e e t ) :

5 b2=Q∗12/(2∗%pi∗R2∗Vrb2 ∗7 .48∗60)6 / / T o r q u e o f t h e S h a f t , T s h a f t ( i n f t − l b f ) :

7 Tshaft=w∗R2ˆ2∗p∗Q∗2∗%pi /3600/7.48/1448 / / P o w e r , Wm( i n h p ) :

9 Wm=w∗Tshaft ∗2∗%pi/60/55010 printf ( ”\n\nRESULTS\n\n” )

75

Page 77: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 printf ( ”\n\ nImpe l l e r e x i t width : %. 3 f f e e t \n\n” , b2 )12 printf ( ”\n\Torque input : %. 3 f f t−l b f \n\n” , Tshaft )13 printf ( ”\n\nPower : %. 3 f hp\n\n” ,Wm)

Example 10.01d 10.01-data.sci

1 / / V o l u m e f l o w r a t e i n gpm :

2 Q= 150 ;3 / / V a l u e o f V r b 2 i n f t / s e c :

4 Vrb2=10;5 / / R a d i u s o f o u t t e r i m p e l l e r i n i n c h e s :

6 R2=2;7 / / I m p e l l e r S p e e d i n r p m :

8 w=3450;9 / / D e n s i t y o f a i r i n s l u g / f t ˆ 3

10 p=1.94;

Example 10.02 10.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.02−data . s c i ’3 exec ( f i l ename )4 U=0.5∗(Dh+Dt) /2∗1200∗2∗%pi/605 k=tand ( alpha1 )+cotd ( betta1 )6 Vn1=U/k7 V1=Vn1/ cosd ( alpha1 )8 Vt1=V1∗ s ind ( alpha1 )9 Vrb1=Vn1/ s ind ( betta1 )

10 / / V o l u m e f l o w r a t e ( i n m ˆ 3 / s e c ) :

11 Q=%pi/4∗Vn1∗(Dtˆ2−Dhˆ2)12 k=(U−Vn1∗ cotd ( betta2 ) ) /Vn113 alpha2= atand ( k )14 V2=Vn1/ cosd ( alpha2 )15 Vt2=V2∗ s ind ( alpha2 )16 / / R o t o r T o r q u e ( i n N−m ) :

17 Tz=p∗Q∗(Dh+Dt) /4∗(Vt2−Vt1 )18 / / P o w e r r e q u i r e d ( i n W) :

19 Wm=w∗2∗%pi/60∗Tz

76

Page 78: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

20 printf ( ”\n\nRESULTS\n\n” )21 printf ( ”\n\nVolume f low ra t e : %. 3 f mˆ3/ sec \n\n” ,Q)22 printf ( ”\n\nRotor Torque : %. 3 f N−m\n\n” ,Tz)23 printf ( ”\n\nPower r equ i r ed : %. 3 f W\n\n” ,Wm)

Example 10.02d 10.02-data.sci

1 / / T i p D i a m e t e r i n m e t r e s :

2 Dt=1.1;3 / / Hub D i a m e t e r i n m e t r e s :

4 Dh=0.8;5 / / O p e r a t i n g S p e e d i n r p m :

6 w=1200;7 / / A b s o l u t e i n l e t a n g l e i n d e g r e e s :

8 alpha1 =30;9 / / B l a d e i n l e t a n g l e i n d e g r e e s :

10 betta1 =30;11 / / B l a d e o u t l e t a n g l e i n d e g r e e s :

12 betta2 =60;13 / / D e n s i t y o f a i r i n k g /m ˆ 3

14 p=1.23;

Example 10.03 10.03.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 0 3 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.03−data . s c i ’3 exec ( f i l ename )4 [nQ mQ]= s ize (Q) ;5 [ nps mps]= s ize ( ps ) ;6 [ npd mpd]= s ize (pd ) ;7 [ nI mI]= s ize ( I ) ;8 / / C o r r e c t m e a s u r e d s t a t i c p r e s s u r e s t o h e p ump

c e n t r e l i n e p 1 , p 2 ( i n p s i g ) :

9 j =1:mps ;10 p1=ps ( j )+px∗g∗ zs /14411 j =1:mpd;12 p2=pd( j )+px∗g∗zd /14413 / / T h e v a l u e o f Pump h e a d ( i n f e e t ) :

77

Page 79: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

14 j =1:mps ;15 Hp=(p2 ( j )−p1 ( j ) ) /( px∗g ) ∗14416 / / V a l u e s o f H y d r a u l i c P o w e r d e l i v e r e d ( i n h p ) :

17 j =1:mps ;18 Wh=Q( j ) . ∗ ( p2 ( j )−p1 ( j ) ) /7.48/60∗144/55019 / / V a l u e s o f m o t o r p o w e r o u t p u t ( i n h p ) :

20 j =1:mI ;21 Pin=Effm∗sqrt (3 ) ∗PF∗E∗ I ( j ) /74622 / / V a l u e s o f Pump E f f i c i e c y :

23 j =1:mI ;24 Effp= Wh( j ) . / Pin ( j ) ∗10025 / / P l o t t i n g p ump c h a r a c t e r i s t i c s :

26 plot (Q,Hp, ”−o” )27 plot (Q, Pin , ”−+” )28 plot (Q, Effp , ”−∗” )29 xt i t le ( ’Pump C h a r a c t e r i s t i c s ’ , ’ Volume f low ra t e ( in

gpm) ’ , [ ’Pump E f f i c i n c y (%) ’ , ’ Pump Head( inf e e t ) ’ , ’ Pump Power input ( in hp) ’ ] )

30 l egend ( ’Hp ’ , ’ Pin ’ , ’ Ef fp ’ )

Example 10.03d 10.03-data.sci

1 / / R a t e o f f l o w i n gm :

2 Q=[0 500 800 1000 1100 1200 1400 1 5 0 0 ] ;3 / / S u c t i o n p r e s s u r e i n p s i g :

4 ps=[ 0 .65 0 .25 −0.35 −0.92 −1.24 −1.62 −2.42 −2 .89 ] ;5 / / D i s c h a r g e p r e s s u r e i n p s i g :

6 pd=[53.3 48 .3 42 .3 36 .9 33 27 .8 15 .3 7 . 3 ] ;7 / / M o t o r C u r r e n t i n a m p s :

8 I =[18 26 .2 31 33 .9 35 .2 36 .3 38 3 9 ] ;9 / / A c c e l e r a t i o n d u e t o g r a v i t y i n f t / s ˆ 2 :

10 g =32.2;11 / / V a l u e o f Z s i n f e e t

12 zs =1;13 / / D e n s i t y o f a i r i n s l u g / f t ˆ 3 :

14 px =1.94;15 / / V a l u e o f ZD i n f e e t :

16 zd=3;

78

Page 80: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 10.1: Output graph of S 10.03

17 / / D e n s i t y o f f l u i d i n s l u g / f t ˆ 3 :

18 py=1000;19 / / M o t o r E f f i c i e n c y :

20 Effm =0.9;21 / / M o t o r S u p p l y i n v o l t s :

22 E=460;23 / / P o w e r F a c t o r :

24 PF=0.875;

Example 10.06 10.06.sce

79

Page 81: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.06−data . s c i ’3 exec ( f i l ename )4 / / S p e c i f i c s p e e d i n U s c u s t o m a r y u n i t s :

5 Nscu=N∗Qusˆ0 .5/ Hus ˆ0 .756 / / C o n v e r s i o n t o S I u n i t s :

7 w=1170∗2∗%pi /60 ;8 Qsi=Qus /7 .48/60∗0 .305ˆ3 ;9 Hsi=Hus ∗0 . 3 0 5 ;

10 / / E n e r g y p e r u n i t m a s s i s :

11 h=g∗Hsi ;12 / / S p e c i f i c s p e e d i n S I u n i t s :

13 Nss i=w∗Qsi ˆ0 .5/ h ˆ0 .7514 / / C o n v e r s i o n t o h e r t z :

15 whz=N/60 ;16 / / S p e c i f i c s p e e d i n E u r o p e a n u n i t s :

17 Nseu=whz∗Qsi ˆ0 . 5/65 . 5ˆ0 . 7518 / / R e l a t i o n b e t w e e n s p e c i f i c s p e e d s i n U s c u s t o m a r y

u n i t s a n d E u r o p e a n u n i t s :

19 Conver s i on fac to r1=Nscu/Nseu20 / / R e l a t i o n b e t w e e n s p e c i f i c s p e e d s i n U s c u s t o m a r y

u n i t s a n d S I u n i t s :

21 Conver s i on fac to r2=Nscu/ Nss i22 printf ( ”\n\nRESULTS\n\n” )23 printf ( ”\n\ n S p e c i f i c speed in US customary un i t s : %. 3 f

\n\n” , Nscu )24 printf ( ”\n\ n S p e c i f i c speed in SI un i t s : %. 3 f \n\n” , Nss i

)25 printf ( ”\n\ n S p e c i f i c speed in European un i t s : %. 3 f \n\n”

, Nseu )26 printf ( ”\n\nRelat ion between s p e c i f i c speeds in Us

customary un i t s and European un i t s : %. 3 f \n\n” ,Conver s i on fac to r1 )

27 printf ( ”\n\nRelat ion between s p e c i f i c speeds in Uscustomary un i t s and SI un i t s : %. 3 f \n\n” ,Conver s i on fac to r2 )

Example 10.06d 10.06-data.sci

80

Page 82: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / H e a d i n U s c u s t o m a r y u n i t s :

2 Hus=21.9;3 / / V o l u m e f l o w r a t e i n US c u s t o m a r y u n i t s :

4 Qus=300;5 / / W o r k i n g s e e d i n r p m :

6 N=1170;7 / / A c e l e r a t i o n d u e t o g r a v i y i n m/ s ˆ 2

8 g =9.81;

Example 10.07 10.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.07−data . s c i ’3 exec ( f i l ename )4 / / V o l u m e f l o w r a t e ( i n gpm ) a t s h u t o f f c o n d i t i o n f o r N2

:

5 Q2so=N2/N1∗Q1so6 / / V o l u m e f l o w ( i n gpm ) r a t e a t b e s t e f f i c i e n c y f o r N2 :

7 Q2be=N2/N1∗Q1be8 / / R e l a t i o n b e t w e e n pump h e a d s :

9 h e a d r e l a t i o n =(N2/N1) ˆ210 / / H e a d ( i n f e e t ) a t s h u t o f f c o n d i t i o n f o r N2 :

11 H2so=(N2/N1) ˆ2∗H1so12 / / H e a d ( i n f e e t ) a t b e s t e f f i c i e n c y c o n d i t i o n f o r N2 :

13 H2be=(N2/N1) ˆ2∗H1be14 Q1=[Q1so Q1be ] ;15 Q2=[Q2so Q2be ] ;16 H1=[H1so H1be ] ;17 H2=[H2so H2be ] ;18 plot (Q1, H1 , ”−o” )19 plot (Q2, H2 , ”−∗” )20 xt i t le ( ’ Comparison o f head f o r both c o n d i t i o n s ’ , ’ Volume

Flow Rate ’ , ’Head ’ )21 l egend ( ’ 1170 ’ , ’ 1750 ’ )

Example 10.07d 10.07-data.sci

81

Page 83: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 / / V o l u m e f l o w r a t e ( i n gpm ) a t s h u t o f f c o n d i t i o n f o r N1

:

2 Q1so=0;3 / / V o l u m e f l o w ( i n gpm ) r a t e a t b e s t e f f i c i e n c y f o r N1 :

4 Q1be=300;5 / / H e a d ( i n f e e t ) a t s h u t o f f c o n d i t i o n f o r N1 :

6 H1so=25;7 / / H e a d ( i n f e e t ) a t b e s t e f f i c i e n c y c o n d i t i o n f o r N1 :

8 H1be=21.99 / / O p e r a t i o n S p e e d 1 :

10 N1=1170;11 / / O p e r a t i o n s p e e d 2 :

12 N2=1750;

Example 10.08 10.08.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.08−data . s c i ’3 exec ( f i l ename )4 / / D i a m e t e r o f p i p e ( i n f e e t ) :

5 Df= Di/126 / / A r e a o f c r o s s e c t i o n o f p i p e ( i n f t ˆ 2 ) :

7 A=%pi/4∗Dfˆ28 / / V e l o c i t y o f f l o w ( i n f t / s e c ) :

9 V=Q/7.48/A/6010 / / F o r w a t e r a t T = 8 0 F , v i s c o s i t y = 0 . 9 2 7 e −5 f t ˆ 2 / s e c ,

R e y n o l d s n u m b e r :

11 Re=V∗Df/v12 / / F r i c t i o n l o s s C o e f f i c i e n t f o r t h i s v a l u e o f R e :

13 f =0.0237;14 / / F o r c a s t i r o n , r o u g h n e s s ( i n f e e t ) :

15 e =0.0008516 / / e / D i s :

17 e/Df18 / / T o t a l h e a d l o s s ( i n f e e t ) :

19 HL=K+f ∗(SE+OGV)+f ∗(L/Df )+120 / / T h e h e a d s a r e ( i n f e e t ) :

82

Page 84: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 10.2: Output graph of S 10.07

83

Page 85: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

21 H1=patm∗144/(p∗g )22 Vh=Vˆ2/2/g23 / / S u c t i o n h e a d ( i n f e e t ) :

24 Hs=H1+h−HL∗Vh25 / / NPSHA ( i n f e e t ) :

26 NPSHA=Hs+Vh−Hv127 / / F o r a f l o w r a t e o f 1 0 0 0 gpm , NPSHR ( i n f e e t ) f o r w a t e r

a t 8 0 F

28 NPSHR=1029 / / PLOTTING NPSHA AND NPSHR VERSUS VOLUME FLOW RATE :

30 / / F o r 8 0 F

31 Qp=0:100 :1500 ;32 [ nQp mQp]= s ize (Qp) ;33 for j =1:mQp;34 Vp( j )=Qp( j ) / (7 .48∗A∗60) ;35 Vhp( j )=(Vp( j ) ) ˆ2/2/g ;36 Hs( j )=H1+h−HL∗Vhp( j ) ;37 end38

39 for j =1:mQp;40 NPSHAp1( j )=Hs( j )+(Vhp( j ) )−Hv1 ;41 end42

43 plot (Qp,NPSHAp1, ”−+” )44 plot (Qh,NPSHRp, ”−o” )45 xt i t le ( ’ Suct ion head vs Flow ra t e ’ , ’ Volume f low ra t e (

gpm) ’ , ’ Suct ion Head( f e e t ) ’ ) ;46 printf ( ”\n\nType (Resume) to cont inue or ( abort ) to end

\n\n” )47 l egend ( ’NPSHA’ , ’NPSHR’ )48 pause49 c l f50

51 / / F o r 1 8 0 F

52 for j =1:mQp;53 NPSHAp2( j )=Hs( j )+(Vhp( j ) )−Hv2 ;54 end55 plot (Qp,NPSHAp2, ”−+” )

84

Page 86: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

56 plot (Qh,NPSHRp, ”−o” )57 xt i t le ( ’ Suct ion head vs Flow ra t e ’ , ’ Volume f low ra t e (

gpm) ’ , ’ Suct ion Head( f e e t ) ’ ) ;58 l egend ( ’NPSHA’ , ’NPSHR’ )59 printf ( ”\n\nRESULTS\n\n” )60 printf ( ”\n\nNPSHA at Q=1000 gpm of water at 80 F : %. 2 f

f t \n\n” ,NPSHA)61 printf ( ”\n\nNPSHR at Q=1000 gpm of water at 80 F : %. 1 f

f t \n\n” ,NPSHR)

Example 10.08d 10.08-data.sci

1 / / F o r 5 i n c h n o m i n a l p i p e l i n e , d i a m e t e r D :

2 Di =5.047;3 / / L e n g t h o f p i p e l i n e ( i n f e e t ) :

4 L=6;5 / / O p e r a t n g s p p e d ( i n r p m ) :

6 N=1750;7 / / W a t e r l e v e l a b o v e p u m p c e n t r e l i n e ( i n f e e t ) :

8 h=3.5;9 / / T e m p e r a t u r e 1 o f w a t e r ( i n F a r e n h e i t ) :

10 T1=80;11 / / T e m p e r a t u r e 2 o f w a t e r ( i n F a r e n h e i t ) :

12 T2=180;13 / / V o l u m e f l o w r a t e o f w a t e r ( i n gpm ) :

14 Q=1000;15 / / M i n o r l o s s C o e f f i c i e n t s :

16 K=0.5; SE=30; OGV=8;17 / / A t m o s p h e r i c p r e s s u r e ( i n l b f / i n ˆ 2 ) :

18 patm=14.7;19 / / D e n s i t y o f a i r ( s l u g / f t ˆ 3 ) :

20 p=1.93;21 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n f t / s e c ˆ 2 ) :

22 g =32.2;23 / / H e a d ( i n f e e t ) d u e t o v a p o r p r e s s u r e o f w a t e r f o r T

= 8 0 F :

24 Hv1=1.17;

85

Page 87: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 10.3: Output graph-1 of S 10.08

25 / / H e a d ( i n f e e t ) d u e t o v a p o r p r e s s u r e o f w a t e r f o r T

= 1 8 0 F :

26 Hv2=17.3;27 / / K i n e m a t i c v i s c o s i t y o f w a t e r a t 8 0 F :

28 v=0.927e−5;29 / / V a l u e o f d i s c h a r g e s f o r p l o t t i n g NPSHR ( i n gpm ) :

30 Qh=[500 700 900 1100 1300 ]31 / / V a l u e s o f NPSHR o b t a i n e d f r o m F i g . D3 o f a p p e n d i x D :

32 NPSHRp=[7 8 9 .5 12 16 ]

Example 10.11 10.11.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 1 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.11−data . s c i ’3 exec ( f i l ename )4 [nQ mQ]= s ize (Q1) ;5 [ np mp]= s ize ( p1 ) ;6 [ nP mP]= s ize (P1) ;7 / / V o l u m e f l o w r a t e f o r f a n 2 ( i n c f m ) :

86

Page 88: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 10.4: Output graph-2 of S 10.08

8 j =1:mQ;9 Q2=Q1( j ) ∗(N2/N1) ∗(D2/D1) ˆ3

10 / / P r e s s u r e v a l u e s f o r f a n 2 ( i n i n c h e s o f H2O ) :

11 j =1:mp;12 p2=p1 ( j ) ∗( d2/d1 ) ∗ ( (N2/N1) ˆ2) ∗ ( (D2/D1) ˆ2)13 / / P o w e r v a l u e s f o r f a n 2 ( i n h p ) :

14 j =1:mP;15 P2=P1( j ) ∗( d2/d1 ) ∗ ( (N2/N1) ˆ3) ∗ ( (D2/D1) ˆ5)16 plot (Q2, p2 )17 xt i t le ( ’ Performance curves ’ , ’ Volume f low ra t e ( in cfm ) ’ ,

’ Pres sure head ( in inche s o f water ) ’ )18 printf ( ”\n\nType ( resume ) to cont inue or ( abort ) to

e x i t \n\n” )19 pause20 c l f21 plot (Q2, P2)22 xt i t le ( ’ Performance curves ’ , ’ Volume f low ra t e ( in cfm ) ’ ,

’ Power ( in hp) ’ )23 printf ( ”\n\nType ( resume ) to cont inue or ( abort ) to

87

Page 89: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

e x i t \n\n” )24 pause25 c l f26 plot (Q2, E f f )27 xt i t le ( ’ Performance curves ’ , ’ Volume f low ra t e ( in cfm ) ’ ,

’ E f i c i e n c y ( in percentage ) ’ )28 / / S p e c i f i c s p e e d o f f a n ( i n US c u s t o m a r y u n i t s ) a t

o p e r a t i n g p o i n t :

29 Nscu= 1150∗110000ˆ0 .50∗0 .045ˆ0 .75/7 .4ˆ0 .7530 / / S p e c i f i c s p e e d o f f a n ( i n S I u n i t s ) a t o p e r a t i n g

p o i n t :

31 Nss i =120∗3110ˆ0.5∗0.721ˆ0 .75/1 .84 e3 ˆ0 .75

Example 10.11d 10.11-data.sci

1 / / D i a m e t e r o f f a n 1 ( i n i n c h e s ) :

2 D1=36;3 / / O p e r a t i n g s p e e d o f f a n 1 ( i n r p m ) :

4 N1=6005 / / D e n s i t y o f a i r u s e d i n f a n 1 ( i n l b m / f t ˆ 3 ) :

6 d1 =0.075;7 / / D i a m e t e r o f f a n 2 ( i n i n c h e s ) :

8 D2=42;9 / / O p e r a t i n g s p e e d o f f a n 2 ( i n r p m ) :

10 N2=1150;11 / / D e n s i t y o f a i f u s d i n f a n 2 ( i n l b m / f t ˆ 3 ) :

12 d2= 0 . 0 4 5 ;13 / / T h e f o l l o w i n g v a l u e s a r e o b t a i n e d f r o m t h e g i v e n

g r a p h

14 / / V a l u e s o f v o l u m e f l o w r a t e ( i n c f m ) t h r o u g h f a n 1 :

15 Q1= [ 0 10000 20000 30000 40000 50000 6 0 0 0 0 ] ;16 / / V a l u e s o f p r e s s u r e ( i n i n c h e s o f H2O ) :

17 p1=[ 3 .68 3 .75 3 .50 2 .96 2 .12 1 .02 0 ] ;18 / / V a l u e s o f p o w e r ( i n h p ) :

19 P1=[ 11 .1 15 .1 18 .6 21 .4 23 .1 23 .1 2 1 . 0 ] ;20 / / E f f i c i e n c y ( i n % ) :

21 Ef f =[0 37 59 65 57 34 0 ] ;

88

Page 90: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 10.5: Output graph-1 of S 10.11

Figure 10.6: Output graph-2 of S 10.11

89

Page 91: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 10.7: Output graph-3 of S 10.11

90

Page 92: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Example 10.12 10.12.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 1 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.12−data . s c i ’3 exec ( f i l ename )4 / / F r o m g i v e n g r a p h , f o r m a x i m u m d e l i v e r y c o n d i t i o n , Q

= 4 8 . 5 gpm .

5 / / V o l u m e o f o i l p e r r e v o l u t i o n d e l i v e r e d b y t h e p ump ( i n

i n ˆ 3 / r e v ) :

6 vc=Qe/N∗2317 / / V o l u m e t r i c E f f c i e n c y o f p ump a t max f l o w :

8 Effv=vc/va9 / / O p e r a t i n g p o i n t o f t h e p ump i s f o u n d t o b e a t 1 5 0 0

p s i g , Q = 4 6 . 5 gpm

10 / / P o w e r d e l i v e r e d b y t h e f l u i d ( i n h p ) :

11 Pf=Qo∗po1 /7.48/60∗144/55012 / / I n p u t p o w e r ( i n h p ) :

13 Pi=Pf/ Effp14 / / T h e p o w e r d e l i v e r e d t o t h e l o a d ( i n h p ) :

15 Pl=Q∗( po1 ) /7.48/60∗144/55016 / / P o w e r d i s s i p a t e d b y t h r o t t l i n g ( i n h p ) :

17 Pd=Pf−Pl18 / / T h e d i s s i p a t i o n w i t h t h e v a r i a b l e d i s p l a c e m e n t p ump (

i n h p ) :

19 Pvd=Q∗( po2−po1 ) /7.48/60∗144/55020 / / P o w e r r e q u i r e d f o r t e l o a d s e n s i n g p ump i f p ump

p r e s s u r e i s 1 0 0 p s i a b o v e t h a t r e q u i r e d b y t h e l o a d (

i n h p ) :

21 Pls=Q∗100/7.48/60∗144/55022 printf ( ”\n\nRESULTS\n\n” )23 printf ( ”\n\nVolume o f o i l per r e v o l u t i o n d e l i v e r e d by

the pump : %. 3 f in ˆ3/ rev \n\n” , vc )24 printf ( ”\n\nRequired pump power input : %. 3 f hp\n\n” , Pi )25 printf ( ”\n\nPower d e l i v e r d to the load : %. 3 f hp\n\n” , Pl

)26 printf ( ”\n\nPower d i s s i p a t e d by t h r o t t l i n g : %. 3 f hp\n\n

” ,Pd)27 printf ( ”\n\nThe d i s s i p a t i o n with the v a r i a b l e

91

Page 93: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

disp lacement pump : %. 3 f hp\n\n” ,Pvd)28 printf ( ”\n\nPower r equ i r ed f o r te load s en s ing pump i f

pump pre s su r e i s 100 p s i above that r equ i r ed by theload : %. 3 f hp\n\n” , Pls )

Example 10.12d 10.12-data.sci

1 / / O p e r a t i o n s p e e d ( i n r p m ) :

2 N=2000;3 / / V o l u m e f l o w r a t e ( i n gpm ) :

4 Q=20;5 / / P r e s s u r e ( i n p s i g ) :

6 p=1500;7 / / A c t u a l Pump D i s p l a c e m e n t ( i n ˆ 3 / r e v ) :

8 va =5.9;9 / / V o l u m e f l o w r a t e a t o p e r a t i n g c o n d i t i o n ( i n gpm ) :

10 Qo=46.5 ;11 / / V o l u m e f l o w r a t e a t m a x i m u m d e l i v e r y ( i n gpm ) :

12 Qe=48.5;13 / / P r e s s u r e a t o p e r a t i o n c o n d i t i o n ( i n p s i ) :

14 po1=1500;15 / / E f f i c i e n c y o f p ump a t o p e r a t i n g c o n d i t i o n :

16 Effp =0.84;17 / / P r e s s u r e a t o p e r a t i n g c o n d i t i o n c a s e 2 ( i n p s i g ) :

18 po2=3000;

Example 10.14 10.14.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 1 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.14−data . s c i ’3 exec ( f i l ename )4 / / P r o p e l l e r T h r u s t ( i n MN ) :

5 Ft=P/V6 / / R e q u i r e d p o w e r i n p u t t o t h e p r o p e l l e r ( i n MW) :

7 Pin=P/ Ef f8 / / C a l c u l a t i n g v a l u e o f D ( i n m ) :

9 nD=V/J10 D=(Ft∗10ˆ6/p/(nD) ˆ2/Cf ) ˆ0 .5

92

Page 94: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 / / O p e r a t i n g s p e e d ( i n r p m ) i s g i v e n b y :

12 n=nD/D∗6013 printf ( ”\n\nRESULTS\n\n” )14 printf ( ”\n\nDiameter o f the s i n g l e p r o p e l l e r r equ i r ed

to pwer the sh ip :%. 3 f m\n\n” ,D)15 printf ( ”\n\nOperating speed o f the p r o p e l l e r : %. 3 f rpm\

n\n” ,n)

Example 10.14d 10.14-data.sci

1 / / T o t a l p r o p u l s i o n p o w e r r e q u i r e m e n t ( i n MW) :

2 P=11.4;3 / / F r o m t h e g i v e n c u r v e s , V a l u e o f c o e f f i c i e n t s a t o p t i m u m

e f f i c i e n c y a r e a s f o l l o w s :

4 / / S p e e d o f a d v a n c e c o e f f i c i e n t :

5 J =0.85;6 / / T h r u s t C o e f f i c i e n t :

7 Cf =0.1;8 / / T o r q u e C o e f f i c i n t :

9 Ct=0.02;10 / / E f f i c i e n c y :

11 Ef f =0.66;12 / / V e l o c i t y o f s h i p ( i n m/ s e c ) :

13 V=6.69;14 / / D e n s i t y o f w a t e r ( i n k g /m ˆ 3 ) :

15 p=1025;

Example 10.16 10.16.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 0 . 1 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 10.16−data . s c i ’3 exec ( f i l ename )4 / / T i p s p e e d r a t i o o f w i n d m i l l :

5 X=N∗2∗%pi/60∗D/2/(V∗5/18)6 / / A c c o u n t i n g f o r w h i r l , max a t t a i n a b l e e f f i c i e n c y i s :

7 Efw=0.53;8 / / K i n e t i c e n e r g y f l u x ( i n W) i s g i v e n b y :

9 KEF=0.5∗p∗(V∗5/18) ˆ3∗%pi∗(D/2) ˆ2

93

Page 95: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

10 / / A c t u a l E f f i c i e n c y :

11 Ef fa=Po/KEF12 / / T h e m a x i m u m p o s s i b l e t h r u s t o c c u r s f o r a n

i n t e r f e r e n c e f a c t o r o f :

13 amax=0.5;14 / / T h r u s t ( i n W) :

15 Kx=p∗(V∗5/18) ˆ2∗%pi∗(D/2) ˆ2∗2∗amax∗(1−amax)16 printf ( ”\n\nRESULTS\n\n” )17 printf ( ”\n\nTip speed r a t i o o f windmi l l :%. 3 f \n\n” ,X)18 printf ( ”\n\nActual E f f i c i e n c y : %. 3 f \n\n” , Ef fa )19 printf ( ”\n\nActual Thrust : %. 3 f W\n\n” ,Kx)

Example 10.16d 10.16-data.sci

1 / / D i a m e t e r o f w i n d m i l l ( i n m ) :

2 D=26;3 / / O p e r a t i n g s p e e d ( i n r p m ) :

4 N=20;5 / / W i n d s p e e d ( i n km / h r ) :

6 V=36;7 / / P o w e r O u t p u t ( i n W) :

8 Po=41000;9 / / M a x i m u m e f f i c i e n c y o c c u r s i n f o l l o w i n g c o n d i t i o n s :

10 / / E f f i c i e n c y :

11 Ef f =0.593;12 / / I n t e f e r e n c e F a c t o r :

13 a=1/3;14 / / D e n s i t y o f a i r ( i n k g /m ˆ 3 ) :

15 p=1.23;

94

Page 96: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 11

Introduction to CompressibleFlow

11.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

When S 11.03 is executed, we get Fig. 11.1.

11.2 Scilab Code

Example 11.01 11.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 1 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 11.01−data . s c i ’3 exec ( f i l ename )4 / / D e n s i t y o f a i r a t e n t r y :

5 d1=p1∗10ˆ3/R/T16 / / A r e a ( i n m ˆ 2 ) :

7 A=m/d1/V18 / / C h a n g e i n e n t h a l p y o f a i r ( i n k J / k g ) :

9 dh=cp ∗(T2−T1)10 / / C h a n g e i n i n t e r n a l e n e r g y o f a i r ( i n k J / k g ) :

95

Page 97: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 du=cv ∗(T2−T1)12 / / C h a n g e i n e n t r o p y ( i n k J / ( k g −K ) ) :

13 ds=cp∗ log (T2/T1)−R/1000∗ log ( p2/p1 )14 printf ( ”\n\nRESULTS\n\n” )15 printf ( ”\n\nDuct Area : %. 3 f mˆ2\n\n” ,A)16 printf ( ”\n\nChange in enthalpy o f a i r : %. 3 f kJ/kg\n\n” ,

dh)17 printf ( ”\n\nChange in i n t e r n a l energy o f a i r :%. 3 f kJ/kg

\n\n” ,du)18 printf ( ”\n\nChange in entropy : %. 3 f kg−K\n\n” , ds )

Example 11.01d 11.01-data.sci

1 / / T e m p e r a t u r e o f a i r e n t e r i n g t h e c o l d s e c t i o n ( i n K ) :

2 T1=440;3 / / A b s o l u t e p r e s s u r e o f a i r e n t e r i n g t h e c o l d s e c t i o n ( i n

k P a ) :

4 p1=188;5 / / V e l o c i t y o f a i r e n t e r i n g t h e c o l d s e c t i o n ( i n m/ s e c ) :

6 V1=210;7 / / T e m p e r a t u r e o f a i r a t o u t l e t : ( i n K )

8 T2=351;9 / / A b s o l u t e p r e s s u r e o f a i r a t o u t l e t ( i n k P a ) :

10 p2=213;11 / / R a t e o f h e a t l o s s i n t h e s e c t i o n ( i n k J / s e c ) :

12 / / G a s C o n s t a n t ( i n N−m ) :

13 R= 287 ;14 / / M a s s f l o w r a t e o f a i r ( i n k g / s e c ) :

15 m=0.15;16 / / S p e c i f i c h e a t a t c o n s t a n t p r e s s u e ( i n k J / ( k g −K ) ) :

17 cp=1;18 / / S p e c i f i c e n e r g y a t c o n s t a n t v o l u m e ( i n k J / ( k g −K ) ) :

19 cv =0.717;

Example 11.03 11.03.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 1 . 0 3 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 11.03−data . s c i ’

96

Page 98: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

3 exec ( f i l ename )4 / / V a l u e s o f a l t i t u d e ( i n m ) :

5 Al =0:1000:150006 [ nAl mAl]= s ize ( Al ) ;7 / / V a l u e s o f t e m p e r a t u r e a t g i v e n a l t i t u d e s ( i n K ) :

8 T=[288.2 281 .7 275 .2 268 .7 262 .2 255 .7 249 .2 242 .7236 .2 229 .7 223 .3 216 .8 216 .7 216 .7 216 .7 2 1 6 . 7 ] ;

9 [ nT mT]= s ize (T) ;10 / / V a l u e s o f s p e e d o f s o u n d a t t h e s e a l t i t u d e s ( i n m/ s e c )

:

11 j =1:mT;12 c=sqrt ( k∗R∗T( j ) )13 / / S p e e d o f s o u n d a t s e a l e v e l ( i n m/ s e c ) :

14 c1=sqrt ( k∗R∗T(1) )15 plot ( c , Al )16 xt i t le ( ’ Var ia t ion o f sound speed with a l t i t u d e ’ , ’ Speed

o f sound (m/ sec ) ’ , ’ A l t i tude (m) ’ )17 printf ( ”\n\nRESULTS\n\n” )18 printf ( ”\n\nSpeed o f sound at sea l e v e l : %. 3 f m/ sec \n\n

” , c1 )

Example 11.03d 11.03-data.sci

1 / / V a l u e o f k :

2 k =1.4 ;3 / / G a s C o n s t a n t ( i n K j / ( k g −K ) ) :

4 R=287;

Example 11.04 11.04.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 1 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 11.04−data . s c i ’3 exec ( f i l ename )4 / / M a c h n u m b e r a t e n t r y :

5 M1=V1/sqrt ( k∗R∗T1)6 / / S t a g n a t i o n p r e s s u r e a t e n t r y ( i n k P a ) :

7 p01=p1∗(1+(k−1)/2∗M1ˆ2) ˆ( k /(k−1) )

97

Page 99: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Figure 11.1: Output graph of S 11.03

98

Page 100: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

8 / / S t a g n a t i o n t e m p e r a t u r e a t e n t r y ( i n K ) :

9 T01=T1∗(1+(k−1)/2∗M1ˆ2)10 / / S t a t i c p r e s s u r e a t e x i t ( i n k P a ) :

11 p2=p02/(1+(k−1)/2∗M2ˆ2) ˆ( k /(k−1) )12 / / T e m p e r a t u r e a t e x i t ( i n K ) :

13 T2=T02/(1+(k−1)/2∗M2ˆ2)14 / / C h a n g e i n e n t r o p y ( i n k J / k g −K ) :

15 ds=cp∗ log (T2/T1)−R/1000∗ log ( p2/p1 )16 printf ( ”\n\nRESULTS\n\n” )17 printf ( ”\n\nStagnat ion pr e s su r e at entry : %. 3 f kPa\n\n”

, p01 )18 printf ( ”\n\nStagnat ion temperature at entry : %. 3 f K\n\n

” ,T01)19 printf ( ”\n\ nSta t i c p r e s su r e at e x i t : %. 3 f kPa\n\n” , p2 )20 printf ( ”\n\nTemperature at e x i t : %. 3 f K\n\n” ,T2)21 printf ( ”\n\nChange in entropy : %. 3 f kJ/kg−K\n\n” , ds )

Example 11.04d 11.04-data.sci

1 / / P r e s s u r e a t e n t r y ( i n k P a ) :

2 p1=350;3 / / T e m p e r a t u r e a t e n t r y ( i n K )

4 T1=333;5 / / V e l o c i t y a t e n t r y ( i n m/ s ) :

6 V1=183;7 / / M a c h n o . a t e x i t :

8 M2=1.3;9 / / S t a g n a t i o n p r e s s u r e a t e x i t ( i n k P a ) :

10 p02=385;11 / / S t a g n a t i o n t e m p e r a t u r e a t e x i t ( i n K ) :

12 T02=350;13 / / V a l u e o f k :

14 k =1.4 ;15 / / G a s c o n s t a n t ( i n N−m/ kg −K )

16 R=287;17 / / S p e c i f i c h e a t a t c o n s t a n t p r e s s u r e ( k J / ( k g −K ) :

18 cp=1;

99

Page 101: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

Chapter 12

Steady One-DimensionalCompressible Flow

12.1 Discussion

When executing the code from the editor, use the ’Execute File into Scilab’taband not the ’Load in Scilab’tab

The .sci files of the respective problems contain the input parameters ofthe question

12.2 Scilab Code

Example 12.01 12.01.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 1 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.01−data . s c i ’3 exec ( f i l ename )4 / / H e r e t h e s t a g n a t i o n q u a n t i t i e s a r e c o n s t a n t .

5 / / S t a g n a t i o n t e m p e r a t u r e ( i n K ) :

6 T0=T1∗(1+(k−1)/2∗M1ˆ2)7 / / S t a g n a t i o n p r e s s u r e ( i n k P a ) :

8 p0=p1∗((1+(k−1)/2∗M1ˆ2) ˆ( k /(k−1) ) )9 / / F i n d i n g T2 / T1 :

10 T=t2 / t111 / / T e m p e r a t u r e a t e x i t ( i n K ) :

100

Page 102: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

12 T2=T∗T113 / / F i n d i n g p 2 / p 1 :

14 P=P2/P115 / / P r e s s u r e a t e x i t ( i n k P a ) :

16 p2=P2∗p117 / / D e n s i t y o f a i r a t e x i t ( i n k g /m ˆ 3 ) :

18 d2=p2∗10ˆ3/R/T219 / / V e l o c i t y o f a i r a t e x i t ( i n m/ s e c ) :

20 V2=M2∗sqrt ( k∗R∗T2)21 / / F i n d i n g A2 / A1 :

22 a=a2/a123 / / A r e a a t e x i t ( i n m ˆ 2 ) :

24 A2=a∗A125 printf ( ”\n\nRESULTS\n\n” )26 printf ( ”\n\nStagnat ion temperature : %. 3 f K\n\n” ,T0)27 printf ( ”\n\nStagant ion pr e s su r e : %. 3 f kPa\n\n” , p0 )28 printf ( ”\n\nTemperature a e x i t %. 3 f K\n\n” ,T2)29 printf ( ”\n\nPressure at e x i t : %. 3 f kPa\n\n” , p2 )30 printf ( ”\n\nDensity o f a i r at e x i t : %. 3 f kg/mˆ3\n\n” , d2

)31 printf ( ”\n\ nVeloc i ty o f a i r at e x i t : %. 3 f m/ sec \n\n” ,V2

)32 printf ( ”\n\nArea at e x i t : %. 3 f \n\n” ,A2)

Example 12.01d 12.01-data.sci

1 / / M a c h n u m b e r a t e n t r y :

2 M1=0.3;3 / / T e m p e r a t u r e a t e n t r y ( i n K ) :

4 T1=335;5 / / P r e s s u r e a t e n t r y ( i n k P a ) :

6 p1=650;7 / / A r e a a t e n t r y ( i n m ˆ 2 ) :

8 A1=0.001;9 / / M a c h n u m b e r a t e x i t :

10 M2=0.8;11 / / / V a l u e o f k :

12 k =1.4 ;

101

Page 103: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

13 / / F o r t h e M a c h n o : 0 . 3 :

14 / / T / T0 :

15 t1 =0.9823 ,16 / / p / p 0 :

17 P1=0.9395;18 / / d / d 0 :

19 den1 =0.9564;20 / / A / A ∗ :

21 a1 =2.035;22 / / F o r t h e M a c h n o : 0 . 8 :

23 / / T / T0 :

24 t2 =0.8865;25 / / p / p 0 :

26 P2=0.6560;27 / / d / d 0 :

28 den2 =0.7400;29 / / A / A ∗ :

30 a2 =1.038;31 / / G a s C o n s t a n t ( i n N−m/ kg −K ) :

32 R=287;

Example 12.02 12.02.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 2 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.02−data . s c i ’3 exec ( f i l ename )4 / / C h e c k i n g f o r c h o c k i n g :

5 c=pb/p0 ;6 i f ( c <=0.528)7 / / c h o k e d

8 else9 / / N o t c h o k e d

10 / / T h e r e f o r e p r e s s u r e a t e x i t = b a c k p r e s s u r e

11 pe=pb ;12 / / M a c h n u m b e r a t e x i t :

13 Me=(((p0/pe ) ˆ ( ( k−1)/k )−1)∗ (2/( k−1) ) ) ˆ0 .514 / / T e m p e r a t u r e a t e x i t ( i n K ) :

15 Te=T0/(1+(k−1)/2∗Meˆ2)

102

Page 104: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

16 / / V e l o c i t y a t e x i t ( i n m/ s e c ) :

17 Ve=Me∗sqrt ( k∗R∗Te)18 / / D e n s i t y a t e x i t ( i n k g /m ˆ 3 ) :

19 de=pe∗10ˆ3/R/Te20 / / M a s s f l o w r a t e o f a i r ( k g / s e c ) :

21 m=de∗Ve∗Ae22 end ;23 printf ( ”\n\nRESULTS\n\n” )24 printf ( ”\n\nMach number at e x i t : %. 3 f \n\n” ,Me)25 printf ( ”\n\nMass f low ra t e o f a i r : %. 3 f kg/ sec \n\n” ,m)

Example 12.02d 12.02-data.sci

1 / / T h r o a t a r e a o f n o z z l e ( i n m ˆ 2 ) :

2 Ae=0.001;3 / / B a c k p r e s s u r e o f a i r ( i n k P a ) :

4 pb=591;5 / / S t a g n a t i o n p r e s s u r e ( i n k P a ) :

6 p0=1000;7 / / S t a g n a t i o n t e m p e r a t u r e ( i n K ) :

8 T0=333;9 / / G a s C o n s t a n t ( i n N−m/ kg −K ) :

10 R=287;11 / / V a l u e o f k :

12 k =1.4 ;

Example 12.03 12.03.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 3 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.03−data . s c i ’3 exec ( f i l ename )4 / / S a t u r a t i o n p r e s s u r e ( i n p s i a ) :

5 p0=p1∗(1+(k−1)/2∗M1ˆ2) ˆ( k /(k−1) )6 / / C h e c k i n g f o r c h o k i n g :

7 x=pb/p0 ;8 i f (x>0.528)9 / / N o t c h o k e d

10 else

103

Page 105: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

11 / / c h o k e d

12 end13 / / A s t h e r e i s c h o k i n g :

14 Mt=1;15 / / V e l o c i t y a t e n t r y :

16 V1=M1∗sqrt ( k∗R∗(T1+460) ∗32 .2 )17 / / D e n s i t y a t t h e e n t r y ( i n l b m / f t ˆ 3 ) :

18 d1=p1 /(R∗(T1+460) ) ∗14419 / / M a s s f l o w r a t e ( i n l b m / s e c ) :

20 m=d1∗V1∗A121 / / F i n d i n g t h e v a l u e o f A1 / A ∗ ;

22 A=1/M1∗((1+(k−1)/2∗M1ˆ2) /(1+(k−1)/2) ) ˆ ( ( k+1) /(2∗ ( k−1) ) )23 / / F o r c h o k e d f l o w , A t =A ∗

24 At=A1/A25 printf ( ”\n\nRESULTS\n\n” )26 printf ( ”\n\nMach number at throat : %. 3 f \n\n” ,Mt)27 printf ( ”\n\nMass f low ra t e : %. 3 f lbm/ sec \n\n” ,m)28 printf ( ”\n\nArea at throat : %. 3 f f t ˆ2\n\n” ,At)

Example 12.03d 12.03-data.sci

1 / / M a c h n u m b e r a t e n t r y :

2 M1=0.52;3 / / T e m p e r a t u r e a t e n t r y ( i n F ) :

4 T1=40;5 / / P r e s s u r e a t e n t r y ( i n p s i a ) :

6 p1=60;7 / / A r e a a t e n t r y ( i n f t ˆ 2 ) :

8 A1=0.013;9 / / B a c k p r e s s u r e ( i n p s i a ) :

10 pb=30;11 / / G a s C o n s a n t ( i n f t − l b f / l bm −R )

12 R=53.3;13 / / V a l u e o f k :

14 k =1.4 ;

Example 12.04 12.04.sce

104

Page 106: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 4 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.04−data . s c i ’3 exec ( f i l ename )4 / / T e m p e r a t u r e a t t h e t h r o a t ( i n K ) :

5 Tt=T0/(1+(k−1)/2∗Mtˆ2)6 / / P r e s s u r e a t t h r o a t ( i n k P a ) :

7 pt=p0∗(Tt/T0) ˆ( k /(k−1) )8 / / D e n s i t y a t t h r o a t ( i n k g /m ˆ 3 ) :

9 dt=pt ∗1000/R/Tt10 / / V e l o c i t y a t t h e t h r o a t ( i n m/ s ) :

11 Vt=Mt∗sqrt ( k∗R∗Tt)12 / / V a l u e o f A t / A ∗ :

13 Ax=1/Mt∗((1+(k−1)/2∗Mtˆ2) /(1+(k−1)/2) ) ˆ ( ( k+1) /(2∗ ( k−1) ))

14 / / S t a g n a t i o n p r o p e r t i e s a r e c o n s t a n t

15 / / A s a r e s u l t p r e s s u r e a t e x i t ,

16 pe=pb ;17 / / T h e M a c h n u m b e r a t t h e e x i t i s t h e r e f o r e g i v e n b y

18 Me=sqrt ( ( ( p0/pe ) ˆ ( ( k−1)/k )−1)∗2/(k−1) )19 / / C a l c u l a t i n g t h e v a l u e o f A e / A ∗ :

20 Ay=1/Me∗((1+(k−1)/2∗Meˆ2) /(1+(k−1)/2) ) ˆ ( ( k+1) /(2∗ ( k−1) ))

21 / / V a l u e o f A ∗ ( i n m ˆ 2 ) :

22 A star=Ae/Ay23 / / A r e a a t t h r o a t ( i n m ˆ 2 ) :

24 At=Ax∗A star25 printf ( ”\n\nRESULTS\n\n” )26 printf ( ”\n\nTemperature at the throat : %. 3 f K\n\n” ,Tt )27 printf ( ”\n\nPressure at throat : %. 3 f kPa\n\n” , pt )28 printf ( ”\n\nDensity at throat : %. 3 f kg/mˆ3\n\n” , dt )29 printf ( ”\n\ nVeloc i ty at the throat : %. 3 f m/ sec \n\n” ,Vt)30 printf ( ”\n\nMach number at the e x i t : %. 3 f \n\n” ,Me)31 printf ( ”\n\nArea at throat : %. 3 f mˆ2\n\n” ,At)

Example 12.04d 12.04-data.sci

1 / / S t a g n a t i o n t e m p e r a t u r e ( i n K ) :

2 T0=350;

105

Page 107: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

3 / / S t a g n a t i o n p r e s s u r e ( i n k P a ) :

4 p0=1000;5 / / B a c k P r e s s u r e ( i n k P a ) :

6 pb=954;7 / / M a c h n u m b e r a t t h r o a t :

8 Mt=0.68;9 / / A r e a a t e x i t ( i n m ˆ 2 ) :

10 Ae=0.001;11 / / V a l u e o f k :

12 k =1.4 ;13 / / G a s C o n s t a n t ( i n N−m/ kg −K ) :

14 R=287;

Example 12.05 12.05.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 5 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.05−data . s c i ’3 exec ( f i l ename )4 / / M a c h n u m b e r a t t h e e x i t :

5 Me=sqrt ( ( ( p0/pe ) ˆ ( ( k−1)/k )−1)∗2/(k−1) )6 / / T e m p e r a t u r e a t e x i t ( i n K ) :

7 Te=T0/(1+(k−1)/2∗Meˆ2)8 / / M a s s f l o w r a t e ( i n k g / s ) :

9 m=pe∗1000∗Me∗sqrt ( k/R/Te)∗Ae10 printf ( ”\n\nRESULTS\n\n” )11 printf ( ”\n\nMach number at the e x i t : %. 3 f \n\n” ,Me)12 printf ( ”\n\nMass f low ra t e : %. 3 f kg/ sec \n\n” ,m)

Example 12.05d 12.05-data.sci

1 / / S t a g n a t i o n t e m p e r a t u r e ( i n K ) :

2 T0=350;3 / / S t a g n a t i o n p r e s s u r e ( i n k P a ) \

4 p0=1000;5 / / P r e s s u r e a t e x i t ( i n k P a )

6 pe =87.5;7 / / B a c k P r e s s u r e ( i n k P a ) :

8 pb=50;

106

Page 108: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

9 / / A r e a a t e x i t ( i n m ˆ 2 ) :

10 Ae=0.001;11 / / G a s C o n s t a n t ( i n N−m/ kg −K )

12 R=287;13 / / V a l u e o f k :

14 k =1.4 ;

Example 12.06 12.06.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 6 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.06−data . s c i ’3 exec ( f i l ename )4 / / M a c h u m b e r a t s e c t i o n 1 :

5 M1=sqrt ( ( 2/ ( k−1) ∗ ( ( p0/p1 ) ˆ ( ( k−1)/k )−1) ) )6 / / T e m p e r a t u r e a t s e c t i o n 1 ( i n K ) :

7 T1=T0/(1+(k−1)/2∗M1ˆ2)8 / / D e n s i t y a t s e c t i o n 1 ( i n k g /m ˆ 3 ) :

9 d1=p1∗1000/R/T110 / / V e l o c i t y a t s e c t i o n 1 ( i n m/ s e c ) :

11 V1=M1∗sqrt ( k∗R∗T1)12 / / A r e a a t s e c t i o n 1 ( i n m ˆ 2 ) :

13 A1=%pi/4∗Dˆ214 / / M a s s f l o w r a t e ( i n k g / s e c ) :

15 m=d1∗A1∗V116 / / M a c h n u m b e r a t s e c t i o n 2 :

17 M2=sqrt ( ( 2/ ( k−1) ) ∗ ( (T0/T2)−1) )18 / / V e l o c i t y a t s e c t i o n 2 ( i n m/ s e c ) :

19 V2=M2∗sqrt ( k∗R∗T2)20 / / D e n s i t y a t s e c t i o n 2 ( i n k g /m ˆ 3 ) :

21 d2=d1∗V1/V222 / / P r e s s u r e a t s e c t i o n 2 ( i n k P a ) :

23 p2=d2/1000∗R∗T224 / / S t a g n a t i o n p r e s s u r e a t s e c t i o n 2 ( i n k P a ) :

25 p02=p2∗(1+(k−1)/2∗M2ˆ2) ˆ( k /(k−1) )26 / / F o r c e e x e r t e d o n c o n t r o l v o l u m e b y d u c t w a l l ( i n N ) :

27 F=(p2−p1 ) ∗1000∗A1+m∗(V2−V1)28 printf ( ”\n\nRESULTS\n\n” )29 printf ( ”\n\nMass f low ra t e : %. 3 f kg/ sec \n\n” ,m)

107

Page 109: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

30 printf ( ”\n\nLocal i s e n t r o p i c s tagnat i on pr e s su r e ats e c t i o n 2 :%. 3 f kPa\n\n” , p02 )

31 printf ( ”\n\nForce exer ted on c o n t r o l volume by ductwa l l :%. 3 f N\n\n” ,F)

Example 12.06d 12.06-data.sci

1 / / D i a m e t e r o f p i p e ( i n m ) :

2 D=7.16∗10ˆ−3;3 / / S t a g n a t i o n p r e s s u r e ( i n k P a ) :

4 p0=101;5 / / S t a g n a t i o n t e m p e r a t u r e ( i n K ) :

6 T0=296;7 / / P r e s s u r e a t s e c t i o n 1 ( i n k P a ) :

8 p1 =98.5 ;9 / / T e m p e r a t u r e a t s e c t i o n 2 ( i n K ) :

10 T2=287;11 / / G a s c o n s t a n t ( i n N−m/ kg −K ) :

12 R=287;13 / / V a l u e o f k :

14 k =1.4 ;

Example 12.07 12.07.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 7 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.07−data . s c i ’3 exec ( f i l ename )4 / / M a c h n u m b e r a t s e c t i o n 1 :

5 M1= sqrt (2/( k−1) ∗ ( ( p0 /( p0+p1 ) ) ˆ ( ( k−1)/k )−1) )6 / / T e m p e r a t u r e a t s e c t i o n 1 ( i n K ) :

7 T1=T0/(1+(k−1)/2∗(M1) ˆ2)8 V1=M1∗sqrt ( k∗R∗T1)9 / / P r e s s u r e a t s e c t i o n 1 ( i n k P a ) :

10 p1=g∗dHg∗(760−18.9)∗10ˆ−311 / / D e n s i t y a t s e c t i o n 1 ( i n k g /m ˆ 3 ) :

12 d1=p1/R/T113 / / A t M1 = 0 . 1 9 0 ,

14 / / ( p / p ∗ ) 1 :

108

Page 110: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

15 P1=5.74516 / / ( f L m a x / Dh ) 1 :

17 F1=16.3818 / / V a l u e o f L 1 3 ( i n m ) :

19 L13=F1∗D/ f20 / / V a l u e o f ( p / p ∗ ) 2 :

21 P2=p2/p1∗P122 / / F o r t h i s v a l u e , V a l u e o f M2 i s o b t a i n e d a s 0 . 4

23 M2=0.4;24 / / F o r M = 0 . 4 , f LmX / D = 2 . 3 0 9

25 F2=2.30926 / / V a l u e o f L 2 3 ( i n m ) :

27 L23=F2∗D/ f28 / / L e n g t h o f d u c t b e t w e e n s e c t i o n 1 a n d 2 ( i n m ) :

29 L12=L13−L2330 printf ( ”\n\nRESULTS\n\n” )31 printf ( ”\n\nLength o f duct r equ i r ed f o r choking from

s e c t i o n 1 : %3f m\n\n” , L13 )32 printf ( ”\n\nMach number s e c t i o n 2 : %. 3 f \n\n” ,M2)33 printf ( ”\n\Length o f duct between s e c t i o n 1 and 2 : %. 3 f

m\n\n” , L12 )

Example 12.07d 12.07-data.sci

1 / / S t a g n a t i o n t e m p e r a t u r e ( i n K ) :

2 T0=296;3 / / S t a g n a t i o n p r e s s u r e ( i n mm o f Hg ) :

4 p0=760;5 / / G a u g e p r e s s u r e a t s e c t i o n 1 ( i n mm o f Hg ) :

6 p1=−18.9;7 / / G a u g e p r e s s u r e a t s e c t i o n 2 ( i n mm o f Hg ) :

8 p2=−412;9 / / M a c h n u m b e r a t 3 :

10 M3=1;11 / / G a s c o n s t a n t :

12 R=287;13 / / D e n s i t y o f m e r c u r y ( k g /m ˆ 3 ) :

14 dHg=13500;

109

Page 111: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

15 / / A c c e l e r a t i o n d u e t o g r a v i t y ( i n m/ s e c ˆ 2 ) :

16 g =9.8 ;17 / / F r i c t i o n f a c t o r :

18 f =0.0235;19 / / D i a m e t e r o f t u b e ( i n m ) :

20 D=7.16∗10ˆ−3;21 / / V a l u e o f k :

22 k =1.4 ;

Example 12.08 12.08.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 8 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.08−data . s c i ’3 exec ( f i l ename )4 / / D e n s i t y a t s e c t i o n 1 ( i n l b m / f t ˆ 3 ) :

5 d1=p1∗144/R/T16 / / V e l o c i t y a t s e c t i o n 2 ( i n f t / s e c ) :

7 V2=(p1−p2 ) ∗144/d1/V1∗32.2+V18 / / D e n s i t y a t s e c t i o n 2 ( i n l b m / f t 3 ) :

9 d2=d1∗V1/V210 / / T e m p e r a t u r e a t s e c t i o n 2 ( i n R ) :

11 T2=p2/d2/R∗14412 / / M a c h n u m b e r a t s e c t i o n 2 :

13 M2=V2/sqrt ( k∗R∗32.16∗T2)14 / / S t a g n a t i o n T e m p e r a t u r e a t s e c t i o n 2 ( i n R ) :

15 T02=T2∗(1+(k−1)/2∗M2ˆ2)16 / / S t a g n a t i o n p r e s s u r e a t s e c t i o n 2 ( i n p s i a ) :

17 p02=p2∗(T02/T2) ˆ( k /(k−1) )18 / / M a c h N u m b e r a t s e c t i o n 1 :

19 M1=V1/sqrt ( k∗R∗32.16∗T1)20 / / S t a g n a t i o n t e m p e r a t u r e a t s e c t i o n 1 ( i n R ) :

21 T01=T1∗(1+(k−1)/2∗M1ˆ2)22 / / E n e r g y a d d e d ( i n B t u / l b m ) :

23 E=Cp∗(T02−T01)24 / / C h a n g e i n e n t r o p y ( i n B t u / ( l bm −R ) ) :

25 dS=Cp∗ log (T2/T1)−(Cp−Cv)∗ log ( p2/p1 )26 printf ( ”\n\nRESULTS\n\n” )27 printf ( ”\n\ nVeloc i ty at s e c t i o n 2 : %. 3 f f t / sec \n\n” ,V2)

110

Page 112: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

28 printf ( ”\n\nDensity at s e c t i o n 2 : %. 3 f lbm/ f t ˆ3\n\n” , d2)

29 printf ( ”\n\nTemperature at s e c t i o n 2 : %. 3 f R\n\n” ,T2)30 printf ( ”\n\nStagnat ion Temperature at s e c t i o n 2 : %. 3 f R

\n\n” ,T02)31 printf ( ”\n\nStagnat ion pr e s su r e at s e c t i o n 2 : %. 3 f p s i a

\n\n” , p02 )32 printf ( ”\n\nEnergy added : %. 3 f Btu/lbm\n\n” ,E)33 printf ( ”\n\nChange in entropy : %. 3 f Btu /( lbm−R)\n\n” ,dS

)

Example 12.08d 12.08-data.sci

1 / / T e m p e r a t u r e a t s e c t i o n 1 ( i n R ) :

2 T1=600;3 / / P r e s s u r e a t s e c t i o n 1 ( i n p s i a ) :

4 p1=20;5 / / P r e s s u r e a t s e c t i o n 2 ( i n p s i a ) :

6 p2=10;7 / / V e l o c i t y a t s e c t i o n 1 ( i n f t / s ) :

8 V1=360;9 / / C r o s s − s e c t i o n a l a r e a o f t h e d u c t ( i n f t ˆ 2 ) :

10 A=0.25;11 / / G a s C o n s t a n t ( i n f t − l b f / l bm −R ) :

12 R=53.3;13 / / V a l u e o f k :

14 k =1.4 ;15 / / S p e c i f i c h e a t a t c o n s t a n t p r e s u r e ( i n B t u / l bm −R ) :

16 Cp=0.24;17 / / S p e c i f i c h e a t a t c o n s t a n t v o l u m e ( i n B t u / l bm −R ) :

18 Cv=0.171;

Example 12.09 12.09.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 0 9 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.09−data . s c i ’3 exec ( f i l ename )4 / / M a c h n u b e r a t s e c t i o n 1 :

111

Page 113: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

5 M1=V1/sqrt ( k∗R∗T1)6 / / F o r t h e s e v a l u e o f M1 a n d M2 , t h e f o l l o w i n g v a l u e s a r e

o b t a i n e d :

7 / / ( To / T0 ∗ ) 1 :

8 t01 =0.7934;9 / / ( T0 / T0 ∗ ) 2 :

10 t02 =0.9787;11 / / ( p 0 / p 0 ∗ ) 1 :

12 P01=1.503;13 / / ( p 0 / p 0 ∗ ) 2 :

14 P02=1.019;15 / / ( T / T ∗ ) 1 :

16 t1 =0.5289;17 / / ( T / T ∗ ) 2 :

18 t2 =0.9119;19 / / ( p / p ∗ ) 1 :

20 P1=0.3636;21 / / ( p / p ∗ ) 2 :

22 P2=0.7958;23 / / ( V / V ∗ ) 1 :

24 v1 =1.455;25 / / ( V / V ∗ ) 2 :

26 v2 =1.146;27 / / V a l u e o f T2 / T1 :

28 t=t2 / t129 / / T e m p e r a t u r e a t s e c t i o n 2 ( i n K ) :

30 T2=t∗T131 / / V a l u e o f p 2 / p 1 :

32 p=P2/P133 / / P r e s s u r e a t s e c t i o n 2 ( i n k P a ) :

34 p2=p∗p135 / / V a l u e o f V2 / V1 :

36 v=v2/v137 / / V e l o c i t y a t s e c t i o n 2 ( i n m/ s e c ) :

38 V2=v∗V139 / / D e n s i t y a t s e c t i o n 2 ( i n k g /m ˆ 3 ) :

40 d2=p2∗1000/R/T241 / / A t M1 , T / T0 = 0 . 5 5 5 6

112

Page 114: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

42 T01=T1/0.555643 / / A t M2 , T / T0 = 0 . 7 7 6 4

44 T02=T2/0.776445 / / H e a t a d d e d ( i n k J / k g ) :

46 E=Cp∗(T02−T01)47 / / C h a n g e i n e n t r o p y ( k J / k g −K ) :

48 dS=Cp∗ log (T2/T1)−R∗ log ( p2/p1 ) /100049 printf ( ”\n\nRESULTS\n\n” )50 printf ( ”\n\nTemperature at s e c t i o n 2 : %. 3 f K\n\n” ,T2)51 printf ( ”\n\nPressure at s e c t i o n 2 : %. 3 f kPa\n\n” , p2 )52 printf ( ”\n\ nVeloc i ty at s e c t i o n 2 : %. 3 f m/ sec \n\n” ,V2)53 printf ( ”\n\nDensity at s e c t i o n 2 : %. 3 f kg/mˆ3\n\n” , d2 )54 printf ( ”\n\nStagnat ion temperature at s e c t i o n 2 : %. 3 f K

\n\n” ,T02)55 printf ( ”\n\nHeat added : %. 3 f kJ/kg\n\n” ,E)56 printf ( ”\n\nChange in entropy : %. 3 f kJ/kg\n\n” ,dS)

Example 12.09d 12.09-data.sci

1 / / T e m p e r a t u r e a t s e c t i o n 1 ( i n K ) :

2 T1=333;3 / / P r e s s u r e a t s e c t i o n 1 ( i n k P a ) :

4 p1=135;5 / / V e l o c i t y a t s e c t i o n 1 ( i n m/ s e c ) :

6 V1=732;7 / / M a c h n u m b e r a t s e c t i o n 2 :

8 M2=1.2;9 / / G a s c o n s t a n t ( i n N−m/ kg −K ) :

10 R=287;11 / / V a l u e o f k :

12 k =1.4 ;13 / / S p e c i f i c h e a t a t c o n s t a n t p r e s u r e ( i n N−m/ kg −K ) :

14 Cp=1;

Example 12.10 12.10.sce

1 pathname=g e t a b s o l u t e f i l e p a t h ( ’ 1 2 . 1 0 . s ce ’ )2 f i l ename=pathname+f i l e s e p ( )+’ 12.10−data . s c i ’

113

Page 115: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

3 exec ( f i l ename )4 / / D e n s i t y a t s e c t i o n 1 ( i n k g /m ˆ 3 ) :

5 d1=p1∗1000/R/T16 / / M a c h n u m b e r a t s e c t i o n 1 :

7 M1=V1/sqrt ( k∗R∗T1)8 / / S t a g n a t i o n t e m p e r a t u r e a t s e c t i o n 1 ( i n K ) :

9 T01=T1∗(1+(k−1)/2∗M1ˆ2)10 / / S t a g n a t i o n p r e s s u r e a t s e c t i o n 1 ( i n k P a ) :

11 p01=p1∗(1+(k−1)/2∗M1ˆ2) ˆ( k /(k−1) )12 / / T h e f o l l o w i n g v a l u e s a r e o b t a i n e d f r o m t h e a p p e n d i x :

13 / / p o 2 / p 0 1 :

14 p0 =0.7209;15 / / T2 / T1 :

16 T=1.687;17 / / p 2 / p 1 :

18 p=4.5;19 / / V2 / V1 :

20 V=0.3750;21 / / T e m p e r a t u r e a t s e c t i o n 2 ( i n K ) :

22 T2=T∗T123 / / P r e s s u r e a t s e c t i o n 2 ( i n k P a ) :

24 p2=p∗p125 / / V e l o c i t y a t s e c t i o n 2 ( i n m/ s e c ) :

26 V2=V∗V127 / / D e n s i t y a t s e c t i o n 2 ( i n k g /m ˆ 3 ) :

28 d2=p2∗1000/R/T229 / / S t a g n a t i o n p r e s s u r e a t s e c t i o n 2 ( i n k P a ) :

30 p02=p0∗p0131 / / S t a g n a t i o n t e m p e r a t u r e a t s e c t i o n 2 ( i n K ) :

32 T02=T01 ;33 / / C h a n g e i n e n t r o p y ( i n k J / ( k g −K ) ) :

34 dS=−R/1000∗ log ( p0 )35 printf ( ”\n\nRESULTS\n\n” )36 printf ( ”\n\nTemperature at s e c t i o n 2 : %. 3 f K\n\n” ,T2)37 printf ( ”\n\nPressure at s e c t i o n 2 : %. 3 f kPa\n\n” , p2 )38 printf ( ”\n\ nVeloc i ty at s e c t i o n 2 : %. 3 f m/ sec \n\n” ,V2)39 printf ( ”\n\nDensity at s e c t i o n 2 : %. 3 f kg/mˆ3\n\n” , d2 )40 printf ( ”\n\nStagnat ion pr e s su r e at s e c t i o n 2 : %. 3 f kPa\

114

Page 116: Scilab Code for Introduction to Fluid Mechanics by Fox and ... · Introduction to Fluid Mechanics by Fox and McDonald1 Created by Eswar Prasad 4th Year Student ... Robert W. Fox and

n\n” , p02 )41 printf ( ”\n\nChange in entropy : %. 3 f kg−K\n\n” ,dS)42 printf ( ”\n\nStagnat ion temperature at s e c t i o n 2 : %. 3 f K

\n\n” ,T02)

Example 12.10d 12.10-data.sci

1 / / T e m p e r a t u r e a t s e c t i o n 1 ( i n K ) :

2 T1=278;3 / / P r e s s u r e a t s e c t i o n 1 ( i n k P a ) :

4 p1=65;5 / / V e l o c i t y a t s e c t i o n 1 ( i n m/ s e c ) :

6 V1=668;7 / / V a l u e o f g a s c o n s t a n t ( i n N−m/ kg −K ) :

8 R=287;9 / / V a l u e o f k :

10 k =1.4 ;

115