D02QWF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D02QWF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy
    9  Example

1  Purpose

D02QWF is a setup routine which must be called prior to the first call of either of the integrators D02QFF and D02QGF and may be called prior to any continuation call to these routines.

2  Specification

INTEGER  NEQF, LATOL, LRTOL, MAXSTP, NEQG, LRWORK, IWORK(LIWORK), LIWORK, IFAIL
REAL (KIND=nag_wp)  ATOL(LATOL), RTOL(LRTOL), TCRIT, HMAX, RWORK(LRWORK)
LOGICAL  VECTOL, ONESTP, CRIT, ALTERG, SOPHST
CHARACTER(1)  STATEF

3  Description

D02QWF permits initialization of the integration method and setting of optional inputs prior to any call of D02QFF or D02QGF. It must be called before the first call of either of the routines D02QFF or D02QGF and it may be called before any continuation call of either of the routines D02QFF or D02QGF.

4  References

None.

5  Parameters

1:     STATEF – CHARACTER(1)Input/Output
On entry: specifies whether the integration routine (D02QFF or D02QGF) is to start a new system of ordinary differential equations, restart a system or continue with a system.
STATEF='S'
Start integration with a new differential system.
STATEF='R'
Restart integration with the current differential system.
STATEF='C'
Continue integration with the current differential system.
Constraint: STATEF='S', 'R' or 'C'.
On exit: is set to 'C', except that if an error is detected, STATEF is unchanged.
2:     NEQF – INTEGERInput
On entry: the number of ordinary differential equations to be solved by the integration routine. NEQF must remain unchanged on subsequent calls to D02QWF with STATEF='C' or 'R'.
Constraint: NEQF1.
3:     VECTOL – LOGICALInput
On entry: specifies whether vector or scalar error control is to be employed for the local error test in the integration.
If VECTOL=.TRUE., then vector error control will be used and you must specify values of RTOLi and ATOLi, for i=1,2,,NEQF.
Otherwise scalar error control will be used and you must specify values of just RTOL1 and ATOL1.
The error test to be satisfied is of the form
i=1NEQF eiwi 21.0.
where wi is defined as follows:
VECTOL wi
.TRUE. RTOLi×yi+ATOLi
.FALSE. RTOL1×yi+ATOL1
and ei is an estimate of the local error in yi, computed internally. VECTOL must remain unchanged on subsequent calls to D02QWF with STATEF='C' or 'R'.
4:     ATOL(LATOL) – REAL (KIND=nag_wp) arrayInput
On entry: the absolute local error tolerance (see VECTOL).
Constraint: ATOLi0.0.
5:     LATOL – INTEGERInput
On entry: the dimension of the array ATOL as declared in the (sub)program from which D02QWF is called.
Constraints:
  • if VECTOL=.TRUE., LATOLNEQF;
  • if VECTOL=.FALSE., LATOL1.
6:     RTOL(LRTOL) – REAL (KIND=nag_wp) arrayInput
On entry: the relative local error tolerance (see VECTOL).
Constraints:
  • RTOLi0.0;
  • if ATOLi=0.0, RTOLi4.0×machine precision.
7:     LRTOL – INTEGERInput
On entry: the dimension of the array RTOL as declared in the (sub)program from which D02QWF is called.
Constraints:
  • if VECTOL=.TRUE., LRTOLNEQF;
  • if VECTOL=.FALSE., LRTOL1.
