fluid mechanics_douglas john f

Post on 03-Apr-2018

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 1/114

Scilab Textbook Companion for

Fluid Mechanics

by Douglas John F1

Created byJay Chakra

B.TechOthers

IIT BombayCollege Teacher

Madhu BelurCross-Checked by

Mukul R. Kulkarni

December 7, 2012

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 ”Textbook Companion Project”section at the website http://scilab.in

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 2/114

Book Description

Title: Fluid Mechanics

Author: Douglas John F

Publisher: Pearson Prentice Hall

Edition: 5

Year: 2005

ISBN: 9780131292932

1

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 3/114

Scilab numbering policy used in this document and the relation to theabove book.

Exa Example (Solved example)

Eqn Equation (Particular equation of the above book)

AP Appendix to Example(Scilab Code that is an Appednix to a particularExample of the above book)

For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 meansa scilab code whose theory is explained in Section 2.3 of the book.

2

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 4/114

Contents

List of Scilab Codes 5

1 Fluids and their properties 11

2 Pressure and Head 12

3 Static Forces on Surfaces Buoyancy 19

4 Motion of Fluid Particles and Streams 26

5 The Momentum Equation and its Applications 30

6 The Energy Equation and its Applications 38

7 Two dimensional Ideal Flow 46

8 Dimensional Analysis 50

9 Similarity 51

10 Laminar and Turbulent Flows in Bounded Systems 56

11 Boundary Layer 61

12 Incompressible Flow around a Body 63

13 Compressible Flow around a Body 68

14 Steady Incompressible Flow in Pipe and Duct Systems 71

3

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 5/114

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 6/114

List of Scilab Codes

Exa 1.1 Excess Pressure . . . . . . . . . . . . . . . . . . . . . 11Exa 2.1 VARIATION OF PRESSURE VERTICALLY . . . . . 12Exa 2.2 VARIATION OF PRESSURE WITH ALTITUDE . . 12Exa 2.3 VARIATION OF PRESSURE WITH ALTITUDE IN A

GAS UNDER ADIABATIC CONDITIONS . . . . . . 13Exa 2.4 VARIATION OF PRESSURE AND DENSITY WITH

ALTITUDE FOR A CONSTANT TEMPERATURE GRA-DIENT . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Exa 2.5 PRESSURE AND HEAD . . . . . . . . . . . . . . . . 14Exa 2.6 PRESSURE MEASUREMENT BY MANOMETER . 15Exa 2.7 PRESSURE MEASUREMENT BY MANOMETER . 15Exa 2.8 PRESSURE MEASUREMENT BY MANOMETER . 16Exa 2.9 PRESSURE MEASUREMENT BY MANOMETER . 17

Exa 2.10 RELATIVE EQUILIBRIUM . . . . . . . . . . . . . . 17Exa 3.1 RESULTANT FORCE AND CENTRE OF PRESSURE

ON A PLANE SURFACE UNDER UNIFORM PRES-SURE . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Exa 3.2 RESULTANT FORCE AND CENTRE OF PRESSUREON A PLANE SURFACE UNDER UNIFORM PRES-SURE . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Exa 3.3 PRESSURE DIAGRAMS . . . . . . . . . . . . . . . . 21Exa 3.4 FORCE ON A CURVED SURFACE DUE TO HYDRO-

STATIC PRESSURE . . . . . . . . . . . . . . . . . . 21Exa 3.5 BUOYANCY . . . . . . . . . . . . . . . . . . . . . . . 22

Exa 3.6 DETERMINATION OF THE POSITION OF THE META-CENTRE RELATIVE TO THE CENTRE OF BUOY-ANCY . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 7/114

Exa 3.7 STABILITY OF A VESSEL CARRYING LIQUID IN

TANKS WITH A FREE SURFACE . . . . . . . . . . 24Exa 4.1 DISCHARGE AND MEAN VELOCITY . . . . . . . . 26Exa 4.2 CONTINUITY OF FLOW . . . . . . . . . . . . . . . 28Exa 4.3 CONTINUITY EQUATIONS FOR THREE DIMEN-

SIONAL FLOW USING CARTESIAN COORDINATES 28Exa 5.1 GRADUAL ACCELERATION OF A FLUID IN A PIPELINE

NEGLECTING ELASTICITY . . . . . . . . . . . . . 30Exa 5.2 FORCE EXERTED BY A JET STRIKING A FLAT

PLATE . . . . . . . . . . . . . . . . . . . . . . . . . . 30Exa 5.3 FORCE DUE TO THE DEFLECTION OF A JET BY

A CURVED VANE . . . . . . . . . . . . . . . . . . . 32

Exa 5.4 FORCE EXERTED WHEN A JET IS DEFLECTEDBY A MOVING CURVED VANE . . . . . . . . . . . 32

Exa 5.5 FORCE EXERTED ON PIPE BENDS AND CLOSEDCONDUITS . . . . . . . . . . . . . . . . . . . . . . . 33

Exa 5.6 REACTION OF A JET . . . . . . . . . . . . . . . . . 34Exa 5.7 REACTION OF A JET . . . . . . . . . . . . . . . . . 35Exa 5.8 REACTION OF A JET . . . . . . . . . . . . . . . . . 36Exa 5.10 ANGULAR MOTION . . . . . . . . . . . . . . . . . . 36Exa 6.1 MECHANICAL ENERGY OF A FLOWING FLUID . 38Exa 6.2 CHANGES OF PRESSURE IN A TAPERING PIPE . 39

Exa 6.3 PRINCIPLE OF THE VENTURI METER . . . . . . 40Exa 6.4 THEORY OF SMALL ORIFICES DISCHARGING TOATMOSPHERE . . . . . . . . . . . . . . . . . . . . . 40

Exa 6.5 THEORY OF LARGE ORIFICES . . . . . . . . . . . 41Exa 6.6 ELEMENTARY THEORY OF NOTCHES AND WEIRS 41Exa 6.7 ELEMENTARY THEORY OF NOTCHES AND WEIRS 42Exa 6.8 THE POWER OF A STREAM OF FLUID . . . . . . 43Exa 6.9 VORTEX MOTION . . . . . . . . . . . . . . . . . . . 43Exa 6.10 Free vortex or potential vortex . . . . . . . . . . . . . 44Exa 7.2 STRAIGHT LINE FLOWS AND THEIR COMBINA-

TIONS . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Exa 7.3 COMBINED SOURCE AND SINK FLOWS DOUBLET 47Exa 7.4 FLOW PAST A CYLINDER . . . . . . . . . . . . . . 48Exa 7.5 CURVED FLOWS AND THEIR COMBINATIONS . 48

6

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 8/114

Exa 8.1 CONVERSION BETWEEN SYSTEMS OF UNITS IN-

CLUDING THE TREATMENT OF DIMENSIONALCONSTANTS . . . . . . . . . . . . . . . . . . . . . . 50Exa 9.1 MODEL STUDIES FOR FLOWS WITHOUT A FREE

SURFACE . . . . . . . . . . . . . . . . . . . . . . . . 51Exa 9.2 MODEL STUDIES FOR FLOWS WITHOUT A FREE

SURFACE . . . . . . . . . . . . . . . . . . . . . . . . 51Exa 9.3 ZONE OF DEPENDENCE OF MACH NUMBER . . 52Exa 9.4 SIGNIFICANCE OF THE PRESSURE COEFFICIENT 52Exa 9.5 MODEL STUDIES IN CASES INVOLVING FREE SUR-

FACE FLOW . . . . . . . . . . . . . . . . . . . . . . . 53Exa 9.6 SIMILARITY APPLIED TO ROTODYNAMIC MA-

CHINES . . . . . . . . . . . . . . . . . . . . . . . . . 54Exa 9.8 RIVER AND HARBOUR MODELS . . . . . . . . . . 54Exa 10.1 INCOMPRESSIBLE STEADY AND UNIFORM LAM-

INAR FLOW BETWEEN PARALLEL PLATES . . . 56Exa 10.2 INCOMPRESSIBLE STEADY AND UNIFORM LAM-

INAR FLOW IN CIRCULAR CROSS SECTION PIPES 57Exa 10.3 INCOMPRESSIBLE STEADY AND UNIFORM TUR-

BULENT FLOW IN CIRCULAR CROSS SECTIONPIPES . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Exa 10.4 STEADY AND UNIFORM TURBULENT FLOW IN

OPEN CHANNELS . . . . . . . . . . . . . . . . . . . 59Exa 10.5 VELOCITY DISTRIBUTION IN TURBULENT FULLYDEVELOPED PIPE FLOW . . . . . . . . . . . . . . 59

Exa 10.7 SEPARATION LOSSES IN PIPE FLOW . . . . . . . 60Exa 11.1 PROPERTIES OF THE LAMINAR BOUNDARY LAYER

FORMED OVER A FLAT PLATE IN THE ABSENCEOF A PRESSURE GRADIENT IN THE FLOW DI-RECTION . . . . . . . . . . . . . . . . . . . . . . . . 61

Exa 11.2 PROPERTIES OF THE TURBULENT BOUNDARYLAYER OVER A FLAT PLATE IN THE ABSENCEOF A PRESSURE GRADIENT IN THE FLOW DI-

RECTION . . . . . . . . . . . . . . . . . . . . . . . . 62Exa 12.1 DRAG . . . . . . . . . . . . . . . . . . . . . . . . . . 63Exa 12.2 RESISTANCE OF SHIPS . . . . . . . . . . . . . . . . 64Exa 12.3 FLOW PAST A CYLINDER . . . . . . . . . . . . . . 64Exa 12.4 FLOW PAST A SPHERE . . . . . . . . . . . . . . . . 65

7

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 9/114

Exa 12.5 FLOW PAST A SPHERE . . . . . . . . . . . . . . . . 66

Exa 12.6 FLOW PAST AN AEROFOIL OF FINITE LENGTH 66Exa 13.1 EFFECTS OF COMPRESSIBILITY . . . . . . . . . . 68Exa 13.2 SHOCK WAVES . . . . . . . . . . . . . . . . . . . . . 69Exa 14.1 INCOMPRESSIBLE FLOW THROUGH DUCTS AND

PIPES . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Exa 14.3 INCOMPRESSIBLE FLOW THROUGH PIPES IN PAR-

ALLEL . . . . . . . . . . . . . . . . . . . . . . . . . . 72Exa 14.4 INCOMPRESSIBLE FLOW THROUGH BRANCHING

PIPES THE THREE RESERVOIR PROBLEM . . . . 73Exa 14.5 INCOMPRESSIBLE STEADY FLOW IN DUCT NET-

WORKS . . . . . . . . . . . . . . . . . . . . . . . . . 74

Exa 14.6 INCOMPRESSIBLE STEADY FLOW IN DUCT NET-WORKS . . . . . . . . . . . . . . . . . . . . . . . . . 75

Exa 14.7 RESISTANCE COEFFICIENTS FOR PIPELINES INSERIES AND IN PARALLEL . . . . . . . . . . . . . 76

Exa 14.8 THE QUANTITY BALANCE METHOD FOR PIPENETWORKS . . . . . . . . . . . . . . . . . . . . . . . 77

Exa 14.9 QUASI STEADY FLOW . . . . . . . . . . . . . . . . 78Exa 14.12 QUASI STEADY FLOW . . . . . . . . . . . . . . . . 79Exa 15.1 RESISTANCE FORMULAE FOR STEADY UNIFORM

FLOW IN OPEN CHANNELS . . . . . . . . . . . . . 81

Exa 15.2 OPTIMUM SHAPE OF CROSS SECTION FOR UNI-FORM FLOW IN OPEN CHANNELS . . . . . . . . . 82Exa 16.2 EFFECT OF LATERAL CONTRACTION OF A CHAN-

NEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Exa 16.3 CLASSIFICATION OF WATER SURFACE PROFILES 84Exa 17.1 MASS FLOW THROUGH A VENTURI METER . . 85Exa 17.2 THE LAVAL NOZZLE . . . . . . . . . . . . . . . . . 86Exa 17.3 NORMAL SHOCK WAVE IN A DIFFUSER . . . . . 86Exa 17.4 COMPRESSIBLE FLOW IN A DUCT WITH FRIC-

TION UNDER ADIABATIC CONDITIONS FANNOFLOW . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Exa 17.5 ISOTHERMAL FLOW OF A COMPRESSIBLE FLUIDIN A PIPELINE . . . . . . . . . . . . . . . . . . . . . 88

Exa 20.3 APPLICATION OF THE SIMPLIFIED EQUATIONSTO EXPLAIN PRESSURE TRANSIENT OSCILLA-TIONS . . . . . . . . . . . . . . . . . . . . . . . . . . 89

8

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 10/114

Exa 20.5 CONTROL OF SURGE FOLLOWING VALVE CLO-

SURE WITH PUMP RUNNING AND SURGE TANKAPPLICATIONS . . . . . . . . . . . . . . . . . . . . . 90Exa 22.1 ONE DIMENSIONAL THEORY . . . . . . . . . . . . 91Exa 22.2 DEPARTURES FROM EULERS THEORY AND LOSSES 92Exa 22.3 COMPRESSIBLE FLOW THROUGH ROTODYNAMIC

MACHINES . . . . . . . . . . . . . . . . . . . . . . . 93Exa 23.1 DIMENSIONLESS COEFFICIENTS AND SIMILAR-

ITY LAWS . . . . . . . . . . . . . . . . . . . . . . . . 94Exa 23.2 THE PELTON WHEEL . . . . . . . . . . . . . . . . . 96Exa 23.3 FRANCIS TURBINES . . . . . . . . . . . . . . . . . 96Exa 23.4 AXIAL FLOW TURBINES . . . . . . . . . . . . . . . 97

Exa 23.5 HYDRAULIC TRANSMISSIONS . . . . . . . . . . . 98Exa 24.1 RECIPROCATING PUMPS . . . . . . . . . . . . . . 100Exa 24.2 RECIPROCATING PUMPS . . . . . . . . . . . . . . 102Exa 25.1 FANS PUMPS AND FLUID NETWORKS . . . . . . 104Exa 25.4 AN APPLICATION OF THE STEADY FLOW EN-

ERGY EQUATION . . . . . . . . . . . . . . . . . . . 106Exa 25.7 JET FANS . . . . . . . . . . . . . . . . . . . . . . . . 107Exa 25.8 JET FANS . . . . . . . . . . . . . . . . . . . . . . . . 108Exa 25.9 CAVITATION IN PUMPS AND TURBINES . . . . . 109Exa 25.11 VENTILATION AND AIRBORNE CONTAMINATION

AS A CRITERION FOR FAN SELECTION . . . . . 110AP 1 UDF Intersect Function . . . . . . . . . . . . . . . . . 112

9

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 11/114

List of Figures

4.1 DISCHARGE AND MEAN VELOCITY . . . . . . . . . . . 27

23.1 DIMENSIONLESS COEFFICIENTS AND SIMILARITY LAWS 95

25.1 FANS PUMPS AND FLUID NETWORKS . . . . . . . . . . 105

10

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 12/114

Chapter 1

Fluids and their properties

Scilab code Exa 1.1 Excess Pressure

1 funcprot ( 0 ) ; clc ;

2 / / E xa mp le 1 . 13 // I n i t i a l i z a t i o n o f V a r i a b le4 s ig ma = 7 2. 7* 10 ^ - 3 ; / / S u r f a c e T e ns i o n5 r = 1 *10^ -3; / / R a di u s o f B ub bl e6

7 / / C a l c u l a t i o n s8 P = 2* s ig ma / r ;

9 disp (P , ” E x c e s s P r e s s u r e (N/m2 ) : ” )

11

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 13/114

Chapter 2

Pressure and Head

Scilab code Exa 2.1 VARIATION OF PRESSURE VERTICALLY

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 13

4 // I n i t i a l i z i n g t he v a r i a b l e s5 z1 = 0; / / Ta ki ng Ground a s r e f e r e n c e6 z2 = -30; //Depth

7 r ho = 1 02 5; / / D e n s i t y8 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y9

10 / / C a l c u l a t i o n11 p r e s su r e I n cr e a s e = - r h o * g *( z 2 - z 1 ) ;

12 disp ( p r e s s u r e I n c r e a s e / 1 0 0 0 , ” I n c r e a s e i n P r e ss u r e (KN/m2) : ” ) ;

Scilab code Exa 2.2 VARIATION OF PRESSURE WITH ALTITUDE

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 2

12

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 14/114

3

4 // I n i t i a l i z i n g t he v a r i a b l e s5 p 1 = 2 2 .4 * 10 ^ 3; // I n i t i a l P r e s su r e6 z 1 = 1 10 00 ; // I n i t i a l Hei ght7 z 2 = 1 50 00 ; // f i n a l H ei gh t8 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y9 R = 2 8 7 ; / / Gas C o n s t a n t

10 T = 2 73 - 5 6. 6; //T e mpe r at ur e11

12 / / C a l c u l a t i o n s13 p 2 = p 1 * exp ( - g * ( z 2 - z 1 ) / ( R * T ) ) ;

14 r h o 2 = p 2 / ( R * T ) ;

15 disp ( r h o 2 , ” F i n a l D e n s i t y ( k g /m3 ) : ” , p 2 / 1 0 0 0 , ” F i n a lP r e s su r e ( kN /m2) : ” ) ;

Scilab code Exa 2.3 VARIATION OF PRESSURE WITH ALTITUDE INA GAS UNDER ADIABATIC CONDITIONS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 3

34 // I n i t i a l i z i n g t he v a r i a b l e s5 p 1 = 1 0 1* 1 0^ 3 ; // I n i t i a l P r e s su r e6 z1 = 0; // I n i t i a l He ig ht7 z2 = 1 20 0; / / F i n a l H e i gh t8 T 1 = 1 5+ 27 3; // I n i t i a l Temp era ture9 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y

10 gamma = 1 .4 ; // Heat c a pa c i ty r a t i o11 R = 2 8 7 ; / / Ga s C o n s t a n t12

13 / / C a l c u l a t i o n s14 p 2 = p 1 *( 1 - g *( z2 - z 1 ) *( gamma - 1 ) / ( gamma * R * T 1 ) ) ^ ( gamma

/( gamma - 1 ) ) ;

15 d T_ dZ = -( g / R) * (( gamma - 1 ) / gamma ) ;

16 T 2 = T1 + d T_ dZ * ( z2 - z 1) ;

13

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 15/114

17 disp ( T 2 - 2 7 3 , ” D e n si ty a t 120 0 m ( i n d e g r e e c e l c i u s ) :

” , p 2 / 1 0 0 0 , ” F i n a l P r e s s u r e ( kN /m2 ) : ” ) ;

Scilab code Exa 2.4 VARIATION OF PRESSURE AND DENSITY WITHALTITUDE FOR A CONSTANT TEMPERATURE GRADIENT

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 43

4 // I n i t i a l i z i n g t he v a r i a b l e s5 p 1 = 1 0 1* 1 0^ 3 ; // I n i t i a l P r e s su r e6 z1 = 0; // I n i t i a l He ig ht7 z2 = 7 00 0; / / F i n a l H e i gh t8 T 1 = 1 5+ 27 3; // I n i t i a l Temp era ture9 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y

10 R = 2 8 7 ; / / Ga s C o n s t a n t11 d T = 6 . 5/ 1 00 0 ; // R ate o f V a r i a t i o n o f T em pe ra tu re12

