waleed ishaque - 2011 thesis final copy.pdf

71
i Hydraulic Transient Analysis of Emergency Water System at Ontario Power Generation Using Method of Characteristics A thesis submitted to the Department of Mechanical and Industrial Engineering In the partial fulfillment of the requirements for the degree of BACHELOR OF APPLIED SCIENCE Author: Waleed Ishaque Supervisor: Prof. Bryan Karney Date: December 2011

Upload: waleedishaque

Post on 17-Jan-2016

20 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Waleed Ishaque - 2011 Thesis final copy.pdf

i

Hydraulic Transient Analysis of Emergency

Water System at Ontario Power Generation

Using Method of Characteristics

A thesis submitted to the

Department of Mechanical and Industrial Engineering

In the partial fulfillment of the requirements for the degree of

BACHELOR OF APPLIED SCIENCE

Author: Waleed Ishaque

Supervisor: Prof. Bryan Karney

Date: December 2011

Page 2: Waleed Ishaque - 2011 Thesis final copy.pdf

ii

Abstract

Hydraulic Transients are sudden changes in velocity and pressure of a fluid in a piping system

which may exceed the design limitations causing a pipe rupture. These sudden changes are

normally caused by operation of a fluid control device such as a valve. Sudden valve closure or

opening downstream of a pressurized pipeline is a typical operation that may cause pressure

oscillations i.e. hydraulic transients in the fluid.

This phenomenon can also be explained using energy transfers. Considering a sudden valve

closure, the moving fluid with high kinetic energy when suddenly stopped gains potential

energy. In a fluid system, this potential energy is a pressure wave that travels along the system. If

this pressure wave exceeds the design limits, system failure will occur.

To demonstrate the application of hydraulic transient analysis, the paper models the Emergency

Water System (EWS) at Ontario Power Generation (OPG), Pickering Nuclear. The EWS is a

safety system at the Pickering CANDU Nuclear Station which consists of three parallel with

peak horse power of 400 capable of supplying 140 meter pressure head at the best efficiency

point.

A mathematical technique known as the Method of Characteristics is used in a MATLAB

program that models transients in simple systems. Combinations pump, valves and air pocket

were analyzed to observe water behavior as system configurations changed e.g. pump startup and

valve opening. Results show that transients due to valve opening are less severe than vale closure

operation. Also, air pocket in a downstream dead end is modeled. Results from this model show

that air pocket if sufficiently of large volume dampens the pressure oscillations. But when the

volume of air pocket is small compared to that of water the pressure oscillations become

significant and become to threaten the system. In the case of EWS, pressure oscillations are

small because of relief flow to the lake and throttling of pump discharge valves during the test

procedure.

Page 3: Waleed Ishaque - 2011 Thesis final copy.pdf

iii

Acknowledgments

I am in debt to Professor Bryan Karney for the tremendous support he gave me throughout my

thesis. Without his guidance I would not have known my potential. Working with him brought

me closer to physics and science of the world we live in. His ambitious personality always

pushed me to achieve the greatest. In my first meeting with him, he said “make something you

are proud of”. This statement will always push me towards ambition, in preparing this thesis and

life in general. He continued to give me advice and encouragement from the moment I met him

to discuss my topic.

Also, I am grateful to the members of Ontario Power Generation who motivated me to pursue

my thesis on hydraulic transients. During my internship at OPG in year 2011, I gained

tremendous knowledge and interest in the nuclear industry. I would specifically like to thank

Carlos Lorencez, Elizabeth Mistele, Evan Davidge and Arvind Misra for being available to me

during the busiest times of their work. Without their help this thesis would not have been

possible.

Last but not the least; I would like to thank my family of non-engineers for listening to me

patiently when I talked about hydraulic transients at the dinner table.

Page 4: Waleed Ishaque - 2011 Thesis final copy.pdf

iv

Table of Contents

Chapter 1 Introduction .................................................................................................................... 1

1.1 Defining hydraulic transients ................................................................................................ 1 1.2 Historical development of hydraulic transients .................................................................... 1 1.3 Purpose .................................................................................................................................. 2 1.4 Organization .......................................................................................................................... 2

Chapter 2 Fundamental Water-hammer Theory ............................................................................. 3

2.1 Introduction ........................................................................................................................... 3 2.2 Rigid water column theory ................................................................................................... 4 2.3 Joukowsky water hammer equation ...................................................................................... 5 2.4 Summary ............................................................................................................................... 7

Chapter 3 Transient Flow Differential Equations ........................................................................... 8

3.1 Introduction ........................................................................................................................... 8 3.2 Equation of motion ............................................................................................................... 8 3.3 Equation of continuity ........................................................................................................ 10

3.4 Summary ............................................................................................................................. 12

Chapter 4 Solution of Transient Flow Differential Equations ...................................................... 13

4.1 Introduction ......................................................................................................................... 13

4.2 Analytical solution using d’Alembert’s method ................................................................. 13 4.3 Numerical solution using method of characteristics ........................................................... 14

4.4 Summary ............................................................................................................................. 15

Chapter 5 Method of Characteristics ............................................................................................ 16

5.1 Introduction ......................................................................................................................... 16

5.2 Characteristic curve equation .............................................................................................. 16 5.3 Compatibility equations ...................................................................................................... 17 5.4 Summary ............................................................................................................................. 18

Chapter 6 Solution of Characteristic Equations ............................................................................ 19

6.1 Introduction ......................................................................................................................... 19 6.2 Finite difference solution .................................................................................................... 19 6.3 Summary ............................................................................................................................. 21

Chapter 7 Boundary Conditions.................................................................................................... 22

7.1 Introduction ......................................................................................................................... 22

7.2 Boundary conditions ........................................................................................................... 23

Page 5: Waleed Ishaque - 2011 Thesis final copy.pdf

v

7.3 Summary ............................................................................................................................. 28

Chapter 8 Typical System Configurations Analyzed.................................................................... 29

8.1 Introduction ......................................................................................................................... 29 8.2 Water tank with a downstream valve .................................................................................. 29 8.3 Pump with a downstream valve .......................................................................................... 32 8.4 Pump with a downstream air pocket ................................................................................... 34 8.5 Summary ............................................................................................................................. 39

Chapter 9 Case Study .................................................................................................................... 40

9.1 Introduction ......................................................................................................................... 40

9.2 Emergency water system .................................................................................................... 40 9.3 MATLAB model of EWS ................................................................................................... 41 9.4 Results ................................................................................................................................. 42

9.5 Discussion ........................................................................................................................... 45 9.6 Recommendations ............................................................................................................... 46

Chapter 10 Overview .................................................................................................................... 47

10.1 Introduction ....................................................................................................................... 47

10.2 Common transient system failures .................................................................................... 47 10.3 System protection ............................................................................................................. 48

10.4 Conclusion ........................................................................................................................ 49

Page 6: Waleed Ishaque - 2011 Thesis final copy.pdf

1

Chapter 1 Introduction

1.1 Defining hydraulic transients

Historically, the term water-hammer has been associated to the “hammering” sound followed by

a sudden closure of valve in water pipeline. This phenomenon is technically a hydraulic transient

when steady-state conditions are changed into transient-state conditions. This state change

induces large disturbances in a fluid system due to a transfer from kinetic energy to internal

energy. Commonly, transient-state conditions are caused by changing valve positions, pump

start-up or shutdown, turbine load acceptance or rejection, air-pocket compression and leakage.

During design phase of a fluid transport system, hydraulic transient analysis must be done to

observe maximum and minimum pressure points and take proper corrective actions to mitigate or

minimize the pressure peaks. The goal is to maintain maximum and minimum pressure points

well below the design limits of a system. Failure to do so can lead to devastating accidents

similar to the collapse of Oigawa Power Station penstock.

With advanced computing capabilities, hydraulic transients are analyzed using numerical

methods for both simple and complex piping systems. Over the past 50 years several methods

have been introduced selection of which depend on the desired degree of accuracy and system

flow characteristics.

1.2 Historical development of hydraulic transients

Throughout the history humans have relied on water for useful energy. With increasing demands,

generally speaking, water flow and pressure requirements have increased. However, as the

saying goes, with great power comes great responsibility; high pressure pipe lines experiencing

transients can have devastating pipe failures if not controlled and mitigated. It is clear from

history that scientists and engineers have put in tremendous effort in developing ways to control

water hammer in pipelines and canals. Classical hydraulic transient text book by Chaudhry

(1979) shows the progress made by the technical society towards the field of hydraulic

transients.

Page 7: Waleed Ishaque - 2011 Thesis final copy.pdf

2

1.3 Purpose

The purpose of this thesis is to introduce hydraulic transient theory and the mathematical

technique called the Method of Characteristics to solve the fundamental transient equations. This

paper does not aim to innovate but rather introduce the topic of hydraulic transients to the reader.

Emphasis is put on the fundamental physics behind the theory to allow the reader look through

the point of view of water as it experiences changes. The thesis concludes with a hydraulic

transient analysis of OPG Emergency Water System as a case study.

1.4 Organization

This paper is presented in ten chapters. Chapter 1 ends with this section and chapter 2 discusses

the fundamental physics of hydraulic transients. In chapter 2 Newton’s second law is related to

two fundamental water hammer theories: Rigid Water Column Theory and the Joukowsky Water

Hammer equation. Chapter 3 moves on from the fundamental water hammer theories to a

broader concept of hydraulic transients. Newton’s second law and conservation of mass are used

to develop transient equations of motion and continuity which are both the fundamental

equations of hydraulic transients. Chapter 4 discusses both analytical and numerical solution of

the fundamental hydraulic transient equations developed in chapter 3. Although the focus of

paper shifts to the numerical solution, analytical solution is presented to better explain the

assumptions and mathematical reasoning behind the numerical solution. Chapter 5 emphasizes

on the numerical solution of transient equations and introduces the Method of Characteristics.

This mathematical technique solves the transient equations on a finite element grid which is

explained in chapter 6. In chapter 7, relevant boundary conditions are discussed that represent

equipment typical in industry applications. With established knowledge of the Method of

Characteristics and boundary conditions, chapter 8 uses MATLAB code to model simple system

configurations and discuss results from analysis. Chapter 9 models the EWS at OPG Pickering

Nuclear Stations as a case study. Finally, chapter 10 discusses a guideline to protect systems

from transients.

Page 8: Waleed Ishaque - 2011 Thesis final copy.pdf

3

Chapter 2 Fundamental Water-hammer Theory

2.1 Introduction

Laws of physics are the fundamental science dictating the behavior of fluid experiencing

transient conditions. Static systems experience balanced forces but systems in transient

experience unbalanced forces that lead to potentially drastic physical disturbances – namely

hydraulic transients. In this section, fundamental physics is used to derive the two basic water

hammer theories: (1) Rigid Column Theory and (2) Joukowsky Water Hammer Equation.

Newton’s Second Law is stated in two ways:

............................................................................................................................ 2.1

…………………………………………………………………………………. 2.2

Equation 2.1 takes into account the change in velocity and change in mass i.e. compressibility of

a material in a control volume (CV); whereas, equation 2.2 is concerned only about the change in

velocity of the material and assumes constant mass i.e. incompressible material. In the next two

