Discretizing: FD Stencils

Part 4, The Acoustic Wave Equation

Learning objectives

  • Derive the second-order stencil from Taylor's series and name the term it leaves out, the truncation error
  • Solve the fourth-order weights from the same conditions and read their leading error
  • Read a stencil's error on a pulse and on a plane wave against the points on a wavelength
  • Apply Alford, Kelly and Boore's ten and five points per wavelength to a grid, and count what each stencil costs

From a Derivative to a Sum

The wave equation of Section 4.1 asks, at every point and every moment, for the curvature of the field, its second space derivative ∂2u/∂x2\partial^2 u/\partial x^2. A computer does not hold the function u(x)u(x). It holds uu at grid points a distance hh apart, the 5 m cell of the book's standard grid, and the curvature has to be built from those samples. Expand the two neighbours in Taylor's series about the point xx and add them: the odd powers of hh cancel, and what remains is

u(x+h)+u(x−h)−2u(x)=h2 u′′(x)+h412 u(4)(x)+⋯u(x+h) + u(x-h) - 2u(x) = h^{2}\,u^{\prime\prime}(x) + \dfrac{h^{4}}{12}\,u^{(4)}(x) + \cdots

Divide by h2h^{2} and the weights (1,−2,1)(1, -2, 1) over h2h^{2} give the curvature, wrong by h212 u(4)\dfrac{h^{2}}{12}\,u^{(4)}. That leftover is the truncation error, and the stencil is called second-order accurate because it falls as h2h^{2}. A test you can do by hand: the function u=x4u = x^{4} has zero curvature at x=0x = 0, and its samples at x=−1,0,1x = -1, 0, 1 are 1,0,11, 0, 1, so with h=1h = 1 the stencil returns 2, which is 112⋅24\tfrac{1}{12} \cdot 24, the leftover exactly.

A Wider Stencil, a Higher Order

Reach further and more terms cancel. Take the sample and two neighbours on each side, with weights w0,w1,w2w_0, w_1, w_2, the same on both sides of the centre. Ask that the sum return u′′u^{\prime\prime} and that the h4h^{4} term vanish as well, and the weights must satisfy w0+2w1+2w2=0w_0 + 2w_1 + 2w_2 = 0, w1+4w2=1w_1 + 4w_2 = 1 and w1+16w2=0w_1 + 16w_2 = 0. They give (−112,43,−52,43,−112)(-\tfrac{1}{12}, \tfrac{4}{3}, -\tfrac{5}{2}, \tfrac{4}{3}, -\tfrac{1}{12}) over h2h^{2}, and the first term that survives is −h490 u(6)-\dfrac{h^{4}}{90}\,u^{(6)}: the fourth-order stencil. Fornberg (1988) gives a recursion for the weights of any order on any grid and tables the equally spaced cases; the figure below solves the conditions rather than typing the weights, and the engine of this part applies these five. On the same test, u=x4u = x^{4} at x=0x = 0 with h=1h = 1, the fourth-order stencil returns 0, exact, because its first leftover involves the sixth derivative, which x4x^{4} does not have.

