RKF45method Class Reference

RKF45method is a class for creating approximate solutions of systems of autonomous ordinary differential equations using an implementation of the Runge-Kutta Fehlberg method of order 4 and 5. More...

List of all members.

Public Member Functions

 RKF45method ()
void setErrorTolerance (double tol)
 Sets the relative and absolute error tolerance of the solution value after one step of size dt.
double getErrorTolerance () const
 Returns the current error tolerance.
int getErrorCode () const
 Returns the error code associated with the RK 45 procedure.
int advance (DoubleVector &yk, double dt, VectorFunction *fPtr)
 The value of yk is updated with the solution of the ODE starting from yk and advancing one timestep dt.

Protected Attributes

double errorTolerance
int errorCode


Detailed Description

RKF45method is a class for creating approximate solutions of systems of autonomous ordinary differential equations using an implementation of the Runge-Kutta Fehlberg method of order 4 and 5.

The solution procedure is a Runge-Kutta Fehlberg method whose mplementation is provided by the routine rkf45 written by H.A. Watts and L.F. Shampine at Sandia Laboratories, Albuquerque, New Mexico.

The version used is an f2c translation of the fortran routine obtained from www.netlib.org. This translated version has been appended with the f2c support routines required for compilation (so that the complete f2c support libraries need not be included).

Author:
Chris Anderson
Version:
01/22/09

Definition at line 37 of file RKF45method.h.


Member Function Documentation

int RKF45method::advance ( DoubleVector &  yk,
double  dt,
VectorFunction *  Fptr 
)

The value of yk is updated with the solution of the ODE starting from yk and advancing one timestep dt.

       iflag = 3 -- integration was not completed because relative error
                    tolerance was too small. relerr has been increased
                    appropriately for continuing.
             = 4 -- integration was not completed because more than
                    3000 derivative evaluations were needed. this
                    is approximately 500 steps.
             = 5 -- integration was not completed because solution
                    vanished making a pure relative error test
                    impossible. must use non-zero abserr to continue.
                    using the one-step integration mode for one step
                    is a good way to proceed.
             = 6 -- integration was not completed because requested
                    accuracy could not be achieved using smallest
                    allowable stepsize. user must increase the error
                    tolerance before continued integration can be
                   attempted.
             = 7 -- it is likely that rkf45 is inefficient for solving
                    this problem. too much output is restricting the
                    natural stepsize choice. use the one-step integrator
                    mode.
             = 8 -- invalid input parameters
                    this indicator occurs if any of the following is
                    satisfied -   neqn .le. 0
                                  t=tout  and  iflag .ne. +1 or -1
                                  relerr or abserr .lt. 0.
                                  iflag .eq. 0  or  .lt. -2  or  .gt. 8

The errorTolerance specified is used to set both the absolute and relative error tolerence values. As dicussed in the comments in original rkf45.f, rkf45Comments.f, the advance() routine should not be used with relative error control smaller than about 1.e-8.

Definition at line 91 of file RKF45method.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Jan 23 08:24:10 2009 for RKF45 by  doxygen 1.5.1-p1