NAG FL Interface
d03ecf (dim3_ellip_fd)
1
Purpose
d03ecf uses the Strongly Implicit Procedure to calculate the solution to a system of simultaneous algebraic equations of sevenpoint molecule form on a threedimensional topologicallyrectangular mesh. (‘Topological’ means that a polar grid, for example, can be used if it is equivalent to a rectangular box.)
2
Specification
Fortran Interface
Subroutine d03ecf ( 
n1, n2, n3, lda, sda, a, b, c, d, e, f, g, q, t, aparam, itmax, itcoun, itused, ndir, ixn, iyn, izn, conres, conchn, resids, chngs, wrksp1, wrksp2, wrksp3, wrksp4, ifail) 
Integer, Intent (In) 
:: 
n1, n2, n3, lda, sda, itmax, ndir, ixn, iyn, izn 
Integer, Intent (Inout) 
:: 
itcoun, ifail 
Integer, Intent (Out) 
:: 
itused 
Real (Kind=nag_wp), Intent (In) 
:: 
a(lda,sda,n3), b(lda,sda,n3), c(lda,sda,n3), d(lda,sda,n3), e(lda,sda,n3), f(lda,sda,n3), g(lda,sda,n3), q(lda,sda,n3), aparam, conres, conchn 
Real (Kind=nag_wp), Intent (Inout) 
:: 
t(lda,sda,n3), wrksp1(lda,sda,n3), wrksp2(lda,sda,n3), wrksp3(lda,sda,n3), wrksp4(lda,sda,n3) 
Real (Kind=nag_wp), Intent (Out) 
:: 
resids(itmax), chngs(itmax) 

C Header Interface
#include <nag.h>
void 
d03ecf_ (const Integer *n1, const Integer *n2, const Integer *n3, const Integer *lda, const Integer *sda, const double a[], const double b[], const double c[], const double d[], const double e[], const double f[], const double g[], const double q[], double t[], const double *aparam, const Integer *itmax, Integer *itcoun, Integer *itused, const Integer *ndir, const Integer *ixn, const Integer *iyn, const Integer *izn, const double *conres, const double *conchn, double resids[], double chngs[], double wrksp1[], double wrksp2[], double wrksp3[], double wrksp4[], Integer *ifail) 

C++ Header Interface
#include <nag.h> extern "C" {
void 
d03ecf_ (const Integer &n1, const Integer &n2, const Integer &n3, const Integer &lda, const Integer &sda, const double a[], const double b[], const double c[], const double d[], const double e[], const double f[], const double g[], const double q[], double t[], const double &aparam, const Integer &itmax, Integer &itcoun, Integer &itused, const Integer &ndir, const Integer &ixn, const Integer &iyn, const Integer &izn, const double &conres, const double &conchn, double resids[], double chngs[], double wrksp1[], double wrksp2[], double wrksp3[], double wrksp4[], Integer &ifail) 
}

