GoldSim allows you to decrease the timestep length according to a specified schedule during a simulation (e.g., start with a small timestep, and then telescope out to a larger timestep) by defining time periods which have different timestep lengths.
Although defining such time periods can be very useful, you must fully specify them prior to running the simulation. That is, you must know how you would like to alter your timesteps prior to running the model. In some cases, however, it may not be possible to do this. That is, in complex systems (particularly ones with uncertain parameters), variables may change at different rates in different realizations, in ways that you cannot predict prior to running the model.
To better simulate these kinds of systems, GoldSim provides an advanced feature that allows you to dynamically adjust the timestep during a simulation (i.e., insert unscheduled updates) based on the values of specified parameters in your model. For example, you could instruct GoldSim to use a maximum timestep of 1 day if X was greater than Y, and 10 days if X was less than or equal to Y. Similarly, you could instruct GoldSim to use a short timestep for a period of 10 days after a particular event occurs, and then return to the default timestep.
This feature can be accessed in the Advanced Time Settings dialog (accessed from the Advanced… button on the Time tab of the Simulation Settings dialog). Within this dialog is a checkbox labeled Dynamically control time between updates:
By default, this checkbox is cleared. Checking it allows you to edit the Maximum time between updates field, which can be used to dynamically control the timestep (by inserting unscheduled updates).
Note: In order to access this checkbox, Allow unscheduled updates must also be checked (the default).
After GoldSim completes all the calculations for a timestep, it must decide when to insert the next timestep. Normally, the next timestep is specified by the Basic Step (or Reporting Periods or Period Timesteps, if defined).
GoldSim uses the value in the Maximum time between updates field (referred to as DTmax below) to override the normally scheduled timestep according to the following rules:
1. If DTmax is greater than or equal to DTsched (the length of time until the next scheduled timestep), the field is ignored and the next timestep is simply the regularly scheduled timestep (Tcurr + DTsched), where Tcurr is the current time.
2. If DTmax is less than or equal to (DTsched /2), the next timestep is Tcurr + DTmax.
3. If DTmax is greater than (DTsched /2), but less than DTsched, the next timestep is Tcurr + (DTsched /2) – that is, DTsched is divided into two equal halves.
These rules can be best understood by considering several simple examples:
Example 1: Assume that the next scheduled timestep length is 10 days, and you have specified a Maximum time between updates (DTmax) of 4 days. GoldSim would compute timesteps at the following points in the first 10 days:
• When time = 0 day, DTsched = 10 days, so DTmax is less than (DTsched /2), and according to rule 2, the next step would be computed at 4 days.
• At time = 4 days, DTsched = 6 days, so DTmax is greater than (DTsched /2), but less than DTsched, and according to rule 3, the next step would be computed at 7 days.
• At time = 7 days, DTsched = 3 days, so DTmax is greater than DTsched, and according to rule 1, the next step would be computed at 10 days.
Example 2: Assume that the next scheduled timestep length is 10 days, and you have specified a Maximum time between updates (DTmax) of 6 days. GoldSim would compute timesteps at the following points in the first 10 days:
• When time = 0 day, DTsched = 10 days, so DTmax is greater than (DTsched /2), but less than DTsched, and according to rule 3, the next step would be computed at 5 days.
• At time = 5 days, DTsched = 5 days, so DTmax is greater than DTsched, and according to rule 1, the next step would be computed at 10 days.
Example 3: Assume that the next scheduled timestep length is 10 days, and you have specified a Maximum time between updates of 1 day. GoldSim would compute timesteps at the following points in the first 10 days:
• When time is equal to 0 through 8 days, rule 2 applies, and a timestep of 1 day is used (steps occur at 1, 2 ,3 ,4 ,5 ,6 ,7, 8, and 9 days).
• At time =9 days, DTsched = 1 day, so DTmax is equal to DTsched, and according to rule 1, the next step would be computed at 10 days.
In all three of these examples, the actual timestep length is always less than or equal to the specified Maximum time between updates. Moreover, the scheduled timesteps defined by the Basic Step, Reporting Periods or Period Timesteps are always observed.
Note: Because certain events (e.g, triggered by a Timed Event or a Reservoir hitting an upper bound) are automatically represented by GoldSim with greater accuracy by allowing them to fall between scheduled timesteps, any events that occur could result in a smaller timestep than that computed using the rules presented above. That is, after GoldSim computes the next timestep based on the rules presented above, it then checks to see if an event would fall within that interval. If an event does fall into that interval, the timestep could be shortened in order to represent the event.
In practice, you would not normally specify the Maximum time between updates as a constant (as you could accomplish the same thing by simply appropriately defining scheduled timesteps. Instead, you would specify it as a variable (i.e., a function). For example:
• If you wanted to reduce the timestep of a model from 10 days to 1 day whenever variable X was close to (say within 10% of) variable Y, you would define your Basic Step as 10 days, and define Maximum time between updates as the function: if(abs(X-Y)/Y < 10%, 1 day, 10 day).
• If you wanted to reduce the timestep to 1 day for a period of 20 days after a particular event occurred, and then return the timestep to its default (e.g., 10 days), you could do this by: 1) triggering an Event Delay when the original Event occurs, with a delay time of 20 days; and 2) defining Maximum time between updates as the function: if(EventDelay.Num_in_Transit>0, 1 day, 10 day).
In addition to providing this dynamic timestepping algorithm on a global scale (i.e., for the entire model), GoldSim also enables you to apply a Maximum time between updates to specific Containers. As a result, you could apply a maximum timestep length only to a portion of your model (represented by a particular Container).
Note: If the Maximum time between updates is less than or equal to zero, a warning message will be written to the Run Log, and it will be ignored (which is equivalent to clearing the Dynamically control time between updates checkbox).
Note: By default, time history displays only include scheduled timesteps, and will not capture unscheduled updates. However, GoldSim provides an option (under a specified set of conditions) in the Advanced Time settings that allows you to include both scheduled and unscheduled updates in a time history display. This provides a mechanism to display and view the exact times at which unscheduled updates are inserted.
Learn more about:
Adding Shorter Timesteps Over Defined Periods
Understanding Timestepping in GoldSim