NAG CL Interfaced02ptc (ivp_​rkts_​diag)

Settings help

CL Name Style:

1Purpose

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

2Specification

 #include
 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.

3Description

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′ = 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 d02pec, d02pfc or d02pgc, d02ptc 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 d02pqc had previously been called with ${\mathbf{errass}}=\mathrm{Nag_ErrorAssess_on}$.
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 d02pqc.
3: $\mathbf{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: $\mathbf{stepsok}$Integer * Output
On exit: the number of accepted steps.
5: $\mathbf{hnext}$double * Output
On exit: the step size the integrator will attempt to use for the next step.
6: $\mathbf{iwsav}\left[130\right]$Integer Communication Array
7: $\mathbf{rwsav}\left[350\right]$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: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6Error 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 $⟨\mathit{\text{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.

Not applicable.

8Parallelism and Performance

d02ptc is not threaded in any implementation.

9Further Comments

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

10Example

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