The routine may be called by the names d03ecf or nagf_pde_dim3_ellip_fd.
3
Description
Given a set of simultaneous equations
(which could be nonlinear) derived, for example, from a finite difference representation of a threedimensional elliptic partial differential equation and its boundary conditions, the routine determines the values of the dependent variable
$t$.
$M$ is a square
$\left({n}_{1}\times {n}_{2}\times {n}_{3}\right)$ by
$\left({n}_{1}\times {n}_{2}\times {n}_{3}\right)$ matrix and
$q$ is a known vector of length
$\left({n}_{1}\times {n}_{2}\times {n}_{3}\right)$.
The equations must be of sevendiagonal form:
for
$i=1,2,\dots ,{n}_{1}$,
$j=1,2,\dots ,{n}_{2}$ and
$k=1,2,\dots ,{n}_{3}$, provided that
${d}_{ijk}\ne 0.0$.
Indeed, if
${d}_{ijk}=0.0$, then the equation is assumed to be:
The system is solved iteratively from a starting approximation
${t}^{\left(1\right)}$ by the formulae:
Thus
${r}^{\left(n\right)}$ is the residual of the
$n$th approximate solution
${t}^{\left(n\right)}$, and
${s}^{\left(n\right)}$ is the update change vector.
The calling program supplies an initial approximation for the values of the dependent variable in the array
t, the coefficients of the sevenpoint molecule system of equations in the arrays
a,
b,
c,
d,
e,
f and
g, and the source terms in the array
q. The routine derives the residual of the latest approximate solution, and then uses the approximate
$LU$ factorization of the Strongly Implicit Procedure with the necessary acceleration argument adjustment by calling
d03ubf at each iteration.
d03ecf combines the newly derived change with the old approximation to obtain the new approximate solution for
$t$. The new solution is checked for convergence against the usersupplied convergence criteria, and if these have not been satisfied, the iterative cycle is repeated. Convergence is based on both the maximum absolute normalized residuals (calculated with reference to the previous approximate solution as these are calculated at the commencement of each iteration) and on the maximum absolute change made to the values of
$t$.
Problems in topologically nonrectangularboxshaped regions can be solved using the routine by surrounding the region by a circumscribing topologically rectangular box. The equations for the nodal values external to the region of interest are set to zero (i.e., ${d}_{ijk}={t}_{ijk}=0$) and the boundary conditions are incorporated into the equations for the appropriate nodes.
If there is no better initial approximation when starting the iterative cycle, one can use an array of zeros as the initial approximation.
The routine can be used to solve linear elliptic equations in which case the arrays
a,
b,
c,
d,
e,
f,
g and
q remain constant and for which a single call provides the required solution. It can also be used to solve nonlinear elliptic equations, in which case some or all of these arrays may require updating during the progress of the iterations as more accurate solutions are derived. The routine will then have to be called repeatedly in an outer iterative cycle. Dependent on the nonlinearity, some underrelaxation of the coefficients and/or source terms may be needed during their recalculation using the new estimates of the solution.
The routine can also be used to solve each step of a timedependent parabolic equation in three space dimensions. The solution at each time step can be expressed in terms of an elliptic equation if the Crank–Nicolson or other form of implicit time integration is used.
Neither diagonal dominance, nor positivedefiniteness, of the matrix
$M$ formed from the arrays
a,
b,
c,
d,
e,
f and
g is necessary to ensure convergence.
For problems in which the solution is not unique in the sense that an arbitrary constant can be added to the solution (for example Poisson's equation with all Neumann boundary conditions), an argument is incorporated so that the solution can be rescaled. A specified nodal value is subtracted from the whole solution $t$ after the completion of every iteration. This keeps rounding errors to a minimum for those cases when convergence is slow. For such problems there is generally an associated compatibility condition. For the example mentioned this compatibility condition equates the total net source within the region (i.e., the source integrated over the region) with the total net outflow across the boundaries defined by the Neumann conditions (i.e., the normal derivative integrated along the whole boundary). It is very important that the algebraic equations derived to model such a problem implement accurately the compatibility condition. If they do not, a net source or sink is very likely to be represented by the set of algebraic equations and no steadystate solution of the equations exists.
4
References
Jacobs D A H (1972) The strongly implicit procedure for the numerical solution of parabolic and elliptic partial differential equations Note RD/L/N66/72 Central Electricity Research Laboratory
Stone H L (1968) Iterative solution of implicit approximations of multidimensional partial differential equations SIAM J. Numer. Anal. 5 530–558
Weinstein H G, Stone H L and Kwan T V (1969) Iterative procedure for solution of systems of parabolic and elliptic equations in three dimensions Industrial and Engineering Chemistry Fundamentals 8 281–287
5
Arguments

1:
$\mathbf{n1}$ – Integer
Input

On entry: the number of nodes in the first coordinate direction, ${n}_{1}$.
Constraint:
${\mathbf{n1}}>1$.

2:
$\mathbf{n2}$ – Integer
Input

On entry: the number of nodes in the second coordinate direction, ${n}_{2}$.
Constraint:
${\mathbf{n2}}>1$.

3:
$\mathbf{n3}$ – Integer
Input

On entry: the number of nodes in the third coordinate direction, ${n}_{3}$.
Constraint:
${\mathbf{n3}}>1$.

4:
$\mathbf{lda}$ – Integer
Input

On entry: the first dimension of the arrays
a,
b,
c,
d,
e,
f,
g,
q,
t,
wrksp1,
wrksp2,
wrksp3 and
wrksp4 as declared in the (sub)program from which
d03ecf is called.
Constraint:
${\mathbf{lda}}\ge {\mathbf{n1}}$.

5:
$\mathbf{sda}$ – Integer
Input

On entry: the second dimension of the arrays
a,
b,
c,
d,
e,
f,
g,
q,
t,
wrksp1,
wrksp2,
wrksp3 and
wrksp4 as declared in the (sub)program from which
d03ecf is called.
Constraint:
${\mathbf{sda}}\ge {\mathbf{n2}}$.

6:
$\mathbf{a}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{a}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i}\mathit{j},\mathit{k}1}$ in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
a, for
$k=1$, must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

