--This article is applicable to GoldSim 11.0 and later--

### Issue

What happens if my Reservoir element has a moving Upper Bound that becomes less than the volume currently stored in the Reservoir?

### Resolution

An upper and a lower bound can be specified for a Reservoir element. If an Upper Bound is specified for a Reservoir, this value provides the upper limit on the amount that can be “stored” in the Reservoir. The value for the Upper Bound can be specified in the Properties dialog as shown in * Figure 1*. In this figure, the Upper Bound is set to a constant value of 100.0 m3.

*Figure 1: Reservoir element Properties dialog*

When a Reservoir element has a specified Upper Bound, the Reservoir has two additional outputs: an “Overflow_Rate”, and an "Is_Full" output, as shown in * Figure 2*. If the Reservoir element does not have an Upper Bound, then it cannot overflow (or abe full) and there is no need for these two outputs. Once an Upper Bound is specified, it is possible for the Reservoir’s capacity to be exceeded. When the capacity is exceeded, the extra volume of water (i.e., the volume of water above the capacity) will overflow, or flow out of, the Reservoir. The “Overflow_Rate” provides access to the discharge rate for water that leaves the Reservoir due to overflow. (The "Is_Full" output is a condition that is True of the Reservoir is at the Upper Bound).

*Figure 2: Reservoir element output with an Upper Bound specified*

A constant Reservoir Upper Bound of 100.0 m3 is specified in * Figure 1*. The Upper Bound of a Reservoir element can also be specified in such a way that the value changes over time. This type of changing Upper Bound could be defined by using an Expression element or a Time Series element for the Upper Bound. An example of using a Time Series element to provide the Upper Bound is shown in

*.*

**Figure 3***Figure 3: Using a Time Series element to provide a moving Upper Bound*

From the GoldSim User’s Guide (TFM), “If the Upper Bound is constant, the Current Value in the Reservoir will never exceed the Upper Bound. However, if the Upper Bound is changing with time, under some circumstances, it is possible for the Current Value of the Reservoir to exceed the Upper Bound. If the Upper Bound is exceeded (because it has changed during a time-step), GoldSim will overflow the excess uniformly over the next time-step.” That is, if the Upper Bound decreases over time and hence becomes smaller than the volume in the Reservoir, then GoldSim will typically overflow the excess uniformly over the next time-step.

As an example, the properties and data for a Time Series element which provides an Upper Bound for a Reservoir element is shown in * Figure 4*. Note that this Time Series represents values as “Constant value over the next time interval”. If the Time Series from

*is then used in a simple 10 day simulation, using a 1 day time-step, of a Reservoir (“Reservoir1”) which starts the simulation with a volume of 100 m3 (i.e. starts the simulation at capacity) and has no other inflows or outflows, the results from this simulation are provided in*

**Figure 4***. The simulation settings of a 10 day duration and a Basic Step duration of 1 day are shown in*

**Figure 6***.*

**Figure 5***Figure 4: An example Time Series for a changing Upper Bound*

*Figure 5: Simulation time settings including a "Basic Step" duration of 1 day*

In * Figure 6* it appears that the Reservoir volume is always above the specified Upper Bound. This appearance is actually a plotting artifact which occurs because the plot is created from point values, or values collected at a discrete instant in time, and then the plot line simply connects the point values using a straight line. According to the Time Series definition in

*, the values should actually be constant over next (i.e. the line should look different). GoldSim does treat these Time Series values as constant over the next interval in calculations so that if GoldSim requests a “Changing_Bound” value at elapsed time 1.995 days then it will receive a value of 95 m3. The issue with the simulation shown in*

**Figure 4***is that the Basic Step duration for this simulation is set to 1 day. Consequently, GoldSim only requests “Changing_Bound” values at one day intervals of elapsed time in this case.*

**Figure 6***Figure 6: Moving Upper Bound simulation for an initially full Reservoir with a 1 day Basic Step duration*

* Figure 7* shows the results from an identical simulation to

*except that a Basic Step duration of 0.1 day is used for the simulation presented in*

**Figure 6***. In*

**Figure 7***, it is evident that GoldSim treats the “Changing_Bound” time series values as constant over the next interval and that the next interval is defined in the Time Series and is un-related to the Basic Step duration. The constant over next representation results in a step-like plot when the Basic Step duration is less than the time intervals defined within the time series, which are just the time intervals between data points. In both*

**Figure 7***and*

**Figure 6***, it is evident that “GoldSim will overflow the excess uniformly over the next time-step” if the Upper Bound is exceeded at the start of a time step just as described in the User’s Guide.*

**Figure 7***Figure 7: Moving Upper Bound simulation for an initially full Reservoir with a 0.1 day Basic Step duration*

