D02NUF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D02NUF

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.

+ Contents

    1  Purpose
    7  Accuracy
    9  Example

1  Purpose

D02NUF is a setup routine which must be called prior to an integrator in sub-chapter D02M–N, if sparse matrix linear algebra is required.

2  Specification

SUBROUTINE D02NUF ( NEQ, NEQMAX, JCEVAL, NWKJAC, IA, NIA, JA, NJA, JACPVT, NJCPVT, SENS, U, ETA, LBLOCK, ISPLIT, RWORK, IFAIL)
INTEGER  NEQ, NEQMAX, NWKJAC, IA(NIA), NIA, JA(NJA), NJA, JACPVT(NJCPVT), NJCPVT, ISPLIT, IFAIL
REAL (KIND=nag_wp)  SENS, U, ETA, RWORK(50+4*NEQMAX)
LOGICAL  LBLOCK
CHARACTER(1)  JCEVAL

3  Description

D02NUF defines the linear algebra to be used as sparse matrix linear algebra, permits you to specify the method for calculating the Jacobian and its structure, and checks the validity of certain input values.

4  References

See the D02M–N sub-chapter Introduction.

5  Parameters

1:     NEQ – INTEGERInput
On entry: the number of differential equations.
Constraint: 1NEQNEQMAX.
2:     NEQMAX – INTEGERInput
On entry: a bound on the maximum number of differential equations to be solved during the integration.
Constraint: NEQMAXNEQ.
3:     JCEVAL – CHARACTER(1)Input
On entry: specifies the technique to be used to compute the Jacobian.
JCEVAL='N'
The sparsity structure and the value of the Jacobian are to be determined numerically by the integrator.
JCEVAL='S'
The sparsity structure of the Jacobian is supplied in the arrays IA and JA but its value is to be determined numerically. This is the recommended mode of operation unless it is a simple matter to supply the Jacobian.
JCEVAL='A'
The Jacobian will be evaluated by calls to JAC. The sparsity structure will be estimated by calls to JAC; that is, no explicit sparsity structure need be supplied in the arrays IA and JA.
JCEVAL='F'
The sparsity structure of the Jacobian is supplied in IA and JA, and its value will be determined by calls to JAC. This is the recommended mode of operation if the JAC is simple to form.
JCEVAL='D'
The default choice is to be made. In this case 'D' is interpreted as 'S'.
If the sparsity structure is supplied in arrays IA and JA, then any evidence from the numerical or analytical formation of the Jacobian that this structure is not correct, is ignored.
Only the first character of the actual parameter JCEVAL is passed to D02NUF; hence it is permissible for the actual argument to be more descriptive, e.g., ‘Numerical’, ‘Structural’, ‘Analytical’, ‘Full information’ or ‘Default’ in a call to D02NUF.
If the option JCEVAL='N', 'S' or 'D' is used then the actual argument corresponding to JAC in the call to D02NDF or D02NJF must be either D02NDZ or D02NJZ respectively.
If integration is to be performed by reverse communication (D02NMF or D02NNF) then JCEVAL should be set to either 'N' or 'A'. In this case IA and JA are not used and their lengths may be set to 1.
Constraint: JCEVAL='N', 'S', 'A', 'F' or 'D'.
4:     NWKJAC – INTEGERInput
On entry: the size of the array WKJAC, which you are supplying to the integrator, as declared in the (sub)program from which D02NUF is called.
Suggested value: NWKJAC=4×NEQMAX if JCEVAL='N' or 'A'. If NWKJAC is less than this estimate, then a message is printed on the current advisory message unit (see X04ABF), and execution continues.
Constraint: if JCEVAL='S', 'F' or 'D', NWKJACnelement+2×NEQ, where nelement is the total number of nonzeros.
5:     IA(NIA) – INTEGER arrayInput
On entry: if JCEVAL='S', 'F' or 'D', IA must contain details of the sparsity pattern to be used for the Jacobian. See JA.
IA is not used if JCEVAL='N' or 'A'.
6:     NIA – INTEGERInput
On entry: the dimension of the array IA as declared in the (sub)program from which D02NUF is called.
Constraints:
  • if JCEVAL='S', 'F' or 'D', NIANEQ+1;
  • otherwise NIA1.
