This notebook covers the following aspects: * Calculation of the second spatial derivative of the Pressure field using the Fourier transform * Implement a 3-point finite difference operator and a 5-point finite difference operator to compute spatial derivatives for comaprision with the fourier derivative * Compare the effects of numerical dispersion on the solution of the 1D acoustic equation using our three different approaches
Basic Equations
We use the Fourier method to calculate exact n-th derivatives on a regular spaced grid (to machine precision). This property combined with classical time extrapolation schemes result in the so call Fourier pseudospectral method. The problem of solving the 1D acoustic wave equation in an homogeneous media
is covered in this notebook. We explore the benefits of calculating exact spatial derivatives (up to machine precision), numerical dispersion, comparison with a Finite Difference scheme
Code
# This is a configuration step for the exercise. Please run it before calculating the derivative!import numpy as npimport matplotlib# Show Plot in The Notebookmatplotlib.use("nbagg")import matplotlib.pyplot as pltfrom ricker import ricker
1. Fourier derivative method
The second spatial derivative is computed by multiplying the spatial Fourier transform of the pressure field \(P(k,t)\) with $ (ik)^2 $
where the space derivative is computed with the Fourier method. In order to compare the above numerical solution, we implement a 3-point finite difference operator, as well as a 5-point finite difference operator to compute spatial derivatives. They are given as:
One of the most prominent characteristic of the Fourier method is the low numerical dispersion in comparison with the finite difference method. The animation displayed below compare the effects of numerical dispersion on the solution of the 1D acoustic equation using our three different approaches.