NAG Library Routine Document

d02ptf  (ivp_rkts_diag)

 Contents

    1  Purpose
    7  Accuracy
    10  Example

1
Purpose

d02ptf provides details about an integration performed by either d02pef, d02pff or d02pgf.

2
Specification

Fortran Interface
Subroutine d02ptf ( fevals, stepcost, waste, stepsok, hnext, iwsav, rwsav, ifail)
Integer, Intent (Inout):: iwsav(130), ifail
Integer, Intent (Out):: fevals, stepcost, stepsok
Real (Kind=nag_wp), Intent (In):: rwsav(350)
Real (Kind=nag_wp), Intent (Out):: waste, hnext
C Header Interface
#include nagmk26.h
void  d02ptf_ ( Integer *fevals, Integer *stepcost, double *waste, Integer *stepsok, double *hnext, Integer iwsav[], const double rwsav[], Integer *ifail)

3
Description

d02ptf and its associated routines (d02pef, d02pff, d02pgf, d02phf, d02pjf, d02pqf, d02prf, d02psf and d02puf) solve the initial value problem for a first-order system of ordinary differential equations. The routines, based on Runge–Kutta methods and derived from RKSUITE (see Brankin et al. (1991)), integrate
y = ft,y   given   yt0=y0  
where y is the vector of n solution components and t is the independent variable.
After a call to d02pef, d02pff or d02pgf, d02ptf can be called to obtain information about the cost of the integration and the size of the next step.

4
References

Brankin R W, Gladwell I and Shampine L F (1991) RKSUITE: A suite of Runge–Kutta codes for the initial value problems for ODEs SoftReport 91-S1 Southern Methodist University

5
Arguments

1:     fevals – IntegerOutput
On exit: the total number of evaluations of f used in the integration so far; this includes evaluations of f required for the secondary integration necessary if d02pqf had previously been called with method>0.
2:     stepcost – IntegerOutput
On exit: the cost in terms of number of evaluations of f of a typical step with the method being used for the integration. The method is specified by the argument method in a prior call to d02pqf.
3:     waste – Real (Kind=nag_wp)Output
On exit: the number of attempted steps that failed to meet the local error requirement divided by the total number of steps attempted so far in the integration. A ‘large’ fraction indicates that the integrator is having trouble with the problem being solved. This can happen when the problem is ‘stiff’ and also when the solution has discontinuities in a low-order derivative.
4:     stepsok – IntegerOutput
On exit: the number of accepted steps.
5:     hnext – Real (Kind=nag_wp)Output
On exit: the step size the integrator will attempt to use for the next step.
6:     iwsav130 – Integer arrayCommunication Array
7:     rwsav350 – Real (Kind=nag_wp) arrayCommunication Array
Note: the communication rwsav used by the other routines in the suite must be used here however, only the first 350 elements will be referenced.
On entry: these must be the same arrays supplied in a previous call to d02pef, d02pff or d02pgf. They must remain unchanged between calls.
On exit: information about the integration for use on subsequent calls to d02pef, d02pff or d02pgf or other associated routines.
8:     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).

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
On entry, a previous call to the setup routine has not been made or the communication arrays have become corrupted, or a catastrophic error has already been detected elsewhere.
You cannot continue integrating the problem.
You cannot call this routine before you have called the integrator.
You have already made one call to this routine after the integrator could not achieve specified accuracy.
You cannot call this routine again.
ifail=-99
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.
ifail=-399
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.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

d02ptf is not threaded in any implementation.

9
Further Comments

When a secondary integration has taken place, that is when global error assessment has been specified using method>0 in a prior call to d02pqf, then the approximate number of evaluations of f used in this secondary integration is given by 2×stepsok×stepcost for method=2 or 3 and 3×stepsok×stepcost for method=1.

10
Example

See Section 10 in d02pef, d02pff, d02prf, d02psf and d02puf.
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017