Sheng Wang

Finite Difference of Staggered Grid (1)

This post presents the central finite difference(FD) system build in stagger grid. Symmetric scheme are derived and examples are presented.

Taylor expansion

As always, we start the derivation from taylor expansion. For the red points in the below staggerd point, function value here have the form of taylor series expanded in the blue point. This kind of stagger grid scheme is widely used in modeling.

f(xiδ2)=f(x)iδ2f(x)+i2δ2222!f(x)i3δ3233!f(3)(x)+...+i2Nδ2N22N(2N)!f(2N)(x)+O(δ2N+1)...f(xδ2)=f(x)δ2f(x)+δ2222!f(x)δ3233!f(3)(x)+...+δ2N22N(2N)!f(2N)(x)+O(δ2N+1)f(x+δ2)=f(x)+δ2f(x)+δ2222!f(x)+δ3233!f(3)(x)+...+δ2N22N(2N)!f(2N)(x)+O(δ2N+1)...f(x+iδ2)=f(x)+iδ2f(x)+i2δ2222!f(x)+i3δ3233!f(3)(x)+...+i2Nδ2N22N(2N)!f(2N)(x)+O(δ2N+1)(i=1,3,5,7,9...)

First order derivatives

f(x+δ2)f(xδ2)2=δ2f(x)+δ3233!f(3)(x)+...+δ2N122N1(2N1)!f(2N1)(x)+O(δ2N+1)...f(x+iδ2)f(xiδ2)2=iδ2f(x)+i3δ3233!f(3)(x)+...+i2N1δ2N122N1(2N1)!f(2N1)(x)+O(δ2N+1)(i=1,3,5,7,9...)

or in the forms of:

f(x)=f(x+δ2)f(xδ2)δδ2223!f(3)(x)...δ2N222N2(2N1)!f(2N1)(x)+O(δ2N)...f(x)=f(x+iδ2)f(xiδ2)iδi2δ2223!f(3)(x)...i2N2δ2N222N2(2N1)!f(2N1)(x)+O(δ2N)

adding all these f(x) propotionally together:

f(x)iCi=iCif(x+iδ2)f(xiδ2)iδδ2223!f(3)(x)ii2Ciδ4245!f(5)(x)ii4Ciδ2N222N2(2N1)!f(2N1)(x)ii2N2Ci+O(δ2N)(i=1,3,5,7,9...,2N1)

So, for 2Nth order accuracy, Ck must be the solution of linear equation:

[1111...11325272...(2N1)21345474...(2N1)4...132N252N272N2...(2N1)2N2][C1C3C5...C2N1]=[100...0]

(16) is the vandermonde equation, its augmented matrix corresponds to the upper triangular linear equation:

[1111...101a23a24...a2N001a34...a3N...0000...1][x1x2x3...xN]=[b1b2b3...bN]

while

aij=[(2j1)2(2i3)2][(2j1)2(2i5)2]...[(2j1)21][(2i1)2(2i3)2][(2i1)2(2i5)2]...[(2i1)21](ji)bi=(1)i11232...(2i3)2[(2i1)2(2i3)2][(2i1)2(2i5)2]...[(2i1)21]

Thus, xi have the value of:

{xi=C2i1=biNj=i+1aijxjxN=C2N1=bN

Conclusion

From (15), the FD scheme of 2Nth order accuracy is built:

f(x)=iCif(x+iδ2)f(xiδ2)iδ

or in the form of:

{f(x)=1δici[f(x+iδ2)f(xiδ2)]ci=Cii(i=1,3,5,7,9...)

Values of ci for different accuracy order are:

order c1 c2 c3 c4 c5 c6
2 11
4 98 124
6 7564 25384 3640
8 12251024 2453072 495120 57168
10 1984516384 7358192 56740960 405229376 35294912
12 160083131072 12705131072 228691310720 54451835008 8472359296 632883584

Examples

FD scheme corresponding to accuracy orders of 2,4,6,8,10,12 are implemented to f(x)=sin(x), their FD results are ploted versus theoretical first order derivative of f(x)=cos(x), as well as their error.