naginterfaces.library.pde.dim2_​laplace

naginterfaces.library.pde.dim2_laplace(stage1, ext, dorm, p, q, x, y, phi, phid, alpha)[source]

dim2_laplace solves Laplace’s equation in two dimensions for an arbitrary domain bounded internally or externally by one or more closed contours, given the value of either the unknown function or its normal derivative (into the domain) at each point of the boundary.

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

https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/d03/d03eaf.html

Parameters
stage1bool

Indicates whether the function call is for stage of the computation as defined in Notes.

The call is for stage .

The call is for stage .

extbool

The form of the domain. If , the domain is unbounded. Otherwise the domain is an interior one.

dormbool

The form of the boundary conditions. If , the problem is a Dirichlet or mixed boundary value problem. Otherwise it is a Neumann problem.

pfloat

To stage , and must specify the and coordinates respectively of a point at which the solution is required.

When is , and are ignored.

qfloat

To stage , and must specify the and coordinates respectively of a point at which the solution is required.

When is , and are ignored.

xfloat, array-like, shape

The and coordinates respectively of points on the one or more closed contours which define the domain of the problem.

Note: each contour is described in such a manner that the subscripts of the coordinates increase when the domain is kept on the left. The final point on each contour coincides with the first and, if a further contour is to be described, the coordinates of this point are repeated in the arrays. In this way each interval is defined by three points, the second of which (the nodal point) always has an even subscript. In the case of the interior Neumann problem, the outermost boundary contour must be given first, if there is more than one.

yfloat, array-like, shape

The and coordinates respectively of points on the one or more closed contours which define the domain of the problem.

Note: each contour is described in such a manner that the subscripts of the coordinates increase when the domain is kept on the left. The final point on each contour coincides with the first and, if a further contour is to be described, the coordinates of this point are repeated in the arrays. In this way each interval is defined by three points, the second of which (the nodal point) always has an even subscript. In the case of the interior Neumann problem, the outermost boundary contour must be given first, if there is more than one.

phifloat, array-like, shape

For stage , must contain the nodal values of or its normal derivative (into the domain) as prescribed in each interval. For stage it must retain its output values from stage .

phidfloat, array-like, shape

For stage , must hold the value or accordingly as contains a value of or its normal derivative, for . For stage it must retain its output values from stage .

alphafloat

For stage , the use of depends on the nature of the problem:

if , need not be set;

if and , must contain the prescribed constant (see Notes);

if and , must contain an appropriate value (often zero) for the integral of around the outermost boundary.

For stage , on every call must contain the value returned at stage .

Returns
phifloat, ndarray, shape

From stage , it contains the constants which approximate in each interval. It remains unchanged on exit from stage .

phidfloat, ndarray, shape

From stage , contains the constants which approximate the normal derivative of in each interval. It remains unchanged on exit from stage .

alphafloat

From stage :

if , contains ;

if and is unchanged;

if and contains a computed estimate for .

From stage :

contains the computed value of at the point (,).

Raises
NagValueError
(errno )

Tolerance is too small: .

(errno )

Tolerance is too large: .

(errno )

Incorrect rank: .

Notes

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

dim2_laplace uses an integral equation method, based upon Green’s formula, which yields the solution, , within the domain, given its value or that of its normal derivative at each point of the boundary (except possibly at a finite number of discrete points). The solution is obtained in two stages. The first, which is executed once only, determines the complementary boundary values, i.e., , where its normal derivative is known and vice versa. The second stage is entered once for each point at which the solution is required.

The boundary is divided into a number of intervals in each of which and its normal derivative are approximated by constants. Of these half are evaluated by applying the given boundary conditions at one ‘nodal’ point within each interval while the remainder are determined (in stage ) by solving a set of simultaneous linear equations. Here this is achieved by means of auxiliary function lapackeig.dgels, which will yield the least squares solution of an overdetermined system of equations as well as the unique solution of a square nonsingular system.

In exterior domains the solution behaves as as tends to infinity, where is a constant, is the total integral of the normal derivative around the boundary and is the radial distance from the origin of coordinates. For the Neumann problem (when the normal derivative is given along the whole boundary) is fixed by the boundary conditions whilst is chosen by you. However, for a Dirichlet problem (when is given along the whole boundary) or for a mixed problem, stage produces a value of for which ; then as tends to infinity the solution tends to the constant .

References

Symm, G T and Pitfield, R A, 1974, Solution of Laplace’s equation in two dimensions, NPL Report NAC 44, National Physical Laboratory