Compact finite difference

From HandWiki

The compact finite difference formulation, or Hermitian formulation, is a numerical method to compute finite difference approximations. Such approximations tend to be more accurate for their stencil size (i.e. their compactness) and, for hyperbolic problems, have favorable dispersive error and dissipative error properties when compared to explicit schemes.[1] A disadvantage is that compact schemes are implicit and require to solve a diagonal matrix system for the evaluation of interpolations or derivatives at all grid points. Due to their excellent stability properties, compact schemes are a popular choice for use in higher-order numerical solvers for the Navier-Stokes Equations.

Example

The classical Pade scheme for the first derivative at a cell with index [math]\displaystyle{ i }[/math] ([math]\displaystyle{ f'_i }[/math]) reads;

[math]\displaystyle{ \frac{1}{4}f'_{i-1} + f'_{i} + \frac{1}{4}f'_{i+1} = \frac{3}{2} \frac{f_{i+1}-f_{i-1}}{2\Delta}. }[/math]

Where [math]\displaystyle{ \Delta }[/math] is the spacing between points with index [math]\displaystyle{ i-1,\ i\ \&\ i+1 }[/math]. The equation yields a fourth-order accurate solution for [math]\displaystyle{ f' }[/math] when supplemented with suitable boundary conditions (typically periodic). When compared to the 4th-order accurate central explicit method;

[math]\displaystyle{ f'_{i} = \frac{-f_{i+2} + 8f_{i+1} - 8f_{i-1} + f_{i-2}}{12\Delta}, }[/math]

the former (implicit) method is compact as it only uses values on a 3-point stencil instead of 5.

Derivation of compact schemes

Compact schemes are derived using a Taylor series expansion. Say we wish to construct a compact scheme with a three-point stencil (as in the example):

[math]\displaystyle{ \alpha_1 f'_{i-1} + f'_{i} + \alpha_2f'_{i+1} = b_1 f_{i+1} + a f_i + b_2 f_{i-1}. }[/math]

From a symmetry argument we deduce [math]\displaystyle{ \alpha_1 = \alpha_2 = \alpha }[/math], [math]\displaystyle{ a = 0 }[/math] and [math]\displaystyle{ b_1 = -b_2 = -b }[/math], resulting in a two-parameter system,

[math]\displaystyle{ \alpha f'_{i-1} + f'_{i} + \alpha f'_{i+1} + b f_{i+1} - b f_{i-1} = 0. }[/math]

We write the expansions around [math]\displaystyle{ x_i }[/math] up to a reasonable number of terms and using notation [math]\displaystyle{ \frac{\mathrm{d}^nf}{\mathrm{d}x^n}=f^n }[/math],

[math]\displaystyle{ \begin{align} f_{i+1} & = & f_i + \Delta &f'_i + \frac{1}{2}\Delta^2&f^2_i + \frac{1}{6}\Delta^3 &f^3_i + \frac{1}{24}\Delta^4f^4_i + \mathrm{etc.},\\ f_{i-1} & = & f_i - \Delta &f'_i + \frac{1}{2}\Delta^2&f^2_i - \frac{1}{6}\Delta^3 &f^3_i + \frac{1}{24}\Delta^4f^4_i + \mathrm{etc.},\\ f'_i & = & & f'_i, \\ f'_{i+1} & = & & f'_i + \Delta&f^2_i + \frac{1}{2}\Delta^2&f^3_i + \frac{1}{6}\Delta^3f^4_i + \frac{1}{24}\Delta^4f^5_i + \mathrm{etc.},\\ f'_{i-1} & = & & f'_i - \Delta&f^2_i + \frac{1}{2}\Delta^2&f^3_i - \frac{1}{6}\Delta^3f^4_i + \frac{1}{24}\Delta^4f^5_i + \mathrm{etc.},\\ \end{align} }[/math]

Each column on the right-hand side gives an equation for the coefficients [math]\displaystyle{ \alpha, b }[/math],

[math]\displaystyle{ \begin{align} f_i:&\ \ \ b - b & = 0, &\ \mathrm{(Trivial)} \\ f'_i:&\ \ \ 2\Delta b + 1 + 2\alpha & = 0, &\ \mathrm{(eq.\ 1)} \\ f^2_i:&\ \ \ b - b + \alpha - \alpha & = 0, &\ \mathrm{(Trivial)}\\ f^3_i:&\ \ \ \frac{1}{3}b\Delta^3 + \Delta^2\alpha & = 0. &\ \mathrm{(eq.\ 2)}. \end{align} }[/math]

We now have two equations for two unknowns and therefore stop checking for higher-order-term equations.

[math]\displaystyle{ \begin{align} \mathrm{eq.\ 2}:&\ b = \frac{-3}{\Delta}\alpha, \rightarrow \\ \mathrm{eq.\ 1}:&\ -6\alpha + 1 + 2\alpha = 0, \rightarrow \\ & \alpha = \frac{1}{4},\ \mathrm{and},\ \rightarrow \\ & b = -\frac{3}{4 \Delta}, \end{align} }[/math]

which is indeed the scheme from the example.

Evaluation of a compact scheme

List of compact schemes

First derivative [math]\displaystyle{ f'_{i} }[/math]

4th order central scheme:

[math]\displaystyle{ \frac{1}{4}f'_{i-1} + f'_{i} + \frac{1}{4}f'_{i+1} = \frac{3}{2} \frac{f_{i+1}-f_{i-1}}{2\Delta}. }[/math]


6th order central scheme:

[math]\displaystyle{ \frac{1}{3}f'_{i-1} + f'_{i} + \frac{1}{3}f'_{i+1} = \frac{14}{9} \frac{f_{i+1}-f_{i-1}}{2\Delta} + \frac{1}{9} \frac{f_{i+2}-f_{i-2}}{4\Delta}. }[/math]


References

  1. Lele, S.K. (August 1992). "Compact finite difference schemes with spectral-like resolution" (in en). Journal of Computational Physics 103 (1): 16–43. doi:10.1016/0021-9991(92)90324-R. Bibcode1992JCoPh.103...16L.