Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

p20: Second order wave equation in 2-D via FFT

We solve the wave equation in 2-d

utt=uxx+uyy,−1<x,y<1,t>0u_{tt} = u_{xx}+u_{yy}, \qquad -1 < x,y < 1, \qquad t >0

with u=0u = 0 on the boundary and initial condition

u(x,y,0)=e−40((x−0.4)2+y2),ut(x,y,0)=0u(x,y,0) = e^{-40((x-0.4)^2 + y^2)}, \qquad u_{t}(x,y,0) = 0

In the following code, i index runs along xx-axis and j index runs along yy-axis; see how the meshgrid function is used with indexing='ij'.

<Figure size 1200x1200 with 4 Axes>

Exercise

Make an animation of the solution.