maxterval/minterval
Set the maximum/minimum allowable integration step size
Syntax
maxterval <variable name> = <maximum step size>
minterval <variable name> = <minimum step size>
Description
The MAXTERVAL and MINTERVAL statements are used to set the maximum and minimum (respectively) allowable step sizes used by the ODE integrators in Magnolia. Each of these statements declares a variable used to hold the value of associated step size. These may be treated similarly to a CONSTANT, in that the values may be set externally from the CSL code (e.g., in script code) prior to a simulation run.
The step sizes used by variable step size ODE integration algorithms work in conjunction with the absolute and relative error tolerance settings (MERROR and XERROR). Generally, an ODE solver will attempt to achieve prescribed error tolerances by adjusting the step size, with the goal of finding the largest step size which yields results to within acceptable error tolerances. The default settings for step size limits and error tolerances tend to work for a wide range of problems, but in some cases it may be necessary to either decrease the minimum step size or increase the error tolerances in order for the ODE solver to successfully solve the system of equations. If the solver fails, an error message like the following will be displayed and the simulation will exit prematurely:
At t = 0.0 and h = 1.0E-5, the error test failed repeatedly or with |h| = hmin.
The choice of whether to increase error tolerances or decrease minimum step size is somewhat problem-dependent. In doing either, one must weigh the desired accuracy of the model predictions against the additional computational effort necessitated by decreasing the step size. Occasionally this may require some trial and error.
Example
maxterval maxt = 1e10
minterval mint = 1e-15