The ODEPACK suite includes the ordinary differential equation solvers LSODE, LSODA, and LSODAR. LSODE was written by A. Hindmarsh; LSODA and LSODAR were written by A. Hindmarsh and L. Petzold.
A Fortran 77 file that can be used with LSODE, LSODA, or LSODAR is created by the command
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:
func |
If the option func=yes is given,
VFGEN creates a subroutine that computes the values of any
Functions that were defined in the vector field file.
The subroutine is designed to be used with the rootfinding
capability of the LSODAR solver.
Default: func=no |
parstyle |
There are two methods for passing parameters to the vector
field and Jacobian functions: include them in the array that
holds the state variables, or put them in a named common block.
The parstyle option allows you to choose which
method to use.
If the option parstyle=common is given,
the parameters will be put in a common block with the
name [name]_parameters, where [name] is the name of
the vector field.
If the option parstyle=after is given,
the parameters are included in the same vector as the
state variables, beginning just after the last state variable.
Default: parstyle=after |
demo |
If the option demo=yes is given,
the file [name]_demo.f
is also created. This program provides
a sample driver for the LSODA subroutine.
The initial conditions and parameter values
are the default values defined in the vector
field file.
Default: demo=no |
Here is a sample vector field file: vanderpol.vf.
The files created by
In a Linux (or similar) system, the following commands will compile and run vanderpol_demo.f using the gfortran compiler.
The Rossler system is
x ' | = | -(y+z) |
y ' | = | x + ay |
z ' | = | b + (x-c)z |
We create a Fortran implementation of the vector field with the command
The program rossler_pmap.f uses the root-finding capability of LSODAR to compute the points where a trajectory crosses the plane y = 0 (and x < 0). The resulting x return map is plotted in the following figure.