d02nbf 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
$\frac{\partial g}{\partial y}$ is a full 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
d02nbf is given below. It calls the full matrix linear algebra setup routine
d02nsf, the Backward Differentiation Formula (BDF) integrator setup routine
d02nvf, and its diagnostic counterpart
d02nyf.
! Declarations
External fcn, jac, monitr
.
.
.
ifail = 0
Call d02nvf(...,ifail)
Call d02nsf(neq, ldysav, jceval, nwkjac, rwork, ifail)
ifail = -1
Call d02nbf(neq, ldysav, t, tout, y, ydot, rwork, rtol, &
atol, itol, inform, fcn, ysave, sdysav, jac, wkjac, nwkjac, &
monitr, itask, itrace, ifail)
If (ifail.eq.1 .or. ifail.ge.14) Stop
ifail = 0
Call d02nyf(...)
.
.
.
Stop
End
The linear algebra setup routine
d02nsf and one of the integrator setup routines,
d02nvf or
d02nwf, must be called prior to the call of
d02nbf. The integrator diagnostic routine
d02nyf may be called after the call to
d02nbf. There is also a routine,
d02nzf, designed to permit you to change step size on a continuation call to
d02nbf without restarting the integration process.
If on entry
${\mathbf{ifail}}=0$ or
$-1$, 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
${\mathbf{itol}}=1$ with
${\mathbf{atol}}\left(1\right)$ small but positive).
d02nbf 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.
The cost of computing a solution depends critically on the size of the differential system and to a lesser extent on the degree of stiffness of the problem. For d02nbf the cost is proportional to ${{\mathbf{neq}}}^{3}$, though for problems which are only mildly nonlinear the cost may be dominated by factors proportional to ${{\mathbf{neq}}}^{2}$ except for very large problems.
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
$\frac{\partial g}{\partial y}$ 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
$\left[0,10\right]$ with initial conditions
$a=1.0$ and
$b=c=0.0$ using scalar error control (
${\mathbf{itol}}=1$) and computation of the solution at
${\mathbf{tout}}=10.0$ with
tcrit (e.g., see
d02mvf) set to
$10.0$ (
${\mathbf{itask}}=4$). d02nby is used for
monitr, a BDF integrator (setup routine
d02nvf) is used and a modified Newton method is selected. This example illustrates the use of both a numerical and an analytical Jacobian.