As the GoldSim Help manual states, Pool elements (and also Reservoirs and Integrators) use Euler Integration. This method solves the continuity equation by assuming the current outflow rate remains constant over the entire timestep:
Quantity(t) = Quantity(t-1) + (Inflows(t-1) - Outflows(t-1)) * dtThe manual states:
"...if the timestep is large, this method can lead to significant errors."
This presents a challenge for simulating highly responsive hydraulic outflow structures like a spillway. If your model uses a 1-day step, it assumes the spillway flow at the start of the day will continue for all 24 hours, even as a flood fills the reservoir.
In most cases, this "overshoot" leads to a massive, unrealistic spike in water level, followed by a massive, unrealistic outflow on the next step. The result is a model that oscillates wildly and is numerically unstable.
A Solution: Dynamic Time-Stepping
A common solution for this numerical instability is Level Pool Routing. However, this classic hydrologic method is "event-based," which introduces a limitation for a systems model: it requires the entire inflow hydrograph to be known in advance, before the calculation starts.
This means it cannot handle "live" or "dynamic" inflows that are calculated during the simulation. For example, it cannot cope if the inflow is the outflow from an upstream reservoir or a pump that turns on based on the current water level.
For a dynamic, continuous model, as is common in GoldSim, we need a different approach. We need a model that can run fast (often using 1-day steps) when the reservoir is calm, but automatically use smaller time steps when the spillway is active to solve the physics directly.
This is what GoldSim's Dynamic Timestep Control is for.
This feature allows you to define a "Maximum time between updates" (DTmax). GoldSim's time-stepping engine will check this value at every step and insert unscheduled updates to ensure the actual time step is never larger than your specified DTmax. You can adjust this value in the Advanced Simulation Settings.
You can also control the time step at the Container level. However, this is not always possible in an interconnected systems model where feedback and coupling of states exist.
Adaptive Time Stepping Implementation
When simulating responsive outflow controls like a spillway, our goal is to create a "smart" DTmax expression that reacts to the reservoir's physics. We also need to solve an edge case: "jumping over" the spillway crest between 1-day steps.
Our solution combines two features:
- Stock Test Events: To stop the clock at the exact moment the water level reaches the spillway crest, either from below or above.
- Adaptive
DTmaxLogic: To control the time step after that event.
Step 1: Catching the Crest with a Stock Test
First, we must prevent the 1-day step from "jumping" from below the crest to far above it. We do this by setting a Stock Test Type of event using a Triggered Event element:
-
Condition:
Pool == Spillway_Crest_Volume(the volume of water in the reservoir at the elevation of the spillway) -
Trigger:
At Stock Test
This tells GoldSim to insert an unscheduled update at the exact moment the water touches the crest. This is our "event detection."
Step 2: Defining the Adaptive Time Step (DTmax)
Now that we've "caught" the crest, we need to tell GoldSim what to do next. At this exact moment, our calculated Weir_Flow is still zero, which could fool our logic.
We will use the following expressions to control the DTmax field in the Simulation Settings:
The "Spill" Logic (DT1) This expression is the "brain" of the operation and handles the three phases of a spill:
DT1 = IF(Weir_Flow < 0.001 m3/s, 1 min, max(1 min, min(1 hr, 0.1 * Pool1 / Weir_Flow)))This logic breaks down as follows:
-
IF(Weir_Flow < 0.001 m3/s, 1 min, ...): This is the "chatter" fix. It handles the crossover event (on both the rising and falling limb) where the water is at the crest but flow is zero. It forces a tiny 1-minute step to "nudge" past this sensitive point. -
...min(1 hr, ...): This is the "falling limb" fix. WhenWeir_Flowgets tiny, theV/Qcalculation becomes huge. This "clamps" theDTto a maximum of 1 hour, forcing the model to step gently back down. -
...max(1 min, ... 0.1 * Pool1 / Weir_Flow): This is a stability rule. ThePool1 / Weir_Flowpart estimates the reservoir's "flushing time" (how fast it's emptying). We use 10% of that time (0.1 * ...) as our new, smaller step. This forces the model to take small, safe steps that are much faster than the reservoir's "reaction time," which keeps the simulation stable. Figure 5 - DT1 Logic in a Selector Element.
Logic 2: The "Master Switch" (DT2) This is the final expression you link to the Maximum time between updates field:
DT2 = IF(Water_Level < spill_crest, 1 day, DT1)This logic is simple:
- If the water is below the crest, the system is not sensitive. Run at full speed: 1 day.
- If the water is at or above the crest, the system is sensitive. Activate the advanced
DT1logic.
Here is the time history plot without adaptive time stepping:
Here is the time history plot with adaptive time stepping:
Conclusion
By combining Stock Test Events (for event detection) with dynamic, adaptive time steps, we've created a reservoir model that is both efficient and numerically stable.
This method gives us the best of both worlds:
- The performance of a 1-day model when the system is stable.
- The accuracy and stability of a 1-minute model when the hydraulics are active.
Limitations
This method requires dynamically adjusting the global time step. While it is true that you can isolate adaptive time stepping to a single Container, this is often not possible when simulating a system of interconnected reservoirs, as is common in many water balance models. This limitation may affect performance, but it will not affect the rest of the model as long as other components have not been built in a way that is dependent on the time step length itself.
Comments
0 comments
Please sign in to leave a comment.