7:
$\mathbf{b}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{b}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i},\mathit{j}1,\mathit{k}}$ in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
b, for
$j=1$, must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

8:
$\mathbf{c}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{c}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i}1,\mathit{j}\mathit{k}}$ in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
c, for
$i=1$, must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

9:
$\mathbf{d}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{d}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i}\mathit{j}\mathit{k}}$ (the ‘central’ term) in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
d are checked to ensure that they are nonzero. If any element is found to be zero, the corresponding algebraic equation is assumed to be
${t}_{ijk}={q}_{ijk}$. This feature can be used to define the equations for nodes at which, for example, Dirichlet boundary conditions are applied, or for nodes external to the problem of interest. Setting
${\mathbf{d}}\left(i,j,k\right)=0.0$ at appropriate points, and the corresponding value of
${\mathbf{q}}\left(i,j,k\right)$ to the appropriate value, namely the prescribed value of
${\mathbf{t}}\left(i,j,k\right)$ in the Dirichlet case, or to zero at an external point.

10:
$\mathbf{e}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{e}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i}+1,\mathit{j}\mathit{k}}$ in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
e, for
$i={\mathbf{n1}}$, must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

11:
$\mathbf{f}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{f}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i},\mathit{j}+1,\mathit{k}}$ in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
f, for
$j={\mathbf{n2}}$, must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

12:
$\mathbf{g}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{g}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the coefficient of
${t}_{\mathit{i}\mathit{j},\mathit{k}+1}$ in the
$\left(\mathit{i},\mathit{j},\mathit{k}\right)$th equation of the system
(1), for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$. The elements of
g, for
$k={\mathbf{n3}}$, must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

13:
$\mathbf{q}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input

