Multigrid is an iterative method that is particularly suited for solving large, sparse linear systems, in the form of .
When we have a sparse matrix at hand, direct methods, such as LU decomposition, for solving the equation becomes undesirable, because we might lose the sparsity and end up with a dense matrix. The best time complexity of a direct method, i.e. FFT, is s=1$ where is the number of unknowns.
In this situation, using an iterative method is much more suitable. In this case, we will be using what are called smoothers, examples include Jacobi method, Gauss-Seidel method, and Successive Over-relaxation (SOR).
Let’s suppose the linear equation we wish to solve comes from discretizing a Poisson equation in space by a grid of uniform grid spacing. See post on Multigrid applied to incompressible Navier-Stokes equation for an example. Multigrid is a method that uses relaxation methods on a hierarchy of grids of successively coarser spatial resolution.
Doing so has two advantages. Suppose the source term is localized in some domain, solving the Poisson equation means this localized information needs to be spread to the entire domain. Using a 5 point stencil, the information can only propagate one grid size at a time, hence the time needed is influenced by the grid size. Using a coarser grid mean the information can travel further in one step, than using a finer grid. Therefore, the grid hierarchy of multigrid helps information quickly propagate through the domain.
Second advantage has to do with how smoothers work. Suppose the solution to the linear equation is made up of modes of all available frequencies on the fine grid. Iterative methods such as Jacobi and Gauss-Seidel are very good at solving for the high frequency modes on a grid, i.e. smoothing the solution. They are less effective at matching up low frequency errors.
Now we coarsen the grid. Some low frequency modes on the previous finer grid, now become high frequency modes on the coarser grid. Apply the same relaxation method, we can again cut down these errors. We can repeat the coarsening and smoothing process until we have a very small grid, where we can solve the problem exactly.
The algorithm of multigrid
Consider a two-grid system, assume we can solve the equation exactly on the coarser grid. We denote equation on level as . Restriction and interpolation operators averages and interpolates results from fine grid to coarse, and from coarse grid to fine, respectively. They are denoted by .
- Apply smoothing to to get an approximate solution
- Calculate residual:
- Restrict residual to coarser grid:
- Interpolate solution back to fine grid:
- Correct top level solution:
- Apply more smoothing to
If the coarser grid isn’t small enough to use a direct method, we can use a relaxation method. Or we can consider it as the top level for another two-grid system and apply the same algorithm recursively.
We have just seen a common way to apply the recursion, namely going from the finest grid level, traverse down the hierarchy and apply relaxation at each level, then traverse back up and apply relaxation again. This is called a V-cycle. Other iterative schemes are also possible, such as the W-cycle or the full multigrid cycle.
Let’s first consider Jacobi method. We first split the matrix by doing . Here are diagonal, strictly lower triangular, and strictly upper triangular matrices of , respectively.
We can then rewrite our matrix equation as
We can write this as an iterative method, i.e. the Jacobi method,
To take a step further, we can use the new values as they become available, i.e.
This modification leads to Gauss-Seidel method.
Discussion on relaxation methods are widely available, I won’t go into further detail here. Note that Gauss-Seidel in general converges faster than Jacobi, but it is harder to be parallelized. We can further improve upon Gauss-Seidel (faster convergence) by adding weights to the appropriate matrices and turning it into SOR.
Multigrid algorithm applies smoothers such as Jacobi or Gauss-Seidel methods, on a hierarchy of grids with coarsening resolution. The coarsening grid allows information to travel further within the same iteration. Since smoothers are effective in eliminating high frequency errors, by coarsening the grid, multigrid allows smoother to work on errors in a wide range of frequencies. The complexity of multigrid is , where is the number of unknowns.
In another post, I write about my project on using OpenMP and GPU to parallelize the smoothing step in a multigrid solver. This solver is developed by our research group, and it is implemented with OpenMPI. By more granular parallelism, I exploited the existing computation resources and improve the execution time performance.
2 thoughts on “Multigrid in a nutshell”
Comments are closed.