NMM: Week 5 - Finite Differences: PDE's
This section explores discretizing partial differential equations, using the wave equation as a test case. Stability criteria (Courant-Friedrichs-Lewy condition) and numerical methods are demonstrated.
For problem 8.1 (f) we wish to solve the 1D wave equation using explicit finite difference method along a bounded X axis with one nonzero node at t = 0. We first create a 2d mesh to store the wave u = (x[j],t[n]) and load initial conditions. We use Dirichlet conditions to define wave behavior at the boundaries, so u[0,1] = u[n*x,1] = 0. From the notes above setting up the finite differencing scheme, we needed to compute the first time step differently because it depends upon a point outside the time mesh. Rearranged we get: u[j,n+1] = u[j,0] - 0.5*ir^2(u[j+1,n]-2u[j,n]+u[j-1,n])
8.1(f) - 1D Wave equation video: