Compact stencil

A 2D compact stencil using all 8 adjacent nodes, plus the center node (in red).

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]

## Contents

* 1 Two Point Stencil Example
* 2 Three Point Stencil Example
* 3 See also
* 4 References

## Two Point Stencil Example

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

f′(x0)=f(x0+h)−f(x0−h)2h+O(h2).

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

f′(x0)=f(x0+h)−f(x0)h−f(2)(x0)2!h−f(3)(x0)3!h2−f(4)(x0)4!h3+⋯.

Replacing h with −h, we have:

f′(x0)=−f(x0−h)−f(x0)h+f(2)(x0)2!h−f(3)(x0)3!h2+f(4)(x0)4!h3+⋯.

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

2f′(x0)=f(x0+h)−f(x0)h−f(x0−h)−f(x0)h−2f(3)(x0)3!h2+⋯.

f′(x0)=f(x0+h)−f(x0−h)2h−f(3)(x0)3!h2+⋯.

f′(x0)=f(x0+h)−f(x0−h)2h+O(h2).

## Three Point Stencil Example

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

f(2)(x0)=f(x0+h)+f(x0−h)−2f(x0)h2+O(h2).

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

f′(x0)=f(x0+h)−f(x0)h−f(2)(x0)2!h−f(3)(x0)3!h2−f(4)(x0)4!h3+⋯.

Replacing h with −h, we have:

f′(x0)=−f(x0−h)−f(x0)h+f(2)(x0)2!h−f(3)(x0)3!h2+f(4)(x0)4!h3+⋯.

Subtraction of the above two equations results in the cancellation of the terms in even powers of h: 0=f(x0+h)−f(x0)h+f(x0−h)−f(x0)h−2f(2)(x0)2!h−2f(4)(x0)4!h3+⋯.

f(2)(x0)=f(x0+h)+f(x0−h)−2f(x0)h2−2f(4)(x0)4!h2+⋯.

f(2)(x0)=f(x0+h)+f(x0−h)−2f(x0)h2+O(h2).

## See also

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

## References

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

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Compact stencil. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Compact_stencil&oldid=216137"