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

CVODE

CVODE is part of the SUNDIALS suite.

The VFGEN CVODE Command

C files that can be used with CVODE are created by the command

$ vfgen cvode vector_field_file.vf

The files created are [name]_cv.c and [name]_cv_proto.h, where [name] is the name of the vector field given in the vector field file. The C file [name]_cv.c will contain the functions [name]_vf and [name]_jac.

Options

func If the option func=yes is given, a function is created (in the file [name]_cv.c) that computes the user-defined functions. The name of the function is [name]_func. The function and its arguments are configured to be used with CVODE's rootfinding capability.
Default: func=no
demo If the option demo=yes is given, the file [name]_solve.c will contain the main routine for a command-line ODE solver for the vector field. Initial conditions, vector field parameter values, and ODE solver parameter values can be given as arguments to the demo program. The output of the program includes the time, the solution, and, if the func=yes option was also given, the values of the user-defined functions at each point.
Default: demo=no
version Code is generated for three versions of CVODE. The CVODE version is given with the version option. The supported version are version=2.3.0, version=2.4.0 or version=2.5.0. The default is 2.5.0. Note: This is the CVODE version, not the SUNDIALS version. This table shows how they are related.
SUNDIALSCVODE
2.1.12.3.0
2.2.02.4.0
2.3.02.5.0

Default: version=2.5.0

Example

Here is a sample vector field file: pendulum.vf.
The files created by
$ vfgen cvode:func=yes,demo=yes pendulum.vf

are
  • pendulum_cv.c
  • pendulum_cv.h
  • pendulum_cvdemo.c,
  • Makefile-pendulum_cvdemo

In an operating system with the POSIX development tools, and where SUNDIALS is installed in /usr/local, the demonstation program is compiled with the make command:

$ make -f Makefile-pendulum_cvdemo
If SUNDIALS is installed in, say, /opt/sundials-v2.3.0, the following command can be used:
$ make SUNDIALS_DIR=/opt/sundials-v2.3.0 -f Makefile-pendulum_cvdemo

After using these files to create the executable pendulum_cvdemo, we can define the initial conditions, parameter values, and some solver parameters on the command line. For example,

$ ./pendulum_cvdemo v=0.0 theta=3.14 b=0.5 stoptime=10 > pend.dat

(Other command line options include the parameters g, L, m, the relative error relerr, and the absolute error, abserr.)

This command generates the file pend.dat. Here is a plot of the data:

Graphs of theta, v, and energy

Copyright © 2005-2007 Warren Weckesser