13 / / C a l c u l a t i o n s14 p 2 = p 1 * (1 - d T * ( z 2 - z 1 ) / T 1 ) ^( g / ( R * d T ) ) ;

15 T2 = T1 - dT *( z2 - z1 );16 r ho 2 = p 2 /( R * T2 ) ;

17 disp ( r h o 2 , ” F i n a l D e n s i t y ( k g /m3 ) : ” , p 2 / 1 0 0 0 , ” F i n a lP r e s s u r e ( kN/m2 ) : ” ) ;

Scilab code Exa 2.5 PRESSURE AND HEAD

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 53

4 // I n i t i a l i z i n g t he v a r i a b l e s5 p = 3 50 *1 0^ 3; / / Ga uge P r e s s u r e6 p At m = 1 0 1. 3 *1 0 ^3 ; / / A t m os p he r ic P r e s s u r e

14

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 16/114

7 r ho W = 1 00 0; / / D e n s i t y o f W ater

8 s ig ma = 1 3. 6; // R e l a t i v e D e ns i t y o f Me rc ury9 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y10

11 / / C a l c u l a t i o n s12 function [ h e a d ] = H e a d ( r h o )

13 h ea d = p / ( rh o * g) ;

14 e n d f u n c t i o n

15 r ho M = s ig ma * r h oW ;

16 pAbs = p + pAtm ;

17

18 disp ( p A b s / 1 0 0 0 , ” A b s o l u t e p r e s s u r e ( kN/m2 ) ” , H e a d ( r h o M )

, ” E q u i v a l e n t h ea d o f w a te r (m) : ” , ” P ar t ( b ) ” , H e a d (r h o W ) , ” E q u i v al e nt head o f w at er (m) : ” , ” P ar t ( a ) ”

) ;

Scilab code Exa 2.6 PRESSURE MEASUREMENT BY MANOMETER

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 6

34 // I n i t i a l i z i n g t he v a r i a b l e s5 r ho = 1 0^ 3; // D e n si t y o f w at er6 h = 2; / / H e i g h t7 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y8

9 / / C a l c u l a t i o n s10 p = r h o * h * g ;

11 disp ( p / 1 0 0 0 , ” Gauge p r e s s u r e ( k /m2 ) : ” ) ;

Scilab code Exa 2.7 PRESSURE MEASUREMENT BY MANOMETER

1 clc ; funcprot ( 0 ) ;

15

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 17/114

2 / / E xa mp le 2 . 7

34 // I n i t i a l i z i n g t he v a r i a b l e s5 r ho = 0 . 8* 1 0^ 3 ; // D en si ty o f f l u i d6 r ho M = 1 3 .6 * 10 ^ 3; / / D e n s i t y o f m ano meter l i q u i d7 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y8

9 / / C a l c u l a t i o n s10 function [ P ] = f l u i d P r e s s u r e ( h 1 , h 2 )

11 P = r ho M * g *h2 - r h o * g* h 1 ;

12 e n d f u n c t i o n

13

14 disp ( f l u i d P r e s s u r e ( 0 . 1 , - 0 . 2 ) / 1 0 0 0 , ” Gauge p r e s s u r e (kN/m2) : ” , ”!−−−−−P ar t ( b )−−−−−!” , f l u i d P r e s s u r e

( 0 . 5 , 0 . 9 ) / 1 0 0 0 , ” G au ge p r e s s u r e ( kN /m2 ) : ” , ”!−−−−−P a rt ( a )−−−−−!” ) ;

Scilab code Exa 2.8 PRESSURE MEASUREMENT BY MANOMETER

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 83

4 // I n i t i a l i z i n g t he v a r i a b l e s5 r ho = 1 0^ 3; // D en si ty o f f l u i d6 r ho M = 1 3 .6 * 10 ^ 3; / / D e n s i t y o f m ano meter l i q u i d7 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y8 H = 0 . 3 ; // D i f f e r n c e i n h ei gh t = b−a a s i n t e x t9 h = 0 . 7 ;

10

11 / / C a l c u l a t i o n s

12 r es u lt = r ho * g * H + h * g *( r ho M - r ho ) ;13 disp ( r e su l t / 1 00 0 , ” P r e s s u r e d i f f e r e n c e ( kN/m2 ) : ” ) ;

16

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 18/114

Scilab code Exa 2.9 PRESSURE MEASUREMENT BY MANOMETER

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 93

4 // I n i t i a l i z i n g t he v a r i a b l e s5 r ho = 1 0^ 3; // D en si ty o f f l u i d6 r ho M = 0 . 8* 1 0^ 3 ; / / D e n s i t y o f ma no me ter l i q u i d7 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y8 a = 0. 25 ;

9 b = 0. 15 ;

10 h = 0 . 3 ;

11 / / C a l c u l a t i o n s12 function [ P ] = P r e s s u r e D i f f ( a , b , h , r h o , r h o M )

13 P = r ho * g *( b - a ) + h * g *( r ho - r ho M ) ;

14 e n d f u n c t i o n

15

16 disp ( P r e s s u r e D i f f ( a , b , h , r h o , r h o M ) , ” P r e s s u r eD i f f e r n e c e ( N/m2) : ” , ”!−−−−−P ar t ( b )−−−−−!” ,

P r e s s u r e D i f f ( a , b , h , r h o , 0 ) / 1 0 0 0 , ” P r e s s u r eD i f f e r n e c e ( kN /m2) : ” , ”!−−−−−P ar t ( a ) : rhoM i sn e g l i g i b l e a ss um in g z er o−−−−−!” ) ;

Scilab code Exa 2.10 RELATIVE EQUILIBRIUM

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 . 1 03

4 // I n i t i a l i z i n g t he v a r i a b l e s5 phi = 30; / / 30 d e g r e e

6 h = 1.2 ; // H ei gh t o f t an k7 l = 2; // L en gth o f t an k8

9 / / C a l c u l a t i o n s10 function [ T h e t a ] = S u r f a c e A n g l e ( a , p h i )

17

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 19/114

11 T h et a = a t an d ( - a * c o sd ( p h i ) / ( g + a * s in d ( p h i ) ) ) ;

12 e n d f u n c t i o n13

14 // c a se ( a ) a = 415 disp ( t a n d ( S u r f a c e A n g l e ( 4 , p h i ) ) , ” Tan o f A n gl e b e tw e en

s u r f a c e o f f l u i d and h o r i z o n t a l : ” ) ;

16 disp ( 1 80 + S u r f ac e A n gl e ( 4 , p h i ) , ”ThetaA ( de gr ee ) : ” ) ;

17

18 // Ca se ( b ) a = − 4 . 519 t a n Th e t aR = t a nd ( S u r fa c e A ng l e ( - 4 .5 , p h i ) ) ;

20 disp (tanThetaR , ”Tan o f An gl e b et wee n s u r f a c e o f  f l u i d and h o r i z o n t a l : ” ) ;

21 disp ( S u r f a c e A n g l e ( - 4 . 5 , p h i ) , ”ThetaR ( de gr ee ) : ” ) ;22

23 D ep th = h - l * t an Th et aR / 2;

24 disp ( D e p t h , ”Maximum Depth of tank (m) : ” ) ;

18

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 20/114

Chapter 3

Static Forces on Surfaces

Buoyancy

Scilab code Exa 3.1 RESULTANT FORCE AND CENTRE OF PRES-SURE ON A PLANE SURFACE UNDER UNIFORM PRESSURE

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 3 . 13

4 // I n i t i a l i z i n g t he v a r i a b l e s5 a = 2 . 7 ; / / U pp er e d g e6 b = 1.2 ; / / L o we r e d g e7 w id th = 1 .5 ; // Width o f t r a p e z o i d a l p l a t e8 h = 1 . 1 ; / / H e ig h t o f w at er col um n a bo ve

s u r f a c e9 r ho = 1 00 0;

10 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y11 p h i = 9 0 ; / / An gl e b et we en w a l l and s u r f a c e12

13 / / C a l c u l a t i o n s14 A = 0 .5 *( a + b ) * wi dt h ; / / Area o f T r a p e z o i d a lP l a t e

15 y = ( 2 *( 0 .5 * w i dt h * 0 .7 5 ) * 0. 5 + ( 1. 2* w i d th ) * 0 .7 5) / A ;

16 z = y + h ; // Depth o f c e n te r o f p r e s su r e

19

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 21/114

17 R = rho * g* A* z ; / / R e s u l ta n t f o r c e

1819 I 0 = 1 . 2* 1 .5 ^ 3/ 1 2 + 1 .2 * 1. 5 *1 . 85 ^ 2 + 1 . 5* 1 .5 ^ 3/ 3 6 +

1 . 5 * 0. 7 5 * 1. 6 ^ 2 ; / / S e c on d moment o f a r e a20 D = ( s in d ( ph i ) ) ^2 * I0 / ( A *z ) ; // d ept h o f c e n te r o f  

p r e s s u r e21 M = R * ( 1. 85 3 3 - 1. 1) ; //Moment about hi nge22 disp ( M / 1 0 0 0 , ” Moment a b o ut t h e h i n g e l i n e ( kN/m) : ” )

Scilab code Exa 3.2 RESULTANT FORCE AND CENTRE OF PRES-SURE ON A PLANE SURFACE UNDER UNIFORM PRESSURE

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 3 . 23

4 // I n i t i a l i z i n g t he v a r i a b l e s5 w = 1 . 8 ; / /Width o f p l a t e6 h1 = 5; // H ei gh t o f p l a t e and w a te r i n

upst r e am7 h2 = 1. 5; / / H ei g ht o f w at er i n d own st rea m

8 r ho = 1 00 0;9 g = 9.81 ; // A c c e l e r a t i o n due t o g r a v i t y

10

11 / / C a l c u l a t i o n s12 function [ F ] = w a t e r F o r c e ( a r e a , m e a n H e i g h t )

13 F = rho * g * area * me anH ei gh t;

14 e n d f u n c t i o n

15

16 P = w a t e rF o r ce ( w * h 1 , h 1 / 2 ) - w a t er F o r ce ( w * h 2 , h 2 / 2 ) ; //R es u lt a nt f o r c e on g at e

17 x = ( w a te r Fo r ce ( w * h1 , h 1 / 2) * ( h1 / 3 ) - w a te r Fo r ce ( w * h2 ,h 2 / 2 ) * ( h 2 / 3 ) ) / P ; // p oi nt o f a c t i o n o f p frombottom

18 R = P / (2 * s in d ( 20 ) ) ; // T ot al R ea ct io n f o r c e19 R t = 1 .1 8* R / 4 .8 ; / / R e a c t i o n o n Top

20

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 22/114

20 Rb = R - R t ; / / R e a c t i o n a t b ot to m

2122 disp ( R b / 1 0 0 0 , ” R e a c t i o n a t b ot to m ( kN ) : ” , R t / 1 0 0 0 , ”

R e a c t io n a t t o p ( kN ) : ” ) ;

Scilab code Exa 3.3 PRESSURE DIAGRAMS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 3 . 3

34 // I n i t i a l i z i n g t he v a r i a b l e s5 D = 1 . 8 ; / / Depth o f t an k6 h = 1 . 2 ; / / Depth o f w a te r7 l = 3; // L engt h o f w a ll o f t an k8 p = 3 50 00 ; // A ir p r e s s ur e9 r ho = 1 0^ 3; / / D e n si t y o f w at er

10 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y11

12

13 / / C a l c u l a t i o n s

14 Ra = p *D *l ; // F or ce due t o a i r15 R w = . 5* ( r ho * g * h) * h *l ; / / F or ce du e t o w at er16 R = Ra + Rw ; // R e s ul t an t f o r c e17 x = ( R a * 0. 9+ R w * 0 .4 ) / R ; // H e i gh t o f c e n t er o f  

p r e s s u r e fro m b as e18 disp (x , ” H ei g ht o f t h e c e n t r e o f p r e s s u r e abov e t he

bas e (m) : ” , R / 1 0 0 0 , ” R e s u l ta n t f o r c e on t he w a l l ( kN) ” ) ;

Scilab code Exa 3.4 FORCE ON A CURVED SURFACE DUE TO HY-DROSTATIC PRESSURE

1 clc ; funcprot ( 0 ) ;

21

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 23/114

2 / / E xa mp le 3 . 4

34 // I n i t i a l i z i n g t he v a r i a b l e s5 R = 6; // R ad ius o f a rc6 h = 2 * R* s in d ( 30 ) ; / / Dep th o f w a te r7 r ho = 1 0^ 3; / / D e n si t y o f w at er8 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y9

10 / / C a l c u l a t i o n s11 R h = ( r ho * g * h ^2 ) / 2; // R es ul t a nt h o r i z o n t a l f o r c e

p er u n it l e ng t h12 R v = r h o * g * ( (6 0 / 3 60 ) * % p i * R ^ 2 - R * s i nd ( 3 0 ) * R * c o sd ( 3 0 ) )

; // R es ul ta nt v e r t i c a l f o r c e p e r u ni t l en g t h13 R = sqrt ( R h ^ 2 + R v ^ 2 ) ; // R e s u lt a nt f o r c e on g at e14 t he ta = a ta nd ( R v / Rh ) ; // A n gl e b et we en r e s u l t a n t

f o r c e and h o r i z o n t a l15

16 disp ( t h e t a , ” D i r e c t i o n o f r e s u l t a n t f o r c e t o t h eh o r i z o n t a l ( D e g r e e ) : ” , R / 1 0 0 0 , ” M a g n it u te o f  r e s u l t a n t f o r c e ( kN/m ) : ” ) ;

Scilab code Exa 3.5 BUOYANCY

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 3 . 53

4 // I n i t i a l i z i n g t he v a r i a b l e s5 B = 6; / / Width o f p o nt oo n6 L = 12; / / L en gt h o f p o nt oo n7 D = 1 . 5 ; / / D ra ug ht o f p o nt oo n

8 Dm ax = 2; / / Maximum p e r m i s s i b l ed r a u g h t9 r ho W = 1 00 0; // D en si t y o f f r e s h w at er

10 r ho S = 1 02 5; // D e ns i t y o f s e a w at er11 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y

22

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 24/114

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 25/114

co mb ined c e n t e r o f g r a v i t y

17 Z 1 = ( ( W+ L ) *Z # - 0 .4 5* W ) / L ; //Maximum h e i g h to f l o a d a bo ve b otto m18

19 disp ( Z 1 , ”Maximum h e i g h t o f c e n t e r o f g r a v i t y a bo vebot tom (m) : ” ) ;

Scilab code Exa 3.7 STABILITY OF A VESSEL CARRYING LIQUIDIN TANKS WITH A FREE SURFACE

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 3 . 73

4 // I n i t i a l i z i n g t he v a r i a b l e s5 l = 20; // L en gth o f b ar ag e6 b = 6; / / Width o f b a r a g e7 r = 3; // R a di u s o f c i r c u l a r t o p o f b ar ag e8 W = 2 00 *1 0^ 3; / / W ei gh t o f em pt y b a r a g e9 d1 = 0. 8; // Depth o f w a te r i n 1 s t h a l f  

10 d 2 = 1 ; // Depth o f w at er i n 2 nd h a l f  

11 r ho = 1 00 0; / / D e n s i t y o f w a te r12 R = 0 . 8 ; // R e l a t i v e d e n s i t y o f l i q u i d13 g = 9. 81 ; // A c c e l e r a t i o n due t o g r a v i t y14 ZG = 0 .4 5; // C en te r o f g r a v i ty o f b ar ag e15

16 / / C a l c u l a t i o n s17 I 00 = l * b ^ 3/ 12 + % pi * b ^ 4 /1 28 ;

18 I CC = l * ( .5 * b ) ^ 3/ 12 ;

19 L = d 1 * rh o * g* l * b /2 *( d 1 + d2 ) ; // Weight o f l i q u i dl o a d

20 W # = L + W ; / / T o t a l w e i g h t21 A = l *b + % pi * r ^2 /2 ; // Area o f p la ne o f  w a t e r l i n e

22 V = W #/ ( rh o* g ); / / V olume o f v e s s e l s ub me rg ed23 D = V / A ; //De pth subme r ge d

24

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 26/114

24 ZB = .5 *D ; // H e ig ht o f c e n t e r o f b uo yancy

25 N M = ZB - Z G + (1 / V ) *( I 00 - R * 2 * I CC ) ; //E f f e c t i v e m e t a c en t ri c h e i g h t26 P = R * r ho * g * l* b / 2* ( d2 - d 1 ) ; / / o v e r t u r n i n g moment27 t h et a = a t an d ( P * 1 . 5 /( W # * N M ) ) ; / / A n g le o f r o l l28

29 disp ( t h e t a , ” A n gl e o f r o l l ( D e gr e e ) : ” ) ;

25

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 27/114

Chapter 4

Motion of Fluid Particles and

Streams

Scilab code Exa 4.1 DISCHARGE AND MEAN VELOCITY

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 4 . 1

34 // I n i t i a l i z i n g t he v a r i a b l e s5 y = linspace ( 0 , 8 0 , 9 ) ;

6 x = [0 23 28 31 32 29 22 14 0];

7 x l a b e l ( ’ V e l o c i t y (m/ s ) ’ ) ;

8 y l a b e l ( ’ D i s t a n c e f r om o n e s i d e (mm) ’ ) ;

9 xgrid ( 1 ) ;

10

11 / / C a l c u l a t i o n s12 plot ( x , y , ’−∗ ’ ) ;

13 m u =[ 17 .5 2 6. 0 2 9. 6 3 1. 9 3 0. 7 2 5. 4 1 8. 1 7 .7 ];14 // mean v e l o c i t y15 disp ( mean ( m u ) ,” Mean v e l o c i t y (m/ s ) : ” ) ;

16

17 // t he p l ot i s a tt ac he d a s 4 . 1 . png

26

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 28/114

Figure 4.1: DISCHARGE AND MEAN VELOCITY

27

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 29/114

Scilab code Exa 4.2 CONTINUITY OF FLOW

1 clc ; funcprot ( 0 ) ; / / E xa mp le 4 . 22

3 / / I n i t i a l i z i n g t h e v a r i a b l e s a l l u nk no wn s a r ea s s i gn e d 0

4

5 d = [0 .0 5 0 .0 75 0 0 .0 30 ];

6 Q = [0 0 0 0];7 V = [0 2 1.5 0];

8 / / C a l c u l a t i o n s9 A 2 = % pi * d ( 2) ^ 2 /4 ;

10 Q ( 2) = A 2 *V ( 2) ;

11 Q = [ Q ( 2) Q ( 2) Q ( 2) / 1 .5 0 .5 * Q ( 2) / 1 . 5] ;

12 d ( 3 ) = ( Q ( 3 ) * 4 /( V ( 3 ) * % p i ) ) ^ 0 .5 ;

13 A = % pi * d ^2 /4 ;

14 V ( 1) = V ( 2) * ( A (2 ) / A (1 ) ) ;

15 V ( 4 ) = Q ( 4 ) / A ( 4 ) ;

16

17 disp ( [ d * 1 00 0 ; A ; Q ; V ] ’ , ” ! Di ame t e r (mm) A r ea ( m2)F lo w R a te ( m3/ s ) V e l o c i t y (m/ s ) ! ” ) ;

Scilab code Exa 4.3 CONTINUITY EQUATIONS FOR THREE DIMEN-SIONAL FLOW USING CARTESIAN COORDINATES

1 clc ; funcprot ( 0 ) ;

2/ / E xa mp le 4 . 33

4 // I n i t i a l i z i n g t he v a r i a b l e s5 v x = - poly (3 , ’ x ’ ) ;

6 vy = 2* poly ( - 2 , ’ x ’ ) ;

28

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 30/114

7 vz = - poly (2 , ’ x ’ ) ;

89 / / C a l c u l a t i o n s

10 d el Vx = derivat ( v x ) ;

11 d el Vy = derivat ( v y ) ;

12 d el Vz = derivat ( v z ) ;

13

14 r es u lt = derivat ( v x ) + derivat ( v y ) + derivat ( v z ) ; //r eq ui r e me nt o f c o n t i n ui t y e q u a ti o n ( r e s u l t = 0 )

15 disp ( ” S a t i s f y r eq ui r e me nt o f c o n t i n ui t y ” ) ;

29

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 31/114

Chapter 5

The Momentum Equation and

its Applications

Scilab code Exa 5.1 GRADUAL ACCELERATION OF A FLUID IN APIPELINE NEGLECTING ELASTICITY

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 5 . 13

4 // I n i t i a l i z i n g t he v a r i a b l e s5

6 l = 60 ; // L engt h o f p i p e l i n e7 r ho = 1 00 0; // D en si ty o f l i q u i d8 a = 0. 02 ; // A c c e l e r a t i o n o f f l u i d9

10 / / C a l c u l a t i o n s11 d el P = r ho * l * a ; / / Change i n p r e s s u r e12 disp ( d e l P / 1 0 0 0 , ” I n c r e a s e o f p r e s s u re d i f f e r e n c e

r e q u i r e d ( kN /m2 ) : ” ) ;

Scilab code Exa 5.2 FORCE EXERTED BY A JET STRIKING A FLATPLATE

30

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 32/114

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 5 . 23

4 // I n i t i a l i z i n g t he v a r i a b l e s5 v = 5; // V e l o ci t y o f j e t6 r ho = 1 00 0; // d e n s i t y o f w at er7 d = 0 .0 25 ; // D ia me t er o f f i x e d n o z z l e8

9 / / C a l c u l a t i o n s10 //−−P a rt ( a ) V a r ia t i o n o f f o r c e e x er t ed nor mal t o t he

p l a t e w i th p l a t e a ng le −−//11 h ea de r = [ ” Theta ” ” v c o s ( x ) ” ” A v ” ”

F o r c e ” ];12 unit = [ ” deg ” ” m/ s ” ” kg / s ” ”

N” ];

