NAG Library Routine Document

d02nwf (ivp_stiff_blend)


d02nwf is a setup routine which must be called prior to linear algebra setup routines and integrators from the SPRINT suite of routines, if the BLEND formulae are to be used.


Fortran Interface
Subroutine d02nwf ( neqmax, sdysav, maxord, con, tcrit, hmin, hmax, h0, maxstp, mxhnil, norm, rwork, ifail)
Integer, Intent (In):: neqmax, sdysav, maxord, maxstp, mxhnil
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: tcrit, hmin, hmax, h0
Real (Kind=nag_wp), Intent (Inout):: con(6), rwork(50+4*neqmax)
Character (1), Intent (In):: norm
C Header Interface
#include <nagmk26.h>
void  d02nwf_ (const Integer *neqmax, const Integer *sdysav, const Integer *maxord, double con[], const double *tcrit, const double *hmin, const double *hmax, const double *h0, const Integer *maxstp, const Integer *mxhnil, const char *norm, double rwork[], Integer *ifail, const Charlen length_norm)


An integrator setup routine must be called before the call to any linear algebra setup routine or integrator from the SPRINT suite of routines in this sub-chapter. This setup routine, d02nwf, makes the choice of the BLEND integrator and permits you to define options appropriate to this choice. Alternative choices of integrator from this suite are the BDF method and the DASSL implementation of the BDF method which can be chosen by initial calls to d02nvf or d02mvf respectively.


See the D02M–N Sub-chapter Introduction.


1:     neqmax – IntegerInput
On entry: a bound on the maximum number of differential equations to be solved.
Constraint: neqmax1.
2:     sdysav – IntegerInput
On entry: the second dimension of the array ysav that will be supplied to the integrator, as declared in the (sub)program from which the integrator is called (e.g., see d02nbf).
Constraint: sdysavmaxord+3.
3:     maxord – IntegerInput
On entry: the maximum order to be used for the BLEND method.
Constraint: 0<maxord11.
4:     con6 – Real (Kind=nag_wp) arrayInput/Output
On entry: values to be used to control step size choice during integration. If any coni=0.0 on entry, it is replaced by its default value described below. In most cases this is the recommended setting.
con1, con2, and con3 are factors used to bound step size changes. If the current step size h fails, the modulus of the next step size is bounded by con1×h. The default value of con1 is 2.0. Note that the new step size may be used with a method of different order to the failed step. If the initial step size is h, the modulus of the step size on the second step is bounded by con3×h. At any other stage in the integration, if the current step size is h, the modulus of the next step size is bounded by con2×h. The default values are 10.0 for con2 and 1000.0 for con3.
con4, con5 and con6 are ‘tuning’ constants used in determining the next order and step size. They are used to scale the error estimates used in determining whether to keep the same order of the BLEND method, decrease the order or increase the order respectively. The larger the value of coni, for i=4,5,6, the less likely the choice of the corresponding order. The default values are: con4=1.2, con5=1.3, con6=1.4.
These constraints must be satisfied after any zero values have been replaced by their default values.
  • 0.0<con1con2con3;
  • coni1.0, for i=2,3,,6.
On exit: the values actually used by d02nwf.
5:     tcrit – Real (Kind=nag_wp)Input
On entry: a point beyond which integration must not be attempted. The use of tcrit is described under the argument itask in the specification for the integrator (e.g., see d02nbf). A value, 0.0 say, must be specified even if itask subsequently specifies that tcrit will not be used.
6:     hmin – Real (Kind=nag_wp)Input
On entry: the minimum absolute step size to be allowed. Set hmin=0.0 if this option is not required.
7:     hmax – Real (Kind=nag_wp)Input
On entry: the maximum absolute step size to be allowed. Set hmax=0.0 if this option is not required.
8:     h0 – Real (Kind=nag_wp)Input
On entry: the step size to be attempted on the first step. Set h0=0.0 if the initial step size is calculated internally.
9:     maxstp – IntegerInput
On entry: the maximum number of steps to be attempted during one call to the integrator after which it will return with ifail=2. Set maxstp=0 if no limit is to be imposed.
10:   mxhnil – IntegerInput
On entry: the maximum number of warnings printed (if itrace0, e.g., see d02nbf) per problem when t+h=t on a step (h=​ current step size). If mxhnil0, a default value of 10 is assumed.
11:   norm – Character(1)Input
On entry: indicates the type of norm to be used.
Maximum norm.
Averaged L2 norm.
Is the same as 'A'.
If vnorm denotes the norm of the vector v of length n, for the averaged L2 norm
while for the maximum norm
If you wish to weight the maximum norm or the L2 norm, rtol and atol should be scaled appropriately on input to the integrator (see under itol in the specification of the integrator for the formulation of the weight vector wi from rtol and atol, e.g., d02nbf).
Only the first character of the actual argument norm is passed to d02nwf; hence it is permissible for the actual argument to be more descriptive e.g., ‘Maximum’, ‘Average L2’ or ‘Default’ in a call to d02nwf.
Constraint: norm='M', 'A' or 'D'.
12:   rwork50+4×neqmax – Real (Kind=nag_wp) arrayCommunication Array
This must be the same workspace array as the array rwork supplied to the integrator. It is used to pass information from the setup routine to the integrator and therefore the contents of this array must not be changed before calling the integrator.
13:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, convalue=value was less than 0.0.
On entry, convalue=value was less than 1.0.
On entry, con1=value and con2=value.
Constraint: con1con2.
On entry, con2=value and con3=value.
Constraint: con2con3.
On entry, maxord=value.
Constraint: 0<maxord11.
On entry, maxord=value and sdysav=value.
Constraint: sdysavmaxord+3.
On entry, neqmax=value.
Constraint: neqmax1.
On entry, norm=value.
Constraint: norm='M', 'A' or 'D'.
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.


Not applicable.

Parallelism and Performance

d02nwf is not threaded in any implementation.

Further Comments



See Section 10 in d02ncf.