Fortran Codes (original) (raw)
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 followinglicence 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 articleE. Hairer and M. Hairer (2002): GniCodes - Matlab programs for geometric numerical integration.
The tar file gnicodes.tarcontains 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.tarcontain 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++ versionof these codes has been written by John Denker.
Rigid body integrator, which is described inE. 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.
- DMV10Fortran subroutine for the modification of order 10 of the DMV algorithm (subroutines for the versions of orders 2,4,6,8 are included).
- DR_DMV10Driver 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.
- DOPRI5explicit Runge-Kutta method of order 5(4) for problems y'=f(x,y); with dense output of order 4
- DR_DOPRI5Driver for DOPRI5
- DOP853explicit Runge-Kutta method of order 8(5,3) for problems y'=f(x,y); with dense output of order 7
- DR_DOP853Driver for DOP853
- ODEXExtrapolation method (GBS) for problems y'=f(x,y); with dense output
- DR_ODEXDriver for ODEX
- ODEX2Extrapolation method (Stoermers rule) for second order differential equations y''=f(x,y); with dense output
- DR_ODEX2Driver for ODEX2
- There is a .tar file of a folder which containsC-versionsof DOPRI5, DOP853 and RETARD. A Unix command-line version of DOP853 is available fromKeith Briggs. A modification of the C-version that can handle discontinuites is available fromFrederico Bergero
- There is a folder, written by Blake Ashby "bmashby (at) stanford.edu", which containsC++ versionsof the nonstiff integrator DOPRI5 and of the stiff integrator RADAU5. It can be unfolded with "tar xzf IntegratorT.tgz".
- There are Matlab and Octave filesMatlabNonStiff,OctaveNonStiff, written by Denis Bichsel "dbichsel (at) infomaniak.ch", for the nonstiff integrators DOPRI5 and DOP853.
- Concerning a Matlab Interfacefor the nonstiff integrators DOPRI5, DOP853, and ODEX consult the homepage at the Technische Universit�t M�nchen.
- There is a gzip-pednonstiff.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.
- RADAU5implicit 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_DECSOLsubroutines for the decomposition and backsubstitution of linear systems; uses the subroutines of DECSOL
- DECSOLlinear algebra routines, used by DC_DECSOL,SDIRK4,ROS4,SEULEX,SODEX
- DC_LAPACKsubroutines for the decomposition and backsubstitution of linear systems; uses the subroutines of LAPACK and LAPACKC
- LAPACKlinear algebra routines, used by DC_LAPACK
- LAPACKClinear algebra routines for complex arithmetic, used by DC_LAPACK
- DR1_RADAU5Driver for RADAU5 (stiff Van der Pol equation)
- DR2_RADAU5Driver for RADAU5 (Amplifier Problem, differential-algebraic of index 1)
- RADAUimplicit 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_RADAUDriver for RADAU (stiff Van der Pol equation)
- RODASRosenbrock 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_RODASDriver for RODAS (stiff Van der Pol equation)
- SEULEXExtrapolation 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_SEULEXDriver 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 followinglicence agreement(for details see the copyright notice (Section 9) of the "Users' guide" for RADAR5). - DC-SUMEXP(version 25 May 2025) linear algebra subroutines that have to be used with an application of RADAU5
- DR-GAMMA-SUMEXP(version 27 May 2025) driver for a test problem with distributed delay (gamma distribution)
- DR-MYELO-SUMEXP(version 27 May 2025) driver for a distributed delay model of chemotherapy-induced myelosuppression (gamma distribution)
The following examples are fractional differential equations. They have to be used in combination with RADAU5 and DC-SUMEXP - DR-FRACDIETdriver for a test problem by Diethelm
- DR-FRACBRUSdriver for a fractional Brusselator problem
- DR-FRACLAP01and DR-FRACLAP12are drivers for a fractional diffusion problem with exact solution
- DR-FRAC3LAPand DR-FRAC3LAPDare drivers for a system of fractional diffusion-reaction problem
Oldies: Some further available codes which, however, do not have the same linear algebra options are: - SDIRK4a 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 driveris also available.
- ROS4Classical 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 driveris also available.
- SODEXExtrapolation method based on linearly implicit mid-point rule for problems of the form My'=f(x,y); uses DECSOL; A driveris also available.
- RADAUPimplicit 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 containsC++ versionsof the nonstiff integrator DOPRI5 and of the stiff integrator RADAU5. It can be unfolded with "tar xzf IntegratorT.tgz".
- There are Matlab and Octave filesMatlabStiff,OctaveStiff, written by Denis Bichsel "dbichsel (at) infomaniak.ch", for the stiff integrator RADAU.
- Concerning a Matlab Interfacefor the stiff integrators RADAU5 and SEULEX consult the homepage at the Technische Universit�t M�nchen.
- Matlab versions of RADAU5 can be downloaded fromUniversit�t T�bingen (Ch. Engstler).
- An interactive pdf fileUniversidad 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-pedstiff.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.tarcontains 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
- RETARDExtension of the code DOPRI5 to delay differential equations y'(t)=f(t,y(t),y(t-a),...)
- DR_RETARDDriver for RETARD
There is a folder withMatlab codes, written by Denis Bichsel "dbichsel (at) infomaniak.ch", for adaptations of the nonstiff integrators DOPRI5 and DOP853 to delay differential equations. 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 followinglicence 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 followinglicence agreement.
- RADAR5(version 2.2 of February 2024)
- DC_SUMEXPDELreplaces the file DC_DECSOLDEL for probems with distributed delays
- DR_PARETODriver 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.
- HEM5Half-explicit Runge-Kutta method of order 5(3); uses DECSOL, LAPACK, LINSP (code by V. Brasey)
- HEM5.PSPostScript file containing a user's guide for HEM5.
- LINSPSparse Linear Algebra routines containing MA28 of the Harwell library
- DR_ISODriver for HEM5 (chain of insulators, non-sparse version)
- DR_ISOSPDriver for HEM5 (chain of insulators, sparse version)
- PHEM56Partitioned half-explicit Runge-Kutta method of order 5(4); uses DECSOL, LAPACK, LINSP (code by A. Murua ander(at)si.ehu.es)
- PHEM56.PSPostScript file containing a user's guide for PHEM56.
- DR_PHEM56Driver for PHEM56 (chain of insulators, sparse version)
- There is a gzip-pedmechanic.tar.gz file containing all this programs.
Back to the page ofErnst Hairer