A tutorial on multigrid methods