d02ngf is a general purpose routine for integrating the initial value problem for a stiff system of implicit ordinary differential equations coupled with algebraic equations, written in the form
It is designed specifically for the case where the resulting Jacobian is a full matrix (see the description of
jac).
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
d02ngf 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 resid, jac, monitr
.
.
.
ifail = 0
Call d02nvf(...,ifail)
Call d02nsf(neq, neqmax, jceval, nwkjac, rwork, ifail)
ifail = -1
Call d02ngf(neq, neqmax, t, tout, y, ydot, rwork, rtol, &
atol, itol, inform, resid, ysave, ny2dim, &
jac, wkjac, nwkjac, monitr, lderiv, 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,
d02mvf,
d02nvf or
d02nwf, must be called prior to the call of
d02ngf. The integrator diagnostic routine
d02nyf may be called after the call to
d02ngf. There is also a routine,
d02nzf, designed to permit you to change step size on a continuation call to
d02ngf without restarting the integration process.
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
-
Either the integrator setup routine has not been called prior to the first call of this routine, or a communication array has become corrupted.
Either the linear algebra setup routine has not been called prior to the first call of this routine, or a communication array has become corrupted.
Either the routine was entered on a continuation call without a prior call of this routine, or a communication array has become corrupted.
Either the value of
nwkjac is not the same as the value supplied to the setup routine or a communication array has become corrupted.
and
in
d02nsf.
Either the value of
sdysav is not the same as the value supplied to the setup routine or a communication array has become corrupted.
,
sdysav (setup)
.
Failure during internal time interpolation.
tout and the current time are too close.
and
and the current time is
.
ires was set to an illegal value during initialization.
at time
.
and
tout is more than an integration step behind the current time.
, current time minus step size:
.
monitr appears to have overwritten the solution vector.
Further integration will not be attempted.
monitr set
.
Constraint:
.
monitr set
.
Constraint:
.
On entry, an illegal (negative) maximum number of steps was provided in a prior call to a setup routine. .
On entry, an illegal (negative) maximum stepsize was provided in a prior call to a setup routine. .
On entry, an illegal (negative) minimum stepsize was provided in a prior call to a setup routine. .
On entry, .
Constraint: .
On entry,
and
for all elements.
Check the evaluation of the residual for this value of
ires.
On entry, .
Constraint: .
On entry,
or
and
tcrit is before the current time in the direction of integration.
,
and the current time is
.
On entry,
or
and
tcrit is before
tout in the direction of integration.
,
and
.
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry,
tout is less than
t with respect to the direction of integration given by the sign of
h0 in a prior call to a setup routine.
,
and
.
On entry,
tout is too close to
t to start integration.
and
.
The initial stepsize, , is too small.
Weight number
used in the local error test is too small. Check the values of
rtol and
atol.
and
may both be zero.
Weight
.
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).
Background information to multithreading can be found in the
Multithreading documentation.
d02ngf is not thread safe and should not be called from a multithreaded user program. Please see
Section 1 in FL Interface Multithreading 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 d02ngf the cost is proportional to , though for problems which are only mildly nonlinear the cost may be dominated by factors proportional to except for very large problems.
In general, you are advised to choose the BDF 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 written in implicit form
with initial conditions
and
over the range
with vector error control (
), the BDF method (setup routine
d02nvf) and functional iteration. The Jacobian is calculated numerically if the functional iteration encounters difficulty and the integration is in one-step mode (
), with
interpolation to calculate the solution at intervals of
using
d02xjf externally.
d02nby is used for
monitr.
For an example of using
d02ngf with a user-supplied Jacobian, please see
d02mvf.