I'm having a problem with multigrid code I wrote. If I solve Laplace's equation in 2D and use more than 5 grid levels, the V-cycles stop converging after a few cycles (see below, convergence factor > 1). At grid level 3, you can see that the recursive V-cycle actually increases the error (L2 norm of the defect). If I use fewer grid levels, my code converges as expected. I suspect it's an issue with the boundary conditions, because the defect is very high close to the boundaries after V-cycle 2.
For Dirichlet boundaries I added ghost points to the finest grid to hold the boundary values. When I restrict the defect, I set the values of the defect at the coarse-grid ghost points to zero. Is there something more I need to worry about?
V-CYCLE 1
LEVEL ACTION ERROR
1 Initial 4.566101e-01
1 Relaxation sweep 1 1.375412e-01
2 Initial 4.264610e-02
2 Relaxation sweep 1 2.082439e-02
3 Initial 1.580465e-02
3 Relaxation sweep 1 9.881322e-03
4 Initial 8.008788e-03
4 Relaxation sweep 1 5.150501e-03
5 Initial 4.121322e-03
5 Relaxation sweep 1 2.643638e-03
5 Relaxation sweep 400 1.525026e-18
5 Coarse grid corr. 4.253979e-03
5 Relaxation sweep 1 1.356265e-03
4 Coarse grid corr. 1.301027e-02
4 Relaxation sweep 1 4.956990e-03
3 Coarse grid corr. 3.427880e-02
3 Relaxation sweep 1 1.421168e-02
2 Coarse grid corr. 8.532111e-02
2 Relaxation sweep 1 3.721634e-02
1 Coarse grid corr. 2.409762e-01
1 Relaxation sweep 1 1.022146e-01
CONVERGENCE FACTOR: 0.223855
V-CYCLE 2
LEVEL ACTION ERROR
1 Initial 1.022146e-01
1 Relaxation sweep 1 6.796567e-02
2 Initial 5.807979e-02
2 Relaxation sweep 1 4.311037e-02
3 Initial 3.733848e-02
3 Relaxation sweep 1 2.717026e-02
4 Initial 2.302219e-02
4 Relaxation sweep 1 1.627633e-02
5 Initial 1.341552e-02
5 Relaxation sweep 1 9.233742e-03
5 Relaxation sweep 400 5.981442e-18
5 Coarse grid corr. 1.660509e-02
5 Relaxation sweep 1 5.472094e-03
4 Coarse grid corr. 4.952103e-02
4 Relaxation sweep 1 1.951415e-02
3 Coarse grid corr. 1.255826e-01
3 Relaxation sweep 1 5.395197e-02
2 Coarse grid corr. 2.973566e-01
2 Relaxation sweep 1 1.349677e-01
1 Coarse grid corr. 6.812406e-01
1 Relaxation sweep 1 3.210040e-01
CONVERGENCE FACTOR: 3.140491