sections it is shown that equation 2.1 and equation 2.2 are the governing equations for the

Joukowsky Water Hammer Equation and Rigid Water Column theory respectively.

Page 9: Waleed Ishaque - 2011 Thesis final copy.pdf

4

2.2 Rigid water column theory

In Figure 1, an element in a pressurized pipeline with a gate valve downstream is gradually

closed. With the valve closure, unbalanced forces are created on the mass of water that is now

decelerating at

.

To determine the unbalanced forces on the mass of water, three assumptions are made: 1) water

is incompressible, 2) pipe is rigid and 3) friction losses are negligible.

By Newton’s Second Law and equation 2.2,

; where is mass and

is acceleration

; where is density, is gravity, is cross

sectional area, is the head at the gate, is the head at gate closure, is pipe length, is

distance between datum and water surface and is incline angle of the pipe with respect to the

datum.

Since :

……………………………………………………………………………... 2.3

Equation 2.3 is the basic rigid column water hammer equation. As shown in the derivation, rigid

column theory assumes negligible compressibility and non elastic conduit. The theory is suitable

to determine uniform valve closure water hammer effects. But if a valve is instantly closed, there

will be fluid compression and change in conduit shape due to elasticity. Next section will discuss

Joukowsky equation that considers these variables.

Figure 1. Increase in head due to gradual gate closure in closed conduit (Parmakian, 1958)

Page 10: Waleed Ishaque - 2011 Thesis final copy.pdf

5

2.3 Joukowsky water hammer equation

In Figure 2 a reservoir filled with water has initial downstream flow conditions of velocity ,

pressure , and density . At time a valve downstream is suddenly closed causing a

wave of speed to travel in the upstream direction flowing out of the control volume shown in

Figure 2. By observing the wave speed with a velocity of in the downstream direction,

the wave is now seen as stationary and the problem is converted from transient to steady state. In

Figure 2b at , the inflow conditions are , , and the outflow conditions are

, , .

According to Newton’s second law i.e. equation 2.1 the net force on the x-axis of the control

volume (CV) in Figure 2 is equal to the rate of change in momentum:

rate of change in momentum

Where momentum of inflow ,

and momentum of outflow .

Substituting the two into Newton’s second law gives:

……………………...... 2.4

Figure 2. Pressure rise due to sudden reduction in downstream velocity due to valve closure

Page 11: Waleed Ishaque - 2011 Thesis final copy.pdf

6

Assuming negligible change in density due to compression such that , and by

continuity equation 2.4 becomes

, which by further simplification is

…………………………………………………………………… 2.5

If the sum of forces acting on the CV is , then equation 2.5 becomes

Assuming

Since

……………………………………………………………………………. 2.6

Equation 2.6 is the famous Joukowsky equation that dictates the basic water hammer theory due

to sudden reduction in velocity. To determine the wave speed in the Joukowsky equation,

assume compressible fluid but rigid pipe such that with CV outflow density of

and by conservation of mass the following computations are carried out:

, when simplified,

Assuming

Substituting bulk modulus

But as seen in the derivation of equation 2.6, , by which:

…………………………………………………………………………………. 2.7

The Joukowsky equation is suitable for determining instant valve closure situations where fluid

compressibility effects are no longer valid. Fluid compressibility is accounted for in the wave

speed equation by the fluid bulk modulus that dictates quantity of compression under certain

pressure.

Page 12: Waleed Ishaque - 2011 Thesis final copy.pdf

7

2.4 Summary

This chapter discusses two fundamental water hammer theories: Rigid Water Column theory and

Joukowsky equation. Due to the absence of bulk modulus and assumptions of negligible

compressibility effects Rigid Water Column theory is suitable only for uniform valve closure

operations. Whereas the Joukowsky equation accommodates for the compressibility effect in

instant valve closures using the wave speed which is influenced by the bulk modulus of the fluid

Page 13: Waleed Ishaque - 2011 Thesis final copy.pdf

8

Chapter 3 Transient Flow Differential Equations

3.1 Introduction

In our discussion on the Joukowsky equation and Rigid Water Column theory, friction losses and

conduit elasticity were neglected. To develop a general case of fluid transient, pipe elasticity and

friction losses are taken into account. Once again, Newton’s second law and conservation of

mass is used to develop the equation of motion and the equation of continuity.

3.2 Equation of motion

Consider a pipe segment with a fluid flow CV as shown in Figure 3. Assume the flow through

the pipe is uniform over the cross section, flow is one-dimensional and pipe is linearly elastic. In

Figure 3a distance x, discharge Q, piezometric head H, and flow velocity V are positive in the

downstream direction.

In the free body diagram of Figure 3b the sum of forces in the x-axis is

……………………………………………………………………… 3.1

Where and are forces due to pressure and is shear force on the control volume due to

friction in the pipe. Since the piezometric hear H dictates the pressure on the CV:

Figure 3. CV for equation of motion

Page 14: Waleed Ishaque - 2011 Thesis final copy.pdf

9

……………………………………………………………………….... 3.2

……………………………………………………………… 3.3

Where is specific weight of the fluid and is the cross sectional area of the pipe.

Head loss due to friction is given by Darcy-Weishbach equation is

This friction head loss is related to shear force by which gives:

…………………………………………………………………………… 3.4

Substituting 3.3, 3.4 and 3.4 into 3.1 yields:

………………………………………………………... 3.5

Since the control volume will accelerate during a transient caused by a change in operating

conditions such as valve closure:

……………………………………………………………………….. 3.6

Substituting equation 3.6 into equation 3.5 and dividing by results in:

……………………………………………………………………. 3.7

Taking the total derivative:

…………………………………………………………………………… 3.8

Substituting equation 3.8 into equation 3.7 yields:

…………………………………………………………... 3.9

It is shown later in Chapter 4 that

is very small compared to

. By neglecting

and

multiplying by area equation 3.9 becomes:

…………………………………………………………...... 3.10

Equation 3.10 is the fundamental water hammer motion equation.

Page 15: Waleed Ishaque - 2011 Thesis final copy.pdf

10

3.3 Equation of continuity

Consider a pipe segment as shown in Figure 4. The pipe wall thickness is e and is assumed

linearly elastic. If the flow through this pipe is in a transient state then the volume inflow and

volume outflow equations are as follows:

…………………………………………………………………………….... 3.11

……………………………………………………………….. 3.12

Change in volume due to conduit radial expansion or contraction

During a transient there is a change in fluid volume during the duration . This change in

volume is due to the pressure rise and drop during the transient wave motion through the pipe.

By this volume change, the conservation of mass dictates:

∆ Fluid Volume in transient+∆ Volume inflow= ∆Volume of conduit …………………. 3.13

Subtracting equation 3.11 and equation 3.12 yields:

∆ Fluid Volume in transient,

……………………….…………... 3.14

is due to the differential of pressure with respect to time during duration .

Consequently this pressure change causes the fluid element length to change which

causes the pipe to elastically deform in the radial direction as seen in Figure 4. To determine the

change in volume due to the radial expansion or contraction, change in hoop stress of the

conduit will be calculated to determine the change in radius

Figure 4. CV for Equation of Continuity

Page 16: Waleed Ishaque - 2011 Thesis final copy.pdf

11

……………………………...…………………………………………… 3.15

Change in strain due to :

…………………………………………………………………………………... 3.16

By using the young’s modulus relationship and substituting equation 3.15 and

equation 3.16 into it:

……………………………………...……………………………………… 3.17

Solving for :

…………………………………………………………………………… 3.18

Change in volume due to the radial expansion or contraction is given by:

…………………………………………………………………………. 3.19

Substituting equation 3.18 into equation 3.19:

…………………………………………………………………….. 3.20

Change in volume due to compression or expansion of fluid

It is known that the compressibility of a fluid is determined by the bulk modulus K which defines

the change in the volume due to a change in pressure :

……………………………………………………………………………… 3.21

Substituting equation 3.21 into the initial fluid volume

……………………………………………………………………. 3.22

So far equations for change in volume due to compression or expansion of the fluid and radial

dimension of the conduit are derived. Therefore, by combination of mass conservation equations

:

……………………………………………………………………….. 3.23

=

…………………………………….. 3.24

=

……………………………………………………………………... 3.25

Page 17: Waleed Ishaque - 2011 Thesis final copy.pdf

12

Consider the definition of wave speed in an elastic pipe:

…………….……………………………………………………………… 3.26

Rearranging terms and substituting equation 3.16 and , equation 3.25 becomes:

…………………………………………………………………………... 3.27

Equation 3.27 is the fundamental water hammer continuity equation.

3.4 Summary

In this chapter Newton’s second law and conservation of mass are used to develop transient

equations of motion and continuity. Motivation to derive these equations is to demonstrate how

affects of fluid compressibility and conduit elasticity are accounted for during hydraulic

transients. These two equations dictate the behavior of fluid when it is in a transient state caused

by a change in upstream or downstream flow conditions. During a specific time period, solution

of the equations indicates at a particular point in a pipeline what flow and head conditions the

pipeline experiences. Solution to the fundamental equations is discussed in the following chapter.

Page 18: Waleed Ishaque - 2011 Thesis final copy.pdf

13

Chapter 4 Solution of Transient Flow Differential Equations

4.1 Introduction

In Chapter 3 the continuity and dynamic equations are derived, equation 3.27 and equation 3.10

respectively. To make these equations useful for transient analysis, solutions with given

boundary conditions must be found. Analytical solution is briefly discussed followed by a

numerical solution which is the focus of this paper.

4.2 Analytical solution using d’Alembert’s method

Parmakian (1958) used graphical method to model water hammer. To describe this method

consider simplified versions of continuity and dynamic equations without the friction terms:

…………………………………………………………............................ 4.1

……………………………………………………………………....... 4.2

Taking partial derivative of equation 4.1 with respect to x and y:

…………………………………………………………………………. 4.3

………………………………………………………………………… 4.4

Taking partial derivative of equation 4.2 with respect to x and y:

……………………………………………………………………... 4.5

……………………………………………………………………… 4.6

Subtracting equation 4.3 from equation 4.6 and equation 4.4 from equation 4.5 yields two partial

derivative equations in the form of classic one-dimensional wave equation:

…………………………………………………………………………. 4.7

………………………………………………………………………… 4.8

Using d’Alembert’s method, general solution of the one-dimensional wave equation is:

………………………………………………………... 4.9

Page 19: Waleed Ishaque - 2011 Thesis final copy.pdf

14

In equation 4.9 and are arbitrary functions. To understand how this is applicable to water

hammer analyses, consider a wave travelling with velocity in the (space, time) plane. A

moving observer with a velocity sees the travelling wave as stationary. Thus to an observer the

wave described initially at at remains unchanged as time increases, i.e., is a wave

propagating to the right at speed . The argument is the moving time

coordinate which takes a snapshot of the wave at a specific location.

Similarly is a wave prorogating to the left with velocity a. The lines t – x/a are called the

characteristic lines along which the wave propagates.. Hence the wave equation solution implies

that at time at a point in the pipe with coordinate x, the head rise is equal to the sum of

travelling pressure waves, namely and . See Figure 5 for a visual representation of the

wave equation functions

Earlier, in deriving the fundamental water hammer motion equation, it was assumed that