13

14 A = % pi * d ^2 /4 ;

15 x = linspace ( 0 , 9 0 , 7 ) ;

16 v co mp = v * c os d ( x) ;

17 m = r ho * A *v ;

18 ma = linspace ( m , m , 7 ) ;

19 f o rc e = r h o * A * v ^2 * c o s d ( x ) ;

20 v al ue = [ x ; v co mp ; m a ; f or ce ] ’ ;

21 disp ( v al ue , u ni t , h ea d er ) ;

22

23 //−−P a rt ( b ) V a r i a t i o n o f f o r c e e x er t ed nor ma l t o t hep l a t e w i t h p l a t e v e l o c i t y −−//

24 h ea de r = [ ” Theta ” ” v ” ” u” ” v−u” ” A ( v−u) ” ” F o r c e ” ] ;

25 unit = [ ” deg ” ”m/ s ” ”m/ s ” ” m/ s ” ” kg / s” ” N” ] ;

26

27 x = linspace ( 0 , 0 , 5 ) ;

28 v = linspace ( 5 , 5 , 5 ) ;29 u = linspace ( 2 , - 2 , 5 ) ;

30 D = v - u ;

31 P ro d = r ho * A * D ;

32 F or ce = r ho * A * D ^2 ;

31

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 33/114

33 v a lu e = [ x ; v ; u ; D ; P ro d ; F o r ce ] ’ ;

34 disp ( value , u nit , h ea de r ) ;

Scilab code Exa 5.3 FORCE DUE TO THE DEFLECTION OF A JETBY A CURVED VANE

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 5 . 33

4 // I n i t i a l i z i n g t he v a r i a b l e s5 x = 60; // A ng l e o f d e f l e c t i o n6 r ho = 1 00 0; // D en si ty o f l i q u i d7 V 1 = 3 0 ; // A c c e l e r a t i on o f f l u i d8 V 2 = 2 5 ;

9 m = .8; / / D i s c h a r g e t h r ou g h A10

11 / / C a l c u l a t i o n s12 function [ R ] = R ea ct io n ( Vi n , V ou t )

13 R = m *( V in - Vou t) ;

14 e n d f u n c t i o n

1516 R x = R e a ct i o n ( V1 , V 2 * c o s d ( x ) ) ;

17 R y = - R e a ct i o n ( 0 , V 2 * s in d ( x ) ) ;

18 disp ( R x , ” R e a ct io n i n X−d i r e c t i o n (N) : ” ) ;

19 disp ( R y , ” R e a ct io n i n Y−d i r e c t i o n (N) : ” ) ;

20 disp ( sqrt ( R x ^2 + R y ^2 ) , ” N et R e a c t i o n (N) : ” ) ;

21 disp ( a t a n d ( R y / R x ) , ” I n c l i n a t i o n o f R es u lt a nt F o rc ew it h x−d i r e c t i o n ( D e gr e e ) : ” ) ;

Scilab code Exa 5.4 FORCE EXERTED WHEN A JET IS DEFLECTEDBY A MOVING CURVED VANE

1 clc ; funcprot ( 0 ) ;

32

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 34/114

2 / / E xa mp le 5 . 4

34 // I n i t i a l i z i n g t he v a r i a b l e s5 v1 = 36 ; // E xi t v e l o c i t y6 u = 15; // V e l o c i t y o f van e\7 x = 30; / / A ng le b et we en v an e s and f l o w8 r ho = 1 00 0; // D en s it y o f w at er9 d = .1; // D ia me t e r o f j e t

10

11 / / C a l c u l a t i o n s12 a lp = a t an d ( v 1 * s i nd ( x ) / ( v 1 * c o sd ( x ) - u ) ) ;

13 v 2 = 0 .8 5* v 1 * s in d ( x );

14 b ta = a co sd ( u * s in d ( al p ) / v2 ) ;15 m = ( r ho * % pi * v 1 *d ^ 2) / 4 ;

16 V in = v 1 * co sd ( x ) ;

17 V ou t = v 2 * co sd ( 9 0) ;

18 R x = m * ( Vi n - V ou t ) ;

19

20 disp ( Rx , ” F o rc e e x e r t e d by v a ne s (N ) : ” , b t a , ” O u t l e tAng le ( De gr ee ) : ” , a l p , ” I n l e t A n gl e ( D e g re e ) : ” ) ;

Scilab code Exa 5.5 FORCE EXERTED ON PIPE BENDS AND CLOSEDCONDUITS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 5 . 53

4 // I n i t i a l i z i n g t he v a r i a b l e s5 r h o = 8 5 0 ; // D en si ty o f l i q u i d6 a = 0.02 ; // A c c e l e r a t i o n o f f l u i d

7 x = 45 ;8 d1 = .5 ;

9 d2 = .2 5;

10 p 1 = 4 0* 10 ^3 ;

11 p 2 = 2 3* 10 ^3 ;

33

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 35/114

12 Q = . 4 5 ;

1314 / / C a l c u l a t i o n s15 A 1 = ( % pi * d 1 ^2 ) / 4;

16 A 2 = ( % pi * d 2 ^2 ) / 4;

17 v1 = Q /A1 ;

18 v2 = Q /A2 ;

19

20 R x = p 1 * A1 - p 2 * A2 * c o sd ( x ) - r ho * Q * ( v2 * c o sd ( x ) - v1 ) ;

21 R y = p 2 * A2 * s in d ( x ) + r ho * Q * v2 * s in d ( x) ;

22

23 disp ( sqrt ( R x ^ 2 + R y ^ 2 ) / 10 00 , ” R e su l ta n t f o r c e on t he

bend (kN) : ” ) ;24 disp ( a t a n d ( R y / R x ) , ” I n c l i n a t i o n o f R es u lt a nt F o rc e

w it h x−d i r e c t i o n ( D e gr ee ) : ” ) ;

Scilab code Exa 5.6 REACTION OF A JET

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 5 . 6

34 // I n i t i a l i z i n g t he v a r i a b l e s5 v = 4 . 9 ; // V e l o c i t y o f J et6 r ho = 1 00 0; // D en s it y o f w at er7 d = 0. 05 ;

8 u = 1.2 ; // V e lo c i t y o f t an k9 / / C a l c u l a t i o n s

10 Vout = v ;

11 Vin = 0;

12 m = r ho * % pi * d ^ 2* v / 4;

13 R = m * ( Vo ut - V in ) ;14 disp (R , ” R e a c t i o n (N) : ” ) ;

15 disp ( R * u , ” Work d o ne p e r s e c o n d (W) : ” ) ;

34

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 36/114

Scilab code Exa 5.7 REACTION OF A JET

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 5 . 73

4 // I n i t i a l i z i n g t he v a r i a b l e s5 V j = 5 *1 0^ 6; // V e l o c i t y o f J e t6 M r = 1 50 00 0; / / M ass o f R oc ke t7 M f0 = 3 00 0 00 ; / / Mass o f i n i t i a l f u e l8 Vr = 3 00 0; // V e l o c i t y o f j e t r e l a t i v e t o

r o c k e t9 g = 9. 81 ; // A c c e l e r a t i on due t o g r a v i ty

10

11 / / C a l c u l a t i o n s12 m = V j / V r ; // R ate o f f u e l c on su mp ti on13 T = Mf0 / m; / / B u rn i ng t i me14 function [ D V t ] = f ( t )

15 DVt = m * Vr /( Mr + Mf0 - m *t ) - g ;

16 e n d f u n c t i o n

1718 function [ V ] = h ( t )

19 V = -g * t - Vr *log (1 - t / 26 9. 95 ) ;

20 e n d f u n c t i o n

21

22 Vt = intg (0 , 1 80 , f) ;

23 Z1 = intg ( 0 , 1 8 0 , h ) ;

24

25 Z 2 = V t ^2 /( 2* g ) ;

26 disp (T , ” ( a ) B u rn in g t i me ( s ) : ” ) ;

27 disp ( V t , ” ( b ) Speed o f r o c ke t when a l l f u e l i s bur ned(m/ s ) : ”) ;

28 disp ( ( Z 2 + Z 1 ) / 1 0 0 0 , ” ( c ) Maximum he i g ht r e a c he d ( km) : ” )

;

35

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 37/114

Scilab code Exa 5.8 REACTION OF A JET

1 clc ; funcprot ( 0 ) ; / / E xa mp le 5 . 82

3 // I n i t i a l i z i n g t he v a r i a b l e s4 V = 2 0 0 ; // V e l o c i t y i n s t i l l a i r5 Vr = 70 0; // v e l o c i t y o f g a s r e l a t i v e t o e ng in e6 mf = 1. 1; / / F u e l C on su mp ti on7 r = 1/40 ;

8 P 1 = 0;

9 P2 = 0;

10

11 / / C a l c u l a t i o n s12 m1 = mf / r ;

13 T = m1 * (( 1+ r ) *V r - V) ;

14 disp ( T / 1 0 0 0 , ” ( a ) T hr u st ( kN ) : ” ) ;

15

16 W = T * V ;

17 disp ( W / 1 0 0 0 , ” ( b ) Work d o ne p e r s e c o n d (kW) : ” ) ;

1819 L o ss = 0 . 5* m 1 * ( 1 + r ) * ( Vr - V ) ^ 2 ;

20 disp ( W / ( W + L os s ) * 1 0 0 , ” ( c ) E f f i c i e n c y (%) : ” ) ;

Scilab code Exa 5.10 ANGULAR MOTION

1 clc ; funcprot ( 0 ) ; / / E xa mp le 5 . 1 02

3 // I n i t i a l i z i n g t he v a r i a b l e s4 r ho = 1 00 0; // D en s it y o f w at er5 Q = 10; // A c c e l e r a t i o n o f f l u i d6 r2 = 1. 6;

7 r1 = 1. 2;

36

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 38/114

8 V1 = 2. 3;

9 V2 = 0. 2;10 r ot = 2 40 ;

11

12 / / C a l c u l a t i o n s13 T f = r ho * Q *( V 2* r2 - V 1* r1 ) ;

14 T = - T f ;

15 n = rot / 60;

16 P = 2* % pi * n* T ;

17

18 disp (T , ” T or qu e e x e r t e d (N− m) : ” ) ;

19 disp ( P / 1 0 0 0 , ” T h e o r e t i c a l p ow er o u tp u t (kW) : ” ) ;

37

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 39/114

Chapter 6

The Energy Equation and its

Applications

Scilab code Exa 6.1 MECHANICAL ENERGY OF A FLOWING FLUID

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Pc = 0; / / A tm os ph er ic P r e s s u r e5 Z3 = 3 0+ 2; // h e i g ht o f n o z z l e6 Ep = 50 ; // E nerg y p er u n i t w ei gh t s u p p l i e d

by pump7 d 1 = 0 .1 50 ; / / D i a m e te r o f sump8 d 2 = 0 .1 00 ; // D iam et e r o f d e l i v e r y p i p e9 d3 = 0.075 ; // D ia me te r o f n o z z l e

10 g = 9. 81 ; // A c c e l e r a t i on due t o g r a v i t y11 Z 2 = 2 ; / / H e i g h t o f pump12 r ho = 1 00 0; // D en s it y o f w at er13

14 / / C a l c u l a t i o n s15 U3 = sqrt ( 2* g * ( E p - Z 3 ) / ( 1 +5 * ( d 3 / d 1 ) ^4 + 1 2 *( d 3 / d 2 ) ^ 4 )

) ;

16 U1 = U3 /4;

17 P b = r ho * g* Z2 + 3* r ho * U1 ^ 2;

38

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 40/114

18 disp ( U 3 , ” V e l o c i t y o f J et t hr ou gh n o z z l e (m/ s ) : ” ) ;

19 disp ( P b / 10 00 , ” P r e ss u r e i n t h e s u c t i on p ip e a t t h ei n l e t t o t h e pump a t B (kN/m2 ) : ” ) ;

Scilab code Exa 6.2 CHANGES OF PRESSURE IN A TAPERING PIPE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 x = 45; // I n c l i n a t i o n o f p ip e5 l = 2; // L en gt h o f p i pe u nd er c o n s i d e r a t i o n6 Ep = 50 ; // E nerg y p er u n i t w ei gh t s u p p l i e d

by pump7 d1 = 0. 2; / / D i a m e te r o f sump8 d2 = 0. 1; // D ia me t e r o f d e l i v e r y p i p e9 g = 9. 81 ; // A c c e l e r a t i on due t o g r a v i t y

10 r ho = 1 00 0; // D en s it y o f w at er11 V 1 = 2 ;

12 R D_ o il = 0 .9 ; // r e l a t i v e d e n si t y o f o i l13 R D _M e rc = 1 3. 6; // R e l a t i v e d e ns i t y o f  

Mercury14

15 / / C a l c u l a t i o n s16 V 2 = V 1 *( d 1 / d2 ) ^ 2;

17 d Z = l * si nd ( x );

18 r h o_ O il = R D_ o il * r ho ;

19 r h o_ M an = R D _M e rc * r h o ;

20 d P = 0 .5 * r h o_ Oi l * ( V2 ^ 2 - V1 ^ 2 ) + r ho _ Oi l * g * dZ ;

21 h = r ho _O il * ( d P /( r h o_ Oi l * g) - dZ ) /( r ho _M an -

r h o _ O i l ) ;

2223 disp (h , ” D i f f e r e n c e i n t he l e v e l o f m er cu ry (m) : ” ,dP

, ” P r e s s u r e D i f f e r e n c e (N/m2 ) : ” ) ;

39

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 41/114

Scilab code Exa 6.3 PRINCIPLE OF THE VENTURI METER

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 d1 = 0 .2 5; / / P i p e l i n e d i a me t er5 d2 = 0 .1 0; / / T hr oa t d i a m e t e r6 h = 0. 63 ; // D i f f e r e n c e i n h e ig h t7 r ho = 1 00 0; / / D e n s i t y o f w a te r8 g = 9 . 8 1 // A c c e l e r a t i o n due t o g r a v i t y9

10 / / C a l c u l a t i o n s11 r ho _ Hg = 1 3. 6* r h o ;

12 r h o_ O il = 0 .9 * r ho ;

13 A 1 = ( % pi * d 1 ^2 ) / 4; // Area a t e n tr y14 m = ( d1 / d2 ) ^2 ; // Area r a t i o15 Q = ( A 1 / sqrt ( m ^ 2 - 1 ) ) * sqrt ( 2 * g * h *( r h o _ H g / r h o _O i l - 1) )

;

16

17 disp (Q , ” T h e p r e t i c a l Volume f l o w r a t e ( m3/ s ) : ” ) ;

Scilab code Exa 6.4 THEORY OF SMALL ORIFICES DISCHARGINGTO ATMOSPHERE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s

45 x = 1 . 5 ;

6 y = 0. 5;

7 H = 1 . 2 ;

8 A = 6 50 *1 0^ - 6 ;

40

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 42/114

9 Q = 0 .1 17 ;

10 g = 9. 81 ;11

12 / / C a l c u l a t i o n s13 Cv = sqrt ( x ^ 2 / ( 4 * y * H ) ) ;

14 C d = Q / ( 6 0 * A * sqrt ( 2 * g * H ) ) ;

15 Cc = Cd / Cv ;

16

17 disp ( C c , ” C o e f f i c i e n t o f c o n t r a c t i o n : ” , C d , ”C o e f f i c i e n t o f D i s ch ar ge : ” , C v , ” C o e f f i c i e n t o f  v e l o c i t y : ” ) ;

Scilab code Exa 6.5 THEORY OF LARGE ORIFICES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 52

3 // I n i t i a l i z i n g t he v a r i a b l e s4 B = 0 . 7 ;

5 H1 = 0. 4;

6 H2 = 1. 9;

7 g = 9. 81 ;8 z = 1.5 ; // h e i g h t o f o pe ni ng9

10 / / C a l c u l a t i o n s11 Q_ Th = 2/3 * B* sqrt ( 2* g ) *( H 2 ^ 1. 5 - H 1 ^ 1. 5) ;

12 A = z * B ;

13 h = 0 .5 *( H 1 + H2 ) ;

14 Q = A * sqrt ( 2 * g * h ) ;

15

16 disp ( ( Q - Q _ T h ) * 1 0 0 / Q _ T h , ” P e rc en ta ge e r r o r i nd i s c h a r g e (%) : ” ) ;

Scilab code Exa 6.6 ELEMENTARY THEORY OF NOTCHES AND WEIRS

41

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 43/114

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 6

23 // I n i t i a l i z i n g t he v a r i a b l e s4 Cd = 0. 6; // C o e f f i c i e n t o f d i s c h ar g e5 Q = 0. 28 ;

6 x = 90; //T he t a7 g = 9. 81 ;

8 d H = 0 .0 01 5;

9

10 / / C a l c u l a t i o n s11 H = ( Q * (1 5 /8 ) / ( Cd * sqrt ( 2 * g ) * t a n d ( x / 2 ) ) ) ^ ( 2 / 5 )

12 F ra c_ Q = 5 /2 *( dH / H) ;

