NAG CL Interface
d02ptc (ivp_​rkts_​diag)

1 Purpose

d02ptc provides details about an integration performed by either d02pec, d02pfc or d02pgc.

2 Specification

#include <nag.h>
void  d02ptc (Integer *fevals, Integer *stepcost, double *waste, Integer *stepsok, double *hnext, Integer iwsav[], const double rwsav[], NagError *fail)
The function may be called by the names: d02ptc or nag_ode_ivp_rkts_diag.

3 Description

d02ptc and its associated functions (d02pec, d02pfc, d02pgc, d02phc, d02pjc, d02pqc, d02prc, d02psc and d02puc) solve the initial value problem for a first-order system of ordinary differential equations. The functions, 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 d02pec, d02pfc or d02pgc, d02ptc 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 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 d02pqc had previously been called with errass=Nag_ErrorAssess_on.
2: 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 d02pqc.
3: waste double * 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 Integer * Output
On exit: the number of accepted steps.
5: hnext double * Output
On exit: the step size the integrator will attempt to use for the next step.
6: iwsav[130] Integer Communication Array
7: rwsav[350] const double Communication Array
Note: the communication rwsav used by the other functions 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 d02pec, d02pfc or d02pgc. They must remain unchanged between calls.
On exit: information about the integration for use on subsequent calls to d02pec, d02pfc or d02pgc or other associated functions.
8: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_MISSING_CALL
You cannot call this function before you have called the integrator.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_PREV_CALL
On entry, a previous call to the setup function 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.
NE_RK_INVALID_CALL
You have already made one call to this function after the integrator could not achieve specified accuracy.
You cannot call this function again.

7 Accuracy

Not applicable.

8 Parallelism and Performance

d02ptc 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 errass=Nag_ErrorAssess_on in a prior call to d02pqc, then the approximate number of evaluations of f used in this secondary integration is given by 2×stepsok×stepcost for method=Nag_RK_4_5 or Nag_RK_7_8 and 3×stepsok×stepcost for method=Nag_RK_2_3.

10 Example

See Section 10 in d02pec, d02pfc, d02prc, d02psc and d02puc.