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

# NAG Library Routine DocumentD02PJF

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.

## 1  Purpose

D02PJF evaluates the interpolant calculated by D02PHF, following an integration step performed by D02PGF to solve an initial value problem.

## 2  Specification

 SUBROUTINE D02PJF ( ICHECK, N, NWANT, T, IDERIV, SOL, WCOMM, LWCOMM, IWSAV, RWSAV, IFAIL)
 INTEGER ICHECK, N, NWANT, IDERIV, LWCOMM, IWSAV(130), IFAIL REAL (KIND=nag_wp) T, SOL(NWANT), WCOMM(LWCOMM), RWSAV(32*N+350)

## 3  Description

When integrating using the reverse communication Runge–Kutta integrator D02PGF, the solution or its derivatives can be obtained inexpensively between steps by interpolation. D02PHF is called after a step by D02PGF from a previous value of $t$ ($={t}_{k-1}$) to its current value, $t={t}_{k}$ (i.e., a $k$th successful time-step has been taken). D02PJF can then be called to evaluate interpolated approximations of the function or its derivatives at any value of $t$ in the interval $\left({t}_{k-1},{t}_{k}\right)$.

## 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:     $\mathrm{ICHECK}$ – INTEGERInput
On entry: indicates whether consistency checks on input arguments should be performed
${\mathbf{ICHECK}}\ne 1$
Don't perform checks on input arguments.
${\mathbf{ICHECK}}=1$
Perform consistency checks on input arguments.
It is recommended to use ${\mathbf{ICHECK}}=1$ on the first call following a call to D02PHF and to set ${\mathbf{ICHECK}}\ne 1$ on subsequent calls within the last step to avoid the overhead of argument checking.
2:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the dimension of the system of ODEs being integrated.
Constraint: this must be the same value as supplied in a previous call to D02PQF.
3:     $\mathrm{NWANT}$ – INTEGERInput
On entry: only the first NWANT system components to be computed. This should be the same value as passed to D02PHF when computing the interpolant.
Constraint: ${\mathbf{NWANT}}={\mathbf{NWANT}}$ passed to D02PHF.
4:     $\mathrm{T}$ – REAL (KIND=nag_wp)Input
On entry: $t$, the value of the independent variable where a solution is desired. Although any value of $t$ can be supplied, accurate solutions can only be obtained for values in the range of the last time-step taken by D02PGF.
5:     $\mathrm{IDERIV}$ – INTEGERInput
On entry:
${\mathbf{IDERIV}}=0$
Compute approximations to the first NWANT components of the solution $y\left(t\right)$.
${\mathbf{IDERIV}}=1$
Compute approximations to the first NWANT components of the first derivatives of the solution ${y}^{\prime }\left(t\right)$.
Constraint: ${\mathbf{IDERIV}}=0$ or $1$.
6:     $\mathrm{SOL}\left({\mathbf{NWANT}}\right)$ – REAL (KIND=nag_wp) arrayOutput
On exit:
${\mathbf{IDERIV}}=0$
The first NWANT components of the solution $y\left(t\right)$.
${\mathbf{IDERIV}}=1$
The first NWANT components of the first derivatives of the solution ${y}^{\prime }\left(t\right)$.
7:     $\mathrm{WCOMM}\left({\mathbf{LWCOMM}}\right)$ – REAL (KIND=nag_wp) arrayCommunication Array
On entry: this must be the same array supplied in a previous call to D02PHF. It must remain unchanged between calls.
8:     $\mathrm{LWCOMM}$ – INTEGERInput
On entry: length of WCOMM. This should be the same value as supplied in a previous call to D02PHF.
If in a previous call to D02PQF:
• ${\mathbf{METHOD}}=1$ or $-1$, LWCOMM must be at least $1$.
• ${\mathbf{METHOD}}=2$ or $-2$, LWCOMM must be at least ${\mathbf{N}}+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{N}},5×{\mathbf{NWANT}}\right)$.
• ${\mathbf{METHOD}}=3$ or $-3$, ${\mathbf{LWCOMM}}\ge 8×{\mathbf{NWANT}}$.
9:     $\mathrm{IWSAV}\left(130\right)$ – INTEGER arrayCommunication Array
10:   $\mathrm{RWSAV}\left(32×{\mathbf{N}}+350\right)$ – REAL (KIND=nag_wp) arrayCommunication Array
On entry: these must be the same arrays supplied in a previous call D02PGF. They must remain unchanged between calls.
On exit: information about the integration for use on subsequent calls to D02PGF, D02PHF or other associated routines.
11:   $\mathrm{IFAIL}$ – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ 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\text{​ 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 $-\mathbf{1}\text{​ 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).

## 6  Error 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.
On entry, ${\mathbf{IDERIV}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{IDERIV}}=0$ or $1$.
On entry, ${\mathbf{LWCOMM}}=〈\mathit{\text{value}}〉$, ${\mathbf{N}}=〈\mathit{\text{value}}〉$ and ${\mathbf{NWANT}}=〈\mathit{\text{value}}〉$.
Constraint: for ${\mathbf{METHOD}}=-2$ or $2$, ${\mathbf{LWCOMM}}\ge {\mathbf{N}}+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{N}},5×{\mathbf{NWANT}}\right)$.
On entry, ${\mathbf{LWCOMM}}=〈\mathit{\text{value}}〉$.
Constraint: for ${\mathbf{METHOD}}=-1$ or $1$, ${\mathbf{LWCOMM}}\ge 1$.
On entry, ${\mathbf{LWCOMM}}=〈\mathit{\text{value}}〉$ and ${\mathbf{NWANT}}=〈\mathit{\text{value}}〉$.
Constraint: for ${\mathbf{METHOD}}=-3$ or $3$, ${\mathbf{LWCOMM}}\ge 8×{\mathbf{NWANT}}$.
On entry, ${\mathbf{N}}=〈\mathit{\text{value}}〉$, but the value passed to the setup routine was ${\mathbf{N}}=〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{NWANT}}=〈\mathit{\text{value}}〉$, but on interpolation setup ${\mathbf{NWANT}}=〈\mathit{\text{value}}〉$.
Constraint: NWANT must be unchanged from setup.
The previous call to the interpolation setup routine returned an error.
You cannot call this routine before you have called the interpolation setup.
${\mathbf{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.
${\mathbf{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.
${\mathbf{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

The computed values will be of a similar accuracy to that computed by D02PGF.

## 8  Parallelism and Performance

D02PJF is not threaded in any implementation.

None.

## 10  Example

See Section 10 in D02PGF.

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