1314 disp ( F r a c _ Q * 1 0 0 , ” P e r ce n ta g e e r r o r i n d i s c h a r g e (%) ” )

;

Scilab code Exa 6.7 ELEMENTARY THEORY OF NOTCHES AND WEIRS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 72

3 // I n i t i a l i z i n g t he v a r i a b l e s4 B = 0 . 9 ;

5 H = 0. 25 ;

6 a lp ha = 1 .1 ;

7 g = 9. 81 ;

8

9 / / C a l c u l a t i o n s10 Q = 1 . 8 4 * B * H ^ ( 3 / 2 ) ;

11 disp (Q , ”Q : ” ) ;

12

13 i = 1;14 while ( i < = 3)

15 v = Q / (1 .2 * ( H +0. 2) ) ;

16 disp (v , ”V(m/ s ) : ” ) ;

17 k = ( (1 + a lp ha * v ^2 /( 2* g * H) ) ^1 .5 -( a lp ha * v

42

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 44/114

^ 2 /( 2 * g * H ) ) ^ 1. 5 ) ;

18 Q = k * 1 . 8 4 * B * H ^ ( 3 / 2 ) ;19 disp (Q , ”Q(m3/ s ) : ” ) ;

20 i = i + 1 ;

21 end

Scilab code Exa 6.8 THE POWER OF A STREAM OF FLUID

1 clc ; funcprot ( 0 ) ; // E xample 6 . 8

23 // I n i t i a l i z i n g t he v a r i a b l e s4 r ho = 1 00 0;

5 v = 66 ;

6 Q = 0. 13 ;

7 g = 9. 81 ;

8 z = 24 0;

9

10 / / C a l c u l a t i o n s11 P _J et = 0 .5 * rh o* v ^2 *Q ;

12 P _S u pp = r ho * g * Q* z ;

13 P _L os t = P _S up p - P _J et ;14 h = P _L os t / ( rh o * g* Q ) ;

15 e ff = P _J et / P _ Su p p ;

16

17 disp ( e f f * 1 0 0 , ” P a rt ( d ) E f f i c i e n c y (%) : ” , h , ” Part (C)head u se d t o o ver co me l o s s e s (m) : ” , P _ Su p p / 1 0 00

, ” P ar t ( b ) power s u p p l i e d fro m t he r e s e r v o i r (kW): ” , P _J et / 1 00 0 , ” P a r t I ( a ) p ow er o f t h e j e t (kW) ” ) ;

Scilab code Exa 6.9 VORTEX MOTION

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 92

43

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 45/114

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 r1 = 0. 2;5 Z 1 = 0 .5 00 ;

6 Z 2 = 0 .3 40 ;

7 g = 9. 81 ;

8 r ho = 0 .9 *1 00 0 ;

9

10 / / C a l c u l a t i o n s11 r0 = r1 *( sqrt ( 2 - 2 * Z 2 / Z 1 ) ) ;

12 o me ga = sqrt ( 2 * g * Z 1 / r 0 ^ 2 ) ;

13

14 function [ o u t ] = G ( r )

15 o ut = r ^3 - r * r0 ^ 2;16 e n d f u n c t i o n

17

18 F = r ho * o m eg a ^ 2* % p i *intg ( r 0 , r 1 , G ) ;

19

20 disp (F , ” P a rt ( b ) Upward f o r c e on t h e c o v e r (N) : ” ,

o me ga , ” P ar t ( a ) S peed o f r o t a t i o n ( r ad / s ) : ” ) ;

Scilab code Exa 6.10 Free vortex or potential vortex

1 clc ; funcprot ( 0 ) ; / / E xa mp le 6 . 1 02

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Ra = 0. 2;

5 Rb = 0. 1;

6 H = 0. 18 ;

7 Z a = 0 .1 25 ;

8

9 / / C a l c u l a t i o n s10 Y = Ra ^2*( H- Za );

11 Z b = H - Y / R b ^ 2 ;

12

13 disp ( Z b * 1 0 0 0 , ” H e ig ht a bo ve datum o f a p o i n t B o n t he

44

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 46/114

f r e e s u r f a c e a t a r a d i u s o f 1 00 mm (mm) : ” ) ;

45

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 47/114

Chapter 7

Two dimensional Ideal Flow

Scilab code Exa 7.2 STRAIGHT LINE FLOWS AND THEIR COMBI-NATIONS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 7 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 x = 1 2 0* (2 * % pi ) / 1 80 ; //T he t a5 r = 1;

6 v0 = 0. 5;7 q = 2;

8

9 / / C a l c u l a t i o n s10 function [ y ] = s h i ( r , t he t a )

11 y = v0 *r *sin ( t h e ta ) + q * t h e ta / ( 2* % p i ) ;

12 e n d f u n c t i o n

13

14

15 //−−Approx d i f f e r e n t i a t i o n a t a p oi nt u si ng c e n t r a l

d i f f e r e n c e f o rm ul a−−//16 h = 0 . 0 0 0 0 0 0 1 ;

17 a t _ t h e t a = x ;

18 at_r = r ;

19 V r = ( s h i ( r , a t _t h e ta + h ) - s h i ( r , a t _t h et a - h ) ) / ( r * 2* h ) ;

46

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 48/114

20 V th = ( s h i ( r + h , a t _t h e ta ) - s h i ( r - h , a t _ th e t a ) ) / ( 2* h ) ;

21 V = sqrt ( V r ^ 2 + V t h ^ 2 ) ;22 alpha = atand ( abs ( V t h / V r ) ) ;

23 b et = x * 1 80 / (2 * % pi ) - a lp ha ;

24 disp ( b e t , ”Be t a ( De gr e e ) : ” , a l p h a , ” A l p ha ( D e g r e e ) : ” ,

V , ” F l u i d V e l o c i t y (m/ s ) : ” ) ;

Scilab code Exa 7.3 COMBINED SOURCE AND SINK FLOWS DOU-BLET

1 clc ; funcprot ( 0 ) ; / / E xa mp le 7 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 q = 10;

5 function [ Z ] = s hi ( x ,y )

6 Z = ( q /2 / %p i) *( atan ( y / ( x - 1 ) ) -atan ( y /( x + 1) ) ) -

2 5 * y ;

7 e n d f u n c t i o n

8 h = 0 .0 00 00 01 ;

9 V in f = 2 5;

1011 / / C a l c u l a t i o n s12 x = poly (0 , ’ x ’ ) ;

13 f = x ^2 - 2 /( 5* % pi ) -1;

14 r oo t = roots ( f ) ;

15 l = abs ( r o o t ( 1 ) ) + abs ( r o o t ( 2 ) ) ;

16 Y ma x = 0 .0 47 ;

17 w id th = 2 * Ym ax ;

18 V x = ( s h i (1 - h , 1 ) - s h i (1 - h , 1 - h ) ) / h ; / / At x=1 t h ef u n c t i o n a t a n i s no t d e f i n e d h e n c e t ak i n g x a

l i t t l e s m a l l e r .19 V y = - 1* ( s hi ( 1 - 2 * h , 1 ) - s hi ( 1 - h , 1 ) ) / h ; / / At x=1 t h ef u n c t i o n a t a n i s no t d e f i n e d h e n c e t ak i n g x al i t t l e s m a l l e r .

20

47

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 49/114

21 V = sqrt ( V x ^ 2 + V y ^ 2 ) ;

22 rho = poly (0 , ’ rho ’ ) ;23 dP = rh o /2 *( V ^2 - V inf ^ 2) ; // d i f f e r e n c e i n p r e s s u r e24

25 disp ( d P , ’ P r e s s u r e D i f f e r e n c e (N/m2 ) : ’ ,V , ’ V e l o c i t y(m/ s ) : ’ , l , ’ L en gt h o f R an ki ne Body (m ) : ’ , w id th

, ’ W i dth o f R a n k in e Body (m) : ’ ) ;

Scilab code Exa 7.4 FLOW PAST A CYLINDER

1 funcprot ( 0 ) ; clc ; / / E xa mp le 7 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s4 a = 0. 02 ;

5 r = 0. 05 ;

6 V0 = 1;

7 x = 1 3 5 ; / / T h et a8 function [ Z ] = s hi ( r ,x )

9 Z = V0 * s in d (x ) *( r - (( a ^2 ) /r ) );

10 e n d f u n c t i o n

11 h = 0 .0 00 1;12

13 / / C a l c u l a t i o n s14 V r = 5 7 *( s h i ( r , x + h ) - s hi ( r , x ) ) / ( r * h );

15 V x = - 1* ( s hi ( r + h , x ) - s hi ( r , x ) ) / h ;

16

17 disp ( V r , ’ R a d i a l V e l o c i t y (m/ s ) : ’ , V x , ’Normalc om po ne nt o f v e l o c i t y (m/ s ) : ’ ) ;

Scilab code Exa 7.5 CURVED FLOWS AND THEIR COMBINATIONS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 7 . 52

48

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 50/114

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 r ho = 1 00 0;5 r = 2;

6 psi = 2* log ( r ) ;

7

8 / / C a l c u l a t i o n s9 y = p s i / log ( r ) ; // y = GammaC / 2∗ p i

10 v = y / r ;

11 d Pb y dr = r ho * v ^ 2/ r ;

12 disp ( d P b y d r , ’ P r e s s u e r G r a d ie n t (N/m3 ) : ’ ) ;

49

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 51/114

Chapter 8

Dimensional Analysis

Scilab code Exa 8.1 CONVERSION BETWEEN SYSTEMS OF UNITSINCLUDING THE TREATMENT OF DIMENSIONAL CONSTANTS

1 clc ; funcprot (0) / / E xa mp le 8 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 P 1 = 5 7 ; / / Power i n S I5 M = 1 /1 4. 6; // R at io o f mass i n S I /

B r i t i s h6 L = 1 /0 .3 04 8; // R at io o f l e ng t h i n SI /

B r i t i s h7 T = 1; // R at io o f t im e i n S I / B r i t i s h8

9 / / C a l c u l a t i o n s10

11 P 2 = M *( L ^2 ) *( T ^ -3 )* P1 ; //P owe r i n kW12 P 2 / P 1 ;

13

14 disp ( P 2 / P 1 , ” C o n v er s i on F a ct o r : ” , P 2 , ’ P o wer ( Kw) : ’) ;

50

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 52/114

Chapter 9

Similarity

Scilab code Exa 9.1 MODEL STUDIES FOR FLOWS WITHOUT A FREESURFACE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 9 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 V p = 1 0 ;

5 L pB yL m = 2 0;

6 r h oP b yR h oM = 1 ;7 m uP by mu M = 1;

8 / / C a l c u l a t i o n s9 V m = V p * L p By L m * r h o P b yR h o M * m u P b ym u M ;

10

11 disp ( V m , ’ Mean w at er t u n n e l f l o w v e l o c i t y (m/ s ) : ’ ) ;

Scilab code Exa 9.2 MODEL STUDIES FOR FLOWS WITHOUT A FREE

SURFACE

1 funcprot ( 0 ) ; clc ; / / E xa mp le 9 . 22

51

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 53/114

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 Vp = 3;5 L pB yL m = 3 0;

6 r h oP b yR h oM = 1 ;

7 m uP by mu M = 1;

8

9 / / C a l c u l a t i o n s10 V m = V p * L p By L m * r h o P b yR h o M * m u P b ym u M ;

11

12 disp ( V m , ’ Mean w at er t u n n e l f l o w v e l o c i t y (m/ s ) : ’ ) ;

Scilab code Exa 9.3 ZONE OF DEPENDENCE OF MACH NUMBER

1 funcprot ( 0 ) ; clc ; / / E xa mp le 9 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Vp = 10 0;

5 cP = 34 0;

6 cM = 29 5;

7 r ho M = 7 .7 ;

8 r ho P = 1 .2 ;9 m uM = 1 .8 *1 0^ - 5 ;

10 m uP = 1 .2 *1 0^ - 5 ;

11

12 / / C a l c u l a t i o n s13 V m = V p *( c M / cP ) ;

14 L m B yL p = 1 / (( V m / V p ) * ( m uM / m u P ) * ( r h oM / r h o P ) ) ;

15 F m B yF p = ( r h oM / r h o P ) * ( V m / Vp ) ^ 2 * ( L m B yL p ) ^ 2 ;

16

17 disp ( F m B y F p * 1 0 0 , ” P e rc en ta ge r a t i o o f f o r c e s (%) : ” ,

Vm , ’ Mean wind t u n n e l f l o w v e l o c i t y (m/ s ) : ’ ) ;

Scilab code Exa 9.4 SIGNIFICANCE OF THE PRESSURE COEFFICIENT

52

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 54/114

1 funcprot ( 0 ) ; clc ; / / E xa mp le 9 . 4

23 // I n i t i a l i z i n g t he v a r i a b l e s4 function [ Z ] = p L o s s Ra t i o ( R a tR h o , R a t Mu , R a t L )

5 Z = R a t Rh o * R a t M u ^ 2* R a t L ^ 2 ;

6 e n d f u n c t i o n

7

8 / / C a l c u l a t i o n s9 // Case ( a ) : w a te r i s u s e d

10 R at Rh o = 1;

11 R at Mu = 1;

12 R at L = 1 0;

13 disp ( p L o s s R a t i o ( R a t R h o , R a t M u , R a t L ) , ” ( a ) R at io o f  p r e s s ur e l o s s e s be t we en t he model and t hep r o t o t y pe i f w a te r i s u se d ” ) ;

14

15 R at R ho = 1 0 00 / 1. 2 3;

16 R a tM u = 1 . 8* 1 0^ - 5 /1 0 ^ - 3 ;

17

18 disp ( p L o s s R a t i o ( R a t R h o , R a t M u , R a t L ) , ” ( b ) R a ti o o f  p r e s s ur e l o s s e s be t we en t he model and t hep ro to ty pe i f a i r i s u s e d ” ) ;

Scilab code Exa 9.5 MODEL STUDIES IN CASES INVOLVING FREESURFACE FLOW

1 funcprot ( 0 ) ; clc ; / / E xa mp le 9 . 52

3 // I n i t i a l i z i n g t he v a r i a b l e s4 s ca le = 1 /5 0;

5 r a tA r ea = s ca le ^ 2 ;6 Qp = 1 20 0;

7

8 / / C a l c u l a t i o n s9 L mB y Lp = sqrt ( r a t A r e a ) ;

53

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 55/114

10 V mB y Vp = sqrt ( L m B y L p ) ;

11 Q m = Q p * ra tA r ea * V m B yV p ;12

13 disp ( Q m , ” Water f l o w r a t e ( m3/ s ) : ” ) ;

Scilab code Exa 9.6 SIMILARITY APPLIED TO ROTODYNAMIC MA-CHINES

1 funcprot ( 0 ) ; clc ; / / E xa mp le 9 . 6

23 // I n i t i a l i z i n g t he v a r i a b l e s4 Qa = 2;

5 Na = 1 40 0;

6 r ho A = 0 .9 2;

7 r ho S = 1 .3 ;

8 D aB yD s = 1;

9 d Pa = 2 00 ;

10

11 / / C a l c u l a t i o n s12 N s = N a * ( r ho A / r h oS ) * ( D a B y Ds ) ;

13 Q s = Q a *( N s / Na ) ;14 d Ps = d Pa * ( r h oS / r h o A ) * ( N s / Na ) ^ 2 * ( 1/ D a By D s ) ^ 2 ;

15

16 disp ( d P s ,” P r e s s u r e r i s e (N/m2 ) : ” , Q s , ” Flow r a t e (m3/ s ) : ”, N s , ” Fan t e s t s p e ed ( r e v / s ) : ” ) ;

Scilab code Exa 9.8 RIVER AND HARBOUR MODELS

1 funcprot ( 0 ) ; clc ; / / E xa mp le 9 . 82

3 // I n i t i a l i z i n g t he v a r i a b l e s4 V = 300 ; / / Vo lume r a t e5 w = 3;

54

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 56/114

6 d = 65;

7 l = 30;8 s ca l eH = 3 0 /1 0 00 / 18 ;

9 s ca l eV = 1 /6 0;

10 Z mB y Zr = 1 /6 0;

11 L mB y Lr = 1 /6 00 ;

12 r ho = 1 00 0;

13 m u = 1 .1 4* 10 ^ - 3 ;

14

15 / / C a l c u l a t i o n s16 V r = V /( w *d ) ;

17 V m = Vr * sqrt ( Z m B y Z r ) ;

18 m = ( w * d* s c al eH * s c a le V ) /( d * s ca le H + 2 * w* s c al eV ) ;19 R em = r ho * V m *m / mu ;

20 T mB y Tr = L mB yL r * sqrt ( 1 / Z m B y Z r ) ;

21 T m = 1 2. 4 *6 0 * T m By Tr ;

22

23 disp ( T m , ” T i d a l P e r i o d ( m i n u t es ) : ” ) ;

55

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 57/114

Chapter 10

Laminar and Turbulent Flows

in Bounded Systems

Scilab code Exa 10.1 INCOMPRESSIBLE STEADY AND UNIFORM LAM-INAR FLOW BETWEEN PARALLEL PLATES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 0 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 mu = 0. 9;

5 r ho = 1 26 0;

6 g = 9. 81 ;

7 x = 45; // t h e ta i n d e g r e es8 P1 = 250 * 10^3;

9 P2 = 80 * 1 0^ 3;

10 Z1 = 1;

11 Z2 = 0; // datum12 U = -1.5;

13 Y = 0. 01 ;

1415 / / C a l c u l a t i o n s16 g ra d P1 = P 1 + r ho * g * Z1 ;

17 g ra d P2 = P 2 + r ho * g * Z2 ;

18 D P s ta r = ( g r ad P1 - g r a d P2 ) * s i nd ( x ) / ( Z1 - Z 2 ) ;

56

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 58/114

19 A = U / Y ; // C o e f f i c i e n t U/Y f o r e qu a ti o n 1 0 . 6

20 B = D Ps ta r / ( 2* m u ) ; // C o e f f i c i e n t dp∗/ d x X( 1 / 2 mu ) f o re q ua t i on 1 0 . 621 y = poly (0 , ’ y ’ ) ;

22 v = ( A + B * Y ) * y - B * y ^ 2 ;

23 d uB Y dy = derivat ( v ) ;

24 t au = 0 .9 * d u BY dy ;

25 y ma x = roots ( d u B Y d y ) ; // v a l u e o f y w he red e r i v a t i v e v a n i s h e s . ;

26 u ma x = ( A + B * Y) * ym ax + B * ym ax ^ 2; // Check t h e v a l u et h e r e i s s l i g h t m is ta ke i n b o o k s an sw e r

27 function [ z ] = u ( y )

28 z = ( A + B *Y )* y -B *y ^2;29 e n d f u n c t i o n

30 t au M ax = abs ( mu * d e r i v a t i v e ( u , Y ) ) ;

31 ymax

32 disp ( t a u M a x / 1 0 0 0 , ”Maximum She ar S t r e s s ( kN /m2) : ” ,

u m a x , ”Maximum F low V e l o c i t y (m/ s ) ” , t a u , ” S h e a rD i s t r i b u t i o n : ” , v , ” V e l oc i t y D i s t r i b u t i o n : ” )

Scilab code Exa 10.2 INCOMPRESSIBLE STEADY AND UNIFORM LAM-INAR FLOW IN CIRCULAR CROSS SECTION PIPES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 0 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 mu = 0. 9;

5 r ho = 1 26 0;

