D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

NAG Library Routine DocumentD02MVF

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

D02MVF is an integration method specific setup routine which must be called prior to linear algebra setup routines and integrators from the SPRINT suite of routines, if the DASSL implementation of Backward Differentiation Formulae (BDF) is to be used. Note that this method is also available, independent from the SPRINT suite, using D02NEF

2  Specification

 SUBROUTINE D02MVF ( NEQMAX, SDYSAV, MAXORD, CON, TCRIT, HMIN, HMAX, H0, MAXSTP, MXHNIL, NORM, RWORK, IFAIL)
 INTEGER NEQMAX, SDYSAV, MAXORD, MAXSTP, MXHNIL, IFAIL REAL (KIND=nag_wp) CON(3), TCRIT, HMIN, HMAX, H0, RWORK(50+4*NEQMAX) CHARACTER(1) NORM

3  Description

An integrator setup routine must be called before the call to any linear algebra setup routine or integrator from the SPRINT suite of routines in this sub-chapter. This setup routine, D02MVF, makes the choice of the DASSL integrator and permits you to define options appropriate to this choice. Alternative choices of integrator from this suite are the BDF method and the BLEND method which can be chosen by initial calls to D02NVF or D02NWF respectively.

4  References

See the D02M–N sub-chapter Introduction.

5  Parameters

1:     NEQMAX – INTEGERInput
On entry: a bound on the maximum number of differential equations to be solved.
Constraint: ${\mathbf{NEQMAX}}\ge 1$.
2:     SDYSAV – INTEGERInput
On entry: the second dimension of the array YSAV that will be supplied to the integrator, as declared in the (sub)program from which the integrator is called (e.g., see D02NBF).
Constraint: ${\mathbf{SDYSAV}}\ge {\mathbf{MAXORD}}+3$.
3:     MAXORD – INTEGERInput
On entry: the maximum order to be used for the BDF method. If ${\mathbf{MAXORD}}=0$ or ${\mathbf{MAXORD}}>5$ then ${\mathbf{MAXORD}}=5$ is assumed.
Constraint: ${\mathbf{MAXORD}}\ge 0$.
4:     CON($3$) – REAL (KIND=nag_wp) arrayInput/Output
On entry: values to be used to control step size choice during integration. If any ${\mathbf{CON}}\left(i\right)=0.0$ on entry, it is replaced by its default value described below. In most cases this is the recommended setting.
${\mathbf{CON}}\left(1\right)$, ${\mathbf{CON}}\left(2\right)$, and ${\mathbf{CON}}\left(3\right)$ are factors used to bound step size changes. If the current step size $h$ fails, then the modulus of the next step size is bounded by ${\mathbf{CON}}\left(1\right)×\left|h\right|$. The default value of ${\mathbf{CON}}\left(1\right)$ is $2.0$. Note that the new step size may be used with a method of different order to the failed step. If the initial step size is $h$, then the modulus of the step size on the second step is bounded by ${\mathbf{CON}}\left(3\right)×\left|h\right|$. At any other stage in the integration, if the current step size is $h$, then the modulus of the next step size is bounded by ${\mathbf{CON}}\left(2\right)×\left|h\right|$. The default values are $10.0$ for ${\mathbf{CON}}\left(2\right)$ and $1000.0$ for ${\mathbf{CON}}\left(3\right)$.
Constraints:
These constraints must be satisfied after any zero values have been replaced by default values.
• $0.0<{\mathbf{CON}}\left(1\right)<{\mathbf{CON}}\left(2\right)<{\mathbf{CON}}\left(3\right)$;
• ${\mathbf{CON}}\left(2\right)>1.0$;
• ${\mathbf{CON}}\left(3\right)>1.0$.
On exit: the values actually to be used by the integration routine.
5:     TCRIT – REAL (KIND=nag_wp)Input
On entry: a point beyond which integration must not be attempted. The use of TCRIT is described under the parameter ITASK in the specification for the integrator (e.g., see D02NBF). A value, $0.0$ say, must be specified even if ITASK subsequently specifies that TCRIT will not be used.
6:     HMIN – REAL (KIND=nag_wp)Input
On entry: the minimum absolute step size to be allowed. Set ${\mathbf{HMIN}}=0.0$ if this option is not required.
7:     HMAX – REAL (KIND=nag_wp)Input
On entry: the maximum absolute step size to be allowed. Set ${\mathbf{HMAX}}=0.0$ if this option is not required.
8:     H0 – REAL (KIND=nag_wp)Input
On entry: the step size to be attempted on the first step. Set ${\mathbf{H0}}=0.0$ if the initial step size is calculated internally.
9:     MAXSTP – INTEGERInput
On entry: the maximum number of steps to be attempted during one call to the integrator after which it will return with ${\mathbf{IFAIL}}={\mathbf{2}}$ (e.g., see D02NBF). Set ${\mathbf{MAXSTP}}=0$ if no limit is to be imposed.
10:   MXHNIL – INTEGERInput
On entry: the maximum number of warnings printed (if ${\mathbf{ITRACE}}\ge 0$, e.g., see D02NBF) per problem when $t+h=t$ on a step ($h=\text{​ current step size}$). If ${\mathbf{MXHNIL}}\le 0$, a default value of $10$ is assumed.
11:   NORM – CHARACTER(1)Input
On entry: indicates the type of norm to be used.
${\mathbf{NORM}}=\text{'M'}$
Maximum norm.
${\mathbf{NORM}}=\text{'A'}$
Averaged L2 norm.
${\mathbf{NORM}}=\text{'D'}$
Is the same as 'A'.
If $\mathit{vnorm}$ denotes the norm of the vector $v$ of length $n$, then for the averaged L2 norm
 $vnormB=1n∑i=1n viwi 2,$