On entry:
${\mathbf{q}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain
${q}_{\mathit{i}\mathit{j}\mathit{k}}$, for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$, i.e., the sourceterm values at the nodal points of the system
(1).

14:
$\mathbf{t}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Input/Output

On entry:
${\mathbf{t}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the element
${t}_{\mathit{i}\mathit{j}\mathit{k}}$ of an approximate solution to the equations, for
$\mathit{i}=1,2,\dots ,{\mathbf{n1}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{n2}}$ and
$\mathit{k}=1,2,\dots ,{\mathbf{n3}}$.
If no better approximation is known, an array of zeros can be used.
On exit: the solution derived by the routine.

15:
$\mathbf{aparam}$ – Real (Kind=nag_wp)
Input

On entry: the iteration acceleration factor. A value of $1.0$ is adequate for most typical problems. However, if convergence is slow, the value can be reduced, typically to $0.2$ or $0.1$. If divergence is obtained, the value can be increased, typically to $2.0$, $5.0$ or $10.0$.
Constraint:
$0.0<{\mathbf{aparam}}\le \left({\left({\mathbf{n1}}1\right)}^{2}+{\left({\mathbf{n2}}1\right)}^{2}+{\left({\mathbf{n3}}1\right)}^{2}\right)/3.0$.

16:
$\mathbf{itmax}$ – Integer
Input

On entry: the maximum number of iterations to be used by the routine in seeking the solution. A reasonable value might be $20$ for a problem with $3000$ nodes and convergence criteria of about ${10}^{3}$ of the original residual and change.

17:
$\mathbf{itcoun}$ – Integer
Input/Output

On entry: on the first call of
d03ecf,
itcoun must be set to
$0$. On subsequent entries, its value must be unchanged from the previous call.
On exit: its value is increased by the number of iterations used on this call (namely
itused). It therefore stores the accumulated number of iterations actually used.
For subsequent calls for the same problem, i.e., with the same
n1,
n2 and
n3 but possibly different coefficients and/or source terms, as occur with nonlinear systems or with timedependent systems,
itcoun should not be reset, i.e., it must contain the accumulated number of iterations. In this way a suitable cycling of the sequence of iteration arguments is obtained in the calls to
d03ubf.

18:
$\mathbf{itused}$ – Integer
Output

On exit: the number of iterations actually used on that call.

19:
$\mathbf{ndir}$ – Integer
Input

On entry: indicates whether or not the system of equations has a unique solution. For systems which have a unique solution,
ndir must be set to any nonzero value. For systems derived from problems to which an arbitrary constant can be added to the solution, for example Poisson's equation with all Neumann boundary conditions,
ndir should be set to
$0$ and the values of the next three arguments must be specified. For such problems the routine subtracts the value of the function derived at the node (
ixn,
iyn,
izn) from the whole solution after each iteration to reduce the possibility of large rounding errors. You must also ensure for such problems that the appropriate compatibility condition on the source terms
q is satisfied. See the comments at the end of
Section 3.

20:
$\mathbf{ixn}$ – Integer
Input

On entry: is ignored unless
ndir is equal to zero, in which case it must specify the first index of the nodal point at which the solution is to be set to zero. The node should not correspond to a corner node, or to a node external to the region of interest.

21:
$\mathbf{iyn}$ – Integer
Input

On entry: is ignored unless
ndir is equal to zero, in which case it must specify the second index of the nodal point at which the solution is to be set to zero. The node should not correspond to a corner node, or to a node external to the region of interest.

22:
$\mathbf{izn}$ – Integer
Input

On entry: is ignored unless
ndir is equal to zero, in which case it must specify the third index of the nodal point at which the solution is to be set to zero. The node should not correspond to a corner node, or to a node external to the region of interest.

23:
$\mathbf{conres}$ – Real (Kind=nag_wp)
Input

On entry: the convergence criterion to be used on the maximum absolute value of the normalized residual vector components. The latter is defined as the residual of the algebraic equation divided by the central coefficient when the latter is not equal to
$0.0$, and defined as the residual when the central coefficient is zero.
conres should not be less than a reasonable multiple of the
machine precision.

24:
$\mathbf{conchn}$ – Real (Kind=nag_wp)
Input

On entry: the convergence criterion to be used on the maximum absolute value of the change made at each iteration to the elements of the array
t, namely the dependent variable.
conchn should not be less than a reasonable multiple of the machine accuracy multiplied by the maximum value of
t attained.
Convergence is achieved when both the convergence criteria are satisfied. You can therefore set convergence on either the residual or on the change, or (as is recommended) on a requirement that both are below prescribed limits.

25:
$\mathbf{resids}\left({\mathbf{itmax}}\right)$ – Real (Kind=nag_wp) array
Output

On exit: the maximum absolute value of the residuals calculated at the
$\mathit{i}$th iteration, for
$\mathit{i}=1,2,\dots ,{\mathbf{itused}}$. If the residual of the solution is sought you must calculate this in the subroutine from which
d03ecf is called. The sequence of values
resids indicates the rate of convergence.

26:
$\mathbf{chngs}\left({\mathbf{itmax}}\right)$ – Real (Kind=nag_wp) array
Output

On exit: the maximum absolute value of the changes made to the components of the dependent variable
t at the
$\mathit{i}$th iteration, for
$\mathit{i}=1,2,\dots ,{\mathbf{itused}}$. The sequence of values
chngs indicates the rate of convergence.

27:
$\mathbf{wrksp1}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Workspace

28:
$\mathbf{wrksp2}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Workspace

29:
$\mathbf{wrksp3}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Workspace

30:
$\mathbf{wrksp4}\left({\mathbf{lda}},{\mathbf{sda}},{\mathbf{n3}}\right)$ – Real (Kind=nag_wp) array
Workspace


31:
$\mathbf{ifail}$ – Integer
Input/Output

On entry:
ifail must be set to
$0$,
$1\text{or}1$. If you are unfamiliar with this argument you should refer to
Section 4 in the Introduction to the NAG Library FL Interface 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, because for this routine the values of the output arguments may be useful even if
${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{or}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}}=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:
Note: in some cases d03ecf may return useful information.
 ${\mathbf{ifail}}=1$

On entry, ${\mathbf{n1}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{n1}}>1$.
On entry, ${\mathbf{n2}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{n2}}>1$.
On entry, ${\mathbf{n3}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{n3}}>1$.
 ${\mathbf{ifail}}=2$

On entry, ${\mathbf{lda}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{n1}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{lda}}\ge {\mathbf{n1}}$.
On entry, ${\mathbf{sda}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{n2}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{sda}}\ge {\mathbf{n2}}$.
 ${\mathbf{ifail}}=3$

On entry, ${\mathbf{aparam}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{aparam}}>0.0$.
 ${\mathbf{ifail}}=4$

On entry, ${\mathbf{aparam}}=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{n1}}=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{n2}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{n3}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{aparam}}\le \left({\left({\mathbf{n1}}1\right)}^{2}+{\left({\mathbf{n2}}1\right)}^{2}+{\left({\mathbf{n3}}1\right)}^{2}\right)/3$.
 ${\mathbf{ifail}}=5$