6 d = 0. 01 ;

7 Q = 1 .8 / 60 *1 0 ^ - 3; / / Flow i n mˆ 3 p e r s e c o nd

8 l = 6 . 5 ;9 R eC r it = 2 00 0;

10 / / C a l c u l a t i o n s11 A = ( % pi * d ^ 2) / 4 ;

12 M ea nV el = Q / A;

57

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 59/114

13 R e = r ho * M e an Ve l * d / mu ; / / C heck p r o p e r l y t h e a ns we r

i n book t h e r e i s s om et hi ng wrong14 D p = 1 2 8* m u * l * Q / ( % pi * d ^ 4 )

15 Q c ri t = Q * R e C r it / R e * 1 0 ^ 3;

16 disp ( Q c r i t , ”Maximum Flow r a t e ( l i t r e s /s ) : ” , D p / 10 00

, ” P r e s s u r e L o s s (N/m2 ) : ” ) ;

Scilab code Exa 10.3 INCOMPRESSIBLE STEADY AND UNIFORM TUR-BULENT FLOW IN CIRCULAR CROSS SECTION PIPES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 0 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 m u = 1 .1 4* 10 ^ - 3 ;

5 r ho = 1 00 0;

6 d = 0. 04 ;

7 Q = 4 *1 0^ - 3 / 60 ; / / Flow i n mˆ3 p e r s e co n d8 l = 7 5 0 ;

9 R eC r it = 2 00 0;

10 g = 9. 81 ;

11 k = 0 .0 00 08 ; / / A b s o l u te R ou gh ne ss12

13 / / C a l c u l a t i o n s14 A = ( % pi * d ^ 2) / 4 ;

15 M ea nV el = Q / A;

16 R e = r ho * M e an Ve l * d / mu ;

17 D p = 1 28 * mu * l * Q /( % pi * d ^ 4) ;

18 h L = D p /( r ho * g );

19 f = 16/ Re ;

20 h l Da = 4 * f * l * M e an V e l ^ 2 / (2 * d * g ) ; / / By D ar cy E q u a t io n

21 P a = r ho * g * h lD a * Q ;22

23 / / P a r t ( b )24 Q = 3 0* 10 ^ - 3 /6 0; // Flow i n mˆ 3 p e r s e co n d25 M ea nV el = Q / A;

58

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 60/114

26 R e = r ho * M e an Ve l * d / mu ;

27 RR = k /d ; // r e l a t i v e r ou gh ne ss28 f = 0.008 ; / / by Moody d ia gr am f o r Re = 1 . 4 x 1 0ˆ 4and r e l a t i v e r ou gh ne ss = 0 . 00 2

29 h l Db = 4 * f * l * M e an V e l ^ 2 / (2 * d * g ) ; / / By D ar cy E q u a t io n30 P b = r ho * g * h lD b * Q ;

31 disp ( P b , ” P ow er R e q u i r e d (W) : ” , hl Db , ”Head Los s (m): ” ,”!−−−− Case (b ) −−−−!” , P a , ”Power Re qu ir ed (W)

: ” , h lD a * 10 00 , ”Head Lo ss (mm) : ” , ”!−−−− Case ( a )−−−−!” ) ;

Scilab code Exa 10.4 STEADY AND UNIFORM TURBULENT FLOWIN OPEN CHANNELS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 0 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s4 w = 4 . 5 ;

5 d = 1.2 ;

6 C = 49;

7 i = 1 /8 00 ;8

9 / / C a l c u l a t i o n s10 A = d * w ;

11 P = 2* d + w ;

12 m = A / P ;

13 v = C * sqrt ( m * i ) ;

14 Q = v * A ;

15

16 disp (Q , ” D i s c h a r g e ( m3/ s ) : ” ,v , ” Mean V e l o c i t y (m/ s ) : ”

) ;

59

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 61/114

Scilab code Exa 10.5 VELOCITY DISTRIBUTION IN TURBULENT FULLY

DEVELOPED PIPE FLOW

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 0 . 52

3 // I n i t i a l i z i n g t he v a r i a b l e s4 R = poly (0 , ’R ’ ) ;

5

6 / / C a l c u l a t i o n s7 r = R *( 1 - ( 49 /6 0) ^ 7) ;

8

9 disp (r , ” Ra di u s a t w hich t h e a c t u a l v e l o c i t y i s e qu al

t o t he mean v e l o c i t y : ” ) ;

Scilab code Exa 10.7 SEPARATION LOSSES IN PIPE FLOW

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 0 . 72

3 // I n i t i a l i z i n g t he v a r i a b l e s4 d 1 = 0 .1 40 ;

5 d 2 = 0 .2 50 ;6 D p F_ D pR = 0 .6 ; // D i f f e r e n c e i n head l o s s when i n

f o rw a rd and i n r e v e r s e d i r e c t i o n7 K = 0.33 ; / / From t a b l e8 g = 9. 81 ;

9 / / C a l c u l a t i o n s10 r at A = ( d 1 / d2 ) ^ 2;

11

12 v = sqrt ( D p F_ Dp R * 2* g / ( (1 - r at A ) ^2 - K ) ) ;

13

14 disp (v , ” V e l o c i t y (m/ s ) : ” ) ;

60

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 62/114

Chapter 11

Boundary Layer

Scilab code Exa 11.1 PROPERTIES OF THE LAMINAR BOUNDARYLAYER FORMED OVER A FLAT PLATE IN THE ABSENCE OF APRESSURE GRADIENT IN THE FLOW DIRECTION

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 1 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 r ho = 8 60 ;

5 v = 10^ - 5;6 Us = 3;

7 b = 1. 25 ;

8 l = 2;

9

10 / / C a l c u l a t i o n s11 x = 1; / / A t x = 112 R ex = Us * x/ v ;

13 ReL = Us * l/ v ;

14 mu = rho *v ;

15 T 0 = 0 . 3 32 * m u * U s / x * R ex ^ 0 . 5 ;16 C f = 1 .3 3* R e L ^ - 0. 5;

17 F = r ho * Us ^ 2* l * b* Cf ;

18

19 disp (F , ” T o ta l , d o ub l e−s i d e d r e s i s t a n c e o f t h e p l a t e

61

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 63/114

(N) : ” , T 0 , ” S he ar s t r e s s a t mid−le ng th (N/m2) ” ) ;

Scilab code Exa 11.2 PROPERTIES OF THE TURBULENT BOUND-ARY LAYER OVER A FLAT PLATE IN THE ABSENCE OF A PRES-SURE GRADIENT IN THE FLOW DIRECTION

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 1 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 Us = 6;5 b = 3;

6 l = 30;

7 r ho = 1 00 0;

8 mu = 10 ^ -3;

9 T = 2 0+ 27 3; / / T em p er at ur e i n K e l v i n10

11 / / C a l c u l a t i o n s12 1 / m u ;

13 R eL = r ho * U s *l / mu ;

14 C f = 0 .4 55 * log10 ( ReL ) ^ -2.58 ;

1516 F = r ho * Us ^ 2* l * b* Cf ;

17 L t = 1 0^ 5* m u / ( rh o * Us ) ; // Assuming t r a n s i t i o n a t Re l= 1 0 ˆ 5

18 disp ( L t , ” T r a n s i t i o n l e n g t h (m) : ” , F / 1 0 0 0 , ” T o t al d ra gon t h e p l a t e ( kN ) : ” ) ;

62

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 64/114

Chapter 12

Incompressible Flow around a

Body

Scilab code Exa 12.1 DRAG

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 2 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 x = 35 ;

5 T = 50;

6 m = 1;

7 g = 9. 81 ;

8 r ho = 1 .2 ;

9 A = 1 . 2 ;

10 U 0 = 4 0 *1 0 00 / 36 0 0; // V e l oc i t y i n m/ s11

12 / / C a l c u l a t i o n s13 L = T * s in d ( x )+ m * g;

14 D = T * co sd ( x ) ;

15 C l = 2 * L /( r ho * U 0 ^ 2* A ) ;16 C d = 2 * D /( r ho * U 0 ^ 2* A ) ;

17 disp ( C d , ” Drag C o e f f i c i e n t : ” , C l , ” L i f t C o e f f i c i e n t : ”) ;

63

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 65/114

Scilab code Exa 12.2 RESISTANCE OF SHIPS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 2 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 V p = 12 ;

5 l p = 4 0 ;

6 lm = 1;

7 As = 2 50 0;

8 D m = 3 2 ;

9 r ho P = 1 02 5;

10 r ho M = 1 00 0;

11 A p = A s ;

12

13 / / C a l c u l a t i o n s14 A m = As / 40 ^2 ;

15 V m = V p * sqrt ( l m / l p ) ;

16 D fm = 3 .7 * V m ^ 1. 95 * A m ;

17 Rm = Dm - Dfm ;

18 R p = R m * ( r h oP / r h o M ) * ( l p / lm ) ^ 2 * ( V p / Vm ) ^ 2 ;19 D fp = 2 .9 * V p ^ 1. 8* A p ;

20 D p = R p + D f p ;

21

22 disp ( D p / 1 0 0 0 , ” E xp ec t e d t o t a l r e s i s t a n c e ( kN ) : ” ) ;

Scilab code Exa 12.3 FLOW PAST A CYLINDER

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 2 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 U 0 = 8 0 *1 0 00 / 36 0 0;

5 d = 0. 02 ;

64

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 66/114

6 r ho = 1 .2 ;

7 m u = 1 .7 *1 0^ - 5 ;8 A = 0 .0 2* 50 0; // P r o j e c t e d a re a o f w ir e9 N = 20; // No o f c a b l e s

10

11 / / C a l c u l a t i o n s12 R e = r ho * U 0 *d / mu ;

13 Cd = 1. 2; // From f i g u r e 1 2 .1 0 f o r g i ve n Re ;14 D = 0 .5 * r ho * C d *A * U0 ^ 2

15 F = N * D ;

16 f = 0 .1 98 *( U 0 /d ) *( 1 - 19 .7 / Re ) ;

17

18 disp (f , ” F r e q u e n c y ( Hz ) : ” , F / 1 0 0 0 , ” T ot al f o r c e ont ow e r ( kN ) : ” ) ;

Scilab code Exa 12.4 FLOW PAST A SPHERE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 2 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 mu = 0 .0 3;5 d = 10^ - 3;

6 r ho P = 1 . 1* 1 0^ 3 ;

7 g = 9. 81 ;

8 r ho 0 = 0 . 9* 1 0^ 3 ;

9 / / C a l c u l a t i o n s10 B = 1 8* m u /( d ^ 2* r h oP ) ;

11 t = 4. 60 / B;

12 V t = d ^ 2* ( r ho P - r ho 0 ) *g / ( 18 * m u );

13 R e = r ho 0 * Vt * d / mu ;

1415

16 disp ( R e , ” R ey no ld s No c o rr o sp o nd i ng t o t he v e l o c i t y :” ,t , ” Time t ak en by t he p a r t i c l e t ak e t o r ea ch 99p er c en t o f i t s t e r m i n a l v e l o c i t y ( s ) : ” ) ;

65

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 67/114

Scilab code Exa 12.5 FLOW PAST A SPHERE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 2 . 52

3 // I n i t i a l i z i n g t he v a r i a b l e s4 m uO = 0 .0 0 27 ;

5 V t = 3 *1 0^ - 3;

6 r ho W = 1 00 0;

7 r ho P = 2 .4 * r ho W ;8 r ho O = 0 .9 * r ho W ;

9 g = 9. 81 ;

10 m uA = 1 .7 *1 0^ - 5 ;

11 r ho A = 1 .3 ;

12

13 / / C a l c u l a t i o n s14 d = sqrt ( 1 8 * m u O * V t / ( r h o P - r h o O ) / g ) ;

15 R e = V t *d * r ho O / mu O ;

16

17 // Movement o f p a r t i c l e i n upward d i r e c t i o n18 if ( Re < 1 ) then

19 v = 0.5;

20 Re = 5 ; // from f i g 1 2 . 1521 v t = m uA * R e /( r h oA * d ) ;

22 u = vt +v ;

23 disp ( u , ” V e l oc i t y o f a i r s tr ea m b lo wi ngv e r t i c a l l y up (m/ s ) : ” ) ;

24 else

25 disp ( ” s t r o k e s l aw i s n ot v a l i d ” ) ;

26 end

Scilab code Exa 12.6 FLOW PAST AN AEROFOIL OF FINITE LENGTH

66

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 68/114

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 2 . 6

23 // I n i t i a l i z i n g t he v a r i a b l e s4 c = 2;

5 s = 10;

6 r ho = 5 .3 3;

7 r h o_ e ll i p = 1 .2 ;

8 D = 4 0 0 ;

9 L = 4 50 00 ;

10 s ca le = 2 0;

11 U _ wi n dT u nn e l = 5 00 ;

12 U _ p ro t o = 4 0 0 * 10 0 0 / 36 0 0 ;

1314 / / C a l c u l a t i o n s15 A = c * s ;

16 U _ m od e l = U _ w i nd T u n ne l / s c a l e ;

17 C d = D / ( 0 . 5* r h o * U _ m o d el ^ 2* A ) ;

18 C l = L / ( 0 . 5* r h o _e l l ip * U _ p ro t o ^ 2 * A ) ; // C o n si d e ri n ge l l i p t i c a l L i f t model

19 C di = C l ^2 /( % p i *s / c ); // A s p e c t R a ti o = s / c20 Cdt = Cd + Cdi ;

21 D w = 0 . 5* C d t * r h o _ e l li p * U _ p r o to ^ 2 * A ;

22 disp ( D w / 1 0 0 0 ,” T o ta l d ra g on f u l l s i z e d wing ( kN ) : ”) ;

67

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 69/114

Chapter 13

Compressible Flow around a

Body

Scilab code Exa 13.1 EFFECTS OF COMPRESSIBILITY

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 3 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 r ho 0 = 1 .8 ;

5 R = 2 8 7 ;

6 T = 7 5+ 27 3; // T em pe ra tu re i n k e l v i n7 g ma = 1 .4 ;

8 Ma = 0. 7;

9

10 / / C a l c u l a t i o n s11 P 0 = r ho 0 *R * T;

12 c = sqrt ( g m a * R * T ) ;

13 V0 = Ma *c ;

14 P t = ( P 0 ^( ( gm a - 1) / g ma ) + r ho 0 * (( g ma - 1) / g ma ) * ( V0

^ 2 / ( 2 * P 0 ^ ( 1 / g m a ) ) ) ) ^ ( g m a / ( g m a - 1 ) ) ;15 r ho T = r ho 0 * ( Pt / P 0 ) ^( 1/ g m a );

16 T t = Pt / (R * rh oT ) - 27 3;

17

18 disp ( r h o T , ” D e n s i ty o f a i r s t r e a m ( k g /M3) : ” , T t , ”

68

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 70/114

T e m p er a t u re ( D e g r e e ) : ” , P t /1 00 0 , ” S t a g a n a t i o n

P r e s s u r e ( kN/m2 ) : ” ) ;

Scilab code Exa 13.2 SHOCK WAVES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 3 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 R = 2 8 7 ;

5 T = 2 8+ 27 3;6 g ma = 1 .4 ;

7 P = 1 .0 2* 10 ^5 ;

8 r ho Hg = 1 3 .6 * 10 ^ 3;

9 g = 9. 81 ;

10

11 / / C a l c u l a t i o n s12 / / C a s e ( a )13 U 0 = 5 0 ;

14 c = sqrt ( g m a * R * T ) ;

15 Ma = U0 /c ;

16 r ho = P /( R *T ) ;17 D el P = 0 .5 * r ho * U 0 ^2 ; //Pt−P18 h a = D el P /( r h oH g * g );

19

20 //C ase ( b )21 U0 = 25 0;

22 Ma = U0 /c ;

23 P t = P * ( 1 +( g m a - 1 ) * M a ^ 2 /2 ) ^ ( g m a / ( gm a - 1 ) ) ;

24 De lP = Pt - P

25 h b = D el P /( r h oH g * g );

2627 //C ase ( c )28 U0 = 42 0;

29 M a1 = U 0 /c ;

30 P 2 = P * ( (2 * g ma / ( g ma + 1 ) )* M a1 ^ 2 - ( ( gm a - 1) / ( g ma + 1 ) ) );

69

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 71/114

31 N = M a1 ^ 2 + 2/ ( gma - 1) ; / / N u me r at o r

32 D = 2 * gm a * Ma 1 ^ 2/ ( gma - 1) -1 ;33 Ma2 = sqrt ( N / D ) ;

34 P t2 = P 2 * ( 1+ ( g ma - 1) * M a 2 ^ 2 / 2) ^ ( g m a / ( g ma - 1) ) ;

35 h c = ( Pt 2 - P 2 ) /( r h oH g * g ) ;

36

37 disp ( h c * 1 0 0 0 , ” D i f f e r e n c e i n h e i g ht o f m erc ury columni n c a s e ( c ) i n mm : ” , h b * 1 0 0 0 , ” D i f f e r e n c e i n

h e i g h t o f m er cu ry column i n c a s e ( b ) i n mm : ” , ha

* 1 0 0 0 , ” D i f f e r e n c e i n h e i g ht o f m erc ury column i nc a s e ( a ) i n mm : ” ) ;

70

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 72/114

Chapter 14

Steady Incompressible Flow in

Pipe and Duct Systems

Scilab code Exa 14.1 INCOMPRESSIBLE FLOW THROUGH DUCTSAND PIPES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 L1 = 5;

5 L 2 = 1 0 ;

6 d = 0 . 1 ;

7 f = 0. 08 ;

8 Z a_ Zc = 4; // d i f f e r e n c e i n h e ig h t bet w ee n Aa n d C

9 g = 9.81 ;

10 P a = 0 ;

11 V a = 0 ;

12 Z a_ Zb = - 1. 5;

13 V = 1. 26 ;14 r ho = 1 00 0;

15

16 / / C a l c u l a t i o n s17 D = 1.5 + 4* f *( L1 + L2 )/ d ; // D en omi na to r i n c a s e o f  

71

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 73/114

v ˆ2

18 v = sqrt ( 2 * g * Z a _ Z c / D ) ;19 P b = r ho * g * Z a_ Zb - r ho * V ^ 2 / 2* ( 1. 5 +4 * f * L1 / d ) ;

20 disp ( P b / 1 0 0 0 , ” P r e s s u r e i n t h e p a r t a t B ( kN/m2 ) : ” ,v ,

” Mean V e l o c i t y a t C (m/ s ) : ” ) ;

Scilab code Exa 14.3 INCOMPRESSIBLE FLOW THROUGH PIPES INPARALLEL

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Z a_ Zb = 1 0;

5 f = 0 .0 08 ;

6 L = 1 0 0 ;

7 d1 = 0 .0 5;

8 g = 9. 81 ;

9 d2 = 0. 1;

10 / / C a l c u l a t i o n s11 function [ z ] = f l ow R at e ( d )

12 D = 1 . 5 + 4 * f * L / d ; // Den om ina to r i n c a s e o f  v 1ˆ2

13 A = % pi * d ^2 /4 ;

14 v = sqrt ( 2 * g * Z a _ Z b / D ) ;

15 z = A * v ;

16 e n d f u n c t i o n

17

18 Q 1 = f lo w Ra t e ( d1 ) ;

19 Q 2 = f lo w Ra t e ( d2 ) ;

20

21 Q = Q 1 + Q 2 ;22 D = poly (0 , ’D ’ ) ;