while for the maximum norm
 $vnorm=max1≤i≤n viwi .$
If you wish to weight the maximum norm or the L2 norm, then RTOL and ATOL should be scaled appropriately on input to the integrator (see under ITOL in the specification of the integrator for the formulation of the weight vector ${w}_{i}$ from RTOL and ATOL, e.g., see D02NBF).
Only the first character to the actual parameter NORM is passed to D02MVF; hence it is permissible for the actual argument to be more descriptive, e.g., ‘Maximum’, ‘Average L2’ or ‘Default’ in a call to D02MVF.
Constraint: ${\mathbf{NORM}}=\text{'M'}$, $\text{'A'}$ or $\text{'D'}$.
12:   RWORK($50+4×{\mathbf{NEQMAX}}$) – REAL (KIND=nag_wp) arrayCommunication Array
This must be the same workspace array as the array RWORK supplied to the integrator. It is used to pass information from the setup routine to the integrator and therefore the contents of this array must not be changed before calling the integrator.
13:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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 parameter, 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}}={\mathbf{0}}$ or $-{\mathbf{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, ${\mathbf{NEQMAX}}<1$, or ${\mathbf{SDYSAV}}<{\mathbf{MAXORD}}+3$, or ${\mathbf{MAXORD}}<0$, or ${\mathbf{MAXORD}}>5$, or invalid value for element of the array CON, or ${\mathbf{NORM}}\ne \text{'M'}$, $\text{'A'}$ or $\text{'D'}$.

Not applicable.

None.

9  Example

This example solves the plane pendulum problem defined by the equations:
 $x′ = u y′ = v u′ = -λx v′ = -λy-1 x2+y2 = 1$
The additional algebraic constraint $xu+yv=0$ can be derived, and after appropriate substitution and manipulation to avoid a singular Jacobian solves the equations:
 $y1′ = y3-y6y1 y2′ = y4-y6y2 y3′ = -y5y1 y4′ = -y5y2-1 0 = y1y3+y2y4 0 = y12+y22-1$
with given initial conditions and derivatives.

9.1  Program Text

Program Text (d02mvfe.f90)

9.2  Program Data

Program Data (d02mvfe.d)

9.3  Program Results

Program Results (d02mvfe.r)