# naginterfaces.library.pde.dim3_​ellip_​helmholtz¶

naginterfaces.library.pde.dim3_ellip_helmholtz(xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, mbdcnd, bdys, bdyf, zs, zf, nbdcnd, bdzs, bdzf, lamda, f)[source]

dim3_ellip_helmholtz solves the Helmholtz equation in Cartesian coordinates in three dimensions using the standard seven-point finite difference approximation. This function is designed to be particularly efficient on vector processors.

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

https://support.nag.com/numeric/nl/nagdoc_30.1/flhtml/d03/d03faf.html

Parameters
xsfloat

The lower bound of the range of , i.e., .

xffloat

The upper bound of the range of , i.e., .

lint

The number of panels into which the interval is subdivided. Hence, there will be grid points in the -direction given by , for , where is the panel width.

lbdcndint

Indicates the type of boundary conditions at and .

If the solution is periodic in , i.e., .

If the solution is specified at and .

If the solution is specified at and the derivative of the solution with respect to is specified at .

If the derivative of the solution with respect to is specified at and .

If the derivative of the solution with respect to is specified at and the solution is specified at .

bdxsfloat, array-like, shape

The values of the derivative of the solution with respect to at . When or , , for , for .

When has any other value, is not referenced.

bdxffloat, array-like, shape

The values of the derivative of the solution with respect to at . When or , , for , for .

When has any other value, is not referenced.

ysfloat

The lower bound of the range of , i.e., .

yffloat

The upper bound of the range of , i.e., .

mbdcndint

Indicates the type of boundary conditions at and .

If the solution is periodic in , i.e., .

If the solution is specified at and .

If the solution is specified at and the derivative of the solution with respect to is specified at .

If the derivative of the solution with respect to is specified at and .

If the derivative of the solution with respect to is specified at and the solution is specified at .

bdysfloat, array-like, shape

The values of the derivative of the solution with respect to at . When or , , for , for .

When has any other value, is not referenced.

bdyffloat, array-like, shape

The values of the derivative of the solution with respect to at . When or , , for , for .

When has any other value, is not referenced.

zsfloat

The lower bound of the range of , i.e., .

zffloat

The upper bound of the range of , i.e., .

nbdcndint

Specifies the type of boundary conditions at and .

if the solution is periodic in , i.e., .

if the solution is specified at and .

if the solution is specified at and the derivative of the solution with respect to is specified at .

if the derivative of the solution with respect to is specified at and .

if the derivative of the solution with respect to is specified at and the solution is specified at .

bdzsfloat, array-like, shape

The values of the derivative of the solution with respect to at . When or , , for , for .

When has any other value, is not referenced.

bdzffloat, array-like, shape

The values of the derivative of the solution with respect to at . When or , , for , for .

When has any other value, is not referenced.

lamdafloat

The constant in the Helmholtz equation. For certain positive values of a solution to the differential equation may not exist, and close to these values the solution of the discretized problem will be extremely ill-conditioned. If , dim3_ellip_helmholtz will set = 3, but will still attempt to find a solution. However, since in general the values of for which no solution exists cannot be predicted a priori, you are advised to treat any results computed with with great caution.

ffloat, array-like, shape

The values of the right-side of the Helmholtz equation and boundary values (if any).

On the boundaries is defined by

 lbdcnd f[0,j−1,k−1] f[l,j−1,k−1] 0 f(xs,yj,zk) f(xs,yj,zk) 1 u(xs,yj,zk) u(xf,yj,zk) 2 u(xs,yj,zk) f(xf,yj,zk) j=1,2,…,m+1 3 f(xs,yj,zk) f(xf,yj,zk) k=1,2,…,n+1 4 f(xs,yj,zk) u(xf,yj,zk) mbdcnd f[i−1,0,k−1] f[i−1,m,k−1] 0 f(xi,ys,zk) f(xi,ys,zk) 1 u(xi,ys,zk) u(xi,yf,zk) 2 u(xi,ys,zk) f(xi,yf,zk) i=1,2,…,l+1 3 f(xi,ys,zk) f(xi,yf,zk) k=1,2,…,n+1 4 f(xi,ys,zk) u(xi,yf,zk) nbdcnd f[i−1,j−1,0] f[i−1,j−1,n] 0 f(xi,yj,zs) f(xi,yj,zs) 1 u(xi,yj,zs) u(xi,yj,zf) 2 u(xi,yj,zs) f(xi,yj,zf) i=1,2,…,l+1 3 f(xi,yj,zs) f(xi,yj,zf) j=1,2,…,m+1 4 f(xi,yj,zs) u(xi,yj,zf)

Note: if the table calls for both the solution and the right-hand side on a boundary, the solution must be specified.

Returns
ffloat, ndarray, shape

Contains the solution of the finite difference approximation for the grid point , for , for , for .

pertrbfloat

, unless a solution to Poisson’s equation is required with a combination of periodic or derivative boundary conditions (, and or ). In this case a solution may not exist. is a constant, calculated and subtracted from the array , which ensures that a solution exists. dim3_ellip_helmholtz then computes this solution, which is a least squares solution to the original approximation. This solution is not unique and is unnormalized. The value of should be small compared to the right-hand side , otherwise a solution has been obtained to an essentially different problem. This comparison should always be made to ensure that a meaningful solution has been obtained.

Raises
NagValueError
(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint:

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

in Helmholtz’s equation – a solution may not exist.

Notes

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

dim3_ellip_helmholtz solves the three-dimensional Helmholtz equation in Cartesian coordinates:

This function forms the system of linear equations resulting from the standard seven-point finite difference equations, and then solves the system using a method based on the fast Fourier transform (FFT) described by Swarztrauber (1984). This function is based on the function HW3CRT from FISHPACK (see Swarztrauber and Sweet (1979)).

More precisely, the function replaces all the second derivatives by second-order central difference approximations, resulting in a block tridiagonal system of linear equations. The equations are modified to allow for the prescribed boundary conditions. Either the solution or the derivative of the solution may be specified on any of the boundaries, or the solution may be specified to be periodic in any of the three dimensions. By taking the discrete Fourier transform in the - and -directions, the equations are reduced to sets of tridiagonal systems of equations. The Fourier transforms required are computed using the multiple FFT functions found in submodule sum.

References

Swarztrauber, P N, 1984, Fast Poisson solvers, Studies in Numerical Analysis, (ed G H Golub), Mathematical Association of America

Swarztrauber, P N and Sweet, R A, 1979, Efficient Fortran subprograms for the solution of separable elliptic partial differential equations, ACM Trans. Math. Software (5), 352–364