Description
The Matlab script poisson.m solves the Poisson problem on a square m × m grid with ∆x = ∆y = h, using the 5-point Laplacian. It is set up to solve a test problem for which the exact solution is u(x,y) = exp(x + y/2), using Dirichlet boundary conditions and the right hand side f(x,y) = 1.25exp(x + y/2).
- Test this script by performing a grid refinement study to verify that it is second orderaccurate. Plot the error versus mesh width and compute an estimate for the convergence rate.
- Modify the script so that it works on a rectangular domain [ax,bx] × [ay,by], but still with ∆x = ∆y = h. Verify that your computed solution agrees with the exact solution.
- Further modify the code to allow ∆x 6= ∆y and test the modified script. Verify that your computed solution agrees with the exact solution.
- When ∆x 6= ∆y, how do you expect the error to behave? Give a brief discussion on your reasoning.
1