Adaptive Step-Size Strategies in Numerical Integration of ODEs

On This Page

The task of numerically integrating differential equations is to transform the initial value problem on continuous time
$$ y'(t)=f(t,y(t)),\quad y(t_0)=y_0 $$
into a recurrence at discrete moments. Fixed-step methods take $t_{n+1}=t_n+h$; for example, the explicit Euler method advances using
$$ y_{n+1}=y_n+h f(t_n,y_n) $$. Its local truncation error is $O(h^2)$, and the global error is $O(h)$; the local error for the fourth-order Runge-Kutta method is then $O(h^5)$. The problem is that the true solution often varies at very different rates over different time intervals: in some intervals the curvature is large or the stiffness is strong, requiring a small $h$; in others the interval is very smooth, and a large $h$ is sufficient. If a fixed step is chosen according to the most severe interval, it wastes a lot of computation in smooth intervals; if chosen according to smooth intervals, it produces unacceptable errors in severe intervals. The basic idea of adaptive step size is to estimate the local error for each step, then decide whether to accept or reject based on the ratio of the error to the tolerance, and to predict the next $h$.

Embedded Runge-Kutta and Error Estimation

The key to adaptive implementation is "obtaining an error estimate without solving an extra time step". Embedded Runge-Kutta methods compute two approximations of different orders within the same step; for example, the Dormand-Prince RK45 simultaneously provides a fifth-order solution $y_{n+1}$ and a fourth-order solution $\hat y_{n+1}$. Usually the higher-order solution is used to advance, and the difference between the two
$$ e_{n+1}=y_{n+1}-\hat y_{n+1} $$
is used as an estimate of the local error. This estimate is not the true error, but a controllable dominant term sufficient to drive step-size adjustment.

The error must be compared with the user-specified tolerance. The absolute tolerance $\mathrm{atol}$ controls components close to zero, while the relative tolerance $\mathrm{rtol}$ controls the relative accuracy of large components. The allowable error for the $i$-th component is often written as
$$ \mathrm{tol}i=\mathrm{atol}i+\mathrm{rtol}\max(|y{n,i}|,|y{n+1,i}|). $$
Then the component errors are scaled and the root-mean-square is taken:
$$ \mathrm{err}=\sqrt{\frac{1}{m}\sum_{i=1}^m\left(\frac{e_{n+1,i}}{\mathrm{tol}_i}\right)^2}. $$
When $\mathrm{err}\le 1$, the step is considered to satisfy the tolerance, it is accepted, and the method advances; otherwise the step is rejected, $h$ is reduced, and the computation is repeated. This scaled norm avoids a component with a very large dimension covering the errors of small components.

Step-Size Control Law: How Error Becomes a New Step Size

If the local error order of the method is $q+1$, i.e., $e\sim C h^{q+1}$, the current error is $\mathrm{err}$, and we wish the new step size to make the error close to $1$, then the ideal ratio is
$$ h_{\mathrm{new}}=h\left(\frac{1}{\mathrm{err}}\right)^{1/(q+1)}. $$
In actual implementation this value is not adopted directly, but a safety factor and change limits are added:
$$ h_{\mathrm{new}}=h\min\left(\eta_{\max},\max\left(\eta_{\min},\alpha \mathrm{err}^{-1/(q+1)}\right)\right). $$
Here $\alpha$ is often taken between $0.8$ and $0.9$ to avoid frequent rejection due to bias in the error estimate; $\eta_{\max}$ limits step-size growth, for example to no more than $2$ to $5$ times the original; $\eta_{\min}$ limits the reduction, for example to no less than $0.1$ to $0.5$ times the original. If the step-size change is too violent, the historical information of the discrete error is destroyed, and the system is prone to oscillation between "accept" and "reject". More refined PI controllers also use the error ratios of previous steps to make the step size smoother.

Sign in to read the full article

Sign in to read the full article for free