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

NAG Library Routine Document

D02ZAF

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

1  Purpose

D02ZAF calculates the weighted norm of the local error estimate from inside a MONITR called from an integrator in sub-chapter D02M–N (e.g., see D02NBF).

2  Specification

FUNCTION D02ZAF ( NEQ, V, W, IFAIL)
REAL (KIND=nag_wp) D02ZAF
INTEGER  NEQ, IFAIL
REAL (KIND=nag_wp)  V(NEQ), W(NEQ)

3  Description

D02ZAF is for use with the forward communication integrators D02NBF, D02NCF, D02NDF, D02NGF, D02NHF and D02NJF and the reverse communication integrators D02NMF and D02NNF. It must be used only inside MONITR (if this option is selected) for the forward communication routines or on the equivalent return for the reverse communication routines. It may be used to evaluate the norm of the scaled local error estimate, v, where the weights used are contained in w and the norm used is as defined by an earlier call to the integrator setup routine (D02MVF, D02NVF or D02NWF). Its use is described under the description of MONITR in the specifications for the forward communication integrators mentioned above.

4  References

None.

5  Parameters

1:     NEQ – INTEGERInput
On entry: the number of differential equations, as defined for the integrator being used.
2:     VNEQ – REAL (KIND=nag_wp) arrayInput
On entry: the vector, the weighted norm of which is to be evaluated by D02ZAF. V is calculated internally by the integrator being used.
3:     WNEQ – REAL (KIND=nag_wp) arrayInput
On entry: the weights, calculated internally by the integrator, to be used in the norm evaluation.
4:     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, because for this routine the values of the output parameters may be useful even if IFAIL0 on exit, the recommended value is -1. 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).
Note: D02ZAF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
IFAIL=1
The value of the norm would either overflow or is close to overflowing. A value close to the square root of the largest number on the computer is returned.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

The result is calculated close to machine precision except in the case when the routine exits with IFAIL=1.

8  Parallelism and Performance

Not applicable.

9  Further Comments

D02ZAF should only be used within MONITR associated with the integrators in sub-chapter D02M–N (e.g., see D02NBF). Its use and only valid calling sequence are fully documented in the description of MONITR in the routine documents for the integrators.

10  Example

This example solves the well-known stiff Robertson problem
a = -0.04a + 1.0E4bc b = 0.04a - 1.0E4bc - 3.0E7b2 c = 3.0E7b2  
over the range 0,10 with initial conditions a=1.0 and b=c=0.0 using scalar error control (ITOL=1) and computation of the solution at TOUT=10.0 with TCRIT (e.g., see D02MVF) set to 10.0 (ITASK=4). A BDF integrator (setup routine D02NVF) is used and a modified Newton method is selected. This example illustrates the use of D02ZAF within a monitor routine MONITR to output intermediate results during the integration. The same problem is solved in the example program for D02NBF where no monitoring was performed and so no intermediate solution information is output.

10.1  Program Text

Program Text (d02zafe.f90)

10.2  Program Data

Program Data (d02zafe.d)

10.3  Program Results

Program Results (d02zafe.r)


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

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