23 v = 4 * Q /( % pi * D ^ 2) ;

24 X = 1.5 + 4* f* L/ D;

25 f = 10*2* g /( X* v^2) - 1 ;

72

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 74/114

26 f = numer ( f ) ;

27 d i am et e r = roots ( f ) ; // Tak in g r o o t s o f n um er at ord en om in at or w i l l be m u l t i p l i e d by z e r o28 i = 1;

29 while ( i < = length ( d i a m e t e r ) )

30 x = d i am e te r ( i ) ;

31 if ( imag ( x) == 0) then

32 d ia = d i am e te r ( i );

33 i = i + 1;

34 else

35 i = i + 1 ;

36 end

37 end38

39 disp ( d i a * 1 0 0 0 , ” D ia me ter o f s i n g l e e q u i v a l e n t p i pe (mm) : ” , Q 2 , ” F lo w t h r o u g h t p i p e 2 ( m3/ s ) : ” , Q 1 , ”Fl ow t h r o u g h t p i p e 1 ( m3/ s ) : ” ) ;

Scilab code Exa 14.4 INCOMPRESSIBLE FLOW THROUGH BRANCH-ING PIPES THE THREE RESERVOIR PROBLEM

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Z a_ Zb = 1 6;

5 Z a_ Zc = 2 4;

6 f = 0. 01 ;

7 l1 = 12 0;

8 l 2 = 6 0 ;

9 l 3 = 4 0 ;

10 d1 = 0 .1 2;11 d 2 = 0 .0 75 ;

12 d 3 = 0 .0 60 ;

13 g = 9. 81 ;

14 / / C a l c u l a t i o n s

73

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 75/114

15

16 A = [ % pi * d 1 ^ 2/ 4 % pi * d 2 ^ 2/ 4 % pi * d 3 ^ 2/ 4]17 function [ z ] = C oe ff ( l , d )

18 z = 4 * f* l /( d * 2* g ) ;

19 e n d f u n c t i o n

20

21 function [ f ] = F ( x )

22 f ( 1) = C oe ff ( l1 , d 1 ) * x (1 ) ^2 + C oe ff ( l2 , d 2 ) *x ( 2) ^ 2

- Z a_ Zb ;

23 f ( 2) = C oe ff ( l1 , d 1 ) * x (1 ) ^2 + C oe ff ( l3 , d 3 ) *x ( 3) ^ 2

- Z a_ Zc ; ;

24 f (3 ) = x ( 1) * d1 ^ 2 - x ( 2) * d2 ^ 2 - x ( 3) * d3 ^ 2; // Q1=

Q225 e n d f u n c t i o n

26

27 function [ j ] = j ac ob ( x )

28 j ( 1 ,1 ) = 2 * C oe ff ( l1 , d 1 ) * x (1 ) ; j ( 1 ,2 ) = 2 * C oe ff (

l2 , d 2 ) * x (2 ) ; j (1 , 3) = 0 ;

29 j ( 2 ,1 ) = 2 * C oe ff ( l1 , d 1 ) * x (1 ) ; j ( 2 ,2 ) = 0 ; j (2 , 3)

= 2 * C o ef f ( l3 , d 3 ) * x ( 3 ) ;

30 j (3 , 1) = d1 ^ 2; j (3 , 2) = - d2 ^ 2; j (3 , 3) = - d3 ^ 2;

31 e n d f u n c t i o n

32

33 x = [1.8 0 0];

34 v = fsolve ( x , F , j ac ob , 1 0 ^ - 20 ) ;

35 disp ( v ( 3 ) * A ( 3 ) ,” Flow r a t e i n p i p e 3 ( m3/ s ) : ” , v ( 2 ) * A

( 2 ) , ” Flow r a t e i n p i p e 2 ( m3/ s ) : ” , v ( 1 ) * A ( 1 ) , ”Flowr a t e i n p ip e 1 (m3/ s ) : ” ) ;

Scilab code Exa 14.5 INCOMPRESSIBLE STEADY FLOW IN DUCT

NETWORKS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 52

3 // I n i t i a l i z i n g t he v a r i a b l e s

74

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 76/114

4 D = 0 . 3 ;

5 Q = 0 . 8 ;6 r ho = 1 .2 ;

7 f = 0 .0 08 ;

8 L _e nt ry = 1 0;

9 L _e xi t = 3 0;

10 Lt = 20 *D ; // T r a n s i t i o n may be r e p r e s e n t e d by as e p ar at i o n l o s s e q u i v al e n t l e n g t h o f 20 t h ea p pr o ac h d u ct d i a m e t e r

11 K _e nt ry = 4;

12 K _e xi t = 10

13 l = 0 . 4 ; // l e n gt h o f c r o s s s e c t i o n

14 b = 0 . 2 ; // w idt h o f c r o s s s e c t i o n15

16 / / C a l c u l a t i o n s17 A = % pi * D ^2 /4 ;

18 D p1 = 0 .5 * r ho * Q ^ 2/ A ^ 2* ( K _ en t ry + 4 * f *( L _ e nt ry + L t ) /D )

;

19 ar ea = l *b ;

20 p e r im e t er = 2 *( l + b ) ;

21 m = a re a / p e ri m et e r ;

22 D p2 = 0 .5 * r ho * Q ^ 2/ a r ea ^ 2 *( K _ e xi t + f * L _e x it / m ) ;

23 Dfan = Dp1 + Dp2 ;

24

25 disp ( D f a n , ” f a n P r e s s u r e i n p u t (N/m2 ) : ” ) ;

Scilab code Exa 14.6 INCOMPRESSIBLE STEADY FLOW IN DUCTNETWORKS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 6

23 // I n i t i a l i z i n g t he v a r i a b l e s4 D = [0 .1 5 0 .3 ];

5 r ho = 1 .2 ;

6 f = 0 .0 08 ;

75

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 77/114

7 L _e nt ry = 1 0;

8 L _e xi t = 2 0;9 L t = 2 0* D (2 ) ;// T r a n s i t i o n may be r e p r e s e n t ed by as e p ar at i o n l o s s e q u i v al e n t l e n g t h o f 20 t h ea p pr o ac h d u ct d i a m e t e r

10 K = 4;

11 Q1 = 0. 2;

12

13 / / C a l c u l a t i o n s14 Q2 = 4* Q1 ;

15 A = % pi * D ^2 /4 ;

16 D p1 = 0 .5 * r ho * Q 1 ^2 / A (1 ) ^ 2* ( K + 4 * f* L _ en t ry / D ( 1) ) ;

17 D p2 = 0 .5 * r ho * Q 2 ^2 / A (2 ) ^ 2 *( 4* f * ( L _e x it + L t )/ D ( 2) ) ;18 Dfan = Dp1 + Dp2 ;

19

20 disp ( D f a n , ” f a n P r e s s u r e i n p u t (N/m2 ) : ” ) ;

Scilab code Exa 14.7 RESISTANCE COEFFICIENTS FOR PIPELINESIN SERIES AND IN PARALLEL

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 72

3 // I n i t i a l i z i n g t he v a r i a b l e s4 d = [ 0. 1 0. 12 5 0. 15 0. 1 0.1 ]; / / C o rr o sp o nd i ng t o

AA1B AA2B BC CD CF5 l = [30 30 60 15 30]; //

Co rro sp on di ng to AA1B AA2B BC CD CF6 r ho = 1 .2 ;

7 f = 0 .0 06 ;

8 Ha = 10 0;

9 H f = 6 0 ;10 H e = 4 0 ;

11

12 / / C a l c u l a t i o n s13 for ( i = 1 : length ( d ) )

76

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 78/114

14 K ( i ) = f * l (i ) / (3 * d (i ) ^ 5) ;

15 end16

17 K _a b = K ( 1) * K ( 2) / ( sqrt ( K ( 1 ) ) + sqrt ( K ( 2 ) ) ) ^ 2 ;

18 K_ ac = K_ ab + K (3 );

19 H c = ( K _a c * Hf + K ( 5) * H a /4 ) /( K _ ac + K ( 5) / 4 ) ;

20 Q = sqrt ( ( Ha - H c )/ K _a c ) ;

21

22 function [ z ] = f ( n )

23 z = He - Hc + ( 0. 5* Q ) ^2 *( K (4 ) +( 40 00 / n ) ^2 );

24 e n d f u n c t i o n

25

26 n = fsolve ( 1 , f ) ;27

28 disp (n , ” P e r c e n ta g e v a l v e o p en i ng (%) : ” , H c , ” H ea d a tC (m) : ” , Q , ” t o t a l Volume f l o w r a t e ( m3/ s ) : ” ) ;

Scilab code Exa 14.8 THE QUANTITY BALANCE METHOD FOR PIPENETWORKS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 82

3 // I n i t i a l i z i n g t he v a r i a b l e s4 d = [ 0. 3 0 .2 5 0. 2] ;

5 l = [1 50 0 80 0 40 0] ;

6 f = 0. 01 ;

7 H a = 6 0 ;

8 H b = 3 0 ;

9 H c = 1 5 ;

10 H d = 3 5 ; / / A s s um p t io n

11 H ( 1 ) = H a - H d ;12 H ( 2 ) = H b - H d ;

13 H ( 3 ) = H c - H d ;

14

15 / / C a l c u l a t i o n s

77

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 79/114

16 K = 0;

17 for ( i = 1 : length ( d ) )18 K ( i ) = f * l (i ) / (3 * d (i ) ^ 5) ;

19 end

20 Q su m = 0 .0 01 ;

21 for ( i = 1 : 2 )

22 Q = 0; Q by 2h = 0; Qs = 0; Q by 2h su m = 0;

23 for ( i = 1 : 3 )

24 if ( imag ( sqrt ( H ( i ) / K ( i ) ) ) ~ = 0 ) then

25 Q (i ) = -1* abs ( imag ( sqrt ( H ( i ) / K ( i ) ) ) ) ;

26 else

27 Q (i ) = sqrt ( H ( i ) / K ( i ) ) ;

28 end ,29

30 Q by 2h = Q ( i ) /( 2* H ( i )) ;

31 Qs = Qs + Q( i );

32 Q b y2 h su m = Q b y2 h su m + Q b y2 h

33

34 end

35 d H = Q s / Q by 2 hs u m ;

36 for ( i = 1 : 3 )

37 H ( i ) = H ( i ) + d H ;

38 end

39 Q su m = Qs ;

40 end

41

42 disp ( Q ( 3 ) ,” Q d c ( m3/ s ) : ” , Q ( 2 ) , ” Q db ( m3/ s ) : ” , Q ( 1 ) ,

” Q a d ( m3/ s ) : ” ) ;

Scilab code Exa 14.9 QUASI STEADY FLOW

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 92

3 // I n i t i a l i z i n g t he v a r i a b l e s4 As = 6;

78

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 80/114

5 d = 0. 02 ;

6 f = 0. 01 ;7 L = 1 . 5 ;

8 K = 0 . 9 ;

9 g = 9. 81 ;

10

11 / / C a l c u l a t i o n s12 A p = % pi * d ^ 2/ 4;

13 function [ y ] = Q in v (h )

14 y = sqrt ( ( 4* f * L / d + K + 1 ) / ( 2* g * h ) ) / A p ;

15 e n d f u n c t i o n

16 //By d i r e c t i n t e g r a t i o n

17 t = - A s * intg ( 3 . 5 , 2 . 2 5 , Q i n v ) ; // D i s ch ar ge i s 2 mbe l ow

18 disp (t , ” Time o f d i s c ha r g e by d i r e c t i n t e g r a t i o n ( s ): ” ) ;

19

20 // By n um er i c al i n t e g r a t i o n s21 i n te rv a l = [ 0. 25 0 0 .1 25 0 .0 08 3 0 .0 06 3 0 .0 05 0 . 00 4 2] ;

22 for ( i = 1 : length ( i n t e r v a l ) )

23

24 s t a r t = 3 . 5 ; p i e c e = 3 . 5 : - i n t e r v a l ( i ) : 2 . 2 5 ;

25 X = - A s * i n t e g r a t e (’ Q i nv ( h ) ’

,’ h ’

, s t a r t , p i e c e ) ;

26

27 disp ( X ( length ( X ) ) ,” Val ue o f t ( s ) : ” , i n t e r v a l ( i

) , ” F o r I n t e r v a l (Dh i n m) ” ) ;

28 end

Scilab code Exa 14.12 QUASI STEADY FLOW

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 4 . 1 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 As = 6;

5 A2 = 4. 5;

79

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 81/114

6 d = 0. 02 ;

7 f = 0. 01 ;8 L = 1 . 5 ;

9 K = 0 . 9 ;

10 g = 9. 81 ;

11

12 / / C a l c u l a t i o n s13 A p = % pi * d ^ 2/ 4;

14 C = Ap *sqrt ( 2 * g / ( 4 * f * L / d + K + 1 ) ) ;

15

16 function [ y ] = Q in v (h )

17 y = sqrt ( 1 / h ) / ( C * ( 1 + A s / A 2 ) ) ;

18 e n d f u n c t i o n19

20 //By d i r e c t i n t e g r a t i o n21 t = - A s * intg ( 3 . 0 , 2 . 0 , Q i n v ) ; // D is ch ar ge i s 2 m

be l ow22 disp (t , ” Time o f d i s c ha r g e by d i r e c t i n t e g r a t i o n ( s )

: ” ) ;

23

24 / /By N um er ic a l I n t e g r a t i o n25 i n te rv a l = [ 0. 25 0 0 .1 25 0 .0 08 3 0 .0 06 3 0 .0 05 0 . 00 4 2] ;

26 for ( i = 1 : length ( i n t e r v a l ) )

27

28 s t a r t = 3 . 0 ; p i e c e = 3 . 5 : - i n t e r v a l ( i ) : 2 . 0 ;

29 X = - A s * i n t e g r a t e ( ’ Q i nv ( h ) ’ , ’ h ’ , s t a r t , p i e c e ) ;

30

31 disp ( X ( length ( X ) ) ,” V al ue o f t ( s ) : ” , i n t e r v a l ( i )

, ” F o r I n t e r v a l ( Dh i n m) ” ) ;

32 end

80

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 82/114

Chapter 15

Uniform Flow in Open

Channels

Scilab code Exa 15.1 RESISTANCE FORMULAE FOR STEADY UNI-FORM FLOW IN OPEN CHANNELS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 5 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 B =4;

5 D = 1 . 2 ;

6 C = 7 . 6 ;

7 n = 0 .0 25 ;

8 s = 1 /1 80 0;

9

10 / / C a l c u l a t i o n s11 W = B + 2 *1.5* D;

12 A = D *( B +C ) /2 ; // Area o f p a r a l l e l o g r a m fo rm ed13 P = B +2* 1.2* sqrt ( D ^ 2 + ( 1. 5 D ) ^ 2 ) ;

14 m = A /P ;15 i = s ;

16 C = ( 2 3 + 0. 0 0 1 55 / i + 1 / n ) / ( 1 + ( 2 3 +0 . 0 0 15 5 / i ) * n / sqrt ( m ) ) ;

/ / By K u tt er f o rm u l a17 Q1 = C *A *sqrt ( m * i ) ;

81

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 83/114

18 Q 2 = A * (1 / n ) *m ^ ( 2/ 3) * sqrt ( i ) ;

19 disp ( Q 2 , ”Q u s i n g t h e Ma nn in g f o r m u l a ( m3/ s ) : ” , Q 2 , ”Qu s i n g Chezy f o r mu l a w it h C d e t e rm i ne d f ro m t h eK u tt e r f o r m u l a ( m3/ s ) : ” ) ;

Scilab code Exa 15.2 OPTIMUM SHAPE OF CROSS SECTION FORUNIFORM FLOW IN OPEN CHANNELS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 5 . 2

23 // I n i t i a l i z i n g t he v a r i a b l e s4 Q = 0 . 5 ;

5 C = 80;

6 i = 1 /2 00 0;

7

8 / / C a l c u l a t i o n s9 function [ y ] = f ( D )

10 y = ( 7/ 4) * C * D ^ (5 / 2) * sqrt ( i / 2) - Q ;

11 e n d f u n c t i o n

12 disp ( fsolve ( 2 , f ) , ”Optimum dep th = Optimum Width ( in

me tr es ) : ” ) ;

82

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 84/114

Chapter 16

Non uniform Flow in Open

Channels

Scilab code Exa 16.2 EFFECT OF LATERAL CONTRACTION OF ACHANNEL

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 6 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 B = [ 1. 4 0. 9] ;

5 D = [ 0. 6 0 .3 2] ;

6 g = 9. 81 ;

7 h = 0. 03 ;

8 Z = 0. 25 ;

9

10 / / C a l c u l a t i o n s11 Q 1 = B ( 2) * D (2 ) *sqrt ( 2 * g * h / ( 1 - ( B ( 2 ) * D ( 2 ) / B ( 1 ) * D ( 1 ) )

^ 2 ) )

12 E = D (1 ) -Z ;

13 Q 2 = 1 .7 0 5* B ( 2) * E ^ 1 .5 ;14 disp ( Q2 , ” Volume f l o w r a t e ( m3/ s ) : ” ) ;

83

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 85/114

Scilab code Exa 16.3 CLASSIFICATION OF WATER SURFACE PRO-

FILES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 6 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 a = 0. 5;

5 b = 0 . 5 ;

6 Dn = 1. 2;

7 s = 1 /1 00 0;

8 C = 55;

9 g = 9. 81 ;

1011 / / C a l c u l a t i o n s12 c = ( 1 + a ) / b ;

13 Q by B = D n* C* sqrt ( D n * s ) ;

14 q = QbyB ;

15 D c = ( q ^ 2/ g ) ^ ( 1/ 3 ) ;

16

17 m = 2 . 4: - 0 . 1 5: 1 .3 5 ;

18 total = 0; Dm = 0; N = 0; D = 0; Lm = 0;

19 for ( i = 1 : length ( m ) - 1 )

20

21 D m ( i ) = ( m ( i ) + m ( i +1 ) ) / 2 ;

22 N (i ) = 1 - ( Dc / Dm (i )) ^3 ; / / N u me r at o r23 D (i ) = 1 - ( Dn / Dm ( i) ) ^3 ; / / D e n o mi n a to r24 L m (i ) = 1 50 *( N ( i ) /D ( i )) ;

25 t ot al = t ot al + Lm ( i) ;

26 end

27 res ult = [ Dm N D Lm ];

28 disp ( t o t a l , ” d i s t a n c e u ps tr ea m c o v e re d ( a pp ro x i n m) :” , r e s u l t , ”Mean Depth (Dm) Numerator Denomi naotor

L(m)” ) ;

84

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 86/114

Chapter 17

Compressible Flow in Pipes

Scilab code Exa 17.1 MASS FLOW THROUGH A VENTURI METER

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 7 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 g = 9. 81 ;

5 r ho = 1 00 0;

6 r ho Hg = 1 3. 6* r h o ;

7 d 1 = 0 .0 75 ;8 d 2 = 0 .0 25 ;

9 P i = 0 .2 50 ;

10 P t = 0 .1 50 ;

11 P _H g = 0 .7 60 ;

12 r ho 1 = 1 .6 ;

13 g ma = 1 .4 ;

14

15 / / C a l c u l a t i o n s16 P 1 = ( P i + P_ Hg ) * r h oH g * g ;

