NAG FL Interface
d02nuf (ivp_​stiff_​sparjac_​setup)

Settings help

FL Name Style:


FL Specification Language:


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

Fortran Interface
Subroutine d02nuf ( neq, neqmax, jceval, nwkjac, ia, nia, ja, nja, jacpvt, njcpvt, sens, u, eta, lblock, isplit, rwork, ifail)
Integer, Intent (In) :: neq, neqmax, nwkjac, ia(nia), nia, ja(nja), nja, njcpvt, isplit
Integer, Intent (Inout) :: ifail
Integer, Intent (Out) :: jacpvt(njcpvt)
Real (Kind=nag_wp), Intent (In) :: sens, u, eta
Real (Kind=nag_wp), Intent (Inout) :: rwork(50+4*neqmax)
Logical, Intent (In) :: lblock
Character (1), Intent (In) :: jceval
C Header Interface
#include <nag.h>
void  d02nuf_ (const Integer *neq, const Integer *neqmax, const char *jceval, const Integer *nwkjac, const Integer ia[], const Integer *nia, const Integer ja[], const Integer *nja, Integer jacpvt[], const Integer *njcpvt, const double *sens, const double *u, const double *eta, const logical *lblock, const Integer *isplit, double rwork[], Integer *ifail, const Charlen length_jceval)
The routine may be called by the names d02nuf or nagf_ode_ivp_stiff_sparjac_setup.

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 Arguments

1: neq Integer Input
On entry: the number of differential equations.
Constraint: 1neqneqmax.
2: neqmax Integer Input
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, 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 argument 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 Integer Input
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, 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 array Input
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 Integer Input
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 array Input
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 ia(1)=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=ja(k)  
where ia(j)k<ia(j+1).
Thus the total number of nonzeros, nelement, must be ia(neq+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
ia(k) 1 4 6 9 12 14 ja(k) 1 3 4 2 03 01 2 3 2 4 5 4 5  
ja is not used if jceval='N' or 'A'.
8: nja Integer Input
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', njaia(neq+1)-1;
  • otherwise nja1.
9: jacpvt(njcpvt) Integer array Communication Array
On exit: data relating to the Jacobian sparsity structure.
10: njcpvt Integer Input
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, 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 argument 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 Logical Input
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, 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 Integer Input
On entry: this argument 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) array Communication 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 Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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, i=value, ia(i)=value, i-1=value, ia(i-1)=value, neq=value.
Constraint: ia(value)-ia(value)neq.
On entry, i=value, ja(i)=value and neq=value.
Constraint: 1ja(i)neq for all i.
On entry, ia(value)=value and ia(value)=value.
Constraint: ia(value)ia(value).
On entry, ia(1)=value.
Constraint: ia(1)=1.
On entry, ia(neq+1)-1=value and neq=value.
Constraint: ia(neq+1)-1neq.
On entry, ja defines duplicate elements in row value and column value.
On entry, jceval=value.
Constraint: jceval='A', 'N', 'S', 'F' or 'D'.
On entry, neq=value.
Constraint: neq1.
On entry, neq=value and neqmax=value.
Constraint: neqneqmax.
On entry, neqmax=value.
Constraint: neqmax1.
On entry, nia=value and neq+1=value.
Constraint: nianeq+1.
On entry, nja=value and ia(neq+1)-1=value.
Constraint: njaia(neq+1)-1.
On entry, njcpvt=value and 3×(ia(neq+1)-1)+14×neq+1=value.
Constraint: njcpvt3×(ia(neq+1)-1)+14×neq+1.
On entry, nwkjac=value and ia(neq+1)-1+2×neq=value.
Constraint: nwkjacia(neq+1)-1+2×neq.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

d02nuf is not thread safe and should not be called from a multithreaded user program. Please see Section 1 in FL Interface Multithreading for more information on thread safety.
d02nuf is not threaded in any implementation.

9 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.

10 Example

See Section 10 in d02ndf, d02njf and d02nnf.