8:     ONESTP – LOGICALInput
On entry: the mode of operation of the integration routine. If ONESTP=.TRUE., the integration routine will operate in one-step mode, that is it will return after each successful step. Otherwise the integration routine will operate in interval mode, that is it will return at the end of the integration interval.
9:     CRIT – LOGICALInput
On entry: specifies whether or not there is a value for the independent variable beyond which integration is not to be attempted. Setting CRIT=.TRUE. indicates that there is such a point, whereas CRIT=.FALSE. indicates that there is no such restriction.
10:   TCRIT – REAL (KIND=nag_wp)Input
On entry: with CRIT=.TRUE., TCRIT must be set to a value of the independent variable beyond which integration is not to be attempted. Otherwise TCRIT is not referenced.
11:   HMAX – REAL (KIND=nag_wp)Input
On entry: if HMAX0.0, a bound on the absolute step size during the integration is taken to be HMAX.
If HMAX=0.0, no bound is assumed on the step size during the integration.
A bound may be required if there are features of the solution on very short ranges of integration which may be missed. You should try HMAX=0.0 first.
Note:  this parameter only affects the step size if the option CRIT=.TRUE. is being used.
12:   MAXSTP – INTEGERInput
On entry: a bound on the number of attempted steps in any one call to the integration routine. If MAXSTP0 on entry, a value of 1000 is used.
13:   NEQG – INTEGERInput
On entry: specifies whether or not root-finding is required in D02QFF or D02QGF.
NEQG0
No root-finding is attempted.
NEQG>0
Root-finding is required and NEQG event functions will be specified for the integration routine.
14:   ALTERG – LOGICALInput/Output
On entry: specifies whether or not the event functions have been redefined. ALTERG need not be set if STATEF='S'. On subsequent calls to D02QWF, if NEQG has been set positive, then ALTERG=.FALSE. specifies that the event functions remain unchanged, whereas ALTERG=.TRUE. specifies that the event functions have changed. Because of the expense in reinitializing the root searching procedure, ALTERG should be set to .TRUE. only if the event functions really have been altered. ALTERG need not be set if the root-finding option is not used.
On exit: is set to .FALSE..
15:   SOPHST – LOGICALInput
On entry: the type of search technique to be used in the root-finding. If SOPHST=.TRUE. then a sophisticated and reliable but expensive technique will be used, whereas for SOPHST=.FALSE. a simple but less reliable technique will be used. If NEQG0, SOPHST is not referenced.
16:   RWORK(LRWORK) – REAL (KIND=nag_wp) arrayCommunication Array
This must be the same parameter RWORK supplied to the integration routine. It is used to pass information to the integration routine and therefore the contents of this array must not be changed before calling the integration routine.
17:   LRWORK – INTEGERInput
On entry: the dimension of the array RWORK as declared in the (sub)program from which D02QWF is called.
Constraint: LRWORK21×1+NEQF+2×J+K×NEQG+2, where
J= NEQF if ​VECTOL=.TRUE. 1 if ​VECTOL=.FALSE.
and
K= 14 if ​ SOPHST=.TRUE. 5 if ​ SOPHST=.FALSE.
.
18:   IWORK(LIWORK) – INTEGER arrayCommunication Array
This must be the same parameter IWORK supplied to the integration routine. It is used to pass information to the integration routine and therefore the contents of this array must not be changed before calling the integration routine.
19:   LIWORK – INTEGERInput
On entry: the dimension of the array IWORK as declared in the (sub)program from which D02QWF is called.
Constraints:
  • if SOPHST=.TRUE., LIWORK21+4×NEQG;
  • if SOPHST=.FALSE., LIWORK21+NEQG.
20:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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 parameter, 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).

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:
IFAIL=1
Illegal input detected.

7  Accuracy

Not applicable.

8  Further Comments

Prior to a continuation call of the integration routine, you may reset any of the optional parameters by calling D02QWF with STATEF='C'. You may reset:
HMAX to alter the maximum step size selection;
RTOL, ATOL to change the error requirements;
MAXSTP to increase or decrease the number of attempted steps before an error exit is returned;
ONESTP to change the operation mode of the integration routine;
CRIT, TCRIT to alter the point beyond which integration must not be attempted; and
NEQG, ALTERG, SOPHST to alter the number and type of event functions, and also the search method.
If the behaviour of the system of differential equations has altered and you wish to restart the integration method from the value of T output from the integration routine (see D02QFF and D02QGF), then STATEF should be set to STATEF='R' and any of the optional parameters may be reset also. If you want to redefine the system of differential equations or start a new integration problem, then STATEF should be set to STATEF='S'. Resetting STATEF='R' or 'S' on normal continuation calls causes a restart in the integration process, which is very inefficient when not needed.

9  Example

See Section 9 in D02QFF and D02QGF.

D02QWF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012