In this problem we will build a finite difference solver for an MRI problem reduced to the Helmholtz equation $$ \Delta u({\bf r}) + k^2({\bf r}) u({\bf r}) = v({\bf r}). $$
As a first attempt, let us construct a finite differences method simulation tool for the general electromagnetic scattering problem in free-space. In this case $k({\bf r}) \equiv k_0$ Discretize the equation on a box $[0,1]^2$ box using second order finite difference scheme and zero Dirichlet boundary conditions. Let $v$ be an impulse, located at $x = 0.5$ m and $y = 0.5$ m, discretized to a vector of zeros with a single element of $1/h^2$ at the appropriate row.
In [ ]:
Consider a Poisson equation $$ \begin{align*} -\Delta u &= f, \\ u|_\Gamma &= 0, \end{align*} $$ where $\Omega = [0,1]^d$, $d = 2, 3$ and $\Gamma=\partial\Omega$.
Although the multigrid method has optimal complexity, there are some precomputations to be done. Therefore, it may have a bigger constant than, for instance, the spectral method or even sparse LU. In this problem you will be asked to find out in which case (2D, 3D, grid sizes) multigrid method is more appropriate.
In [ ]: