2 A five point stencil
The approach we shall use is to approximate the two second derivatives using central differences. First we need some notation for our numerical solution, and we shall re-use some of the ideas seen in HELM booklet 32.4 and HELM booklet 32.5. We divide the -axis up into subintervals of width and the -axis into subintervals of width .
There is a simplification available to us now that was not possible in HELM booklet 32. Here, the two independent variables ( and ) both measure distance (in HELM booklet 32 we had measuring distance and measuring time) and there is no reason to suppose that one direction is more important than another, so we may choose the subintervals and to be equal.
Key Point 4
In deriving numerical solutions to elliptic PDEs we use equal steps in the and directions. That is, we take
So the idea is to approximate the second derivatives in the familiar way:
We will write our numerical approximation as
Key Point 5
We use subscripts on to relate to space variables. For Elliptic PDEs both of the independent variables measure distance and so we have two subscripts.
Key Point 6
If there is no danger of ambiguity we may omit the comma from the subscript. That is,
and may be written
Given all of this preamble we can now write down a difference equation which approximates the partial differential equation:
Rearranging this gives
This equation defines a five-point stencil approximating the PDE. The following diagram shows the stencil.
The idea in an implementation of this stencil is to centre the cross-shape on each node where we want to find . This guarantees that we will end up with the same number of equations as unknowns. An example of this approach will follow shortly, but first we note other ways of writing down the five-point stencil.
As the diagram above shows, the stencil involves a centre point and four additional points each corresponding to one of the points of the compass. It is this observation which has led to a simplified version of the mathematical expression and the diagram. The symbolic stencil can be written
where a subscript 0 corresponds to the centre of the stencil and other subscripts correspond to compass points (North, South, East, West) in the obvious way. The diagram becomes
and we reinterpret the local “ " positions each time we move the stencil on the global grid.
Another way of writing the stencil is as follows:
This latest version has the advantage of showing the values of the coefficients used in approximating .
We summarise in Key Point 7 the main idea using the notation established above.
Key Point 7
The five-point stencil used to approximate the partial differential equation
gives rise to the difference equation
Example 6
Consider the boundary value problem
in the square
on the boundary.
Use and formulate a system of simultaneous equations for the 4 unknowns.
Solution
In the diagram on the right we see a schematic of the square in the
plane. The numbers correspond to boundary data where the numerical grid intersects that boundary. The (as yet unknown) numerical approximations are shown in the positions where they approximate
.
The numerical stencil in this case is and we centre this at each of the places where is sought. There are four such places in this example:
This is a system of equations in the four unknowns which may be written
It is now a (simple, in theory) matter of solving the system to obtain the numerical approximation to . It turns out that the solution to the system of equations is , , and . These values are, to four decimal places, 0.0833, 0.1944, 0.1389 and 0.3611, respectively.
We will say more later about how to solve the system of equations, but first there is a Task to help consolidate what we have covered so far.
Task!
Consider the boundary value problem
Use and hence formulate a system of simultaneous equations for the four unknowns.
In the diagram on the right we see a schematic of the square in the
plane. The numbers correspond to boundary data where the numerical grid intersects that boundary. The (as yet unknown) numerical approximations are shown in the positions where they approximate
The numerical stencil in this case is
and we centre this at each of the places where is sought. In this Example there are four such places:
This is a system of equations in the four unknowns and it may be written