NAG FL Interface
d02zaf (ivp_​stiff_​errest)

Settings help

FL Name Style:


FL Specification Language:


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

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 <nag.h>
double  d02zaf_ (const Integer *neq, const double v[], const double w[], Integer *ifail)
The routine may be called by the names d02zaf or nagf_ode_ivp_stiff_errest.

3 Description

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.

4 References

None.

5 Arguments

1: neq Integer Input
On entry: the number of differential equations, as defined for the integrator being used.
2: v(neq) Real (Kind=nag_wp) array Input
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: w(neq) Real (Kind=nag_wp) array Input
On entry: the weights, calculated internally by the integrator, to be used in the norm evaluation.
4: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value −1 is recommended since useful values can be provided in some output arguments even when ifail0 on exit. 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:
Note: in some cases d02zaf may return useful information.
ifail=1
The value of the norm would either overflow or is close to overflowing.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface 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

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

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)