d02ndf is a general purpose routine for integrating the initial value problem for a stiff system of explicit ordinary differential equations,
It is designed specifically for the case where the Jacobian
is a sparse matrix.
Both interval and step oriented modes of operation are available and also modes designed to permit intermediate output within an interval oriented mode.
An outline of a typical calling program for
d02ndf is given below. It calls the sparse matrix linear algebra setup routine
d02nuf, the Backward Differentiation Formula (BDF) integrator setup routine
d02nvf, its diagnostic counterpart
d02nyf, and the sparse linear algebra diagnostic routine
d02nxf.
! Declarations
External fcn, jac, monitr
.
.
.
ifail = 0
Call d02nvf(...,ifail)
Call d02nuf(neq, neqmax, jceval, nwkjac, ia, nia, ja, nja, &
jacpvt, njcpvt, sens, u, eta, lblock, isplit, &
rwork,ifail)
ifail = -1
Call d02ndf(neq, neqmax, t, tout, y, ydot, rwork, rtol, &
atol, itol, inform, fcn, ysave, ny2dim, jac, &
wkjac,nwkjac, jacpvt, njcpvt, monitr, itask, &
itrace, ifail)
If(ifail.eq.1 .or. ifail.ge.14) Stop
ifail = 0
Call d02nxf(...)
Call d02nyf(...)
.
.
.
Stop
End
The linear algebra setup routine
d02nuf and one of the integrator setup routines,
d02nvf or
d02nwf, must be called prior to the call of
d02ndf. Either or both of the integrator diagnostic routine
d02nyf, or the sparse matrix linear algebra diagnostic routine
d02nxf, may be called after the call to
d02ndf. There is also a routine,
d02nzf, designed to permit you to change step size on a continuation call to
d02ndf without restarting the integration process.
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
The accuracy of the numerical solution may be controlled by a careful choice of the arguments
rtol and
atol, and to a much lesser extent by the choice of norm. You are advised to use scalar error control unless the components of the solution are expected to be poorly scaled. For the type of decaying solution typical of many stiff problems, relative error control with a small absolute error threshold will be most appropriate (that is, you are advised to choose
with
small but positive).
d02ndf is not thread safe and should not be called from a multithreaded user program. Please see
Section 3.12.1 in How to Use the NAG Library and its Documentation for more information on thread safety.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
Since numerical stability and memory are often conflicting requirements when solving ordinary differential systems where the Jacobian matrix is sparse, we provide a diagnostic routine,
d02nxf, whose aim is to inform you how much memory is required to solve the problem and to give you some indication of numerical stability.
In general, you are advised to choose the Backward Differentiation Formula option (setup routine
d02nvf) but if efficiency is of great importance and especially if it is suspected that
has complex eigenvalues near the imaginary axis for some part of the integration, you should try the BLEND option (setup routine
d02nwf).
This example solves the well-known stiff Robertson problem
over the range
with initial conditions
and
using scalar error control (
). The solution is computed up to
by overshooting and interpolating (
) and the intermediate solution computed on an equispaced mesh through
monitr. The integration algorithm used is the BDF method (setup routine
d02nvf) and a modified Newton method is also used. The use of the 'N' (Numerical) and 'S' (Structural) options are illustrated in turn for calculating the Jacobian.