- Art Gallery -

.

In mathematics, especially in the areas of numerical analysis called numerical partial differential equations, a compact stencil is a type of stencil that uses only nine nodes for its discretization method in two dimensions. It uses only the center node and the adjacent nodes. For any structured grid utilizing a compact stencil in 1, 2, or 3 dimensions the maximum number of nodes is 3, 9, or 27 respectively. Compact stencils may be compared to non-compact stencils. Compact stencils are currently implemented in many partial differential equation solvers, including several in the topics of CFD, FEA, and other mathematical solvers relating to PDE's.[1][2]

Two Point Stencil Example

The two point stencil for the first derivative of a function is given by:

\( f'(x_0)=\frac{f\left(x_0 + h\right) - f\left(x_0 - h\right)}{2h} + O\left(h^2\right) \) .


This is obtained from the Taylor series expansion of the first derivative of the function given by:

\( \begin{array} {l} f'(x_0)=\frac{f\left(x_0 + h\right) - f(x_0)}{h} -\frac{f^{(2)}(x_0)}{2!}h - \frac{f^{(3)}(x_0)}{3!}h^2 - \frac{f^{(4)}(x_0)}{4!}h^3 + \cdots \end{array}. \)


Replacing h with -h, we have:

\( \begin{array} {l} f'(x_0)=-\frac{f\left(x_0 - h\right) - f(x_0)}{h} + \frac{f^{(2)}(x_0)}{2!}h - \frac{f^{(3)}(x_0)}{3!}h^2 + \frac{f^{(4)}(x_0)}{4!}h^3 + \cdots \end{array}. \)


Addition of the above two equations together results in the cancellation of the terms in odd powers of h:

\( \begin{array} {l} 2f'(x_0)= \frac{f\left(x_0 + h\right) - f(x_0)}{h} -\frac{f\left(x_0 - h\right) - f(x_0)}{h} -2\frac{f^{(3)}(x_0)}{3!}h^2 + \cdots \end{array}. \)

\( \begin{array} {l} f'(x_0)= \frac{f\left(x_0 + h\right) - f\left(x_0 - h\right)}{2h} - \frac{f^{(3)}(x_0)}{3!}h^2 + \cdots \end{array}. \)

\( \begin{array} {l} f'(x_0)= \frac{f\left(x_0 + h\right) - f\left(x_0 - h\right)}{2h} + O\left(h^2\right) \end{array}. \)


Three Point Stencil Example

For example, the three point stencil for the second derivative of a function is given by:

\( \begin{array} {l} f^{(2)}(x_0)= \frac{f\left(x_0 + h\right) + f\left(x_0 - h\right) - 2f(x_0)}{h^2} + O\left(h^2\right) \end{array}. \)


This is obtained from the Taylor series expansion of the first derivative of the function given by:

\( \begin{array} {l} f'(x_0)=\frac{f\left(x_0 + h\right) - f(x_0)}{h} -\frac{f^{(2)}(x_0)}{2!}h - \frac{f^{(3)}(x_0)}{3!}h^2 - \frac{f^{(4)}(x_0)}{4!}h^3 + \cdots \end{array}. \)


Replacing h with -h, we have:

\( \begin{array} {l} f'(x_0)=-\frac{f\left(x_0 - h\right) - f(x_0)}{h} + \frac{f^{(2)}(x_0)}{2!}h - \frac{f^{(3)}(x_0)}{3!}h^2 + \frac{f^{(4)}(x_0)}{4!}h^3 + \cdots \end{array}. \)


Subtraction of the above two equations results in the cancellation of the terms in even powers of h: \( \begin{array} {l} 0= \frac{f\left(x_0 + h\right) - f(x_0)}{h} +\frac{f\left(x_0 - h\right) - f(x_0)}{h} - 2\frac{f^{(2)}(x_0)}{2!}h - 2\frac{f^{(4)}(x_0)}{4!}h^3 + \cdots \end{array}. \)

\( \begin{array} {l} f^{(2)}(x_0)= \frac{f\left(x_0 + h\right) + f\left(x_0 - h\right) - 2f(x_0)}{h^2} - 2\frac{f^{(4)}(x_0)}{4!}h^2 + \cdots \end{array}. \)

\( \begin{array} {l} f^{(2)}(x_0)= \frac{f\left(x_0 + h\right) + f\left(x_0 - h\right) - 2f(x_0)}{h^2} + O\left(h^2\right) \end{array}. \)


See also

Stencil (numerical analysis)
Non-compact stencil
Five-point stencil

References

W. F. Spotz. High-Order Compact Finite Difference Schemes for Computational Mechanics. PhD thesis, University of Texas at Austin, Austin, TX, 1995.
Communications in Numerical Methods in Engineering, Copyright © 2008 John Wiley & Sons, Ltd.

1 Examples of spectral methods
1.1 A concrete, linear example
1.1.1 Algorithm
1.2 A concrete, nonlinear example
2 A relationship with the spectral element method
3 See also

Mathematics Encyclopedia

Retrieved from "http://en.wikipedia.org/"
All text is available under the terms of the GNU Free Documentation License

Home - Hellenica World