Compact stencil

From testwiki
Jump to navigation Jump to search

Template:Refimprove

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 implemented in many partial differential equation solvers, including several in the topics of CFD, FEA, and other mathematical solvers relating to PDEs[1][2]

Two point stencil example

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

f′(x0)=f(x0+h)βˆ’f(x0βˆ’h)2h+π’ͺ(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″(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″(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+h)βˆ’f(x0βˆ’h)2h+π’ͺ(h2).

Three point stencil example

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

f″(x0)=f(x0+h)+f(x0βˆ’h)βˆ’2f(x0)h2+π’ͺ(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″(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″(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+π’ͺ(h2).

See also

References

Template:Reflist

  1. ↑ Template:Cite journal
  2. ↑ Communications in Numerical Methods in Engineering, Copyright Β© 2008 John Wiley & Sons, Ltd.