is

very small compared to

. It was just shown that

and

are pressure waves

travelling with velocity inside the pipe in the and – direction, respectively. It was defined

that , which implies .

Then

Usually in a pipe the ratio of fluid velocity and wave speed V/a is of the order 1/100. Thus the

term

by its definition shown above is negligible.

4.3 Numerical solution using method of characteristics

The two fundamental water hammer equations of continuity and motion are hyperbolic and are

commonly solved using numerical analysis. Classical water hammer text book by Streeter and

Figure 5. Wave equation representation (Parmakian, 1958)

Page 20: Waleed Ishaque - 2011 Thesis final copy.pdf

15

Wylie (1978) demonstrates the Method of Characteristics to numerically solve the water hammer

differential equations. Chou (2009) describes Method of Characteristics as a mathematical

technique used to solve first order Partial Differential Equations. For instance, the function

of two independent variables and has a solution that defines a surface above the

plane. Numerical solution of such a function is possible through the Methods of Characteristics

where a relationship between and is established such that along the characteristic curve

the function is simplified. The characteristic curve is a propogation or a trajectory

that travels through plane. By finding for each infinite number of the characteristic

curves , on the plane is numerically determined.

When applying Methods of Characteristics to the water hammer equations, the characteristic

curve is similar to the function

discussed above in the analytical solution; the only

difference is that in Methods of Characteristics the characteristic curve is on the independent

plane where as in the graphical method the characteristic curve

is on the

dependent plane.

4.4 Summary

This chapter discusses the analytical and numerical solution to transient fluid equations of

continuity and motion. The purpose of discussing the analytical solution was not to encourage its

use but rather to show that term

in equation 3.9 is negligible hence validating the

assumption. Numerical method and the analytical solution share the same fundamental idea that

a characteristic pressure wave travels along a defined path at a known speed. This defined path is

called the characteristic curve and along this curve the transient equations have solutions that are

numerically calculated. The Method of Characteristics is further explored in the next chapter.

Page 21: Waleed Ishaque - 2011 Thesis final copy.pdf

16

Chapter 5 Method of Characteristics

5.1 Introduction

Method of Characteristics established a relationship between and such that along the

characteristic curve the function is simplified. The characteristic curve is a

propogation or a trajectory that travels through plane. By finding for each infinite

number of the characteristic curve , on the plane is numerically found. The

following section derives the equation for characteristic curve and develops equations that are

solved numerically along the characteristic curve

5.2 Characteristic curve equation

Method of Characteristics solves equations on a characteristic curve and to derive its equation

let’s start by stating the dynamic and continuity equation as L1 and L2 respectively which as per

Wiley and Streeter (1978) are a pair of quasilinear PDEs:

(Dynamic Equation)………………………….…….…… 5.1

(Continuity Equation)…………………………………………….. 5.2

The two equations are combined linearly using an arbitrary multiplier (Wiley and Street, 1978)

.Substituting equations and rearranging the combination yields:

………………………………...… 5.3

If the independent location variable is a function of time and both and are also a function

of and then by taking the total derivative of and the following is obtained

(Wiley and Streeter, 1978):

………………………………………………………………………...... 5.4

…………………………………………………………………………. 5.5

Comparing equation 5.5 and equation 5.4 with equation 5.3, it is noted that if

…………………………………………………………………………….. 5.6

Then equation 5.3 becomes an ordinary differential equation (Wiley and Streeter, 1978)

Page 22: Waleed Ishaque - 2011 Thesis final copy.pdf

17

………………………………………………………………….. 5.7

Also, equation 5.6 has two solutions

which when substituted back in the equation show:

…………………………………………………………………………………. 5.8

Wiley and Street (1978) explain that equation 5.8 shows that the position of a wave is related to

the wave propagation velocity . Therefore, it is established that equation 5.7 is an ODE only if

, the characteristic curve along which the ODE has solutions.

5.3 Compatibility equations

Since there are two solutions of

, there are two cases of ODE’s: one positive and the other

negative. The two pairs are identified as Characteristic Equations and are grouped into positive

and negative compatibility equations C+ and C

- (Wiley and Streeter, 1978)

C+

C-

By applying the Method of Characteristics a relationship exists such that equation 5.11 and 5.9

are only valid when equation 5.12 and 5.10 are satisfied, respectively. This relationship

simplifies the dynamic and continuity equations into ordinary differential equations in the

independent time variable which is solved using finite difference. Chaudhry (1979) explains

that equation 5.10 and equation 5.12 are two straight lines with slopes on the plane

as shown in Figure 6:

………………………………………………………….. 5.9

……………………………………………………………………….. 5.10

………………………………………………………….. 5.11

……………………………………………………………………….. 5.12

Figure 6. Characteristic lines in x-t plane (taken from Chaudhry 1979)

Page 23: Waleed Ishaque - 2011 Thesis final copy.pdf

18

The two characteristic lines AP and PB in Figure 6 physically represent the pressure waves that

travel from point A to point P in time and similarly from point P to B.

5.4 Summary

This chapter derives the equation for characteristic curve and shows that the position of a wave is

related to the wave propagation velocity i.e.

. Along the characteristic curve there are

two solutions that are known as the compatibility equations 5.9, 5.10, 5.11, and 5.12. These

equations are imagined as two pressure waves coming from opposite directions that meet along

the characteristic curve.

Page 24: Waleed Ishaque - 2011 Thesis final copy.pdf

19

Chapter 6 Solution of Characteristic Equations

6.1 Introduction

In the previous chapter the fundamental continuity and dynamic PDEs were transformed into a

pair of compatibility equations C+ and C

- using the Method of Characteristics.

C+

C-

Equations 6.2 and 6.4 are straight lines, one with a positive and other with a negative slope of .

These slopes are the characteristic lines along which equations 6.1 and 6.3 have solutions (Wiley

and Streeter, 1978). The following section discusses finite difference solutions of the

compatibility equations C+ and C

- .

6.2 Finite difference solution

Superimposing the plane on a pipeline of length divided into N intervals, characteristic

lines on an grid are shown in Figure 7:

………………………………………………………….. 6.1

……………………………………………………………………….. 6.2

………………………………………………………….. 6.3

……………………………………………………………………….. 6.4

Figure 7. grid on a single pipeline; taken from Wiley and Streeter (1978)

Page 25: Waleed Ishaque - 2011 Thesis final copy.pdf

20

The purpose is to find the unknown velocity and head variables and at point P. To determine

unknown velocity and head, boundary conditions must be known at points A and B. For the

purpose of derivation, let’s assume the boundary conditions (discussed in the next chapter) at

time in Figure 7 are known. In a pipeline conditions at represent initial steady-state

conditions. As the time increases by , more points on the grid are known which then

become the initial conditions for the next time step. Going back to Figure 7, flow and head

values conditions at point P i.e. at are calculated using finite difference along the

characteristic lines and (Chaudhry, 1979). Therefore, head and flow equations along the

positive characteristic line are:

…………………………………………………………………………… 6.5

…………………………………………………………………………… 6.6

Equations along the negative characteristic line are also formed using finite differences:

…………………………………………………………………………… 6.7

…………………………………………………………………………... 6.8

Multiplying compatibility equations 6.1 and 6.3 by and converting velocity into

flow by dividing the equations with pipeline area followed by substitution of finite difference

flow and head equations:

……………………………………… 6.9

……………………………….……... 6.10

Solving for :

C+: ………………………………………………... 6.11

C-: ………………………………………………... 6.12

Where and

Equations 6.11 and 6.12 are algebraic relations that govern the head and flow in a pipeline during

a transient. Referring to Figure 7, numerical solution of a transient problem starts by first

determining flow and head values at time i.e. steady-state conditions where and

values are known or determined. Once steady-state conditions are found compatibility

equations 6.11 and 6.12 are simultaneously solved to determine interior points (P on Figure 7) in

Page 26: Waleed Ishaque - 2011 Thesis final copy.pdf

21

the same time step. Equations 6.11 and 6.12 are simplified for aid in programming (Wiley and

Streeter, 1978):

C+:

…………………………………………………………………….. 6.13

C-:

…………………………………………………………………….. 6.14

Where and are constants in each time step and have the following equations:

……………………………………………………... 6.15

…………………………………………………….. 6.16

By elimination of from equations 6.13 and 6.14:

……………………………………………………………………………… 6.17

Once is found, using equations 6.13 or 6.14

is calculated. Here the subscript is any

point on the x-axis of characteristic grid in Figure 7. Subscripted head and flow values are

the known conditions in a time step that are used to determine the next incremental conditions

subscripted by P within the same time step. However, in Figure 7, it is observed that to solve a

time step on the grid, conditions on the left and right extremes of the graph at are

required. A clear explanation is shown in Figure 8 where point P on the extreme left and right of

the grid are required to complete the grid solution. Theses extremes can represent pump and

valve conditions in a pipeline.

6.3 Summary

By determining solution of C+ and C

- on the characteristic lines , finite difference

solution of the compatibility equations is developed. In this chapter it is mentioned that boundary

conditions are required to complete the grid solution in a time step. These boundary conditions

can be pumps and valves in a typical industry application. Several boundary conditions along

with their equations are discussed in the next chapter.

Figure 8. Characteristics at boundaries (Wiley and Streeter, 1978)

Page 27: Waleed Ishaque - 2011 Thesis final copy.pdf

22

Chapter 7 Boundary Conditions

7.1 Introduction

The characteristic grid on the plane contains the flow and head values at each interior point

P of the pipeline. However to determine the behavior of fluid within the pipeline information on

each end i.e. boundary must be known. A typical example of pipeline boundary condition is an

upstream pump and a downstream valve. In this chapter, boundary equations for pump and valve

are developed along with other typical boundary conditions. Each boundary equation is solved

independent of interior points and other boundary equations (Wiley and Streeter, 1978).

As seen in Figure 9 the boundary conditions have influence on the interior sections. For this

reason boundary head and flow conditions are calculated before the interior points. The

following section discusses several typical boundary condition equations.

Figure 9. Developed Characteristic Grid (Chaudhry, 1979)

Page 28: Waleed Ishaque - 2011 Thesis final copy.pdf

23

7.2 Boundary conditions

Fluid in a pipeline is controlled by equipment installed in upstream and downstream directions.

The most common is a reservoir which supplies sufficient head for the flow to reach a particular

point in the downstream where the travelling fluid may see a control device such as a valve.

These upstream and downstream conditions control the fluid behavior within the pipeline and are

thus called boundary conditions.

Reservoir at upstream end

Assuming the elevation of the reservoir does not change during transients the flow and head

boundary conditions are simply:

………………………………………………………………………………… 7.1

……………………………………………………………………………. 7.2

Here the subscript indicates that the head value is on the first interval of pipeline i.e. left

boundary of the characteristic grid, Figure 8.

Pipe closed at the downstream end

With the pipe closed at its end, there is no flow:

………………………………………………………………………………..... 7.3

By downstream boundary compatibility equation 6.13:

………………………………………………………………………………. 7.4

Because is the total number of pipe intervals, here the subscript represents the end of the

pipe on the characteristic grid.

Valve at downstream end

Valves are control devices that allow flow control in a pipeline. Typically valves offer a

