XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ dverk_r()

void dverk_r ( int  n,
double *  t,
double  y[],
double  tout,
double  tol,
double  c[],
int  lc,
double  work[],
int  lwork,
int *  info,
double *  tt,
double  yy[],
double  yyp[],
int *  irev 
)

Initial value problem of ordinary differential equations (6(5)-th order Runge-Kutta-Verner method) (reverse communication version)

NOTE - THIS ROUTINE IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION.

Purpose
This routine integrates a system of first order ordinary differential equations of the form
dy/dt = f(t, y), y = y0 at t = t0
where t0 and y0 are the given initial values of t and y, respectively. y may be a vector if the above is a system of differential equations.

dverk is a 6(5)-th order Runge-Kutta-Verner code. It is efficient for non-stiff systems when derivative evaluations are not expensive.

dverk_r is the reverse communication version of dverk.
Parameters
[in]nNumber of differential equations. (n >= 1)
[in,out]tThis routine integrates from t to tout. The initial point of the integration is to be given, and the last point of the final step will be returned.
[in] Initial value of the independent variable t.
[out] Last value of the independent variable t of the final step (normally equals to tout). The solution was successfully advanced to this point. It is possible to continue the integration to new point by recalling this routine with the new tout value.
[in,out]y[]Array y[ly] (ly >= n)
[in] Initial values of the dependent variables y[] at initial t.
[out] Computed solution approximation at last t (normally equals to tout).
[in]toutSet tout to the point at which a solution is desired. Integration either forward in t (tout > t) or backward in t (tout < t) is permitted.
This routine advances the solution from t to tout using step sizes which are automatically selected so as to achieve the desired accuracy.
[in]tolError tolerance.
This routine attempts to control a norm of the local error in such a way that the global error is proportional to tol. The norm is a max norm with weights that depend on the error control strategy specified by the c[] parameters. The default weight for the k-th component is 1/max(1, abs(y(k))), which therefore provides a mixture of absolute and relative error control.
[in,out]c[]Array c[lc]
[in]
The input parameters (set 0 to all parameters for default actions).
c[0]: Error control indicator. The norm of the local error is the max norm of the weighted error estimate vector. The weights are determined according to the value of c[0].
  = 0: The weights are 1/max(1, abs(y[k])) (mixture of absolute and relative error control)
  = 1: The weights are 1 (absolute error control)
  = 2: The weights are 1/abs(y[k]) (relative error control)
  = 3: The weights are 1/max(abs(c[1]), abs(y[k])) (relative error control, unless abs(y[k]) is less than the floor value, abs(c[1]))
  = 4(*): The weights are 1/max(abs(c[k+30]), abs(y[k])) (individual floor values are used)
  = 5(*): The weights are 1/abs(c[k+30])
  (For other values, c[0] = 0 is assumed.)
  (*) In the cases 4 or 5, the size of array c[] must be at least n + 30 and the components c[30], c[31], ..., c[k+29] must be set to the appropriate values.
c[1]: Floor value which is used when c[0] = 3.
c[2]: Minimum step size (hmin). If c[2] = 0, the default value = 10*max(dwarf, rreb*max((weighted norm of y)/tol, abs(x))) is used, where dwarf is a very small positive machine number (= 1.0e-50) and rreb is the relative roundoff error bound.
c[3]: Initial step size (hstart) = abs(c[3]) except for the restrictions imposed by hmin and hmax. If c[3] = 0, the default value = hmax*tol^(1/6) is used.
c[4] Measure of the scale of the problem (scale). If c[4] = 0, the default value = 1 is used. This parameter is used to determine hmax and to modify the acceptance criterion. Larger values of scale tend to make the method more reliable,
c[5]: Maximum step size (hmax).
  If c[5] = 0:
    If c[4] = 0: hmax = 2
    If c[4] != 0: hmax = 2/abs(c[4])
  If c[5] != 0:
    If c[4] = 0: hmax = abs(c[5])
    If c[4] != 0: hmax = min(abs(c[5]), 2/abs(c[4]))
