# NAG FL Interfaced02ptf (ivp_​rkts_​diag)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine d02ptf (
 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
#include <nag.h>
 void d02ptf_ (Integer *fevals, Integer *stepcost, double *waste, Integer *stepsok, double *hnext, Integer iwsav[], const double rwsav[], Integer *ifail)
The routine may be called by the names d02ptf or nagf_ode_ivp_rkts_diag.

## 3Description

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′ = f(t,y) given y(t0)=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.

## 4References

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

## 5Arguments

1: $\mathbf{fevals}$Integer Output
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 ${\mathbf{method}}>0$.
2: $\mathbf{stepcost}$Integer Output
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: $\mathbf{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: $\mathbf{stepsok}$Integer Output
On exit: the number of accepted steps.
5: $\mathbf{hnext}$Real (Kind=nag_wp) Output
On exit: the step size the integrator will attempt to use for the next step.
6: $\mathbf{iwsav}\left(130\right)$Integer array Communication Array
7: $\mathbf{rwsav}\left(350\right)$Real (Kind=nag_wp) array Communication 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: $\mathbf{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 $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{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.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

When a secondary integration has taken place, that is when global error assessment has been specified using ${\mathbf{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×{\mathbf{stepsok}}×{\mathbf{stepcost}}$ for ${\mathbf{method}}=2$ or $3$ and $3×{\mathbf{stepsok}}×{\mathbf{stepcost}}$ for ${\mathbf{method}}=1$.