complete range of open and close positions. Using Bernoulli principle the flow through the valve

at the elevation of datum is written as:

…………………………………………………………………… 7.5

Subscript indicates steady state conditions. Here the coefficient of discharge represents flow

loss due to the valve internal characteristics. is typically provided by valve manufactures.

Page 29: Waleed Ishaque - 2011 Thesis final copy.pdf

24

Equation 7.5 represents flow through a valve at its initial position; equation 7.6 represents flow

conditions across the valve for its new position:

……………………………………………………………………… 7.6

Here represents the instantaneous change in hydraulic grade line across the valve after its

position is changed i.e. change in opening size. To represent the valve opening with a

comparative ratio of initial and final position define :

………………………………………………………………………………. 7.7

To incorporate this ratio into the boundary condition, divide equation 7.6 by equation 7.5

…………………………………………………………………….… 7.8

With proper subscripts representing end of pipe boundary conditions:

…………………………………………………………………….. 7.9

Because represents the valve opening ratio, a fully closed valve has representing no flow

condition whereas represents steady conditions. Solving equations 7.9 and 6.13

simultaneously yields:

…………………………………………………….. 7.10

where . With

calculated, is determined from the downstream

compatibility equation 6.13.

Constant speed centrifugal pump at upstream end

A centrifugal pump is described through the pump head-discharge curve. A typical centrifugal

pump operates at the Best Efficiency Point which depends on the system requirements. Pump

speed is dictated by how much resistance the motor sees i.e. if the pump is supplying an empty

line with no head, pump motor sees minimum head and will supply maximum flow and run at

maximum revolutions per minute (rpm). Sufficient head must exist in the discharge line for the

pump to operate at the Best Efficiency Point to avoid pump dry out.

Page 30: Waleed Ishaque - 2011 Thesis final copy.pdf

25

With data points from pump curve, head and discharge rates are related to each other for use in

boundary conditions. Wiley and Street (1978) use an analytical equation to describe pump

characteristic curve.

…………………………………………………………… 7.11

Where is the pump shut-off head and and are constants that describe the pump curve.

These constants are calculated using two points from a known pump running head and discharge

values. As in any other boundary condition, equation 7.11 and the upstream compatibility

equation 6.14 are simultaneously solved to get,

…………………………………...... 7.12

is determined by substituting the calculated

into equations 7.12 or 6.14.

Linear rate centrifugal pump start-up at upstream end

Water systems with safety functions, e.g. fire water, remain poised and are started up on demand.

During pump-startup, depending on the steady-state conditions of the pipeline, transients may

occur due to surge. If a linear pump motor startup speed is assumed, pump speed ratio is

defined as the ratio between the time increment and time for the pump to reach its rated speed.

……………………………………………………………………………...…. 7.13

Where is the instantaneous time on the characteristic grid and is the time it takes the

pump to reach its rate speed or rpm. Wiley and Streeter (1978) state equation 7.14 for pump

curve related to the speed ratio:

………………………………………………………. 7.14

It should be noted that if (constant pump speed) then equation 7.14 becomes 7.11 which

describes a constant speed pump head-discharge curve. Simultaneously solving equations 7.14

and 6.14, pump discharge boundary equation 7.15 is developed:

………………………………………………. 7.15

is determined by substituting calculated

into equations 7.15 or 6.14

Page 31: Waleed Ishaque - 2011 Thesis final copy.pdf

26

Trapped air volume

In some system configurations, often there is an air pocket trapped in the pipe. To simplify the

analysis compressibility of the liquid in the pipe is considered negligibly smaller than that of the

air pocket. The air is assumed to behave like a polytropic gas that obeys the relation

………………………………………………………………………………... 7.16

where is the absolute head , is the gas volume, is the polytropic exponent of the

thermodynamic process and is a constant. When the air volume is small compared to the

volume of water in system, the process may become isothermal and an value of 1 is assumed.

However, ,commonly, an average value of 1.2 is used for in analysis.

In equation 7.16 is the sum of three pressure heads, gauge , barometric and pipe height

. The initial volume is used to define compressed volume for all time increments and

equation 7.17 is developed that combines the three pressure heads:

……………………………………………………. 7.17

Equation 7.17 and the upstream compatibility equation 6.15 are solved simultaneously to obtain

a new nonlinear equation 7.18 with the variable :

………………………………. 7.18

To determine Wiley and Streeter (1978) suggest using the Newton’s method which uses the

expression

. Substituting equation 7.18 into this expression and simplifying it

generates:

…………………………………………….. 7.19

Equation 7.19 calculates

which is used to determine with equation 7.20:

…………………………………………………………………………… 7.20

At each time step, is then calculated using the relationship in equation 7.21:

…………………………………………………………………………… 7.21

Page 32: Waleed Ishaque - 2011 Thesis final copy.pdf

27

Pipe Junction

In complex fluid systems, the fluid travels through pipes which eventually connect and divert

into other pipes from a junction. To model a junction, additional boundary conditions are not

required. Instead, equations of continuity are used to relate downstream and upstream flows of

different pipes. To develop the continuity equation, minor losses in the junction are neglected

and a common head is assumed i.e. the downstream head at pipe 1 and 2 is equal to upstream

head at pipe 3 and 4.

Writing the upstream compatibility equations for pipe 1 and 2, and writing the upstream

compatibility equations for pipe 3 and 4 with the flow subject of the formula:

……………………………………………………………………… 7.22

……………………………………………………………………… 7.23

…………………………………………………………………….. 7.24

…………………………………………………………………….. 7.25

Observing Figure 10, the continuity equation is written as follows:

………………………………..……………………. 7.26

Substituting equations 7.22 to 7.25 into 7.26 and rearranging the equation 7.27 for the common

head :

…………………………………………………………………… 7.27

Figure 10. Pipe Junction (taken from Wiley and Streeter (1978))

Page 33: Waleed Ishaque - 2011 Thesis final copy.pdf

28

7.3 Summary

This chapter discusses the boundary conditions that are used in a case study that is analyzed in

chapter 9. The idea of developing a boundary condition is to setup the characteristic grid that

communicates the head and velocity information across the pipeline. The boundary conditions

dictate how the pressure and discharge behave during the time of simulation. In the next chapter,

typical system configurations are modeled and their results are discussed.

Page 34: Waleed Ishaque - 2011 Thesis final copy.pdf

29

Chapter 8 Typical System Configurations Analyzed

8.1 Introduction

An understanding of modeling transients using the Method of Characteristics is now established.

In this chapter, typical system configurations are modeled and their results are discussed.

8.2 Water tank with a downstream valve

A simple system consisting of a water tank with a gate valve in downstream is a common

configuration in water systems. MATLAB code for both cases of gate valve opening and closing

was considered.

Sudden operation of valves can cause transients in a system as simple as a water reservoir

discharging to atmosphere. Gate valves are either closed or opened and for either operation a

MATLAB code (see Appendix A) was developed to simulate transients.

Comparing Figure 12 and Figure 13, it is observed that when valve is opened rapidly (25% per

second) the local pressure head oscillations at the gate valve are of high amplitude. Whereas in a

slow opening (2.5% per second) operation the pressure oscillations still exist but are not as

severe. A direct affect of the pressure oscillations is the formation of voids around the valve

wedge which can cause pitting leading to accelerated wear.

Figure 11. Water tank with a downstream valve

Page 35: Waleed Ishaque - 2011 Thesis final copy.pdf

30

.

Figure 12. Gate valve opening at 2.5% per second

Figure 13. Gate valve opening at 25% per second

Page 36: Waleed Ishaque - 2011 Thesis final copy.pdf

31

The second mode of operation for a valve is closure. Transients in a rapid closure are more

severe than in the case of valve opening. Comparing Figure 14and Figure 15, it is observed that a

rapid closure of valve can induce pressure peaks double the head supplied by the reservoir.

Whereas a slow valve closure induces pressure peaks 10% higher than the supply head.

Figure 14. Gate valve closing at 10% per second

Figure 15. Gate valve closing in one second

Page 37: Waleed Ishaque - 2011 Thesis final copy.pdf

32

8.3 Pump with a downstream valve

A common device to provide fluid flow is a centrifugal pump. A pump behaves according to the

performance curve which dictates the pressure at certain flow supplied by the pump. When a

pump sees the low resistance in a pipeline its flow rate continues to increase until the pump dries

out of fluid. On the other hand, when pump sees a high resistance its flow rate decreases and

pressure head increases until it reaches the shutoff head at which the pump turns off.

MATLAB code (see Appendix A) was developed to observe system behavior of a pump with a

downstream gate valve. The code solves the transient equations for a pump start up. Typically in

a pump startup boundary condition, inertial effects are neglected unlike in a pump failure

situation where reverse flow and pump motor rotation plays a significant role in transient

behavior. Figure 17 shows how a pump behaves when the gate valve is ultimately closed and the

head at the pump increases until it shuts off at the shutoff head value of 140 meter.

.

Figure 16. Pump with a downstream valve

Figure 17. Pump Startup with downstream valve closing at 20 seconds

Page 38: Waleed Ishaque - 2011 Thesis final copy.pdf

33

Figure 18 shows the pump behavior when the gate valve is started to open at 30 seconds into the

simulation. The pressure fluctuations are not severe but still exist due a change in resistance in

pipeline.

Figure 18. Pump Startup with downstream valve opening at 30 seconds

Page 39: Waleed Ishaque - 2011 Thesis final copy.pdf

34

8.4 Pump with a downstream air pocket

Keeping a pipeline air tight can sometimes be a challenge if the system is continuously tested for

flows. A simple configuration of a pump and a downstream air pocket in a vertical line was

analyzed for transient conditions. The MATLAB code (see Appendix A) simulates a pump

startup and compares transients caused by different sized air pocket heights. Figure 20 to Figure

23 show results from the MATLAB code (see Appendix A) with different air pocket heights and

a constant horizontal pipe length of 100m.

A general observation from the results of air pocket simulation is that transients become severe

as the air pocket volume decreases. Comparing the graphs of flow discharge at the air pocket and

volume of air pocket it is evident that as water flows away from the air pocket the volume of air

pocket increases due to air expansion. The reverse flowing water then also affects the pump flow

as seen in the graph of flow discharge variation at the pump.

Figure 19. Pump with a downstream air pocket

Page 40: Waleed Ishaque - 2011 Thesis final copy.pdf

35

Figure 20. Pump startup with downstream air pocket of 10m height

Page 41: Waleed Ishaque - 2011 Thesis final copy.pdf

36

Figure 21. Pump startup with downstream air pocket of 5m height

Page 42: Waleed Ishaque - 2011 Thesis final copy.pdf

37

Figure 22. Pump startup with downstream air pocket of 1m height

Page 43: Waleed Ishaque - 2011 Thesis final copy.pdf

38

Figure 23. Pump startup with downstream air pocket of 10 cm height

Page 44: Waleed Ishaque - 2011 Thesis final copy.pdf

39

8.5 Summary

This chapter presents the results of MATLAB simulations of simple system configurations of

upstream pump and head reservoir combined with downstream valve and air pocket. From

results of transient simulations, it was observed that valve opening causes non-significant

