# naginterfaces.library.pde.dim3_​ellip_​fd_​iter¶

naginterfaces.library.pde.dim3_ellip_fd_iter(n2, n3, a, b, c, d, e, f, g, aparam, it, r)[source]

dim3_ellip_fd_iter performs at each call one iteration of the Strongly Implicit Procedure. It is used to calculate on successive calls a sequence of approximate corrections to the current estimate of the solution when solving a system of simultaneous algebraic equations for which the iterative update matrix is of seven-point molecule form on a three-dimensional topologically-rectangular mesh. (‘Topological’ means that a polar grid , for example, can be used as it is equivalent to a rectangular box.)

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

https://www.nag.com/numeric/nl/nagdoc_29/flhtml/d03/d03ubf.html

Parameters
n2int

The number of nodes in the second coordinate direction, .

n3int

The number of nodes in the third coordinate direction, .

afloat, array-like, shape

must contain the coefficient of in the th equation of the system (2), for , for , for . The elements of , for , must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

bfloat, array-like, shape

must contain the coefficient of in the th equation of the system (2), for , for , for . The elements of , for , must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

cfloat, array-like, shape

must contain the coefficient of in the th equation of the system (2), for , for , for . The elements of , for , must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

dfloat, array-like, shape

must contain the coefficient of , the ‘central’ term, in the th equation of the system (2), for , for , for . The elements of are checked to ensure that they are nonzero. If any element is found to be zero, the corresponding algebraic equation is assumed to be . 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, by setting at appropriate points. The corresponding value of is set equal to the appropriate value, namely the difference between the prescribed value of and the current value in the Dirichlet case, or zero at an external point.

efloat, array-like, shape

must contain the coefficient of in the th equation of the system (2), for , for , for . The elements of , for , must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

ffloat, array-like, shape

must contain the coefficient of in the th equation of the system (2), for , for , for . The elements of , for , must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

gfloat, array-like, shape

must contain the coefficient of in the th equation of the system (2), for , for , for . The elements of , for , must be zero after incorporating the boundary conditions, since they involve nodal values from outside the box.

aparamfloat

The iteration acceleration factor. A value of is adequate for most typical problems. However, if convergence is slow, the value can be reduced, typically to or . If divergence is obtained, the value can be increased, typically to , or .

itint

The iteration number. It must be initialized, but not necessarily to , before the first call, and should be incremented by one in the calling program for each subsequent call. The function uses this counter to select the appropriate acceleration argument from a sequence of nine, each one being used twice in succession. (Note that the acceleration argument depends on the value of .)

rfloat, array-like, shape

The current residual on the right-hand side of the th equation of the system (2), for , for , for .

Returns
rfloat, ndarray, shape

These residuals are overwritten by the corresponding components of the solution of the system (2), i.e., the changes to be made to the vector to reduce the residuals supplied.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , , and .

Constraint: .

Notes

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

Given a set of simultaneous equations

(which could be nonlinear) derived, for example, from a finite difference representation of a three-dimensional elliptic partial differential equation and its boundary conditions, the solution may be obtained iteratively from a starting approximation by the formulae

Thus is the residual of the th approximate solution , and is the update change vector.

dim3_ellip_fd_iter determines the approximate change vector corresponding to a given residual , i.e., it determines an approximate solution to a set of equations

where is a square matrix and is a known vector of length . The set of equations (2) must be of seven-diagonal form

for , and , provided that . Indeed, if , then the equation is assumed to be

The calling program supplies the current residual at each iteration and the coefficients of the seven-point molecule system of equations on which the update procedure is based. The function performs one iteration, using the approximate factorization of the Strongly Implicit Procedure with the necessary acceleration argument adjustment, to calculate the approximate solution of the set of equations (2). The change overwrites the residual array for return to the calling program. The calling program must combine this change stored in with the old approximation to obtain the new approximate solution for . It must then recalculate the residuals and, if the accuracy requirements have not been satisfied, commence the next iterative cycle.

Clearly there is no requirement that the iterative update matrix passed in the form of the seven-diagonal element arrays , , , , , and is the same as that used to calculate the residuals, and, therefore, the one governing the problem. However, the convergence may be impaired if they are not equal. Indeed, if the system of equations (1) is not precisely of the seven-diagonal form illustrated above but has a few additional terms, then the methods of deferred or defect correction can be employed. The residual is calculated by the calling program using the full system of equations, but the update formula is based on a seven-diagonal system (2) of the form given above. For example, the solution of a system of eleven-diagonal equations each involving the combination of terms with and could use the seven-diagonal coefficients on which to base the update, provided these incorporate the major features of the equations.

Problems in topologically non-rectangular box-shaped regions can be solved using the function by surrounding the region with a circumscribing topologically rectangular box. The equations for the nodal values external to the region of interest are set to zero (i.e., ) 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 all zeros as the initial approximation from which the first set of residuals are determined.

The function can be used to solve linear elliptic equations in which case the arrays , , , , , and and the quantities will be unchanged during the iterative cycles, or for solving nonlinear elliptic equations in which case some or all of these arrays may require updating as each new approximate solution is derived. Depending on the nonlinearity, some under-relaxation of the coefficients and/or source terms may be needed during their recalculation using the new estimates of the solution (see Jacobs (1972)).

The function can also be used to solve each step of a time-dependent 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 positive-definiteness, of the matrix or of the update matrix formed from the arrays , , , , , and 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), the calling program should subtract a typical nodal value from the whole solution at every iteration to keep 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 accurately implement 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 steady-state solution of the equations exists.

References

Ames, W F, 1977, Nonlinear Partial Differential Equations in Engineering, (2nd Edition), Academic Press

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 multi-dimensional 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