17 P 2 = ( P t + P_ Hg ) * r h oH g * g ;18 r h o2 = r h o1 * ( P 2 / P 1 ) ^ ( 1/ g m a ) ;

19

20 function [ f ] = v e lo c it y ( V )

21 f ( 1 ) = d 2 ^ 2* V ( 2 ) * r ho 2 - d 1 ^ 2 * V ( 1 ) * r ho 1 ;

85

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 87/114

22 f ( 2) = 0 .5 *( V ( 2) ^ 2 - V ( 1) ^ 2 ) *( ( gma - 1) / g ma ) * ( r ho 2

* r h o 1 / ( r h o 2 * P 1 - r h o 1 * P 2 ) ) - 1 ;23 e n d f u n c t i o n

24 V = [0 0];

25 V el o = fsolve ( V , v e l o c i t y ) ;

26 F l ow = % pi * d 1 ^ 2 / 4 * V e lo ( 1 ) ;

27 disp ( F l o w , ” V ol um e o f f l o w ( m3/ s ) : ” ) ;

Scilab code Exa 17.2 THE LAVAL NOZZLE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 7 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Ma = 4;

5 g ma = 1 .4 ;

6 At = 50 0; / / i n mm7

8 / / C a l c u l a t i o n s9 N = 1 + ( gma - 1) * Ma ^ 2/ 2;

10 D = ( gm a +1) /2 ;

11 A = A t * ( N / D) ^ ( ( g m a + 1) / ( 2 * ( g ma - 1) ) ) / M a ;12

13 disp (A , ” A rea o f t e s t s e c t i o n (mm2) : ” ) ;

Scilab code Exa 17.3 NORMAL SHOCK WAVE IN A DIFFUSER

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 7 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Ma1 = 2;

5 g ma = 1 .4 ;

6 T 1 = 1 5+ 27 3; // I n k e l v i n7 P1 = 10 5;

86

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 88/114

8

9 / / C a l c u l a t i o n s10 Ma2 = sqrt ( ( ( gm a - 1 ) * M a 1 ^ 2 + 2) / ( 2 * g m a * M a1 ^ 2 - g m a + 1 ) ) ;

11 P 2 = P 1 * ( 1+ g m a * M a 1 ^ 2 ) / (1 + g m a * M a2 ^ 2 ) ;

12 T 2 = T 1 *( 1 + ( gm a - 1) / 2 * Ma 1 ^ 2) / ( 1 + ( gm a - 1) / 2 * M a2 ^ 2 ) ;

13 disp ( T2 - 273 , ” T e m p er a tu r e ( D e g re e C ) o f d ow ns tr ea ms h o c k wa ve : ” , P 2 , ” P r e s s u r e ( b a r ) o f d ow ns tr ea m

s h o c k wa ve : ” , M a 2 , ”Mach N o dow nst r e am shoc k w av e: ” ) ;

Scilab code Exa 17.4 COMPRESSIBLE FLOW IN A DUCT WITH FRIC-TION UNDER ADIABATIC CONDITIONS FANNO FLOW

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 7 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s4 g ma = 1 .4 ;

5 f = 0 .0 03 75 ;

6 d = 0. 05 ;

7

8 / / C a l c u l a t i o n s9 m = d / 4 ;

10 function [ y] = x (Ma )

11 A = (1 - Ma ^ 2 ) / ( gm a * Ma ^ 2 ) ;

12 B = ( g m a + 1) * M a ^ 2 / ( 2 +( g m a - 1 ) * M a ^ 2) ;

13 y = m / f*( A + ( g ma + 1) * log ( B ) / ( 2 * g m a ) ) ;

14 e n d f u n c t i o n

15

16 X 1 = x ( 0. 2) ; // At e n t ra n c e Ma = 0 . 2 ;17 X 0 6 _X 1 = x ( 0 . 6) ; // S e c t i o n ( b ) Ma = 0 . 6 ;

1819 X06 = X1 - X 06 _X 1;

20 disp ( X 0 6 , ” D i s t a n c e f ro m t h e e n t r a n c e (m) : ” , X 1 , ”TheD i s t a n ce X1 a t w hi ch t h e Mach number i s u n i t y (m)

: ” ) ;

87

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 89/114

Scilab code Exa 17.5 ISOTHERMAL FLOW OF A COMPRESSIBLE FLUIDIN A PIPELINE

1 clc ; funcprot ( 0 ) ; / / E xa mp le 1 7 . 42

3 // I n i t i a l i z i n g t he v a r i a b l e s4 g ma = 1 .4 ;

5 Q = 2 8/ 60 ; // m3/ s

6 d = 0 . 1 ;7 p 1 = 2 0 0* 1 0^ 3 ;

8 f = 0 .0 04 ;

9 x _x 1 = 6 0;

10 R = 2 8 7 ;

11 T = 1 5+ 27 3;

12

13 / / C a l c u l a t i o n s14 A = % pi * d ^2 /4 ;

15 m = d / 4 ;

16 v1 = Q /A ;

17 p a = p 1 * sqrt ( 1 - f * ( x _ x 1 ) * v 1 ^ 2 / ( m * R * T ) ) ;

18

19 function [ y ] = g ( p)

20 A = ( v 1 * p1 ) ^ 2/ ( R *T )

21 B = f * A * x_ x1 / ( 2* m ) ;

22 y = ( p^2 - p1 ^2) /2 -A *log ( p / p1 ) + B ;

23 e n d f u n c t i o n

24 pb = fsolve ( p a , g ) ; // G ue ss in g s o l u t i o n a ro un d pa25 disp ( p b / 1 0 0 0 , ” P r es s ur e a t t he o u t l e t , a l l o wi n g f o r

v e l o c i t y c ha ng es ( kN ) : ” , p a / 1 0 0 0 , ” P r e ss u r e a t t he

o u t l e t , n e g l e c t i n g v e l o c i t y c ha ng es ( kN ) ”) ;

88

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 90/114

Chapter 20

Pressure Transient Theory and

Surge Control

Scilab code Exa 20.3 APPLICATION OF THE SIMPLIFIED EQUATIONSTO EXPLAIN PRESSURE TRANSIENT OSCILLATIONS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 0 . 32

3 // I n i t i a l i z i n g t he v a r i a b l e s4 c = 12 50 ;

5 Dt = 0 .0 2;

6 Dv = 0. 5;

7 r ho = 1 00 0;

8 v = 0. 5;

9

10 / / C a l c u l a t i o n s11 cDt = c * Dt ;

12 D p = r ho * c* Dv ;

13 D O v_ D Ot = D v / Dt ;

14 v D Ov _D O t = v * Dv / c Dt ;15 D O p_ D Ot = D p / Dt ;

16 v D Op _D O x = v * Dp / c Dt ;

17 E r ro r = [ v D O v _ DO t * 1 0 0 / D O v _ DO t v D O p_ D O x * 1 0 0/ D O p_ D O t ] ;

18 disp ( E r r o r , ”The p e rc e nt a ge e r r o r s a re g i ve n be l o w

89

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 91/114

a r e v er y s m al l h en ce can be n e g l e c t e d : ” ) ;

Scilab code Exa 20.5 CONTROL OF SURGE FOLLOWING VALVE CLO-SURE WITH PUMP RUNNING AND SURGE TANK APPLICATIONS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 0 . 52

3 // I n i t i a l i z i n g t he v a r i a b l e s4 f = 0;

5 A t un n el = 1 .2 2 7;6 A sh a ft = 1 2. 57 ;

7 Q =2;

8 L = 2 0 0 ;

9 g = 9. 81 ;

10

11 / / C a l c u l a t i o n s12 Z ma x = ( Q / A sh a ft ) * sqrt ( A s h a f t * L / ( A t u n n e l * g ) ) ;

13 T = 2 * % p i * sqrt ( A s h a f t * L / ( A t u n n e l * g ) ) ;

14 disp (T , ” Mass O s c i l l a t i o n P er io d ( s ) : ” , Z m a x , ”Peakw at er l e v e l (m) : ” ) ;

90

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 92/114

Chapter 22

Theory of Rotodynamic

Machines

Scilab code Exa 22.1 ONE DIMENSIONAL THEORY

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 2 . 12

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Q = 5;

5 R 1 = 1 .5 /2 ;

6 R2 = 2/ 2;

7 w = 18;

8 r ho = 1 00 0;

9 r ho A = 1 .2 ;

10 H th = 0 .0 17 ;

11 g = 9 . 8 1 ;

12

13 / / C a l c u l a t i o n s14 A = % pi * ( R2 ^ 2 - R1 ^ 2) ;

15 Vf = Q /A ;16 Ut = w *R2 ;

17 Uh = w *R1 ;

18 B 1t = a co td ( U t / Vf ) ;

19 B 1h = a co td ( U h / Vf ) ;

91

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 93/114

20 E = H th * r ho / r h oA ;

21 function [ y ] = B et a (u )22 y = a co td ( ( u - E* g / u) / Vf ) ;

23 e n d f u n c t i o n

24 B 2t = B et a ( Ut ) ;

25 B 2h = B et a ( Uh ) ;

26

27 disp ( B 2 h , ”At Hub : ” , B 2 t , ”At t i p : ” , ”!−−−−B l a d eO u t l e t A n g le s ( D e g r ee s )−−−−!” , B 1 h , ”At Hub : ” , B 1 t ,

”At t i p : ” , ”!−−−−B la de I n l e t A ng le s−−−−!” ) ;

Scilab code Exa 22.2 DEPARTURES FROM EULERS THEORY ANDLOSSES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 2 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s4 D = 0 . 1 ;

5 t = 1 5* 10 ^ - 3;

6 Q = 8 .5 /3 60 0;

7 N = 7 50 /6 0;8 B 2 = 2 5 ; // Beta 2 i nd d e g re e s9 g = 9. 81 ;

10 z = 16;

11

12 / / C a l c u l a t i o n s13 A = % pi * D *t ;

14 V_ f2 = Q /A ;

15 U 2 = % pi * N* D ;

16 V _w 2 = U 2 - V _f 2 * co td ( B2 ) ;

17 H th = U 2 * V_ w2 / g ;18 S f = 1 - % pi * s i nd ( B 2 ) /( z * (1 - ( V _ f2 / U 2 ) * co td ( B 2 )) ) ;

19 H = Sf * Hth ;

20

21 disp (H , ” P ar t ( b ) − Head d e v e l o p e d (m) : ” , H t h , ” P a r t

92

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 94/114

( a ) − Head d e v e l o p e d (m) : ” ) ;

Scilab code Exa 22.3 COMPRESSIBLE FLOW THROUGH ROTODY-NAMIC MACHINES

1 clc ; funcprot ( 0 ) ; / / Exa mpl e 2 2 . 3 .2

3 // I n i t i a l i z i n g t he v a r i a b l e s4 Ma = 0. 6;

5 Cl = 0. 6;6 t By C = 0 .0 35 ; // T hi ck ne ss t o c h or d r a t i o7 c By C = 0 .0 15 ; // Camber t o c ho rd r a t i o8 x = 3; // A ngl e o f i n c i d e nc e9

10 / / C a l c u l a t i o n s11 l am da = 1/ sqrt ( 1 - M a ^ 2 ) ;

12 C l# = l am da * Cl ;

13 t By C1 = t By C * l am da ;

14 c By C1 = c By C * l am da ;

15 C l1 = C l * la md a ^ 2;

16 A e = x * la md a ;17

18 disp ( A e , ” a n g l e o f i n c i d e n c e ( D eg re e ) : ” , Cl1 , ” L i f tC o e f f i c i e n t : ” , c B y C 1 , ” Camber t o c ho rd r a t i o : ” ,

t B y C 1 , ” T h ic kn es s t o c h or d r a t i o : ” , ” G e o m e t r i cC h a r a c t e r s t i c s ” ) ;

93

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 95/114

Chapter 23

Performance of Rotodynamic

Machines

Scilab code Exa 23.1 DIMENSIONLESS COEFFICIENTS AND SIMI-LARITY LAWS

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 3 . 1

23 // I n i t i a l i z i n g t he v a r i a b l e s4 Q = [ 0: 7: 56 ];

5 H = [40 40 .6 40 .4 3 9. 3 38 3 3. 6 2 5. 6 1 4. 5 0];

6 n = [0 41 60 74 83 83 74 51 0];

7 N1 = 75 0;

8 N2 = 1 45 0;

9 D1 = 0. 5;

10 D2 = 0 .3 5;

11

12 / / C a l c u l a t i o n s13 Q 2 = Q * ( N2 / N 1 ) *( D 2 / D1 ) ^ 3;

14 H 2 = H * ( N 2 / N1 ) ^ 2 * ( D 2 / D1 ) ^ 2 ;

15 x l a b e l ( ”Q (m3/s ) ” ) ;

16 y l a b e l ( ”H (m o f w a te r ) a nd n ( p e r c e n t ) ” ) ;

94

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 96/114

Figure 23.1: DIMENSIONLESS COEFFICIENTS AND SIMILARITYLAWS

95

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 97/114

17 plot ( Q , H , Q , n , Q 2 , H 2 , Q 2 , n ) ;

1819 l e g e n d ( ”H1” , ” n 1 ” , ”H2” , ” n 2 ” ) ;

Scilab code Exa 23.2 THE PELTON WHEEL

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 3 . 22

3 // I n i t i a l i z i n g t he v a r i a b l e s

4 n = 0 . 9 ;5 g = 9. 81 ;

6 D = 1. 45 ;

7 N = 3 75 /6 0;

8 H = 2 0 0 ; // R ea l h e i g h t9 x = 1 6 5 ; / / T h et a

10 P = 3 75 0* 10 ^3 ;

11 r ho = 1 00 0;

12

13 / / C a l c u l a t i o n s14 h = n * H ; // E f f e c t i v e Head

15 v1 = sqrt ( 2 * g * h ) ;16 u = % pi * D *N ;

17

18 n _a = ( 2* u / v 1 ^ 2 ) * ( v1 - u ) * ( 1 - n * c o sd ( x ) ) ;

19

20 P _b = P / n_ a;

21 p pj = P _b / 2; // Power p er j e t22 d = sqrt ( 8 * p pj / ( r h o * % p i * v1 ^ 3 ) ) ;

23

24 disp (d , ” D i am et er o f J e t (m) : ” , n _ a * 1 0 0 , ” E f f i c i e n c y(%) : ” )

Scilab code Exa 23.3 FRANCIS TURBINES

96

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 98/114

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 3 . 3

23 // I n i t i a l i z i n g t he v a r i a b l e s4 g = 9. 81 ;

5 H = 12;

6 n = 0 . 8 ;

7 w = 3 00 *2 * % pi / 6 0;

8 Q = 0. 28 ;

9

10 / / C a l c u l a t i o n s11 V _f 1 = 0 .1 5* sqrt ( 2 * g * H ) ;

12 V _f 2 = V _f 1 ;

13 V _w 1 = sqrt ( n * g * H ) ;14 u1 = V_ w1 ;

15 t he ta = a ta nd ( V _ f1 / u 1 ) ;

16 u 2 = 0. 5* u 1 ;

17 B 2 = a ta nd ( V _ f2 / u 2 ) ;

18 r1 = u1 /w ;

19 b 1 = Q / ( V_ f2 * 0 . 9* 2 * % pi * r 1 ); // v an es o ccu py 10 p erc en t o f t he c i r cu m f er e n ce h en ce 0 . 9

20 b2 = 2* b1 ;

21

22 disp ( b 2 * 1 0 0 0 ,” Width o f r u n n er a t e x i t (mm) : ”

, b1

* 1 0 0 0 , ” Width o f r u nn e r a t i n l e t (mm) : ” , B 2 , ”Vane a n g le a t e x i t ( d e gr e e ) : ” , t h e t a , ” G u id e v a ne

a n g l e ( d e g r e e ) : ” ) ;

Scilab code Exa 23.4 AXIAL FLOW TURBINES

1 clc ; funcprot ( 0 ) ; / / E xa mp le 2 3 . 4

23 // I n i t i a l i z i n g t he v a r i a b l e s4 H = 35;

5 g = 9. 81 ;

6 D = 2;

97

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 99/114

7 N = 1 45 /6 0;

8 z = 30; // a n gl e bet w ee n v an es and d i r e c t i o n o f  r un ne r r o t a t i o n9 y = 28; // a n gl e bet w ee n r un ne r b l ad e s a t t he o u t l e t

.10

11 / / C a l c u l a t i o n s12 H _n et = 0 .9 3* H ; // s i n c e 7% head i s l o s t13 v1 = sqrt ( 2 * g * H _ n e t ) ;

14 u = % pi * N *D ;

15 V _r 2 = u * c os d ( y );

16 V 2 = u * s in d ( y );

17 V _w 2 = V 2 * si nd ( y ) ;18

19 // F un ct io n t o s o l v e t he v e ct o r f o r Vr1 and B1 by j u s t r e w r i t i n g t h e p a r a l l e l o g r a m l aw i n a r r a n g e d

form20 function [ f ] = F ( x )

21 f ( 1) = u ^ 2 + x ( 1) ^ 2 + 2 * u* x ( 1) * c o sd ( x ( 2) ) - v1 ^ 2 ;

22 f ( 2) = x ( 1) * s i nd ( x ( 2) ) - t an d ( z) * ( u + x ( 1) * c o sd (

x ( 2 ) ) ) ;

23 e n d f u n c t i o n

24 X = [10 50];// An i n n i t i a l g u e s s o f v e c t o r l e n g t hand a n gl e by f i g u r e

25 r e s u l t = fsolve ( X , F ) ;

26 V _ r1 = r e s u lt ( 1 ) ;

27 B 1 = r es ul t (2 ) ;

28 V _w 1 = u + V _r 1 * co sd ( B1 )

29 E = ( u/ g )*( V _w 1 - V _w 2 );

30 n = E / H ;

31 disp ( n * 1 0 0 , ” E f f i c i e n c y (%) : ” , B 1 , ” B la de a n g l e a ti n l e t ( D eg re e ) : ” ) ;

Scilab code Exa 23.5 HYDRAULIC TRANSMISSIONS

98

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 100/114

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 3 . 53

4 // I n i t i a l i z i n g t he v a r i a b l e s5 s = 0. 03 ;

6 P = 1 85 *1 0^ 3;

7 r ho = 0 . 86 * 10 ^ 3;

8 A = 2 .8 *1 0^ - 2 ;

9 N = 2 25 0/ 60 ;

10 D = 0. 46 ;

11

12 / / C a l c u l a t i o n s

13 R 0 = 0 .4 6/ 2;14 W s_ Wp = 1 - s;

15 n = Ws _W p ;

16 Pf = s *P ;

17 Q = ( 2* P f * A ^ 2 / ( 3 .5 * r h o ) ) ^ ( 1 /3 ) ;

18 W p = 2 * %p i *N ;

19 Ri = sqrt ( ( 1/ W s _ W p ) * ( R 0 ^2 - P / ( r ho * Q * W p ^ 2 ) ) ) ; //M od i fi e d e q ua t i on f o r power t r a n s m i s s i o n .

20 Di = 2* Ri ;

21 T = P /( r ho * Wp ^ 3 * D ^5 );

22

23 disp (T , ” Torque C o e f f i c i e n t : ” , D i *1 00 0 , ”Meand i a m e t e r (mm) : ” ) ;

99

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 101/114

Chapter 24

Positive Displacement

Machines

Scilab code Exa 24.1 RECIPROCATING PUMPS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 4 . 13

