Fortran and Matlab Codes
If you have any problems with the file transfer, please, contact
Ernst.Hairer (at) unige.ch
We hope the programs will be of use for you and your group.
We appreciate, if you communicate us your experiences (bad and
good) with our codes.
A
testset of stiff differential equations with drivers for some of our
codes is also at your disposal.
The software of this page (with the exception of Radar5 and
dc_sumexp below) is free subject to the following
licence agreement
Geometric Integrators (Structure-Preserving Algorithms)
Symplectic methods for Hamiltonian systems and symmetric methods
for reversible problems show an improved qualitative and quantitative
behaviour, especially for long-time integrations.
For a description see:
E. Hairer, C. Lubich and G. Wanner (2002): Geometric Numerical Integration.
Structure-Preserving Algorithms for Ordinary Differential equations.
Springer Series in Comput. Math., vol. 31 as well as the article
E. Hairer and M. Hairer (2002): GniCodes - Matlab programs for geometric numerical integration.
The tar file gnicodes.tar
contains a directory with the following Fortran 77 codes (for
unfolding the directory use the command tar xvf gnicodes.tar)
- GNI_IRK2, symplectic and symmetric implicit Runge-Kutta code
for second order differential equations;
- GNI_COMP, composition methods with basic method as external subroutine;
- GNI_LMM2, symmetric linear multistep methods for second order
differential equations;
- Driver examples for all three methods;
- Comparison of three 8th order methods at the Kepler problem and
the outer solar system;
- sophisticated use of composition methods: rigid-body simulation (top)
based on splitting or on Rattle; two-body problem on the sphere.
The tar file gnimatlab.tar
contain a directory with the following Matlab codes (for
unfolding the directory use the command tar xvf gnimatlab.tar)
- GNI_IRK2, symplectic and symmetric implicit Runge-Kutta code
for second order differential equations;
- GNI_COMP, composition methods with basic method as external subroutine;
- GNI_LMM2, symmetric linear multistep methods for second order
differential equations;
- Driver examples for the methods, Kepler problem;
- Computation of Poincare sections for the Henon-Heiles problem;
- Driver for solving the two-body problem on the sphere.
A C++ version
of these codes has been written by John Denker.
Rigid body integrator, which is described in
E. Hairer and G. Vilmart (2006): Preprocessed Discrete Moser-Veselov
algorithm for the full dynamics of the rigid body,
J. Phys. A: Math. Gen. 39 (2006) 13225-13235.
- DMV10
Fortran subroutine for the modification of order 10 of the DMV
algorithm (subroutines for the versions of orders
2,4,6,8 are included).
- DR_DMV10
Driver for DMV10 (asymmetric rigid body).
Nonstiff Differential Equations
For a description see:
Hairer, Norsett and Wanner (1993): Solving Ordinary
Differential Equations. Nonstiff Problems. 2nd edition.
Springer Series in Comput. Math., vol. 8.
- DOPRI5
explicit Runge-Kutta method of order 5(4) for
problems y'=f(x,y); with dense output of order 4
- DR_DOPRI5
Driver for DOPRI5
- DOP853
explicit Runge-Kutta method of order 8(5,3) for
problems y'=f(x,y); with dense output of order 7
- DR_DOP853
Driver for DOP853
- ODEX
Extrapolation method (GBS) for problems
y'=f(x,y); with dense output
- DR_ODEX
Driver for ODEX
- ODEX2
Extrapolation method (Stoermers rule) for
second order differential equations y''=f(x,y);
with dense output
- DR_ODEX2
Driver for ODEX2
- There is a .tar file of a folder which contains
C-versions
of DOPRI5, DOP853 and RETARD.
A Unix command-line version of DOP853 is available from
Keith Briggs.
A modification of the C-version that can handle discontinuites is available from
Frederico Bergero
- There is a folder, written by Blake Ashby
"bmashby (at) stanford.edu", which contains
C++ versions
of the nonstiff integrator DOPRI5 and of the stiff integrator RADAU5.
It can be unfolded with "tar xzf IntegratorT.tgz".
- There are Matlab and Octave files
MatlabNonStiff,
OctaveNonStiff,
written by Denis Bichsel
"dbichsel (at) infomaniak.ch", for the
nonstiff integrators DOPRI5 and DOP853.
- Concerning a
Matlab Interface
for the nonstiff integrators DOPRI5, DOP853, and ODEX consult the
homepage at the Technische Universität München.
- There is a gzip-ped
nonstiff.tar.gz file containing all this programs.
Stiff Differential Equations and Differential-Algebraic Problems
Description:
Hairer and Wanner (1996): Solving Ordinary Differential
Equations. Stiff and Differential-Algebraic Problems. 2nd edition.
Springer Series in Comput. Math., vol. 14.
- RADAU5
implicit Runge-Kutta method of order 5
(Radau IIA) for problems of the form
My'=f(x,y) with possibly singular matrix M;
with dense output (collocation solution).
Concerning the linear algebra routines the
user has the choice to link the program either with
DC_DECSOL and DECSOL
or with
DC_LAPACK and LAPACK and LAPACKC
Hints for the choice:
a) the LAPACK routines use BLAS
b) the compiler has to accept COMPLEX*16
for the LAPACK routines; the DECSOL
routines only use REAL*8 declarations
- C-Interface to radau/radau5 code, written by
Michael Hauth
(Michael.Hauth (at) wsi-gris.uni-tuebingen.de).
This package allows to call the radau/radau5-codes from C.
- DC_DECSOL
subroutines for the decomposition and
backsubstitution of linear systems; uses
the subroutines of DECSOL
- DECSOL
linear algebra routines, used by
DC_DECSOL,SDIRK4,ROS4,SEULEX,SODEX
- DC_LAPACK
subroutines for the decomposition and
backsubstitution of linear systems; uses
the subroutines of LAPACK and LAPACKC
- LAPACK
linear algebra routines, used by DC_LAPACK
- LAPACKC
linear algebra routines for complex
arithmetic, used by DC_LAPACK
- DR1_RADAU5
Driver for RADAU5 (stiff Van der Pol equation)
- DR2_RADAU5
Driver for RADAU5
(Amplifier Problem, differential-algebraic of index 1)
- RADAU
implicit Runge-Kutta method (Radau IIA) of variable order (switches
automatically between orders 5, 9, and 13)
for problems of the form
My'=f(x,y) with possibly singular matrix M;
For the choices IWORK(11)=3 and IWORK(12)=3, the code is mathematically
equivalent to RADAU5 (in general a little bit slower than RADAU5).
- DR_RADAU
Driver for RADAU
(stiff Van der Pol equation)
- RODAS
Rosenbrock method of order 4(3),
for problems of the form My'=f(x,y) with possibly
singular matrix M; with dense output;
algebraic order conditions are considered
Concerning the linear algebra routines the
user has the choice to link the code with
DC_DECSOL and DECSOL
or with
DC_LAPACK and LAPACK and LAPACKC
(actually, the file LAPACKC and the routines of
DC_LAPACK which need COMPLEX*16 are not used)
- DR_RODAS
Driver for RODAS
(stiff Van der Pol equation)
- SEULEX
Extrapolation method based on linearly
implicit Euler for problems of the form
My'=f(x,y) with possibly singular matrix M;
with dense output; concerning the linear algebra
the user has the same choice as for RODAS
- DR_SEULEX
Driver for SEULEX
(stiff Van der Pol equation)
Stiff problems with distributed delays (integro-differential equations):
such problems can be solved with RADAU5 by replacing DC_DECSOL with DC_SUMEXP.
A description can be found in: N. Guglielmi and E. Hairer, Applying stiff
integrators for ODEs and DDEsto problems with distributed delays.
The codes are written in collaboration with
Nicola Guglielmi (nicola.guglielmi (at) gssi.it).
They are free subject to the following
licence agreement
(for details see the copyright notice (Section 9) of the "Users' guide" for RADAR5).
- DC-SUMEXP
linear algebra subroutines that have to be used with an application of RADAU5
- DR-GAMMA-SUMEXP
driver for a test problem with distributed delay (gamma distribution)
- DR-MYELO-SUMEXP
driver for a distributed delay model of chemotherapy-induced
myelosuppression (gamma distribution)
Oldies: Some further available codes which, however, do not have
the same linear algebra options are:
- SDIRK4
a diagonally-implicit Runge-Kutta method of order 4
for problems of the form My'=f(x,y) with possibly
singular matrix M; with dense output, uses DECSOL;
A driver
is also available.
- ROS4
Classical Rosenbrock methods of order 4(3),
for problems of the form My'=f(x,y) with possibly
singular matrix M; no dense output; uses DECSOL;
A driver
is also available.
- SODEX
Extrapolation method based on linearly
implicit mid-point rule for problems of the form
My'=f(x,y); uses DECSOL;
A driver
is also available.
- RADAUP
implicit Runge-Kutta method of order 5, 9, or 13
(Radau IIA) for problems of the form
My'=f(x,y) with possibly singular matrix M;
superseded by RADAU.
- There is a folder, written by Blake Ashby
"bmashby (at) stanford.edu", which contains
C++ versions
of the nonstiff integrator DOPRI5 and of the stiff integrator RADAU5.
It can be unfolded with "tar xzf IntegratorT.tgz".
- There are Matlab and Octave files
MatlabStiff,
OctaveStiff,
written by Denis Bichsel
"dbichsel (at) infomaniak.ch", for the
stiff integrator RADAU.
- Concerning a
Matlab Interface
for the stiff integrators RADAU5 and SEULEX consult the
homepage at the Technische Universität München.
- Matlab versions of RADAU5 can be downloaded from
Universität Tübingen
(Ch. Engstler).
- An interactive pdf file
Universidad de Zaragoza
is provided by (Luis Randez).
It is an academic implementation of RADAU5, and permits to
integrate bidimensional differential systems.
- There is a gzip-ped
stiff.tar.gz file containing all this programs.
Stabilized explicit methods for stiff differential equations
The methods are based on explicit Runge-Kutta methods with extended
stability domain along the negative real axis. They are easy to
use (no linear algebra routines, ...), and they are especially
suited for MOL discretizations of parabolic partial differential
equations. The codes are written by
Assyr Abdulle
(Assyr.Abdulle (at) math.unige.ch).
- the tar file rock.tar
contains a directory with the Fortran 77 codes ROCK2 (order 2)
and ROCK4 (order 4), and subdirectories for the following three examples. For
unfolding the directory use the command tar xvf rock.tar
- BURGER, a MOL discretization of Burger's equation (dimension 500);
- BRUSS-2D, a MOL discretization of a reaction-diffusion problem
in 2 space dimensions (dimension of the ODE is 32768);
- FINAG, the FitzHug and Nagumo nerve conduction equation (dimension 400).
Delay Differential Equations
For nonstiff problems
For stiff problems, including differential-algebraic and neutral
delay equations with constant or state-dependent (eventually
vanishing) delay. The codes are written in collaboration with
Nicola Guglielmi
(nicola.guglielmi (at) gssi.it).
They are free subject to the following
licence agreement
(for details see the copyright notice (Section 9) of the "Users' guide").
- the tar file radar5-v2.2.tar (version 2.2 of February 2024)
contains a directory with the Fortran 90 code RADAR5, the necessary linear algebra
routines, and subdirectories for the following nine examples.
A user's guide for the
version 2.2 is available.
- ENZYME kinetics with an inhibitor molecule, dimension 4,
one constant delay;
- HAYASHI an almost singular state dependent neutral problem,
dimension 2 as differential-algebraic problem, one vanishing delay;
- HEPATITIS acute hepatitis B virus infection, dimension 10,
5 constant delays;
- OREGONATOR chemical kinetics, dimension 2, one constant delay;
- ROBERTSON chemical reaction with steady state solution, dimension 3,
one constant delay, very large time interval (step sizes larger than the delay);
- SDISC, non smooth artificial problem, dimension 1, 1 constant delay;
- WALTMAN, threshold model for antibody production, dimension 6,
2 state-dependent delays tending to zero,
discontinuities in the right-hand side of
the equations;
- PAUL, state-dependent artificial problem;
- ELSNOR, problem with solution termination.
For problems with distributed delay.
The codes are written in collaboration with
Nicola Guglielmi
(nicola.guglielmi (at) gssi.it).
They are free subject to the following
licence agreement.
- RADAR5
(version 2.2 of February 2024)
- DC_SUMEXPDEL
replaces the file DC_DECSOLDEL for probems with distributed delays
- DR_PARETO
Driver for RADAR5 for a problem with a Pareto-distributed integral term.
Mechanical Systems
The following codes are especially adapted to the equations
of motion for constrained mechanical systems:
q' = T(q,t)v
M(t,q)v' = f(q,v,u,t) - L(q,v,u,t)*lamda
0 = H(q,t)v + k(q,t)
u' = d(q,v,u,lambda,t)
They have options for projecting the numerical solution to manifolds
defined by 0 = g(q,t).
A dense output is available.
- HEM5
Half-explicit Runge-Kutta method of order 5(3);
uses DECSOL, LAPACK, LINSP (code by V. Brasey)
- HEM5.PS
PostScript file containing a user's guide for HEM5.
- LINSP
Sparse Linear Algebra routines containing MA28 of the
Harwell library
- DR_ISO
Driver for HEM5 (chain of insulators, non-sparse version)
- DR_ISOSP
Driver for HEM5 (chain of insulators, sparse version)
- PHEM56
Partitioned half-explicit Runge-Kutta method of order 5(4);
uses DECSOL, LAPACK, LINSP (code by A. Murua
ander(at)si.ehu.es)
- PHEM56.PS
PostScript file containing a user's guide for PHEM56.
- DR_PHEM56
Driver for PHEM56 (chain of insulators, sparse version)
- There is a gzip-ped
mechanic.tar.gz file containing all this programs.
Back to the page of
Ernst Hairer