transients compared to a rapid valve closure. However, when opening a valve at 20% per second

the transient pressure oscillations were twice as much as opening a valve at 2.5% per second.

Also, results from the air pocket simulation show that transients are less sever for a larger

volume air pocket.

Page 45: Waleed Ishaque - 2011 Thesis final copy.pdf

40

Chapter 9 Case Study

9.1 Introduction

Up to this point the paper has established background on the physical fundamentals of hydraulic

transients, developed the governing equations of transient analysis, discussed in detail the

Methods of Characteristics and boundary conditions. Utilizing these developments, this chapter

uses the method of characteristics to analyze the Emergency Water System (EWS) at Ontario

Power Generation, Pickering Nuclear Station.

9.2 Emergency water system

EWS is a safety system that is credited for supplying cooling water to critical reactor

components during a seismic event when all primary and backup systems have failed. Because

EWS is a poised system, it is tested to check for availability and perform maintenance if

degradation is observed.

For a safety system it is critical for a start-up to take place as soon as possible following an

accident. With this intent, a downstream valve on the 16 inch vertical line was proposed to be

left open to save approximately 12 minutes of the start-up time during an emergency start-up.

However, by leaving the valve open, an air pocket is introduced in the 9.0 meter vertical line

where the valve is located. Figure 24 shows the top view and side view of the simplified EWS

configuration. For confidentiality purposes the actual drawings are not shown here and valve

numbers are changed.

Figure 24. Simplified Emergency Water System

Pipe 7

Page 46: Waleed Ishaque - 2011 Thesis final copy.pdf

41

9.3 MATLAB model of EWS

Using the Method of Characteristics, MATLAB code (see Appendix B) was developed to

simulate the simplified EWS. Significant challenges were faced with regards to stability of code.

With parallel pump boundaries, multiple junctions and air pocket in the downstream, the

traditional Method of Characteristics starts to show limitations. To mitigate the issue of

instability the wave speed was reduced to 500m/s and pipe length increased to 100m between

each boundary. Another alternative to make the code more stable is to use robust boundary

conditions for pumps and air pockets. State of the art modeling techniques have been developed

which may have been useful for modeling a system such as the EWS. However, due to time

constraints, advance modeling techniques were not perused. Rather, code instability was

mitigated by modeling the parallel pumps to start at the same time as if a single pump. With

pumps starting up in sequence, code was unable to perform stably. This was discovered after the

code was developed.

The existing code successfully demonstrates the EWS with a single pump or parallel pumps

starting up together. Two models were evaluated, one with throttle valves V-1 and V-2 opening

in 5 seconds and the other opening in 15 seconds. In the following section graphs from the

MATLAB code (see Appendix B) are shown.

Page 47: Waleed Ishaque - 2011 Thesis final copy.pdf

42

9.4 Results

Figure 25. Transients at the Pump 1 and Throttle Valve 1 opening in 5 seconds

Figure 26. Transients at Pump 2 and Throttle Valve 2 opening in 5 seconds

Page 48: Waleed Ishaque - 2011 Thesis final copy.pdf

43

Figure 27. Transients at junction 1 and 2 of the simplified EWS

Figure 28. Transients at the test nozzle (relief valve) and between junction 1 and junction 2

Page 49: Waleed Ishaque - 2011 Thesis final copy.pdf

44

Figure 29. Transients at the air pocket downstream of junction 2

Figure 30. Transients at junction 1 and 2 of the simplified EWS with throttle valves opening in 15

seconds

Page 50: Waleed Ishaque - 2011 Thesis final copy.pdf

45

9.5 Discussion

Observing Figure 27, junction 1 and 2 of the simplified EWS experience significant pressure

oscillations of an average 100 kPa. Though not severe, these oscillations showcase the danger

of having air trapped in system. To understand the affect of air in a system, the downstream air

pocket in EWS is replaced by a dead end and modeled in MATLAB.

Comparing Figure 31 and Figure 25 in the last 20 seconds of simulation, the transients in EWS

without air pocket are smooth unlike the sever oscillations in the EWS with air pocket. Air

pocket causes severe oscillations due to high sudden accelerations the fluid experiences as it

encounters the air pocket. Decreasing the air pocket volume has shown to worsen the transients

due to the loss of dampening effect air has on the fluid. Effect of decreasing air pocket volume is

observed through Figure 20 and Figure 23.

Also, comparing Figure 27 and Figure 30, it is observed that transient pressure peaks are lower

when the valves are opened slowly (in 15 seconds). This is consistent with the earlier results

from a simple pump and valve configuration model shown in Figure 16.

Figure 31. Transients in Junction 1 and Junction 2 of EWS (without an air pocket in dead-end)

Page 51: Waleed Ishaque - 2011 Thesis final copy.pdf

46

9.6 Recommendations

The downstream air pocket causes minor oscillations in junctions 1 and 2 of the simplified EWS.

The affect of air pocket is not so significant due to its large volume. While performing flow test

on EWS the downstream air pocket line must be checked for any opened or leaking valves.

Research has shown that transients are severe when the trapped air is allowed to release through

a nozzle (Martino. G. D et al, 2008).

Also, the effect of valve opening rate is not the dominating factor in the transients. Only at an

opening rate of 5 seconds the transients start to get worse. In EWS the throttle valves are 18 inch

gate valves which take approximately 200 turns to fully open. Leaving the valves fully open will

affect the steady state performance of the pumps during startup. With initial throttling the pumps

will remain at the best efficiency point and as the system is filled valves can be opened

gradually. However, throttling of gate valves for extended periods is not recommended since the

transient waves passing through will causing cavitation and pitting of valve. Overtime, valves

may degrade and must be inspected for internal damage.

Overall, by comparing the two EWS models with dead end and air pocket in the downstream, it

is observed that the large volume of air amplifies the transients by 20 kPa and only towards

the end of simulation when the system is filled with water. Therefore it is safe to perform the

system flow test with the downstream valve V-3 left open, provided test nozzles are open to

allow relief flow to the lake.

Page 52: Waleed Ishaque - 2011 Thesis final copy.pdf

47

Chapter 10 Overview

10.1 Introduction

This paper does not aim to provide expert opinion on hydraulic transients; however, through the

results of previous chapters, the goal is that the technical reader will gain a different point of

view on water systems. Often systems are designed without putting thought into how water

“feels” as it goes through it. Questions a design engineer must ask can vary depending on the

system. But using the example of sudden valve closure, an engineer should realize that flowing

water when suddenly stopped experiences forces much greater than what human experiences in a

high speed car crash. This chapter will discuss some design implementations that can mitigate

transient affects by essentially understanding water behavior. In essence a system should achieve

a balance in how it wants the water to behave and how water wants to behave by itself.

10.2 Common transient system failures

In previous chapters, specific system configurations with a combination pump startup, valve

operation, dead end and air pocket were modeled. These specific configurations were considered

to build an understanding of the OPG EWS system configuration and simplify its model.

However, to develop a broader understanding of transients in water systems, consider the

following system failures or consequences of transients (Pejovic et al, 1987):

1. Maximum pressure: Results from chapter 8 and 9 show that pressure oscillations can be

10 times that of the operating conditions. These pressure oscillations can damage the pipe

and yield the material to the point of rupture.

2. Vacuum: Oscillating pressure waves can cause vacuum conditions similar to the ones

following drainage of pipeline. Air inlet valves must be located at the high points of

pipeline. Vacuum conditions can be sufficient to collapse a thin walled pipeline.

3. Cavitation: As the local pressure drops below water vapor pressure during a transient,

vapor bubbles or voids start to form. Eventually these voids are collapsed due to adjacent

water molecules. The sudden collapse of voids causes a pressure surge that causes

vacuum and high peak pressures.

4. Hydraulic vibrations: Transients in a system at different locations can influence each

other leading to vibrations approaching the natural frequency of the network i.e.

Page 53: Waleed Ishaque - 2011 Thesis final copy.pdf

48

resonance frequency. Resonance is capable of destroying the entire network. Naturally, it

is extremely expensive to design pipe systems that can withstand resonance; therefore, it

is best to carefully model different transient scenarios and observe their influence on the

system.

10.3 System protection

A systematic methodology must be used when designing or analyzing fluid systems. Detecting

transients in an early stage is crucial to avoid system failures. The flow chart below lays out a

comprehensive guideline to control transients in a water distribution system:

Figure 32. Flowchart for surge control in water distribution systems (Boulos. P.; et al, 2005)

Page 54: Waleed Ishaque - 2011 Thesis final copy.pdf

49

10.4 Conclusion

Transient flow is an intermediate condition between two steady-state conditions. Transients are a

form of communication for one end to tell the other end that a change has been made. This

communication takes place in a form of a pressure wave. Often this pressure wave is too high for

the pipe and it may be capable of causing failure.

The most important aspect of hydraulic transient modeling is to gain a point of view of flowing

water in a network of pipes. “A hydrologic engineer is a water psychologist who makes water

behave by his will while also respecting its own”, (Karney. B, 2011). Expanding on this

statement, transient analysis is a tool for the water psychologist.

The intent was to explore the fundamentals of transient analysis and apply them to an industry

case. Though the analysis is complex it provides meaningful insight into the system as it goes

through changes. A comprehensive transient analysis in the design phase of water network can

improve system behavior, operation and capital cost. In modern industry with flow capacities

increasing and piping networks getting more complex a comprehensive transient analysis

become more important. Besides, “we have power to bend [water] but it is a responsibility”,

Karney. B. W (2011).

Page 55: Waleed Ishaque - 2011 Thesis final copy.pdf

50

Appendix A – Transient model 1

%1-D TRANSIENT ANALYSIS CODE% %Using Method of Characteristics%

%This MATLAB code is capable of modeling four boundary conditions. User can

choose from 1)upstream linear rate pump startup, 2) upstream constant head

reservoir, 3) downstream valve opening, or 4) downstream valve closing

%% Pipe Data clear all; %clears stored variables from memory lenght = 100; %meter D = 0.3; %meter r = 0.26/1000; %absoltue pipe wall roughness wave_speed = 200.0; %meter/second; pressure wave speed viscosity = 1.519E-6; %meter^2/second, water kinematic viscosity at 5 celcius ps = 5; %number of pipe sections excluding boundaries total_time = 100; %seconds, total simulation time courant_number = 1.0; %program stability condition gravity = 9.806; %meter^2/second, earth gravity

%% Characteristic Grid Data delta_x = lenght/(ps+2); %meter, incremental length of pipe delta_t = courant_number*delta_x/wave_speed; %second, incremental time ts = total_time/delta_t +1.0; %number of time intervals pipe_area = (pi/4.0)*(D^2); %meter^2, pipe cross section area

%% Initializing Variables for the Characteristic Grid x = zeros(ps+2,1); %x-axis, fill ps+2 x 1 matrix with zeros t = zeros(ts, 1); %time-axis, fill ps+2 x 1 matrix with zeros H = zeros(ps+2,ts); %create a zero matrix to store H values on the grid Q = zeros(ps+2,ts); %create a zero matrix to store Q values on the grid V = zeros(ps+2, ts); %create a zero matrix to store flow V values on the grid B = wave_speed/(gravity*pipe_area); %B in the characteristic equation R_multiplier = delta_x/(2.0*gravity*D*(pipe_area^2));

