|
9 | 9 | "This notebook compares the numerical dispersion of explicit finite-difference stencils for the second derivative obtained via several methods.\n", |
10 | 10 | "\n", |
11 | 11 | "Contents:\n", |
12 | | - "1. **Problem setup**\n", |
13 | | - "2. **Finite Difference Weights from Fornberg’s Algorithm** computed via the Fornberg algorithm. [1]\n", |
14 | | - "3. **Investigation of the dispersion properties** of the weights.\n", |
15 | | - "4. **DRP (Dispersion-Relation-Preserving) stencils (part 1)** following Tam and Webb [2], Caunt [3]\n", |
16 | | - "5. **DRP stencils (part 2)** following Chen, Peng and Li [4]\n", |
| 12 | + "1. **[Problem setup](#1.-Problem-Setup)**\n", |
| 13 | + "2. **[Finite Difference Weights from Fornberg’s Algorithm](#2.-Finite-Difference-Weights-from-Fornberg’s-Algorithm)** computed via the Fornberg algorithm. [[1]](#References)\n", |
| 14 | + "3. **[Investigation of the dispersion properties](#3.-Investigation-of-the-dispersion-properties)** of the weights.\n", |
| 15 | + "4. **[DRP (Dispersion-Relation-Preserving) stencils (part 1)](#4.-Dispersion-Relation-Preserving-Stencils-(part-1))** following Tam and Webb [[2]](#References), Caunt [[3]](#References)\n", |
| 16 | + "5. **[DRP stencils (part 2)](#5.-Dispersion-Relation-Preserving-Stencils-(part-2))** following Chen, Peng and Li [[4]](#References)\n", |
17 | 17 | "\n", |
18 | | - "Both 3. and 4. above are achieved by computed by solving different constrained least-squares optimization problems.\n", |
19 | | - "\n", |
20 | | - "[1] https://www.colorado.edu/amath/sites/default/files/attached-files/mathcomp_88_fd_formulas.pdf\n", |
21 | | - "\n", |
22 | | - "[2] https://www.sciencedirect.com/science/article/pii/S0021999183711423\n", |
23 | | - "\n", |
24 | | - "[3] https://arxiv.org/pdf/2107.13525\n", |
25 | | - "\n", |
26 | | - "[4] https://www.sciencedirect.com/science/article/pii/S009830042100234X" |
| 18 | + "Both 3. and 4. above are achieved by computed by solving different constrained least-squares optimization problems." |
27 | 19 | ] |
28 | 20 | }, |
29 | 21 | { |
|
296 | 288 | "source": [ |
297 | 289 | "## 3. Investigation of the dispersion properties\n", |
298 | 290 | "\n", |
299 | | - "Chen, Peng and Li [4] provide the dispersion error in the form of a ratio\n", |
| 291 | + "Chen, Peng and Li [[4]](#References) provide the dispersion error in the form of a ratio\n", |
300 | 292 | "$$\n", |
301 | 293 | "\\frac{v_\\text{FD}}{v} = \\delta(r_a, r, \\alpha, \\beta),\n", |
302 | 294 | "$$\n", |
|
464 | 456 | "metadata": {}, |
465 | 457 | "source": [ |
466 | 458 | "## 3.1. Observing the effects on wavefields\n", |
467 | | - "We now use Devito to solve the acoustic wave equation, propagating a Ricker wavelet source from the centre. We define a function that solves the acoustic wave equation in a 2D grid with reflecting boundary conditions. Recievers are also placed near the top of the domain allowing us to later generate a shot profile. The source in the centre of the 1km by 1km domain is simulated for at total of 0.6 seconds, long enough for the wave to pass the recievers and be reflected by the boundary\n", |
| 459 | + "We now use Devito to solve the acoustic wave equation, propagating a Ricker wavelet source from the centre. We define a function that solves the acoustic wave equation in a 2D grid with reflecting boundary conditions. Receivers are also placed near the top of the domain allowing us to later generate a shot profile. The source in the centre of the 1km by 1km domain is simulated for at total of 0.6 seconds, long enough for the wave to pass the receivers and be reflected by the boundary\n", |
468 | 460 | "\n", |
469 | 461 | "Note the use of the weights keyword argument passed to the derivative, `u.dx2(weights=weights)`, allowing the use of custom stencil weights." |
470 | 462 | ] |
|
751 | 743 | "\n", |
752 | 744 | "Note that in the unstable case there is a wavefront that is somehow ahead of the original wavelet! The large peak of the wavelet is also growing in amplitude and as a result the solution is not physically accurate. In the unstable case the first arrival time is also affected, and this becomes very obvious when looking at shot profiles.\n", |
753 | 745 | "\n", |
754 | | - "Again the plots from left to right go from the smallest Courtant number to largest. The correspinging wavelet is plotted along the green dashed line and the **true** first arrival time is clearly marked on all of the plots." |
| 746 | + "Again the plots from left to right go from the smallest Courant number to largest. The correspinging wavelet is plotted along the green dashed line and the **true** first arrival time is clearly marked on all of the plots." |
755 | 747 | ] |
756 | 748 | }, |
757 | 749 | { |
|
848 | 840 | "cell_type": "markdown", |
849 | 841 | "metadata": {}, |
850 | 842 | "source": [ |
851 | | - "We are now free to choose an objective function for the stencil weights to optimise over. We follow the method of Tam and Webb [2] and executed in the Masters thesis of Caunt [3] (for second derivatives) and minimise the $L^2$ norm of the difference between the derivative and the stencil in Fourier space. We minimise $\\Phi(a_m)$, where\n", |
| 843 | + "We are now free to choose an objective function for the stencil weights to optimise over. We follow the method of Tam and Webb [2](#References) and executed in the Masters thesis of Caunt [3](#References) (for second derivatives) and minimise the $L^2$ norm of the difference between the derivative and the stencil in Fourier space. We minimise $\\Phi(a_m)$, where\n", |
852 | 844 | "$$\n", |
853 | 845 | "\\Phi(a_m):= \\int_{\\pi/2}^{\\pi/2} \\left| \\varphi^2 + \\sum_{m=-M}^M a_m e^{im\\varphi} \\right|^2 d\\varphi,\n", |
854 | 846 | "$$\n", |
|
981 | 973 | "source": [ |
982 | 974 | "Both sets of weight approximate the curve well, but it is clear from the right hand plot that the error is smaller for DRP stencil 1 over a larger range; less than $10^-4$ in the whole range $[0, \\pi/2]$.\n", |
983 | 975 | "\n", |
984 | | - "We can also look at the velocity error ratio for this set of coefficients, as outlined by Chen, Peng and Li [4] and we did above for the Fornberg weights." |
| 976 | + "We can also look at the velocity error ratio for this set of coefficients, as outlined by Chen, Peng and Li [4](#References) and we did above for the Fornberg weights." |
985 | 977 | ] |
986 | 978 | }, |
987 | 979 | { |
|
1310 | 1302 | "name": "stderr", |
1311 | 1303 | "output_type": "stream", |
1312 | 1304 | "text": [ |
1313 | | - "/tmp/ipykernel_626021/237837473.py:12: RuntimeWarning: invalid value encountered in arccos\n", |
| 1305 | + "/tmp/ipykernel_904261/237837473.py:12: RuntimeWarning: invalid value encountered in arccos\n", |
1314 | 1306 | " diff = np.abs(np.acos(theta)/(k*dt) - v)\n" |
1315 | 1307 | ] |
1316 | 1308 | }, |
|
1375 | 1367 | "source": [ |
1376 | 1368 | "It is, but only just! This should, however, come as no surprise: We used the value of $\\Delta t$ directly in the optimisation and we obtain a stencil that minimises dispersion as much as possible for that value.\n", |
1377 | 1369 | "\n", |
1378 | | - "Next we plot the veloicty error ratio for DRP stencil 2:" |
| 1370 | + "Next we plot the velocity error ratio for DRP stencil 2:" |
1379 | 1371 | ] |
1380 | 1372 | }, |
1381 | 1373 | { |
|
1450 | 1442 | "cell_type": "markdown", |
1451 | 1443 | "metadata": {}, |
1452 | 1444 | "source": [ |
1453 | | - "The two DRP stencils produce curves that are indistinguihable in the left hand plot, the difference is only really noticable in the logarithmic difference, where we se larger error for DRP stencil 2 than DRP stencil 1, while still remaining small.\n", |
| 1445 | + "The two DRP stencils produce curves that are indistinguishable in the left hand plot, the difference is only really noticable in the logarithmic difference, where we see larger error for DRP stencil 2 than DRP stencil 1, while still remaining small.\n", |
1454 | 1446 | "\n", |
1455 | 1447 | "We can also look at the isosurfaces of the velocity difference function $\\hat{\\delta}$, the expression that the objective function tried to minimise." |
1456 | 1448 | ] |
|
1598 | 1590 | "source": [ |
1599 | 1591 | "Again, the ripples following the wavelet have almost entirely disappeared. The unstable $\\Delta t$ still has an incorrect first arrival wave, but this is expected." |
1600 | 1592 | ] |
| 1593 | + }, |
| 1594 | + { |
| 1595 | + "cell_type": "markdown", |
| 1596 | + "metadata": {}, |
| 1597 | + "source": [ |
| 1598 | + "## References\n", |
| 1599 | + "[1] **Generation of Finite Difference Formulas on Arbitrarily Spaced Grids** (1988)\n", |
| 1600 | + "\n", |
| 1601 | + "_Bengt Fornberg_\n", |
| 1602 | + "\n", |
| 1603 | + "Mathematics of Computation, Vol. 51, No. 184\n", |
| 1604 | + "\n", |
| 1605 | + "http://dx.doi.org/10.1090/S0025-5718-1988-0935077-0, https://www.colorado.edu/amath/sites/default/files/attached-files/mathcomp_88_fd_formulas.pdf\n", |
| 1606 | + "\n", |
| 1607 | + "[2] **Dispersion-Relation-Preserving Finite Difference Schemes for Computational Acoustics** (1993)\n", |
| 1608 | + "\n", |
| 1609 | + "_Christopher K.W. Tam, Jay C. Webb_\n", |
| 1610 | + "\n", |
| 1611 | + "Journal of Computational Physics, Volume 107, Issue 2, Pages 262-281, ISSN 0021-9991\n", |
| 1612 | + "\n", |
| 1613 | + "https://doi.org/10.1006/jcph.1993.1142, https://www.sciencedirect.com/science/article/pii/S0021999183711423\n", |
| 1614 | + "\n", |
| 1615 | + "[3] **Spatially-optimized finite-difference schemes for numerical dispersion suppression in seismic applications** (2019)\n", |
| 1616 | + "\n", |
| 1617 | + "_Edward Caunt_\n", |
| 1618 | + "\n", |
| 1619 | + "Masters Thesis\n", |
| 1620 | + "\n", |
| 1621 | + "http://dx.doi.org/10.48550/arXiv.2107.13525, https://arxiv.org/pdf/2107.13525\n", |
| 1622 | + "\n", |
| 1623 | + "[4] **A framework for automatically choosing the optimal parameters of finite-difference scheme in the acoustic wave modeling** (2022)\n", |
| 1624 | + "\n", |
| 1625 | + "_Guiting Chen, Zhenming Peng, Yalin Li_\n", |
| 1626 | + "\n", |
| 1627 | + "Computers & Geosciences, Volume 159, 104948, ISSN 0098-3004,\n", |
| 1628 | + "\n", |
| 1629 | + "https://doi.org/10.1016/j.cageo.2021.104948, https://www.sciencedirect.com/science/article/pii/S009830042100234X" |
| 1630 | + ] |
1601 | 1631 | } |
1602 | 1632 | ], |
1603 | 1633 | "metadata": { |
|
0 commit comments