gsl_ode_control Class Template Reference

Control structure for gsl_astep. More...

#include <gsl_astep.h>


Detailed Description

template<class vec_t>
class gsl_ode_control< vec_t >

This class implements both the "standard" and "scaled" step control methods from GSL. The standard control method is the default. To use the scaled control, set standard to false and set the scale for each component using set_scale().

The control object is a four parameter heuristic based on absolute and relative errors eps_abs and eps_rel, and scaling factors a_y and a_dydt for the system state $ y(t) $ and derivatives $ y^{\prime}(t) $ respectively.

The step-size adjustment procedure for this method begins by computing the desired error level $ D_i $ for each component. In the unscaled version,

\[ D_i = \mathrm{eps\_abs}+\mathrm{eps\_rel} \times \left( \mathrm{a\_y} | y_i| + \mathrm{a\_dydt}~h | y_i^{\prime}| \right) \]

while in the scaled version the user specifies the scale for each component, $ s_i $,

\[ D_i = \mathrm{eps\_abs}~s_i+\mathrm{eps\_rel} \times \left( \mathrm{a\_y} | y_i| + \mathrm{a\_dydt}~h | y_i^{\prime}| \right) \]

The desired error level $ D_i $ is compared to then observed error $ E_i = |\mathrm{yerr}_i| $. If the observed error $ E $ exceeds the desired error level $ D $ by more than 10 percent for any component then the method reduces the step-size by an appropriate factor,

\[ h_{\mathrm{new}} = S~h_{\mathrm{old}} \left(\frac{E}{D}\right)^{-1/q} \]

where $ q $ is the consistency order of the method (e.g. $ q=4 $ for 4(5) embedded RK), and $ S $ is a safety factor of 0.9. The ratio $ E/D $ is taken to be the maximum of the ratios $ E_i/D_i $.

If the observed error E is less than 50 percent of the desired error level $ D $ for the maximum ratio $ E_i/D_i $ then the algorithm takes the opportunity to increase the step-size to bring the error in line with the desired level,

\[ h_{\mathrm{new}} = S~h_{\mathrm{old}} \left(\frac{E}{D}\right)^{-1/(q+1)} \]

This encompasses all the standard error scaling methods. To avoid uncontrolled changes in the stepsize, the overall scaling factor is limited to the range 1/5 to 5.

If the user specified fewer scaling parameters than the number of ODEs, then the scaling parameters are reused as follows. If there are $ N $ ODEs and $ M $ scaling parameters, then for $ i>M $, the ith scaling parameter $ s_i $ is set to be $ s_{i\%M} $ . If the user selects the scaled control by setting standard to false and no scale parameters are specified, this class reverts to the standard control.

Definition at line 118 of file gsl_astep.h.


Public Member Functions

template<class svec_t >
int set_scale (size_t nscal, const svec_t &scale)
 Set the scaling for each differential equation.
virtual int hadjust (size_t dim, unsigned int ord, const vec_t &y, vec_t &yerr, vec_t &yp, double &h)
 Automatically adjust step-size.

Data Fields

double eps_abs
 Absolute precision (default $ 10^{-6} $).
double eps_rel
 Relative precision (default 0).
double a_y
 Function scaling factor (default 1).
double a_dydt
 Derivative scaling factor (default 0).
bool standard
 Use standard or scaled algorithm (default true).

Protected Attributes

size_t sdim
 Number of scalings.
double * scale_abs
 Scalings.

The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page