This model demonstrates the use of hydraulics of a simulated outlet works that consists of a long pipeline and fittings that contribute to head losses experienced as water flows from the reservoir pool to the downstream side of a dam. The Hazen Williams formula is used to calculate the head losses due to friction and incorporated into Bernoulli's energy equation to calculate the flow that would result in a pressure drop equal to the difference in water elevation at the reservoir and the downstream water body below the dam.

As the water level in the reservoir increases, the flow through the outlet works will also increase accordingly. If the water level drops to a level below the tailwater elevation, then flow will stop.

A flow solver is used to calculate the flow rate that results in the total head losses including minor losses, friction losses through the length of pipe and the velocity head at the discharge point. A Script element is used to perform the solver calculations, which are included in text format below.

// ************** ENERGY EQUATION ORIFICE AND PIPE FLOW **************

//

// Input Variables (User-Defined)

// Water level upstream

VALUE[ft] z1 = Water_Level_US

// Downstream tailwater

VALUE[ft] z2 = Tailwater_Elev

//

// Constants (User-Defined)

// Pipe diameter

VALUE[m] D = D

// Pipe length

VALUE[m] L = Length

// Hazen-William's friction coefficient

VALUE C = C

// Minor headloss coefficient (for orifice opening, bends, valves, etc)

VALUE K = sumv(K)

//

// Set up initial range of guess values and varible definitions

// Flow area in the pipe

VALUE[m2] A = pi * ~D^2 / 4

// Wetted perimeter

VALUE[m] P = pi * ~D

// Hydraulic radius

VALUE[m] R = ~A / ~P

VALUE[m3/s] Low = 0 cfs

VALUE[m3/s] High = 1e9 m3/s

VALUE[m3/s] Mid = (~High - ~Low) / 2

CONDITION Converged = false

// Set the flag to true if convergence was not met at least 1 time during the

simulation

CONDITION Converge_Flag = false

// Convergence error

VALUE[%] Conv_Error = 0.01 %

VALUE loopcount = 0.0

// Max number of loops before issuing convergence error

VALUE MaxLoops = 200

// Friction headloss (emperical equation)

VALUE[m] hf = 0 m

// Friction, minor headlosses plus the velocity head at the end

VALUE[m] h (variable exposed) = ~z1 - ~z2

// Total head loss

VALUE[m] hL (variable exposed) = ~h

// Perform binary search algorithm to solve for flow rate

WHILE (not ~Converged and ~z1 > ~z2)

Mid = ~Low + (~High - ~Low) / 2

// Velocity

VALUE[m/s] v = ~Mid / ~A

// Minor headlosses

VALUE[m] hm = ~K * (~v^2 / (2 * gee))

hf = (4.73 * ~C^-1.852 * ~L * ~D|ft|^-4.87) * ~Mid|cfs|^1.852

hL = ~hm + ~hf

// Contract the range based on whether the midpoint guess was too high or too low

IF (~hL > ~h) THEN

High = ~Mid

ELSE

Low = ~Mid

END IF // '~hL > ~h'

//

// Check for convergence

IF (~loopcount > ~MaxLoops) THEN

Log Error: Flow solver did not converge after {=~MaxLoops} iterations!

BREAK

END IF // '~loopcount > ~MaxLoops'

Converged = (~High - ~Low) / ~Mid <= ~Conv_Error

loopcount = ~loopcount + 1

END WHILE

// Energy grade slope

VALUE[m/m] S (variable exposed) = ~hf / ~L

Result = if(~z1 > ~z2, ~Mid, 0 m3/d)

VALUE error = (~hL - ~h) / ~h

IF (~error > ~Conv_Error) THEN

Converge_Flag = true

END IF // '~error > ~Conv_Error'

IF (ETime >= SimDuration and ~Converge_Flag) THEN

Log Warning: Model did not converge during the simulation 1 or more times.

END IF // 'ETime >= SimDuration and ~Converge_Flag'

Below is a time history chart showing the water level compared to the target and the resulting inflow and reservoir discharges.

## Comments

0 comments

Please sign in to leave a comment.