Simulation of waves on a string
Discretizing the domain
The discrete solution
Fulfilling the equation at the mesh points
Replacing derivatives by finite differences
Formulating a recursive algorithm
Sketch of an implementation
Verification
A slightly generalized model problem
Using an analytical solution of physical significance
Manufactured solution and estimation of convergence rates
Constructing an exact solution of the discrete equations
Implementation
Callback function for user-specific actions
The solver function
Verification: exact quadratic solution
Verification: convergence rates
Visualization: animating the solution
Running a case
Working with a scaled PDE model
Vectorization
Operations on slices of arrays
Finite difference schemes expressed as slices
Verification
Efficiency measurements
Remark on the updating of arrays
Exercises
Exercise 1: Simulate a standing wave
Exercise 2: Add storage of solution in a user action function
Exercise 3: Use a class for the user action function
Exercise 4: Compare several Courant numbers in one movie
Exercise 5: Implementing the solver function as a generator
Project 6: Calculus with 1D mesh functions
Generalization: reflecting boundaries
Neumann boundary condition
Discretization of derivatives at the boundary
Implementation of Neumann conditions
Index set notation
Verifying the implementation of Neumann conditions
Alternative implementation via ghost cells
Generalization: variable wave velocity
The model PDE with a variable coefficient
Discretizing the variable coefficient
Computing the coefficient between mesh points
How a variable coefficient affects the stability
Neumann condition and a variable coefficient
Implementation of variable coefficients
A more general PDE model with variable coefficients
Generalization: damping
Building a general 1D wave equation solver
User action function as a class
Pulse propagation in two media
Exercises
Exercise 7: Find the analytical solution to a damped wave equation
Problem 8: Explore symmetry boundary conditions
Exercise 9: Send pulse waves through a layered medium
Exercise 10: Explain why numerical noise occurs
Exercise 11: Investigate harmonic averaging in a 1D model
Problem 12: Implement open boundary conditions
Exercise 13: Implement periodic boundary conditions
Exercise 14: Compare discretizations of a Neumann condition
Exercise 15: Verification by a cubic polynomial in space
Analysis of the difference equations
Properties of the solution of the wave equation
More precise definition of Fourier representations
Stability
Numerical dispersion relation
Extending the analysis to 2D and 3D
Finite difference methods for 2D and 3D wave equations
Multi-dimensional wave equations
Mesh
Discretization
Implementation
Scalar computations
Vectorized computations
Verification
Exercises
Exercise 16: Check that a solution fulfills the discrete model
Project 17: Calculus with 2D mesh functions
Exercise 18: Implement Neumann conditions in 2D
Exercise 19: Test the efficiency of compiled loops in 3D
Applications of wave equations
Waves on a string
Elastic waves in a rod
Waves on a membrane
The acoustic model for seismic waves
Sound waves in liquids and gases
Spherical waves
The linear shallow water equations
Waves in blood vessels
Electromagnetic waves
Exercises
Exercise 20: Simulate waves on a non-homogeneous string
Exercise 21: Simulate damped waves on a string
Exercise 22: Simulate elastic waves in a rod
Exercise 23: Simulate spherical waves
Problem 24: Earthquake-generated tsunami over a subsea hill
Problem 25: Earthquake-generated tsunami over a 3D hill
Problem 26: Investigate Matplotlib for visualization
Problem 27: Investigate visualization packages
Problem 28: Implement loops in compiled languages
Exercise 29: Simulate seismic waves in 2D
Project 30: Model 3D acoustic waves in a room
Project 31: Solve a 1D transport equation
Problem 32: General analytical solution of a 1D damped wave equation
Problem 33: General analytical solution of a 2D damped wave equation
References