7:     JA(NJA) – INTEGER arrayInput
On entry: if JCEVAL='S', 'F' or 'D', JA must contain details of the sparsity pattern to be used for the Jacobian. JA contains the row indices where nonzero elements occur, reading in column-wise order, and IA contains the starting locations in JA of the descriptions of columns 1,2,,NEQ in that order, with IA1=1. Thus for each column index j=1,2,,NEQ, the values of the row index i in column j where a nonzero element may occur are given by
i=JAk
where IAjk<IAj+1.
Thus the total number of nonzeros, nelement, must be IANEQ+1-1. For example, for the following matrix
x 0 x 0 0 0 x x x 0 x x x 0 0 x 0 0 x x 0 0 0 x x
where x represents nonzero elements (13 in all) the arrays IA and JA should be
IAk 1 4 6 9 12 14 JAk 1 3 4 2 03 01 2 3 2 4 5 4 5
JA is not used if JCEVAL='N' or 'A'.
8:     NJA – INTEGERInput
On entry: the dimension of the array JA as declared in the (sub)program from which D02NUF is called.
Constraints:
  • if JCEVAL='S', 'F' or 'D', NJAIANEQ+1-1;
  • otherwise NJA1.
9:     JACPVT(NJCPVT) – INTEGER arrayCommunication Array
On exit: data relating to the Jacobian sparsity structure.
10:   NJCPVT – INTEGERInput
On entry: the length of the array JACPVT, which you are supplying to the integrator, as dimensioned in the sub(program) from which D02NUF is called.
Suggested value: NJCPVT=20×NEQMAX if JCEVAL='N' or 'A'. If NJCPVT is less than this estimate, then a message is printed on the current advisory message unit (see X04ABF), and execution continues.
Constraint: if JCEVAL='S', 'F' or 'D', NJCPVT3×nelement+14×NEQ, where nelement is the total number of nonzeros.
11:   SENS – REAL (KIND=nag_wp)Input
On entry: a threshold parameter used to determine whether or not a matrix element is zero; when SENS is set to 0.0 on entry, the routine will use SENS=100.0×machine precision. Otherwise the absolute value of SENS is used.
12:   U – REAL (KIND=nag_wp)Input
On entry: should have a value between 0.0 and 0.9999. Otherwise a default value of 0.1 is used. When the sparsity pattern has been evaluated, the first Jacobian computed is decomposed with U governing the choice of pivots; subsequent Jacobian decompositions use the same pattern of decomposition until the sparsity pattern is re-evaluated. When searching a row for a pivot, any element is excluded from the search which is less than U times the largest of those elements in the row available as pivots. Thus decreasing U biases the algorithm towards maintaining sparsity at the expense of numerical stability.
13:   ETA – REAL (KIND=nag_wp)Input
On entry: a relative pivot threshold, below which on subsequent decompositions (as described under U), an internal error is provoked.
ETA>1.0
No check on pivot size is made.
ETA0.0
The default value ETA=1.0E−4 is used.
14:   LBLOCK – LOGICALInput
On entry: indicates if preordering is used before decomposition.
If LBLOCK=.TRUE., on entry, the Jacobian matrix is preordered to block lower triangular form before a decomposition is performed (this is the recommended mode). If you know the structure of the Jacobian to be irreducible, that is not permutable to block lower triangular form, then you should set LBLOCK=.FALSE.. For example, a Jacobian arising from using the method of lines for parabolic partial differential equations would normally be irreducible. (See the specification of D02NXF for optional output concerning LBLOCK.)
15:   ISPLIT – INTEGERInput
On entry: this parameter is used for splitting the integer workspace JACPVT to effect an efficient decomposition. It must satisfy 1ISPLIT99. If ISPLIT lies outside this range on entry, a default value of 73 is used. An appropriate value for ISPLIT for subsequent runs on similar problems is available via the optional output D02NXF.
Suggested value: ISPLIT=73, unless you have information from a previous run of a similar problem.
16:   RWORK(50+4×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.
17:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ 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​ 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 -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On 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:
IFAIL=1
On entry, an illegal input was detected.

7  Accuracy

Not applicable.

8  Further Comments

D02NUF must be called as a setup routine before a call to either D02NDF or D02NJF and may be called as the linear algebra setup routine before a call to D02NMF or D02NNF.

9  Example

See Section 9 in D02NDF, D02NJF and D02NNF.

D02NUF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012