naginterfaces.library.ode.ivp_​stiff_​sparjac_​setup

naginterfaces.library.ode.ivp_stiff_sparjac_setup(neq, neqmax, jceval, nwkjac, ia, ja, comm, njcpvt, sens, u, eta, lblock, isplit=73)[source]

ivp_stiff_sparjac_setup is a setup function which must be called prior to an integrator in submodule ode, if sparse matrix linear algebra is required.

For full information please refer to the NAG Library document for d02nu

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/d02/d02nuf.html

Parameters
neqint

The number of differential equations.

neqmaxint

A bound on the maximum number of differential equations to be solved during the integration.

jcevalstr, length 1

Specifies the technique to be used to compute the Jacobian.

The sparsity structure and the value of the Jacobian are to be determined numerically by the integrator.

The sparsity structure of the Jacobian is supplied in the arrays and 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.

The Jacobian will be evaluated by calls to . The sparsity structure will be estimated by calls to ; that is, no explicit sparsity structure need be supplied in the arrays and .

The sparsity structure of the Jacobian is supplied in and , and its value will be determined by calls to . This is the recommended mode of operation if the is simple to form.

The default choice is to be made. In this case ‘D’ is interpreted as ‘S’.

If the sparsity structure is supplied in arrays and , 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 is passed to ivp_stiff_sparjac_setup; 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 ivp_stiff_sparjac_setup.

If the option , or is used then the actual argument corresponding to in the call to ivp_stiff_exp_sparjac() or ivp_stiff_imp_sparjac() must be specified as None.

If integration is to be performed by reverse communication (ivp_stiff_exp_revcom() or ivp_stiff_imp_revcom()) then should be set to either ‘N’ or ‘A’.

In this case and are not used and their lengths may be set to .

nwkjacint

The size of the array , which you are supplying to the integrator, as declared in the (sub)program from which ivp_stiff_sparjac_setup is called.

Suggested value: if or . If is less than this estimate, a message is printed on the file object associated with the advisory I/O unit (see FileObjManager), and execution continues.

iaint, array-like, shape

If , or , must contain details of the sparsity pattern to be used for the Jacobian. See .

is not used if or .

jaint, array-like, shape

If , or , must contain details of the sparsity pattern to be used for the Jacobian. contains the row indices where nonzero elements occur, reading in column-wise order, and contains the starting locations in of the descriptions of columns in that order, with . Thus for each column index , the values of the row index in column where a nonzero element may occur are given by

where .

Thus the total number of nonzeros, , must be .

For example, for the following matrix

where represents nonzero elements (13 in all) the arrays and should be

is not used if or .

commdict, communication object, modified in place

Communication structure.

This argument must have been initialized by a prior call to ivp_stiff_bdf() or ivp_stiff_blend().

njcpvtint

The length of the array [‘jacpvt’], which you are supplying to the integrator, as dimensioned in the sub(program) from which ivp_stiff_sparjac_setup is called.

Suggested value: if or . If is less than this estimate, a message is printed on the file object associated with the advisory I/O unit (see FileObjManager), and execution continues.

sensfloat

A threshold argument used to determine whether or not a matrix element is zero; when is set to on entry, the function will use . Otherwise the absolute value of is used.

ufloat

Should have a value between and . Otherwise a default value of is used. When the sparsity pattern has been evaluated, the first Jacobian computed is decomposed with 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 times the largest of those elements in the row available as pivots. Thus decreasing biases the algorithm towards maintaining sparsity at the expense of numerical stability.

etafloat

A relative pivot threshold, below which on subsequent decompositions (as described under ), an internal error is provoked.

No check on pivot size is made.

The default value is used.

lblockbool

Indicates if preordering is used before decomposition.

If , 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 .

For example, a Jacobian arising from using the method of lines for parabolic partial differential equations would normally be irreducible. (See the specification of ivp_stiff_sparjac_diag() for optional output concerning .)

isplitint, optional

This argument is used for splitting the integer workspace [‘jacpvt’] to effect an efficient decomposition. It must satisfy . If lies outside this range on entry, a default value of is used. An appropriate value for for subsequent runs on similar problems is available via the optional output ivp_stiff_sparjac_diag().

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, defines duplicate elements in row and column .

(errno )

On entry, , and .

Constraint: for all .

(errno )

On entry, , , , , .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: , , , or .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

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