c[6]: Maximum number of function evaluations. If c[6] = 0, no check for number of evaluations is made. If c[6] < 0, abs(c[6]) is used.
c[7] Interrupt number 1.
  = 0: No interruption.
  != 0: The routine will interrupt the calculations after it has chosen its preliminary value of step size and just before choosing htrial and ttrial in preparation for taking a step. The routine returns with info = 2, and will resume calculation at the point of interruption if reentered with info = 2.
c[8] Interrupt number 2.
  = 0: No interruption.
  != 0: The routine will interrupt the calculations immediately after it has decided whether or not to accept the result of the most recent trial step, with info = 5 if it plans to accept, or info = 6 if it plans to reject. The routine will resume calculations at the point of interruption on reentry with info = 5 or 6. User may change info in this case if wishes, for example to force acceptance of a step that would otherwise be rejected, or vice versa.
  = 2: In addition to the above, dense output is enabled, i.e. dverk_int routine can be used to compute the interpolated values within latest step interval if ind = 5 (ind = 3 for last step). One additional function evaluation per accepted step is required.
c[30], c[31], ... c[n+29]: Floor values (if c[0] = 4 or 5).
[out]
The output parameters.
c[9]: Relative roundoff error bound (rreb)
c[10]: Very small positive machine number (dwarf)
c[11]: Weighted norm of y
c[12]: Minimum step size (hmin)
c[13]: Step size (hmag)
c[14]: Measure of the scale of the problem (scale)
c[15]: Maximum step size (hmax)
c[16]: t value of trial step (ttrial)
c[17]: h value of trial step (htrial)
c[18]: Error estimate
c[19]: Previous tout
c[20]: Flag for tout reached
c[21]: Number of successful steps
c[22]: Number of successive failures
c[23]: Number of function evaluations
[in]lcThe length of c[]. (lc >= 24 unless c[0] = 4 or 5 in which case lc >= n + 30)
[out]work[]Array work[lwork]
Work array.
[in]lworkThe length of work[]. (lwork >= 9*n (lwork >= 12*n if c[8] = 2))
[in,out]infoControl variable
[in] Control code.
Set info = 1 or 2 on the initial call.
= 1: Start integration after initializing all parameters automatically to default values.
= 2: Start integration without initializing parameters. The input parameters (c[0] to c[8]) must be initialized by the user prior to calling this routine.
= 3: Reentry after a normal return with new value of tout.
= 4: Resume from the interruption 1. (see c[7])
= 5: Resume from the interruption 2. (step accepted) (see c[8])
= 6: Resume from the interruption 2. (step rejected) (see c[8])
[out] Return code. By examining this code, user can call this routine again when info = 3 to 6 as a next action if necessary.
= -1: The argument n had an illegal value (n < 1)
= -2: The argument t or tout had an illegal value (tout reached, and either t changed or tout not changed on reentry with info = 1)
= -5: The argument tol had an illegal value (tol <= 0)
= -7: The argument lc had an illegal value (lc too small)
= -9: The argument lwork had an illegal value (lwork too small)
= -10: The argument info had an illegal value (info != 1 to 6)
= 3: Successful exit (t = tout). User can reenter with new value of tout without having to change any other variables.
= 4: Interrupt 1.
= 5: Interrupt 2. (step accepted)
= 6: Interrupt 2. (step rejected)
= 11: The allowed maximum number of function evaluations has been exceeded.
= 12: The value of hmin is greater than hmax (tol may be too small).
= 13: Unable to satisfy the error requirement with a particular step size that is less than or equal to hmin (tol may be too small).
[out]ttirev = 1 to 10: The value of t where the derivative values should be evaluated and given in yyp[] in the next call.
[out]yy[]Array yy[lyy] (lyy >= n)
irev = 1 to 10: The value of y where the derivative values should be evaluated and given in yyp[] in the next call.
[in]yyp[]Array yyp[lyyp] (lyyp >= n)
irev = 1 to 10: The computed derivatives at given t (= tt) and y (= yy[]), i.e. yyp[i] = dyi/dt = fi(tt, yy[0], ..., yy[n-1]) (i = 0 to n-1), should be given in the next call.
[in,out]irevControl variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered.
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Computation finished. See return code in info.
= 1 to 10: User should set the computed derivative values at tt and yy[] in yyp[]. Do not alter any variables other than yyp[].
Reference
netlib/ode