4 // I n i t i a l i z i n g t he v a r i a b l e s5 H _a t = 1 0. 3;

6 Hs = 1. 5;

7 Hd = 4. 5;

8 Ls = 2;

9 L d = 1 5 ;

10 g = 9. 81 ;

11 Ds = 0. 4; // D ia me te r o f s t r o k e12 Db = 0 .1 5; // D ia me te r o f b or e13 Dd = 0 .0 5; // D ia me t e r o f d i s c ha r g e and s u c t i o n

p i p e

14 nu = 0. 2;15 f = 0. 01 ;

16 a b s _ pu m p _ p re s s u re = 2 . 4;

17

18 / / C a l c u l a t i o n s

100

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 102/114

19 A = % pi * ( Db ) ^ 2 /4 ;

20 a = % pi * ( Dd ) ^ 2 /4 ;21 r = D s / 2 ;

22 W = 2* % pi * nu ;

23 Hsf = 0;

24 function [ y ] = H _s uc k (n ) // n f o r c he ck in g t he s i gno f H s i = 4 f l / 2 dg ∗( v A /a) ˆ2

25 y = H _a t - H s + ( -1 ) ^ n *( L / g ) *( A / a )* W ^ 2* r ;

26 e n d f u n c t i o n

27

28 function [ y ] = H ( n , D is c ha r ge O rS u ct i on ) // n f o rc h ec k in g t he s i g n o f H si = 4 f l /2 dg ∗( vA / a ) ̂ 2 , f o r

s u c t i o n 1 and f o r d i sc h a r ge 229 if ( D i s c h a r g eO r S u c ti o n = = 1 ) then

30 y = H _a t - H s + ( -1 ) ^n * ( Ls / g ) *( A / a )* W ^ 2* r ;

31 elseif ( D i s c h a r g eO r S u ct i o n = = 2 ) then

32 y = H _a t + H d + ( -1 ) ^n * ( Ld / g ) *( A / a )* W ^ 2* r ;

33 e l se d i sp ( ” T her e i s s o me th i ng wrong : ” )

34 end

35 e n d f u n c t i o n

36

37 function [ y ] = H _ mi d ( D i s c h a rg e O rS u c ti o n , u A ) // n f o r

c h ec k in g t he s i g n o f H si = 4 f l /2 dg ∗( vA / a ) ̂ 2 , f o rd i sc h a r g e 1 and f o r s u c t i o n 238

39 if ( D i s c h a r g eO r S u c ti o n = = 1 ) then

40 H s f = 4 * f * Ls / ( 2 * D d * g ) *( u A / a ) ^ 2;

41 y = H_at - Hs - Hsf ;

42 elseif ( D i s c h a r g eO r S u ct i o n = = 2 ) then

43 H s f = 4 * f * Ld / ( 2 * D d * g ) *( u A / a ) ^ 2;

44 y = H_at + Hd + Hsf ;

45 e l se d i sp ( ” T her e i s s o me th i ng wrong : ” )

46 end

47 e n d f u n c t i o n48

49 H s _s ta r t = H ( 1 , 1) ; // I n e r t i a head n e g a ti v eh en ce n = 1

50 H s_ e nd = H ( 2 ,1 ) ; // I n e r t i a head p o s i t i v e h e n c e

101

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 103/114

n = 2

51 H d _s ta r t = H ( 1 , 2) ;52 H d_ e nd = H ( 2 ,2 ) ;

53 u = W * r ;

54 H s_ m id = H _m id ( 1 , u *A ) ;

55 s li p = 0 .0 4;

56 H d_ m id = H _m id ( 2 , u *A ) ;

57 s u ct i on = [ H s _s t ar t H s_ e nd H s_ m id ] ;

58 d i sc h ar g e = [ H d _s t ar t H d_ en d H d_ mi d ] ;

59 h ea de r = [ ” S t a r t (m) ” , ” End (m) ” , ” Mid (m) ” ];

60 W _m ax = sqrt ( ( a b s_ p um p _p r es s ur e - H _a t + H s ) *( g / Ls )

* ( a / A ) * ( 1 / r ) ) ;

61 W _ m ax _ r ev = W _ ma x / ( 2 * % p i ) * 60 ; / / maximum r o t a t i o ns p ee d i n r e v / min

62 disp (W_max_rev , ” D ri ve s pe ed f o r s e p e r a t i o n ( r ev / min) : ” , ”!−−−−Pa rt ( c )−−−−1” ,discharge ,header , ”!−−−−P ar t ( b )−−−−! H ead a t ” ,suction ,header , ”!−−−−P ar t ( a)−−−−! H ead a t ” ) ;

Scilab code Exa 24.2 RECIPROCATING PUMPS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 4 . 23

4 // I n i t i a l i z i n g t he v a r i a b l e s5 H _ fr i ct i on = 2 .4 ;

6 H _a t = 1 0. 3;

7 Hs = 1. 5;

8 L =2;

9 f = 0. 01 ;

10 d = 0. 05 ;11 g = 9. 81 ;

12 Ds = 0. 4; // D ia me te r o f s t r o k e13 Db = 0 .1 5; // D ia me te r o f b or e14 r = 0 . 2 ;

102

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 104/114

15

16 / / C a l c u l a t i o n s17 A = % pi * ( Db ) ^ 2 /4 ;

18 a = % pi * ( Dd ) ^ 2 /4 ;

19 W = sqrt ( ( H_ at - Hs - H _f ri ct io n ) * (2 * d* g /( 4* f * L) ) )

* ( a / A ) * ( % p i / r ) ;

20 W _r ev = W / ( 2* % p i ) *6 0; / / maximum r o t a t i o n s p e ed i nr e v / m i n

21

22 disp (W_rev -40 , ” I n c r e a s e i n s p ee d ( r e v / min ) : ” ) ;

103

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 105/114

Chapter 25

Machine Network Interactions

check Appendix AP 1 for dependency:

intersectFunc.sci

Scilab code Exa 25.1 FANS PUMPS AND FLUID NETWORKS

1 clc ; funcprot ( 0 ) ;

2

3 //−−−−−−−−−−−−−−−−−−−−−−−I m p o r t a nt N ot e−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−//

4 // P l ea s e k e e p i n t e rs e c t F u n c . s c i i n t he same f o l d e ri n w hi ch t h i s f i l e / /

5 // i s k ep t a nd c h an ge t he c u r re n t w or ki ng d i r e c t o r yt o t h e d i r e c t o r y //

6 // i n which bot h t he f i l e s a r e k ep t u s in g c h di r ”a b s o l u t e pat h ” //

7 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

8

9

104

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 106/114

Figure 25.1: FANS PUMPS AND FLUID NETWORKS

105

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 107/114

10 / / E xa mp le 2 5 . 1

1112 // I n i t i a l i z i n g t he v a r i a b l e s13 exec ( ” i n t e r s e c t F u n c . s c i ”) ;

14 Q = [ 0. 01 0 0 .0 14 0 .0 17 0 .0 19 0 .0 24 ] ’ ;

15 H = [ 9. 5 8.7 7 .4 6.1 0.9] ’ ;

16 n = [65 81 78 68 12] ’;

17 d = 0. 15 ;

18 m u = 1 .1 4* 10 ^ - 3 ;

19 r ho = 1 00 0;

20 g = 9. 81 ;

21

22 / / C a l c u l a t i o n s23 E 1 = 3 + 92 1 8* Q ^ 2 ; // f = 0 . 0 0 2 5 f ro m m oody c h a r t24 Q 1 = i n t e rs e c t Fu n c ( H , E1 , Q ) ;

25 v 1 = 4 * Q1 / ( % pi * d ^ 2) ;

26 R e1 = r ho * v 1 *d / mu ;

27 E 2 = 3 +1 5 48 6 * Q ^2 ; // s i n c e f = 0 . 00 4228 Q 2 = i n t e rs e c t Fu n c ( H , E2 , Q ) ;

29 n = 0. 78 ; // e f f i c i e n c y a t Q2 f rom gr a ph30 H1 = 7 .4 5; // From Graph31 P = r ho * g * H1 * Q 2 /n ;

32

33 t i t l e ( ” E x am pl e 2 5 . 1 ” ) ;

34 x l a b e l ( ”Q (m3/ s ) : ” ) ;

35 y l a b e l ( ”H(m) ” ) ;

36 plot ( Q , H , Q , E 1 , Q , E 2 ) ;

37 l e g e n d ( ”H” , ”E1” ,”E2” ) ;

38

39 disp ( P / 1 0 0 , ”P owe r c onsumed (kW) : ” , Q 2 , ” F lo w b e tw e nt he r e s e r v o i r s (m3/ s ) : ” ) ;

Scilab code Exa 25.4 AN APPLICATION OF THE STEADY FLOW EN-ERGY EQUATION

106

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 108/114

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 5 . 43

4 // I n i t i a l i z i n g t he v a r i a b l e s5 P a_ P1 = - 20 0; / / From p r e v i o u s Q u e st i o n6 Q = 1.4311 ; / / From p r e v i o u s q u e s t i o n s .7

8 / / C a l c u l a t i o n s9 D pS ys = P a_ P1 + 9 8. 9* Q ^ 2;

10 disp ( D p S y s , ” S y st em O p e r a t i n g p o i n t ( m3/ s ) : ” ) ;

Scilab code Exa 25.7 JET FANS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 5 . 73

4 // I n i t i a l i z i n g t he v a r i a b l e s5 Vo = 2 5. 3; // O ut l et v e l o c i t y6 D = 10 ; / / Mean h y d r a u l i c d i a me t er7 f = 0 .0 08 ; / / f r i c t i o n f a c t o r

8 X = 10 00 ; // L en gth o f r oa d9 P = 1 26 00 ; / / A b so r b in g p ow er

10 Va = 30 0; // Tunnel a i r f l o w11 K1 = 0 .9 6;

12 K2 = 0. 9;

13 T = 5 9 0 ; / / T h r u s t14 r ho = 1 .2 ; // A ir d e n si t y15

16 / / C a l c u l a t i o n s17 a lp ha = ( 1/ D ) ^ 2;

18 A = % pi * D ^2 /4 ; // Area o f t u nn e l19 Vt = Va /A ;

20 W = V o / V t ; //Omega21 E = (1 - a lp ha * W );

22 C = (1 - a lp ha * W ) *(1 - E ) ^2 + E ^2 - 1 ;

107

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 109/114

23 // M an ip u la ti n g e q ua t i on 2 5 . 2 0 ;

24 LHS = f *X *( E +1) ^2/ D + C + 1 ;25 n = poly (0 , ” n” ) ;

26 R HS = K 1 * (2 *( ( a l ph a * W ^2 + ( 1 - a lp ha ) * E ^ 2 -1 ) +( n - 1) * (

a l p h a * W * ( W - 1 ) - C / 2 ) ) ) ;

27 E qu at io n = R HS - LH S ;

28 roots ( E q u a t i o n ) ;

29

30 // A l t e r na t i v e a pp ro ac h u s in g e q u at i on 2 5 .2 231 n = ( r ho * ( (4 * f * X* V t ^2 ) / (2 * D ) + 1 .5 * Vt ^ 2 /2 ) ) * A /( K 1 *

K 2 * T ) ;

32 Pt = round ( n ) * P ;

33 disp ( P t / 1 0 0 0 , ” T o t a l p ow er c on su me d (KW) : ” , round ( n) , ” Number o f f a n s r e q u i r e d : ” ) ;

Scilab code Exa 25.8 JET FANS

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 5 . 83

4 // I n i t i a l i z i n g t he v a r i a b l e s5 f = 0 .0 08 ;

6 T = 2 9 0 ;

7 L = 7 5 0 ;

8 Dt = 9; / / D i a me t er T un ne l9 Df = 0 .6 3; / / D ia me te r f a n

10 K1 = 0 .9 8;

11 K2 = 0 .9 2;

12 Vo = 2 7. 9;

13 n = 10;

1415 / / C a l c u l a t i o n s16 a lp ha = ( D f / Dt ) ^ 2;

17 / / e q u a t i on 2 5 . 2 0 b ec om es when E = 1 nad C = 018 W = poly (0 , ’W’ ) ;

108

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 110/114

19 E q ua ti o n = 2 * K1 * ( a l ph a * W ^2 + (n - 1 ) * al ph a * W *( W - 1) ) -

4 * f * L / Dt - 1;20 omega = roots ( E q u a t i o n ) ;

21 for ( i = 1: length ( o m e g a ) )

22 if ( real ( o m e g a ( i ) ) > 0 ) then // s i n c e omega i sa lw a ys p o s i t i v e and r e a l

23 w = o me ga ( i );

24 end ,

25 end

26 Vt = Vo /w ;

27 disp ( V t , ” T u nn el V e l o c i t y (m/ s ) : ” ) ;

Scilab code Exa 25.9 CAVITATION IN PUMPS AND TURBINES

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 5 . 93

4 // I n i t i a l i z i n g t he v a r i a b l e s5 Ws = 0 .4 5;

6 Ks = 3. 2;

7 H = 1 5 2 ;8 h = 0;

9 H at m = 1 0. 3;

10 Pv = 35 0; // v a po ur p r e s s u r e11 g = 9. 81 ;

12 r ho = 1 00 0;

13

14 / / C a l c u l a t i o n s15 H t1 = H * ( Ws / K s ) ^( 4 /3 )

16 H va p = P v /( r h o *g ) ;

17 Z = H at m - h - H va p - Ht1 ;18 disp (Z , ” E l e v a t i o n o f pump (m) : ” ) ;

109

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 111/114

Scilab code Exa 25.11 VENTILATION AND AIRBORNE CONTAMI-

NATION AS A CRITERION FOR FAN SELECTION

1 clc ; funcprot ( 0 ) ;

2 / / E xa mp le 2 5 . 1 13

4 // I n i t i a l i z i n g t he v a r i a b l e s5 Co = 0;

6 Q c = 0 .0 02 4;

7 V = 54 00 ;

8 c = 10;

9 / / C a l c u l a t i o n s

10 function [ y] = partA (n )11 Ci = 10;

12 t = 1 0^ 10 00 ; // i n f i n i t y ( a v er y l a r g e number )13 Q = V * n /3 60 0;

14 y = ( Co + 1 00 00 * Qc / Q) *( 1 - %e ^( - n *t ) ) + Ci * %e ^( - n

* t ) - c ;

15 e n d f u n c t i o n

16

17 S ol _A = fsolve ( 1 , p a r t A ) ;

18

19 function [ y] = partB (n )

20 C i = 0 ;

21 t = 1; // t ime i n h ou rs22 Q = V * n /3 60 0;

23 A = Co + 1 00 00 * Qc /Q ;

24 B = Ci * %e ^( - n* t) - c ;

25 y = A *(1 - %e ^( -n *t )) + B ;

26 e n d f u n c t i o n

27

28 S ol _B = fsolve ( 1 , p a r t B ) ;

29

30 function [ y] = partC (c )31 C i = 0 ;

32 n = 1;

33 t = 0 .3 33 33 3; // 20 m in ut es i n h ou rs34 Q = V * n /3 60 0;

110

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 112/114

35 y = ( Co + 1 00 00 * Qc / Q) *( 1 - %e ^( - n *t ) ) + Ci * %e ^( - n

* t ) - c ;36 e n d f u n c t i o n

37

38 S ol _C = fsolve ( 1 , p a r t C ) ;

39

40 function [ y] = partD (t )

41 Ci = 10;

42 n = 1;

43 c = 0.1;

44 y = Ci * %e ^( - n* t) - c ;

45 e n d f u n c t i o n

4647 S ol _D = fsolve ( 0. 00 1 , p ar tD ) ;

48

49

50 disp ( S o l _ D , ” P ar t (D) : t im e n e c e s s a r y t o run t hev e n t i l a t i o n s y s t e m a t t h e r a t e c a l c u l a t e d i n ( b )t o r ed uc e t he c o nc e n t r a t i o n t o 0 . 0 01 p er c en t ( i n

h o u r s ) : ” , So l_ C , ” P a rt (C) : t h e c o n c e n t r a t i o na f t e r 20 m in ut es ( P a rt s p er 1 00 00 ) : ” , S o l _ B , ” P a r t(B) : number o f a i r c ha ng es p er hour i f t h i s

maximum l e v e l i s r ea c he d a f t e r 1 h ou r a nd t heg ar a ge i s o ut o f u s e : ” , S ol _A , ” P a r t (A ) : n um be ro f a i r c h a n g e s p e r hour i f t h e g ar a ge i s i n

c o n t i n u o u s u s e a nd t h e maximum p e r m i s s i b l ec o n c e n t r a t i o n o f c ar bo n monoxi de i s 0 . 1 p er c en t .

: ” ) ;

111

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 113/114

Appendix

Scilab code AP 1 UDF Intersect Function

1 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ i n t e rs e c t F u n c s c i l a bf u n c t i o n ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/ /

2 / / Ta kes a rg um en t a s t h r e e a r r a y s n ame ly f 1 , f 2 (f u nc t i o n s ) and t h e i r domain //

3 // I t f i n d s i n t e r s e c t i n g p o i n t s i n a l l t h e subd oma i ns//

4 // G iv es o ut pu t a s p o in t ( s ) o f i n t e r s e c t i o n o f t hetwo f u n c t i o n s //

5 // Domain sh ou ld be INCREASING//

6 / / C r e a t e d b y : J a y C ha kr a (www . j a y c h a k r a . c o . c c )

//7 // U n d e r g r a d u a t e

//8 // A e r o s p a c e E n g i n e e r i n g

//9 // I I T Bombay

//10 / / Comments , s u g g e s t i o n s , b u gs w el co me d a t j a y c h a k r a .

 j c @ g m a i l . com //

11 //∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗

12

112

7/28/2019 Fluid Mechanics_Douglas John F

http://slidepdf.com/reader/full/fluid-mechanicsdouglas-john-f 114/114

13 function [ y ] = i n t e rs e c t Fu n c ( f 1 , f2 , d o ma i n )

14 L1 = length ( f 1 ) ;15 L2 = length ( f 2 ) ;

16 L3 = length ( d o m a i n ) ;

17 if ( ( L 1 ~ = L 2 ) | ( L 1 ~ = L 3 ) | ( L 2 ~ = L 3 ) ) then

18 error ( ” Check D i me ns i on s o f i n p u t p a r am e t er s! ! ” ) ;

19 else

20 R = 1;

21 y = [];

22 for ( i = 1 : L 1 - 1 )

23 N 1 = f 1 (i + 1) - f 1 (i ) ;

24 N 2 = f 2 (i + 1) - f 2 (i ) ;25 D = d om a in ( i + 1) - d o ma i n ( i) ;

26 x = poly (0 , ’ x ’ ) ;

27 // W ri ti ng e q u a ti o n o f s t r a i g h t l i n e s j o i n i n g t h e t e r m i n a l p o i n t s

28 f ( 1) = f 1 (i ) + ( N1 / D ) *( x - d o ma in ( i ) ) ;

29 f ( 2) = f 2 (i ) + ( N2 / D ) *( x - d o ma in ( i ) ) ;

30 d if fe re nc e = f (2 ) - f ( 1) ;

31 r oo t = roots ( d i f f e r e n c e ) ; //S o l u t i o n w i l l be t h e r o o t s o f  

d i f f e r e n c e32 if ( d i f fe r en c e = = 0 ) then //i f bot h f u n c t i o n s a r e same

33 y = d om ai n ;

34 break ;

top related