This model demonstrates how to simulate the hydraulics of a reservoir outlet works, incorporating the dynamic relationship between the reservoir water level and the discharge rate. It specifically models an outlet consisting of a long pipeline and fittings that contribute to head losses as water flows from the reservoir pool to the downstream tailwater. This approach allows for a more physically realistic representation of outflow compared to simpler assumptions, making it valuable for integrated system modeling.
The model calculates discharge based on the available head (the difference between the upstream reservoir water level and the downstream tailwater elevation) and the hydraulic properties of the outlet conduit. As the water level in the reservoir fluctuates due to inflows and outflows, the calculated discharge through the outlet works dynamically adjusts. If the reservoir level drops below the tailwater elevation, flow ceases.
Figure 1: GoldSim model schematic illustrating the key components.
The simulation incorporates several GoldSim elements:
- Pool: Represents the reservoir itself, tracking the volume of water stored.
- Inflow: A placeholder (Stochastic element) representing water flowing into the reservoir. In a larger model, this could be linked to upstream hydrology.
- Lookup Table ("Elev_Vol_Table"): Defines the relationship between the reservoir's water surface elevation and the volume of water stored. This is used to:
- Determine the initial volume based on a starting water level.
- Calculate the current water surface elevation based on the current volume in the Pool element.
- Script Element: Contains the core hydraulic calculations (detailed below). It takes the current reservoir water level (from the Pool/Lookup Table) and the tailwater elevation as inputs to calculate the potential discharge rate.
- Outflows: The Pool element has withdrawals representing:
- Evaporation: A simplified placeholder loss (e.g., 1% of current volume per day).
- Outlet Discharge: The primary controlled discharge, calculated by the Script element based on hydraulics.
Hydraulic Calculation (Script Element)
A flow solver implemented within a GoldSim Script element calculates the discharge rate. It uses the Hazen-Williams formula to estimate head losses due to friction and incorporates these into Bernoulli's energy equation. The solver iteratively finds the flow rate where the calculated total head loss (including minor losses from fittings and friction losses along the pipe) equals the available driving head (the difference between the reservoir and tailwater elevations, z1 - z2
).
The script implementing this logic is shown below:
// ************** ENERGY EQUATION ORIFICE AND PIPE FLOW ************** // // Input Variables (User-Defined) VALUE[m] z1 = Water_Level_US // Water level upstream VALUE[m] z2 = Tailwater_Elev // Downstream tailwater // // Constants (User-Defined) VALUE[m] D = D // Pipe diameter VALUE[m] L = Length // Pipe length VALUE C = C // Hazen-William's friction coefficient VALUE K = sumv(K) // Minor head loss coefficient (for orifice opening, bends, valves, etc) // // Set up initial range of guess values and varible definitions VALUE[m2] A = pi * ~D^2 / 4 // Flow area in the pipe VALUE[m] P = pi * ~D // Wetted perimeter VALUE[m] R = ~A / ~P // Hydraulic radius 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 VALUE[%] Conv_Error = 0.01 % // Convergence error VALUE loopcount = 0.0 VALUE MaxLoops = 200 // Max number of loops before issuing convergence error VALUE[m] hf = 0 m // Friction head loss (emperical equation) VALUE[m] h (variable exposed) = ~z1 - ~z2 // Available head (driving head) VALUE[m] hL (variable exposed) = ~h // Total head loss (solver target) // Perform binary search algorithm to solve for flow rate WHILE (not ~Converged and ~z1 > ~z2) Mid = ~Low + (~High - ~Low) / 2 VALUE[m/s] v = ~Mid / ~A // Velocity VALUE[m] hm = ~K * (~v^2 / (2 * gee)) // Minor head losses hf = (10.67 * ~C^-1.852 * ~L * ~D|m|^-4.87) * ~Mid|m3/s|^1.852 // Friction loss hL = ~hm + ~hf // Calculated total head loss for current guess (Mid) // Contract the range based on whether the midpoint guess was too high or too low IF (~hL > ~h) THEN High = ~Mid // Guessed flow too high ELSE Low = ~Mid // Guessed flow too low 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 VALUE[m/m] S (variable exposed) = ~hf / ~L // Energy grade slope Result = if(~z1 > ~z2, ~Mid, 0 m3/d) // Final calculated discharge 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'
Why Model Hydraulics Explicitly?
Integrating detailed hydraulic calculations like this into a larger GoldSim model (e.g., a watershed model, water resources system model, or mine water balance) provides significant advantages:
- Physical Realism: It captures the non-linear physics governing flow through conduits, where the discharge rate is inherently dependent on the upstream driving head. This is often more accurate than using simplified rating curves or fixed outflow assumptions.
- Dynamic Response: The model dynamically responds to changing conditions (reservoir levels, tailwater levels), leading to more realistic system behavior simulations, especially during flood or drought events.
- Design and Operations Analysis: It allows for testing different outlet configurations (pipe diameters, lengths, roughness, fitting losses) or operational strategies by adjusting the corresponding parameters (D, L, C, K).
By explicitly modeling the hydraulic constraints, you can build greater confidence in the simulation of reservoir operations, spillway performance, pumping systems, or pipe network flows within your broader project context.
Example Simulation Results
Below is an example time history chart showing the simulated reservoir water level compared to a target level, along with the resulting inflow and outflow rates, illustrating the dynamic interaction between storage and discharge.
Figure 2: Example time history results.
Comments
0 comments
Please sign in to leave a comment.