At 5 m the fourth-order stencil lays 10.8 points on the 54 m upper half-powerwavelength of a 30 Hz pulse, 2.2 times the 5 that Alford, Kelly and Boore ask of it,and reads the pulse's curvature to within 0.24 % of its peak.(a) The weights-2-1012−3−2−1012Offset (samples)vertical: weight, times 1 / h squared−1/124/3−5/24/3−1/12(b) On the pulse-100-50050100−1.0−0.50.00.51.0Distance (m)vertical: second derivative, share of its peak(c) Error and points2351020501000.0000010.00010.011100Points per wavelengthvertical: error of the second derivative, %105second orderfourth orderDistance runs across (b). The shaded band is the stencil's error. Dashed lines in (c) are the first termof Taylor's series; the rings mark Alford, Kelly and Boore's counts of 10 and 5 points on a wavelength.Points per wavelength 10.8 (on the upper half-power wavelength, 54 m at 43 Hz in the 2.34 km/s gassand). Alford's largest spacing 10.8 m (for the 5 points Alford asks of the fourth order; this grid isinside it). Error on the pulse 0.24 % of the peak (the stencil's curvature of the pulse against theexact one, worst sample). Error at that wavelength 0.12 % (of the curvature of a wave of thatwavelength; Taylor's first term gives 0.13 %). Points a cell reads 9 in 2D (13 in 3D; the second orderreads 5 and 7).

The Error in Points per Wavelength

What matters for a wave is not hh alone but the number of points on a wavelength, N=λ/hN = \lambda/h. On a plane wave sampled NN times a wavelength, each stencil returns the exact curvature times a factor that depends on NN alone, and for large NN the error is Taylor's first term: θ2/12\theta^{2}/12 at second order and θ4/90\theta^{4}/90 at fourth, with θ=2π/N\theta = 2\pi/N. Plate (c) draws both. At ten points on a wavelength the second-order stencil's curvature is 3.2 percent short (Taylor's first term alone gives 3.3), and at five points the fourth-order stencil's is 2.4 percent short (the first term gives 2.8). Give the fourth-order stencil ten points and it falls to 0.17 percent.

Ten and five are Alford, Kelly and Boore's counts. Comparing finite-difference seismograms for a wedge in a two-dimensional medium with exact ones, they found that “ten or more grid points per wavelength at the frequency of the upper half-power point should be adequate” with the second-order scheme, while the fourth-order scheme “seems to produce accurate results at five grid points per wavelength” (Alford, Kelly and Boore, 1974).

The frequency is the upper half-power frequency of the source, where the Ricker's power has fallen to half (Ricker, 1953): 1.44 times the peak, 43.2 Hz for the standard 30 Hz pulse. In the slowest rock of the standard earth, the gas sand at 2.34 km/s, that is a wavelength of 54 m, so the rule allows a cell of 5.4 m at second order and 10.8 m at fourth. The book's 5 m cell puts 10.8 points on it: just inside the second-order rule, and a little over twice the fourth-order count. Raise the pulse to 45 Hz and the same cell puts 7.2 points on its wavelength, short of ten and above five: the second-order stencil misses the pulse's curvature by 7.3 percent of its peak, the fourth by 1.1.

The two rules ask for about the same accuracy. On the pulse, a snapshot of the 30 Hz Ricker laid along a line, the second-order stencil at Alford's 5.4 m misses the peak curvature by 3.9 percent and the fourth-order stencil at 10.8 m by 4.1. The fourth-order stencil reaches the second-order stencil's ten-point accuracy on a plane wave at 4.6 points, so Alford's five is not a round number but the same accuracy at about half the points. The percentages are the stencil's own: the counts of Alford, Kelly and Boore are for the whole scheme, and what the time step adds to the stencil's error is the subject of Section 4.4.

What Meeting the Count Costs

The fourth-order stencil is wider. In 2D its Laplacian reads 9 samples where the second order reads 5, and in 3D 13 where the second reads 7, the 9 and 13 that the cost model of Figure 0.2 counts for the acoustic engine. But Alford's rule lets it use a cell twice as wide, and a coarser grid is cheaper in cells and in steps. On the standard 800 by 600 m earth at 30 Hz, for 0.5 s, the second-order stencil at 5.4 m needs 148 by 111 cells and 378 steps at the stability limit: 31.0 million multiply-adds. The fourth-order stencil at 10.8 m needs 74 by 56 cells and 218 steps, although its limit on the step is lower, 0.61 of a cell against 0.71 (Section 4.3): 8.1 million, 3.8 times fewer. The counts are floors, without absorbing borders. They grow with the cube of the frequency in 2D, the cells as its square and the steps as its first power, so at 45 Hz the fourth-order count is 3.4 times that at 30.

What the Stencil Leaves Out

This figure holds one thing, the space derivative, on a function whose second derivative is known exactly. It has no time step, no variable velocity and no boundary. A wave run adds the error of the time step to the stencil's (Section 4.4), and the stencil's error, small in one cell, accumulates over the distance a wave travels. Both belong to the sections that follow; this one gives the stencil, its weights, its error and the grid it needs.

References

  • Alford, R. M., Kelly, K. R., & Boore, D. M. (1974). Accuracy of finite-difference modeling of the acoustic wave equation. Geophysics, 39(6), 834–842.
  • Fornberg, B. (1988). Generation of finite difference formulas on arbitrarily spaced grids. Mathematics of Computation, 51(184), 699–706.
  • Ricker, N. (1953). The form and laws of propagation of seismic wavelets. Geophysics, 18, 10–40.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.