NAG FL Interface
d02phf (ivp_​rk_​interp_​setup)

Settings help

FL Name Style:

FL Specification Language:

1 Purpose

d02phf is a reverse communication routine that computes the interpolant for evaluation by d02pjf anywhere on an integration step taken by d02pgf. The direct communication version of the d02phf and d02pjf pair is d02psf. A significant difference in functionality between the forward and reverse communication versions is that d02phf and d02pjf can interpolate for the high-order Runge–Kutta method.

2 Specification

Fortran Interface
Subroutine d02phf ( irevcm, n, nwant, t, y, yp, wcomm, lwcomm, iwsav, rwsav, ifail)
Integer, Intent (In) :: n, nwant, lwcomm
Integer, Intent (Inout) :: irevcm, iwsav(130), ifail
Real (Kind=nag_wp), Intent (In) :: yp(n)
Real (Kind=nag_wp), Intent (Inout) :: wcomm(lwcomm), rwsav(32*n+350)
Real (Kind=nag_wp), Intent (Out) :: t, y(n)
C Header Interface
#include <nag.h>
void  d02phf_ (Integer *irevcm, const Integer *n, const Integer *nwant, double *t, double y[], const double yp[], double wcomm[], const Integer *lwcomm, Integer iwsav[], double rwsav[], Integer *ifail)
The routine may be called by the names d02phf or nagf_ode_ivp_rk_interp_setup.

3 Description

d02phf and its associated routines (d02pgf, d02pjf, d02pqf, d02prf, d02ptf 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.
d02pgf computes the solution at the end of an integration step. Using the information computed on that step d02phf computes the interpolant which can be evaluated at any point on that step by d02pjf. If method=1 or −1 then there is enough information available from the stages of the last step to provide an interpolant of sufficient order of accuracy; no further derivative evaluations will, therefore, be requested. If method=2 or −2 then the interpolant is an order 8 continuous Runge–Kutta process that requires a further 3 stages of derivative evaluations that will be requested in turn before a final exit. If method=3 or −3 was specified in the call to setup routine d02pqf then the interpolant is a continuous Runge–Kutta process requiring a further 7 stages of derivative evaluations that will be requested in turn.

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

Note: this routine uses reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the argument irevcm. Between intermediate exits and re-entries, all arguments other than those specified by the value of irevcm must remain unchanged.
1: irevcm Integer Input/Output
On initial entry: irevcm must be set to zero to indicate that the interpolant for a new step is being taken.
On intermediate re-entry: irevcm should remain unchanged.
On intermediate exit: irevcm returns a value 1 to indicate that a function evaluation is required prior to re-entry; the value of the derivatives must be returned in yp where the value of t is supplied in t and the values y(t) are supplied in the array y.
On final exit:
Successful exit; rwsav and wcomm contain details of the interpolant.
Error exit; ifail should be interrogated to determine the nature of the error.
Note: any values you return to d02phf as part of the reverse communication procedure should not include floating-point NaN (Not a Number) or infinity values, since these are not handled by d02phf. If your code does inadvertently return any NaNs or infinities, d02phf is likely to produce unexpected results.
2: n Integer Input
On entry: n, the number of ordinary differential equations in the system to be solved by the integration routine.
Constraint: n1. This must be the same value as supplied in a previous call to d02pqf.
3: nwant Integer Input
On entry: the number of components of the solution to be computed. The first nwant components are evaluated.
Constraint: 1nwantn.
4: t Real (Kind=nag_wp) Output
On intermediate exit: t contains the value of the independent variable t at which the derivatives y are to be evaluated.
On final exit: contains no useful information.
5: y(n) Real (Kind=nag_wp) array Output
On intermediate exit: y contains the value of the solution y at which the derivatives y are to be evaluated.
On final exit: contains no useful information.
6: yp(n) Real (Kind=nag_wp) array Input
On initial entry: need not be set.
On intermediate re-entry: yp must contain the values of the derivatives yi for the given values of the parameters t, yi.
7: wcomm(lwcomm) Real (Kind=nag_wp) array Communication Array
On entry: wcomm need not be set.
On intermediate re-entry: wcomm contains the partial computation of the polynomial coefficients corresponding to a continuous Runge–Kutta process for interpolating medium and high order Runge–Kutta methods.
On final exit: if method=2, −2, 3 or −3, wcomm contains details of the interpolant which must be passed unchanged to d02pjf for evaluation of the interpolant.
8: lwcomm Integer Input
On entry: length of wcomm.
If in a previous call to d02pqf:
  • method=1 or −1, lwcomm must be at least 1.
  • method=2 or −2, lwcomm must be at least n+max(n,5×nwant).
  • method=3 or −3, lwcomm must be at least 8×nwant.
9: iwsav(130) Integer array Communication Array
10: rwsav(32×n+350) Real (Kind=nag_wp) array Communication 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, d02pjf or other associated routines.
11: ifail Integer Input/Output
On initial 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 final 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:
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, lwcomm=value, n=value and nwant=value.
Constraint: for method=−2 or 2, lwcommn+max(n,5×nwant).
On entry, lwcomm=value.
Constraint: for method=−1 or 1, lwcomm1.
On entry, lwcomm=value and nwant=value.
Constraint: for method=−3 or 3, lwcomm8×nwant.
On entry, n=value, but the value passed to the setup routine was n=value.
On entry, nwant=value and n=value.
Constraint: 1nwantn.
You cannot call this routine after the integrator has returned an error.
You cannot call this routine after the range integrator has been called.
You cannot call this routine before you have called the step integrator.
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.
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.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

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

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
d02phf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments


10 Example

See d02pgf.