VFGEN
  • Home
  • Download
  • Support & FAQ
  • User's Guide
  • §   Vector Field File
  • §   ADOL-C
  • §   AUTO
  • §   Check
  • §   CVODE
  • §   DDE23
  • §   DDE-BIFTOOL
  • §   DDE_SOLVER
  • §   Delay2ODE
  • §   DSTool
  • §   EVF
  • §   GSL
  • §   Help
  • §   LaTeX
  • §   MATCONT
  • §   MATLAB
  • §   Octave
  • §   PyDSTool
  • §   PyGSL
  • §   RADAU5
  • §   Scilab
  • §   SciPy
  • §   Taylor
  • §   XPP

RADAU5 Fortran 77 ODE Solver

RADAU5 is an ODE solver written by Ernst Hairer and Gerhard Wanner.

The VFGEN RADAU5 Command

A Fortran 77 file that can be used with RADAU5 is created by the command

$ vfgen radau5 vector_field_file.vf

This command creates the Fortran file [name]_rhs.f, where [name] is the name of the vector field given in the vector field file. The file contains the following subroutines:

  • [name]_rhs   The vector field function (right hand side)
  • [name]_jac   The Jacobian of the vector field
  • [name]_sol   A simple output subroutine

Options

demo If the option demo=yes is given, the file [name]_dr5.f is also created. This program provides a sample driver for the RADAU5 subroutine. The initial conditions and parameter values are the default values defined in the vector field file.
Default: demo=no

Notes

  • I have tested the Fortran files generated by this command with the GNU Fortran 77 compiler g77, the GNU Fortran compiler gfortran, and fort77, a Fortran compiler based on the Fortran-to-C translator f2c. If you use a different compiler and have problems with the code generated by VFGEN, please let me know.
  • Two non-standard features of the compiler are used: the Fortran code is written in lower case, and the underscore is used in variable names (e.g. y_). The underscores are an easy way to avoid conflicts with variable names that are taken from the vector field file. (If you need code without underscores, let me know.)

Example

Here is a sample vector field file: vanderpol.vf.
The files created by

$ vfgen radau5:demo=yes vanderpol.vf
are
  • vanderpol_rhs.f
  • vanderpol_dr5.f

The files radau5.f and dc_lapack.f can be downloaded from the RADAU5 web site. I will use the g77 Fortran compiler. In a Linux (or similar) system, in which the LAPACK library is installed in a standard location, the following commands will compile and run vanderpol_dr5.

$ g77 -c radau5.f
$ g77 -c dc_lapack.f
$ g77 -c vanderpol_rhs.f
$ g77 -c vanderpol_dr5.f
$ g77 vanderpol_dr5.o vanderpol_rhs.o radau5.o dc_lapack.o -llapack -o vanderpol_dr5
$ ./vanderpol_dr5 > vdp.dat
The last command runs the program and sends the output to vdp.dat. Here is a plot of the data:
Graphs of x(t) and y(t)

Copyright © 2005-2007 Warren Weckesser