The Basic Step duration controls the expected resolution of input information and controls the rate of information propagation through the simulated system. In * Figure 6*, the Reservoir volume is shown as always above the Upper Bound because the plot (or Time History Result element) only knows about values on one day increments. The plot only knows about values on one day increments because the model creator told the Time History Result element, which produced the plot, to only obtain information and told the simulation to only calculate values on one day intervals by setting the Basic Step duration to 1 day. This issue of information resolution and the rate of information propagation through a simulated system is a ubiquitous issue for dynamic, numerical simulation. In dynamic simulation of complex physical processes like computational fluid dynamics (CFD) simulations, criteria have been established to guide modelers so that the loss of information from the simulated system will not adversely impact model results. The most famous of these criteria is probably the Courant-Friedrichs-Lewy, or CFL, condition.

* Figure 6* and

*demonstrate that GoldSim will typically overflow the excess volume uniformly over the next time-step if the Upper Bound is exceeded. There is one special situation where GoldSim will handle the overflow differently with a moving Upper Bound and a Reservoir volume which exceeds the Upper Bound. This situation occurs when the rate of change of the Upper Bound across the*

**Figure 7***previous*time step, or Basic Step duration, is exactly equal to the rate of change of the Upper Bound across the

*current*time step.

* Figure 8* presents a Time Series which has an exactly equal rate of change from elapsed time 0.0 days to elapsed time 4.0 days. A comparison of the Time Series in

*to the Time Series in*

**Figure 8***shows that in*

**Figure 4***the rate of change of the Upper Bound is never exactly equal across the intervals provided in the time series. In contrast, the rate of change of the Upper Bound in*

**Figure 4***is exactly equal ( 5.0 m3/day ) across the defined time intervals from 0.0 days elapsed time to 4.0 days elapsed time.*

**Figure 8***Figure 8: Time Series for a changing Upper Bound with exactly equal rate of change from elapsed time 0.0 day to 4.0 days*

When the rate of change of the Upper Bound is exactly equal across two consecutive Basic Step intervals, GoldSim will try to "snap" the Reservoir volume to the changing Upper Bound value. The snapping is achieved by flushing additional water from the Reservoir to try to catch-up to the changing boundary in the middle of a Basic Step interval rather than at the end of the Basic Step interval. * Figure 9* shows the results of a simulation, which is identical to the simulation presented in

*except that the rate of change of the Upper Bound is equal or constant from elapsed time 0.0 day to elapsed time 4.0 day. Because the rate of change of the Upper Bound is equal across several Basic Step intervals, GoldSim will attempt to guess where the Upper Bound will be in the future and will flush water from the Reservoir in order to move the Reservoir volume to meet the guess for the Upper Bound.*

**Figure 6***Figure 9: Equal rate moving Upper Bound simulation for an initially full Reservoir with a 1 day Basic Step duration*

The plot presented in * Figure 9* uses the Time Series from

*for the Reservoir Upper Bound. Within the green box in*

**Figure 8***, the Reservoir volume is snapped to the Upper Bound value because of an equal rate of change of the Upper Bound over two or more Basic Step intervals. In other words, the dark blue and light blue lines overlap within the green box. This occurs because in the case of the Upper Bound changing at exactly the same rate over two Basic Step durations, and only in this case, GoldSim will project, or guess, where the Upper Bound will be in the future and will flush additional water from the Reservoir to match the future projection or guess.*

**Figure 9**An issue will occur with this guessing algorithm in the situation where the rate of change of the Upper Bound is exactly equal across two Basic Step durations and then the rate of change of the Upper Bound is different across the next Basic Step interval. This scenario is shown in the orange box in **Figure 9**. In the orange box, GoldSim makes an incorrect guess for the future position of the Upper Bound and flushes too much water from the Reservoir. The result is that the volume in the Reservoir overshoots the Upper Bound. As a result, GoldSim projects overflow from the Reservoir even though the Reservoir volume is below the Upper Bound.

One way to eliminate the possibility of an overshoot is to use a short Basic Step duration so that GoldSim correctly samples the “constant over next” definition for the Time Series shown in * Figure 8*. If a Basic Step duration of 0.1 day is employed instead of a duration of 1.0 day, then results will be obtained which are similar to the 0.1 day Basic Step duration model shown in

*. In fact,*

**Figure 7***displays results using the Time Series shown in*

**Figure 10***which has a rate of change of the Upper Bound which is exactly equal from elapsed time 0.0 days to 4.0 days for a simulation using a Basic Step duration of 0.1 day. The results in*

**Figure 8***are approximately identical to the results in*

**Figure 10***and the overshoot is corrected with the use of a relatively shorter (i.e. 0.1 day versus 1.0 day) Basic Step duration.*

**Figure 7***Figure 10: Equal rate moving Upper Bound simulation for an initially full Reservoir with a 0.1 day Basic Step duration*

## Comments