%% Boundary condition data valve_open = 0; %if the valve is opening enter 1, otherwise enter 0 valve_closure_time = 5.0; %seconds, valve closure time, instant valve closure valve_open_rate = 0.05; % x 100 percentage valve opening per second valve_taw=0; valve_open_time=10; %seconds, time when valve starts to opn pump_timer = 0.0; %seconds, time when pump starts up pump_time = 20; %seconds, time it takes the pump to reach effeciency point speed_ratio = 0; %ratio of current/effeciency point pump speed, initial speed

= 0 aone = -77.26; %pump curve constant atwo = -136.9; %pump curve constant Zp=D; Vol=(3.142*0.25*D^2)*(5); pc=1.2;

upstream = 2; %reservoir = 1, pump = 2 downstream = 1; %valve = 1, air pocket = 2

Page 56: Waleed Ishaque - 2011 Thesis final copy.pdf

51

%% Steady State Calculation H_reservoir =50; %meter, constant head reservoir if valve_open == 0 && upstream == 1 SS_Q = 1; %meter^3/second, steady-state discharge else SS_Q = 0.0001; %meter^3/second, steady-state discharge end t(1) = 0.0; %seconds, time at steady state SS_V = SS_Q/pipe_area; %steady state velocity Q(:,1) = SS_Q; %enter steady state Q in the ps+2 x 1 matrix V(:,1) = SS_V; %enter steady state V in the ps+2 x 1 matrix reynolds = SS_V*D/viscosity; friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; if upstream == 1 H(1,1) = H_reservoir; elseif upstream == 2 H(1,1) = 0.001; end H_loss = friction*(delta_x/D)*(SS_V^2/(2.0*gravity)); %Darcy Weisback

Equation for i = 2:ps+2, %calculate steady state H values for the pipe x(i) = i*delta_x; H(i,1) = H(i-1,1)-H_loss; end SS_valve_H=H(ps+2,1);

%% TRANSIENT STATE CALCULATION

for ti = 2:ts, %%% Calculate upstream boundary conditions on the grid at x=0.0 t(ti)=(ti-1)*delta_t; if upstream == 2; if t(ti)> pump_timer speed_ratio=(t(ti)-pump_timer)/pump_time; if speed_ratio >= 1 speed_ratio=1; end end if speed_ratio == 0.0 Q(1,ti) = 0; H(1,ti) = 0.01; else reynolds = abs(V(1,ti-1)*D/viscosity); f = 0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; R = f*R_multiplier; CM = H(2,ti-1)-Q(2,ti-1)*(B-(R*(abs(Q(2,ti-1))))); theta = ((B-(aone*speed_ratio))/(2*atwo)); gamma = (1-((4*atwo*(((speed_ratio^2)*140.0)-CM))/(B-

(aone*speed_ratio))^2))^0.5; Q(1,ti) = theta*(1-gamma); H(1,ti) = CM+(B*Q(1,ti));

end elseif upstream == 1; t(ti) = (ti-1)*delta_t;

Page 57: Waleed Ishaque - 2011 Thesis final copy.pdf

52

H(1,ti) = H_reservoir; reynolds = abs(V(2,ti-1)*D/viscosity); friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R = friction*R_multiplier; CM = H(2,ti-1)-B*Q(2,ti-1)+R*Q(2,ti-1)*(abs(Q(2,ti-1))); Q(1,ti) = (H(1,ti)-CM)/B; end

%%%Calculate downstream boundary conditions on the grid at x=lenght if downstream == 2 C_1=(H(ps+2,ti)+10.3-D); C_2=(Vol-delta_t*(Q(ps+2, ti)+Q(ps+2,ti-1))/2)^1; C=C_1*C_2; CP=H(ps+1,ti-1)+B*Q(ps+1,ti-1)-(R*Q(ps+1,ti-1)*(abs(Q(ps+1,ti-1)))); for newton=1:50 Vol_p=Vol-delta_t*0.5*(Q(ps+2, ti)+Q(ps+2,ti-1)); if Vol_p < 0.0004 Vol_p=0.0004; end Zp=Zp+0.5*(Q(ps+2,ti))*delta_t/pipe_area; F1=((CP-B*Q(ps+2, ti)-Zp+10.3)*(Vol_p)^pc) - C; dFdQ=(-pc*delta_t*C*0.5/Vol_p)-B*(Vol_p^pc); dQ=-F1/dFdQ; Q(ps+2, ti)=Q(ps+2, ti)+dQ; end Vol=Vol-delta_t*0.5*(Q(ps+2, ti)+Q(ps+2, ti-1)); if Vol <= 0.0 Vol = 0.0; end H(ps+2,ti)=CP-(B*Q(ps+2,ti));

elseif downstream == 1 if valve_open == 1 if t(ti)>=valve_open_time valve_taw = valve_open_rate*t(ti)/0.1; if valve_taw >=10 valve_taw = 10; end end else if t(ti)>=valve_closure_time valve_taw = 0.0; else valve_taw = -(t(ti)-valve_closure_time)/valve_closure_time; end end reynolds = abs(V(ps+1,ti-1)*D/viscosity); friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R = friction*R_multiplier; CP = H(ps+1,ti-1)+B*Q(ps+1,ti-1)-R*Q(ps+1,ti-1)*(abs(Q(ps+1,ti-1))); CV = ((Q(ps+1,ti-1)*valve_taw)^2)/(2*H(ps+1,ti-1)); alpha = ((B*CV)^2)+2.0*CV*CP; Q(ps+2,ti) = -B*CV+sqrt(alpha); H(ps+2,ti) = CP-B*Q(ps+2,ti); end

Page 58: Waleed Ishaque - 2011 Thesis final copy.pdf

53

