NAG Library Routine Document

d02zaf (ivp_stiff_errest)


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).


Fortran Interface
Function d02zaf ( neq, v, w, ifail)
Real (Kind=nag_wp):: d02zaf
Integer, Intent (In):: neq
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: v(neq), w(neq)
C Header Interface
#include <nagmk26.h>
double  d02zaf_ (const Integer *neq, const double v[], const double w[], Integer *ifail)


d02zaf is for use with the direct 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 direct 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 direct communication integrators mentioned above.




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 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, because for this routine the values of the output arguments 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).

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:
The value of the norm would either overflow or is close to overflowing.
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.


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

Parallelism and Performance

d02zaf 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.
d02zaf is not threaded in any implementation.

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.


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.

Program Text

Program Text (d02zafe.f90)

Program Data

Program Data (d02zafe.d)

Program Results

Program Results (d02zafe.r)