Convergence not achieved in
itmax iterations:
${\mathbf{itmax}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{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.
 ${\mathbf{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.
 ${\mathbf{ifail}}=999$
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
The improvement in accuracy for each iteration depends on the size of the system and on the condition of the update matrix characterised by the sevendiagonal coefficient arrays. The ultimate accuracy obtainable depends on the above factors and on the
machine precision. The rate of convergence obtained with the Strongly Implicit Procedure is not always smooth because of the cyclic use of nine acceleration arguments. The convergence may become slow with very large problems. The final accuracy obtained may be judged approximately from the rate of convergence determined from the sequence of values returned in the arrays
resids and
chngs and the magnitude of the maximum absolute value of the change vector on the last iteration stored in
${\mathbf{chngs}}\left({\mathbf{itused}}\right)$.
8
Parallelism and Performance
d03ecf is not threaded in any implementation.
The time taken per iteration is approximately proportional to ${\mathbf{n1}}\times {\mathbf{n2}}\times {\mathbf{n3}}$.
Convergence may not always be obtained when the problem is very large and/or the coefficients of the equations have widely disparate values. The latter case is often associated with a near illconditioned matrix.
10
Example
This example solves Laplace's equation in a rectangular box with a nonuniform grid spacing in the
$x$,
$y$, and
$z$ coordinate directions and with Dirichlet boundary conditions specifying the function on the surfaces of the box equal to
Note that this is the same problem as that solved in the example for
d03ubf. The differences in the maximum residuals obtained at each iteration between the two test runs are explained by the fact that in
d03ecf the residual at each node is normalized by dividing by the central coefficient, whereas this normalization has not been used in the example program for
d03ubf.
10.1
Program Text
10.2
Program Data
10.3
Program Results