%%% Calculating interior points on the grid 0<x<lenght for j = 3:-1:2, for ps_i = j:2:ps+1, reynolds = abs(V(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 friction = 0.0; else friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; end R = friction*R_multiplier; CM = H(ps_i+1,ti-1)-B*Q(ps_i+1,ti-1)+R*Q(ps_i+1,ti-

1)*(abs(Q(ps_i+1,ti-1))); reynolds = abs(V(ps_i-1,ti-1)*D/viscosity); if reynolds == 0.0 friction = 0.0; else friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; end R = friction*R_multiplier; CP = H(ps_i-1,ti-1)+B*Q(ps_i-1,ti-1)-R*Q(ps_i-1,ti-1)*(abs(Q(ps_i-

1,ti-1))); H(ps_i,ti) = (CP+CM)/2; Q(ps_i,ti) = (H(ps_i,ti)-CM)/B; end end V(:,ti) = Q(:,ti)/pipe_area; end

%% Plotting Results

subplot(2,2,1) plot (t,H(ps+2,:)*9.8,'b') xlabel ('Time (second)') ylabel ('Pressure (kPa)') title ('a) - Pressure variations at downstream')

subplot(2,2,2) plot (t,Q(ps+2,:)*1000,'b') xlabel ('Time (second)') ylabel ('Q (kg/s)') title ('b) - Flow variation at downstream')

subplot(2,2,3) plot (t,Q(1,:)*1000,'b') xlabel ('Time (second)') ylabel ('Q (kg/s)') title ('c) - Flow variations at upstream')

subplot(2,2,4) plot (t,H(1,:)*9.8,'b') xlabel ('Time (second)') ylabel ('Pressure (kPa)') title ('d) - Pressure variations at upstream')

Page 59: Waleed Ishaque - 2011 Thesis final copy.pdf

54

Appendix B – Transient model 2

%1-D TRANSIENT ANALYSIS CODE% %Using Method of Characteristics%

%This MATLAB code models two parallel identical centrifugal pumps in

upstream. In the downstream the code models either an air pocket or a dead

end depending on user choice. This model simulates the OPG EWS system%

%% Common Pipe Properties clear all; %clears stored variables from memory lenght = 100; %meter D = 0.3; %meter D6 = 0.5; %meter, relief line diameter r = 0.26/1000; %absolute pipe wall roughness wave_speed = 600.0; %meter/second; pressure wave speed viscosity = 1.519E-6; %meter^2/second, water kinematic viscosity at 5 Celsius ps = 10; %number of pipe sections excluding boundaries total_time = 100; %seconds, total simulation time courant_number = 1.0; %program stability condition gravity = 9.806; %meter^2/second, earth gravity

%% Data for pipe 1 and pipe 2 with upstream pump and downstream valve H1_initial=0.01; H2_initial=0.01; SS_Q1=0.0; SS_Q2=0.0; pump_1_switch = 1.0; pump_2_switch = 1.0; pump_1_timer = 0; pump_2_timer = 30; pump_1_time=60; pump_2_time=60; speed_ratio_2=0.0; speed_ratio=0.0; aone=-77.26; %pump curve constant atwo=-136.9; %pump curve constant

%% Data for pipe 3 and 4 with upstream valve and downstream junction H3_initial=0.01; H4_initial=0.01; valve_taw_1=0.0; valve_taw_2=0.0; valve_1_max=1; valve_2_max=1; valve_1_time=40; %time valve takes to open valve_2_time=40; valve_1_timer=5; % time when valve open

Page 60: Waleed Ishaque - 2011 Thesis final copy.pdf

55

valve_2_timer=5; SS_Q3=0.0; SS_Q4=0.0;

%% Data for pipe 5 with junction on either end H5_initial=0.01; SS_Q5=0.0;

%%Data for pipe 6 with open valve in downstream pipe_6_area=(pi/4.0)*(D6^2); H6_initial=0.01; relief_valve_taw=0.9; SS_Q6=0.0;

%% Data for pipe 7 with air pocket or dead end in downstream H7_initial = 0.01; SS_Q7=0.0; pc=1.2; Zp=D; Vol=(3.142*0.25*D^2)*(10);

%%Characteristic Grid data delta_x=lenght/(ps+2); delta_t=courant_number*delta_x/wave_speed; ts=total_time/delta_t +1.0; %ts = time_steps pipe_area=(pi/4.0)*(D^2);

%%Initializing Variables for each pipe on the grid% x=zeros(ps+2,1); %x-axis, fill Nx+2 X 1 matrix with zeros t=zeros(ts, 1); %time-axis, fill ts X 1 matrix with zeros H1=zeros(ps+2,ts); %create a zero matrix to store H values on the grid H2=zeros(ps+2,ts); H3=zeros(ps+2,ts); H4=zeros(ps+2,ts); H5=zeros(ps+2,ts); H6=zeros(ps+2,ts); H7=zeros(ps+2,ts);

Q1=zeros(ps+2,ts); %create a zero matrix to store Q values on the grid Q2=zeros(ps+2,ts); Q3=zeros(ps+2,ts); Q4=zeros(ps+2,ts); Q5=zeros(ps+2,ts); Q6=zeros(ps+2,ts); Q7=zeros(ps+2,ts);

V1=zeros(ps+2, ts); %Create a zero matrix to store flow V values on the grid V2=zeros(ps+2, ts); V3=zeros(ps+2, ts); V4=zeros(ps+2, ts); V5=zeros(ps+2, ts); V6=zeros(ps+2, ts); V7=zeros(ps+2, ts);

Page 61: Waleed Ishaque - 2011 Thesis final copy.pdf

56

Vol_storage=zeros(1,ts); %create a zero matrix to store air pocket volume

values on the grid

B1=wave_speed/(gravity*pipe_area); %B in the characteristic equation B2=B1; B3=B2; B4=B3; B5=B4; B6=wave_speed/(gravity*pipe_6_area); %B in the characteristic equation B7=B5;

R1_multiplier=delta_x/(2.0*gravity*D*(pipe_area^2)); R2_multiplier=R1_multiplier; R3_multiplier=R1_multiplier; R4_multiplier=R1_multiplier; R5_multiplier=R1_multiplier; R6_multiplier=delta_x/(2.0*gravity*D6*(pipe_6_area^2)); R7_multiplier=R1_multiplier;

%% Boundary condition data downstream = 2; % dead end = 1, air pocket = 2

%%Steady state calculation for all pipes% t(1)=0.0; SS_V1=SS_Q1/pipe_area; SS_V2=SS_Q2/pipe_area; SS_V3=SS_Q3/pipe_area; SS_V4=SS_Q4/pipe_area; SS_V5=SS_Q5/pipe_area; SS_V6=SS_Q6/pipe_6_area; SS_V7=SS_Q7/pipe_area;

Q1(:,1)=SS_Q1; %Enter steady state Q in the first column V1(:,1)=SS_V1; Q2(:,1)=SS_Q2; V2(:,1)=SS_V2; Q3(:,1)=SS_Q3; V3(:,1)=SS_V3; Q4(:,1)=SS_Q4; V4(:,1)=SS_V4; Q5(:,1)=SS_Q5; V5(:,1)=SS_V5; Q6(:,1)=SS_Q6; V6(:,1)=SS_V6; Q7(:,1)=SS_Q7; V7(:,1)=SS_V7;

reynolds=SS_V1*D/viscosity; f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; H1(1,1)=H1_initial; H2(1,1)=H2_initial; H3(1,1)=H3_initial; H4(1,1)=H4_initial; H5(1,1)=H5_initial;

Page 62: Waleed Ishaque - 2011 Thesis final copy.pdf

57

H6(1,1)=H6_initial; H7(1,1)=H7_initial;

H1_loss=f*(delta_x/D)*(SS_V1^2/(2.0*gravity));%Darcy - Weisback Equation H2_loss=f*(delta_x/D)*(SS_V2^2/(2.0*gravity)); H3_loss=f*(delta_x/D)*(SS_V3^2/(2.0*gravity)); H4_loss=f*(delta_x/D)*(SS_V4^2/(2.0*gravity)); H5_loss=f*(delta_x/D)*(SS_V5^2/(2.0*gravity)); H6_loss=f*(delta_x/D)*(SS_V6^2/(2.0*gravity)); H7_loss=f*(delta_x/D)*(SS_V7^2/(2.0*gravity));

for i=2:ps+2, %calculate steady state H values from x=2 till end of pipe x(i)=i*delta_x; H1(i,1)=H1(i-1,1)-H1_loss; H2(i,1)=H2(i-1,1)-H2_loss; H3(i,1)=H3(i-1,1)-H3_loss; H4(i,1)=H4(i-1,1)-H4_loss; H5(i,1)=H5(i-1,1)-H5_loss; H6(i,1)=H6(i-1,1)-H6_loss; H7(i,1)=H7(i-1,1)-H7_loss;

end

%%TRANSIENT STATE CALCULATION% for ti=2:ts t(ti)=(ti-1)*delta_t;

%Upstream Boundary at pipe 1 % if pump_1_switch == 1; if t(ti)> pump_1_timer speed_ratio=(t(ti)-pump_1_timer)/pump_1_time; if speed_ratio >= 0.8 speed_ratio=0.8; end end end

if speed_ratio ==0.0 Q1(1,ti)=0; H1(1,ti)=H1_initial; else reynolds=abs(V1(1,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; R1=f*R1_multiplier; CM1=H1(2,ti-1)-Q1(2,ti-1)*(B1-(R1*(abs(Q1(2,ti-1)))));at theta=((B1-(aone*speed_ratio))/(2*atwo)); gamma=(1-((4*atwo*(((speed_ratio^2)*140.0)-CM1))/(B1-

(aone*speed_ratio))^2))^0.5; Q1(1,ti)=theta*(1-gamma); H1(1,ti)=CM1+(B1*Q1(1,ti));

end

%Upstream Boundary at pipe 2%

Page 63: Waleed Ishaque - 2011 Thesis final copy.pdf

58

if pump_2_switch == 1; if t(ti) > pump_2_timer; speed_ratio_2=(t(ti)-pump_2_timer)/pump_2_time; if speed_ratio_2 >= 0.8 speed_ratio_2=0.8; end end end

if speed_ratio_2 ==0.0 Q2(1,ti)=0; H2(1,ti)=H2_initial; else

reynolds=abs(V2(2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; R2=f*R2_multiplier; CM2=H2(2,ti-1)-Q2(2,ti-1)*(B2-(R2*(abs(Q2(2,ti-1)))));%i-1 represents t

step at i to find Hi and Qi theta=((B2-(aone*speed_ratio_2))/(2*atwo));%see example 3-5 of wiley and

streeter gamma=(1-((4*atwo*(((speed_ratio_2^2)*140.0)-CM2))/(B2-

(aone*speed_ratio_2))^2))^0.5; Q2(1,ti)=theta*(1-gamma); H2(1,ti)=CM2+(B2*Q2(1,ti)); end

%Downstream Boundary at pipe 2 junction with pipe 3, in-line valve% reynolds=abs(V2(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R2=f*R2_multiplier;

reynolds=abs(V3(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R3=f*R3_multiplier; CM3=H3(2,ti-1)-B3*Q3(2,ti-1)+R3*Q3(2,ti-1)*(abs(Q3(2,ti-1))); %here CM4

is the upstream CP2=H2(ps+1,ti-1)+B2*Q2(ps+1,ti-1)-(R2*Q2(ps+1,ti-1)*(abs(Q2(ps+1,ti-

1)))); %here CP3 is the downstream

if t(ti)>valve_2_timer valve_taw_2=(t(ti)-valve_2_timer)/valve_2_time; if valve_taw_2>=valve_2_max valve_taw_2=valve_2_max; end end

reynolds=abs(V2(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R2=f*R2_multiplier; CV2=((Q2(ps+1,ti-1)*valve_taw_2)^2)/(2*H2(ps+1,ti-1)); alpha_n=((CV2^2)*(B2+B3)^2)-(2*CV2*(CP2-CM3)); alpha_p=((CV2^2)*(B2+B3)^2)+(2*CV2*(CP2-CM3));

if CP2-CM3 >= 0

Page 64: Waleed Ishaque - 2011 Thesis final copy.pdf

59

Q2(ps+2,ti)=-CV2*(B2+B3)+(alpha_p)^0.5; else Q2(ps+2,ti)=CV2*(B2+B3)-(alpha_n)^0.5; end H2(ps+2,ti)=CP2-(B2*Q2(ps+2,ti));

%In-line valve between pipe 1 and pipe 4% reynolds=abs(V4(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R4=f*R4_multiplier;

reynolds=abs(V1(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R1=f*R1_multiplier;

CM4=H4(2,ti-1)-B4*Q4(2,ti-1)+R4*Q4(2,ti-1)*(abs(Q4(2,ti-1)));

CP1=H1(ps+1,ti-1)+B1*Q1(ps+1,ti-1)-(R1*Q1(ps+1,ti-1)*(abs(Q1(ps+1,ti-1))));

if t(ti)>valve_1_timer valve_taw_1=(t(ti)-valve_1_timer)/valve_1_time; if valve_taw_1>=valve_1_max valve_taw_1=valve_1_max; end end

CV1=((Q1(ps+1,ti-1)*valve_taw_1)^2)/(2*H1(ps+1,ti-1)); alpha_n=((CV1^2)*(B1+B4)^2)-(2*CV1*(CP1-CM4)); alpha_p=((CV1^2)*(B1+B4)^2)+(2*CV1*(CP1-CM4));

if CP1-CM4 >= 0 Q1(ps+2,ti)=-CV1*(B1+B4)+(alpha_p)^0.5; else Q1(ps+2,ti)=CV1*(B1+B4)-(alpha_n)^0.5; end H1(ps+2,ti)=CP1-(B1*Q1(ps+2,ti));

%Interior Points in pipe 1% for j1=3:-1:2, for ps_i=j1:2:ps+1, reynolds=abs(V1(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R1=f*R1_multiplier; CM1=H1(ps_i+1,ti-1)-B1*Q1(ps_i+1,ti-1)+R1*Q1(ps_i+1,ti-

1)*(abs(Q1(ps_i+1,ti-1))); reynolds=abs(V1(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end

Page 65: Waleed Ishaque - 2011 Thesis final copy.pdf

60

R1=f*R1_multiplier; CP1=H1(ps_i-1,ti-1)+B1*Q1(ps_i-1,ti-1)-R1*Q1(ps_i-1,ti-

1)*(abs(Q1(ps_i-1,ti-1)));

H1(ps_i,ti)=(CP1+CM1)/2; Q1(ps_i,ti)= (H1(ps_i,ti)-CM1)/B1; end end V1(:,ti)=Q1(:,ti)/pipe_area;

%Interior Points in pipe 2% for j2=3:-1:2, for ps_i=j2:2:ps+1, reynolds=abs(V2(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R2=f*R2_multiplier; CM2=H2(ps_i+1,ti-1)-B2*Q2(ps_i+1,ti-1)+R2*Q2(ps_i+1,ti-

1)*(abs(Q2(ps_i+1,ti-1))); reynolds=abs(V2(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R2=f*R2_multiplier; CP2=H2(ps_i-1,ti-1)+B2*Q2(ps_i-1,ti-1)-R2*Q2(ps_i-1,ti-

1)*(abs(Q2(ps_i-1,ti-1)));

H2(ps_i,ti)=(CP2+CM2)/2; Q2(ps_i,ti)= (H2(ps_i,ti)-CM2)/B2; end end V2(:,ti)=Q2(:,ti)/pipe_area;

%Upstream Boundary at pipe 3 and pipe 4%

reynolds=abs(V3(1,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R3=f*R3_multiplier;

Q3(1,ti)=Q2(ps+2,ti); CM3=H3(2,ti-1)-B3*Q3(2,ti-1)+R3*Q3(2,ti-1)*(abs(Q3(2,ti-1))); H3(1,ti)=CM3+(B3*Q3(1,ti));

reynolds=abs(V4(1,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R4=f*R4_multiplier;

Q4(1,ti)=Q1(ps+2,ti);

Page 66: Waleed Ishaque - 2011 Thesis final copy.pdf

61

CM4=H4(2,ti-1)-B4*Q4(2,ti-1)+R4*Q4(2,ti-1)*(abs(Q4(2,ti-1))); H4(1,ti)=CM4+(B4*Q4(1,ti));

%Junction boundary downstream of both pipe 3 and pipe 4 , junction 1% reynolds=abs(V3(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R3=f*R3_multiplier;

reynolds=abs(V4(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R4=f*R4_multiplier;

reynolds=abs(V5(ps+2,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R5=f*R5_multiplier;

CP3=H3(ps+1,ti-1)+Q3(ps+1,ti-1)*(B3-(R3*(abs(Q3(ps+1,ti-1))))); CP4=H4(ps+1,ti-1)+Q4(ps+1,ti-1)*(B4-(R4*(abs(Q4(ps+1,ti-1))))); CM5=H5(2,ti-1)-Q5(2,ti-1)*(B5-(R5*(abs(Q5(2,ti-1)))));

H3(ps+2,ti)=((CP3/B3)+(CP4/B4)+(CM5/B5))/((1/B3)+(1/B4)+(1/B5)); H4(ps+2,ti)=((CP3/B3)+(CP4/B4)+(CM5/B5))/((1/B3)+(1/B4)+(1/B5)); H5(1,ti)=((CP3/B3)+(CP4/B4)+(CM5/B5))/((1/B3)+(1/B4)+(1/B5));

Q3(ps+2,ti)= -(H3(ps+2,ti)/B3) + (CP3/B3); Q4(ps+2,ti)= -(H4(ps+2,ti)/B4) + (CP4/B4); Q5(1,ti)= (H5(1,ti)/B5) - (CM5/B5);

%Interior Points in pipe 3% for j3=3:-1:2, for ps_i=j3:2:ps+1, reynolds=abs(V3(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R3=f*R3_multiplier; CM3=H3(ps_i+1,ti-1)-B3*Q3(ps_i+1,ti-1)+R3*Q3(ps_i+1,ti-

1)*(abs(Q3(ps_i+1,ti-1))); reynolds=abs(V3(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R3=f*R3_multiplier; CP3=H3(ps_i-1,ti-1)+B3*Q3(ps_i-1,ti-1)-R3*Q3(ps_i-1,ti-

1)*(abs(Q3(ps_i-1,ti-1)));

H3(ps_i,ti)=(CP3+CM3)/2; Q3(ps_i,ti)= (H3(ps_i,ti)-CM3)/B3; end end V3(:,ti)=Q3(:,ti)/pipe_area;

Page 67: Waleed Ishaque - 2011 Thesis final copy.pdf

62

%Interior Points in pipe 4% for j4=3:-1:2, for ps_i=j4:2:ps+1, reynolds=abs(V4(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R4=f*R4_multiplier; CM4=H4(ps_i+1,ti-1)-B4*Q4(ps_i+1,ti-1)+R4*Q4(ps_i+1,ti-

1)*(abs(Q4(ps_i+1,ti-1))); reynolds=abs(V4(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R4=f*R4_multiplier; CP4=H4(ps_i-1,ti-1)+B4*Q4(ps_i-1,ti-1)-R4*Q4(ps_i-1,ti-

1)*(abs(Q4(ps_i-1,ti-1)));

H4(ps_i,ti)=(CP4+CM4)/2; Q4(ps_i,ti)= (H4(ps_i,ti)-CM4)/B4; end end V4(:,ti)=Q4(:,ti)/pipe_area;

%Junction boundary downstream of pipe 5, junction 2% reynolds=abs(V5(ps+1,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R5=f*R5_multiplier;

reynolds=abs(V6(ps+1,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R6=f*R6_multiplier;

reynolds=abs(V7(ps+1,ti-1)*D/viscosity); f=0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R7=f*R7_multiplier;

CP5=H5(ps+1,ti-1)+Q5(ps+1,ti-1)*(B5-(R5*(abs(Q5(ps+1,ti-1))))); CM6=H6(2,ti-1)-Q6(2,ti-1)*(B6-(R6*(abs(Q6(2,ti-1))))); CM7=H7(2,ti-1)-Q7(2,ti-1)*(B7-(R7*(abs(Q7(2,ti-1)))));

H5(ps+2,ti)=((CP5/B5)+(CM6/B6)+(CM7/B7))/((1/B5)+(1/B6)+(1/B7)); Q5(ps+2,ti)= -(H5(ps+2,ti)/B5) + (CP5/B5);

H6(1,ti)= H5(ps+2,ti); Q6(1,ti)= (H6(1,ti)/B6) - (CM6/B6);

H7(1,ti)= H5(ps+2,ti); Q7(1,ti)= (H7(1,ti)/B7) - (CM7/B7);

Page 68: Waleed Ishaque - 2011 Thesis final copy.pdf

63

%Interior Points in pipe 5% for j5=3:-1:2, for ps_i=j5:2:ps+1, reynolds=abs(V5(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.5*D))+(5.54/(reynolds^0.9))))^2; end R5=f*R5_multiplier; CM5=H5(ps_i+1,ti-1)-B5*Q5(ps_i+1,ti-1)+R5*Q5(ps_i+1,ti-

1)*(abs(Q5(ps_i+1,ti-1))); reynolds=abs(V5(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.5*D))+(5.54/(reynolds^0.9))))^2; end R5=f*R5_multiplier; CP5=H5(ps_i-1,ti-1)+B5*Q5(ps_i-1,ti-1)-R5*Q5(ps_i-1,ti-

1)*(abs(Q5(ps_i-1,ti-1)));

H5(ps_i,ti)=(CP5+CM5)/2; Q5(ps_i,ti)= (H5(ps_i,ti)-CM5)/B5; end end V5(:,ti)=Q5(:,ti)/pipe_area;

%Downstream Boundary at pipe 6 with throttle relief valve% reynolds=abs(V6(ps+1,ti-1)*D6/viscosity); f=0.25/(log10((r/(3.7*D6))+(5.74/reynolds^0.9)))^2; R6=f*R6_multiplier; CP6=H6(ps+1,ti-1)+B6*Q6(ps+1,ti-1)-(R6*Q6(ps+1,ti-1)*(abs(Q6(ps+1,ti-

1)))); CV6=((Q6(ps+1,ti-1)*relief_valve_taw)^2)/(2*H6(ps+1,ti-1)); alpha=((B6*CV6)^2)+(2.0*CV6*CP6); Q6(ps+2,ti)=(-B6*CV6)+sqrt(alpha); H6(ps+2,ti)=CP6-B6*Q6(ps+2,ti);

%Interior Points in pipe 6% for j6=3:-1:2, for ps_i=j6:2:ps+1, reynolds=abs(V6(ps_i+1,ti-1)*D6/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D6))+(5.74/(reynolds^0.9))))^2; end R6=f*R6_multiplier; CM6=H6(ps_i+1,ti-1)-B6*Q6(ps_i+1,ti-1)+R6*Q6(ps_i+1,ti-

1)*(abs(Q6(ps_i+1,ti-1))); reynolds=abs(V6(ps_i-1,ti-1)*D6/viscosity); if reynolds==0.0 f=0.0; else

Page 69: Waleed Ishaque - 2011 Thesis final copy.pdf

64

f=0.25/(log10((r/(3.7*D6))+(5.74/(reynolds^0.9))))^2; end R6=f*R6_multiplier; CP6=H6(ps_i-1,ti-1)+B6*Q6(ps_i-1,ti-1)-R6*Q6(ps_i-1,ti-

1)*(abs(Q6(ps_i-1,ti-1)));

H6(ps_i,ti)=(CP6+CM6)/2; Q6(ps_i,ti)= (H6(ps_i,ti)-CM6)/B6; end end V6(:,ti)=Q6(:,ti)/pipe_6_area;

%Downstream Boundary at pipe 7 with dead end or air pocket% if downstream == 1; CP7=H7(ps+1,ti-1)+B7*Q7(ps+1,ti-1)-(R7*Q7(ps+1,ti-1)*(abs(Q7(ps+1,ti-

1)))); Q7(ps+2,ti)=0; H7(ps+2,ti)=CP7-B7*Q7(ps+2,ti); elseif downstream == 2; C_1=(H7(ps+2,ti)+10.3-D); C_2=(Vol-delta_t*(Q7(ps+2, ti)+Q7(ps+2,ti-1))/2)^pc; C=C_1*C_2; CP7=H7(ps+1,ti-1)+B7*Q7(ps+1,ti-1)-(R7*Q7(ps+1,ti-

1)*(abs(Q7(ps+1,ti-1)))); for newton=1:50 Vol_p=Vol-delta_t*0.5*(Q7(ps+2,ti)+Q7(ps+2,ti-1)); if Vol_p < 0.0001 Vol_p=0.0001; end Zp=Zp+((0.5*(Q7(ps+2,ti))+Q7(ps+2,ti-1))/pipe_area)*delta_t; F1=(CP7-B7*Q7(ps+2,ti)-Zp+10.3)*(Vol_p)^pc - C; dFdQ7=(-pc*delta_t*C*0.5/Vol_p)-B7*(Vol_p^pc); dQ7=-F1/dFdQ7; Q7(ps+2,ti)=Q7(ps+2,ti)+dQ7; end Vol=Vol-delta_t*0.5*(Q7(ps+2, ti)+Q7(ps+2, ti-1)); if Vol < 0.0 Vol = 0.0; end H7(ps+2,ti)=CP7-B7*Q7(ps+2,ti); Vol_storage (1,ti)=Vol; end

%Interior Points in pipe 7% for j7=3:-1:2, for ps_i=j7:2:ps+1, reynolds=abs(V7(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R7=f*R7_multiplier; CM7=H7(ps_i+1,ti-1)-B7*Q7(ps_i+1,ti-1)+R7*Q7(ps_i+1,ti-

1)*(abs(Q7(ps_i+1,ti-1)));

Page 70: Waleed Ishaque - 2011 Thesis final copy.pdf

65

reynolds=abs(V7(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R7=f*R7_multiplier; CP7=H7(ps_i-1,ti-1)+B7*Q7(ps_i-1,ti-1)-R7*Q7(ps_i-1,ti-

1)*(abs(Q7(ps_i-1,ti-1))); H7(ps_i,ti)=(CP7+CM7)/2; Q7(ps_i,ti)= (H7(ps_i,ti)-CM7)/B7; end end V7(:,ti)=Q7(:,ti)/pipe_area;

end

Page 71: Waleed Ishaque - 2011 Thesis final copy.pdf

66

References

Boulos. P. F; Karney. B. W; Wood. J. D; Lingireddy. (2005) Hydraulic Transient Guidelines for

Protecting Water Distribution Systems. American Water Works Association

Chou, T (2009) The Method of Characteristics. Dept. of Biomathematics, UCLA, Los

Angeles, CA 90095-1766

Chaudhry, M. H. (1979). Applied hydraulic transients. Van Nostrand Reinhold Co.,

New York, N.Y.

Karney. B. W, (2011). University of Toronto, CIV1303 lecture

Martino. G. D; Fontana. N; Giugni. M. (2008) Transient Flow Caused by Air Expulsion Through

an Orifice”, ASCE 0733-9429; 134:9

Parmakian, J. (1958). Waterhammer Analysis. Bureau of Reclamation Denver, Colorado: Dover

Publications, Inc.

Pejovic, S.; Boldy, A.P. & Obradovic, D., 1987. Guidelines for Hydraulic Transient Analysis.

Gower Technical Press, Eng-land-USA.

Wylie, E. B., and Streeter, V. L. (1978). Fluid transients. FEB Press, Ann Arbor,

Mich.