Yet another "byproduct" of my course CSE 6644 / MATH 6644. :)
Using finite difference method to discrete Poisson equation in 1D, 2D, 3D and use multigrid method to accelerate the solving of the linear system. I use center difference for the second order derivative. The right hand side is set as random numbers.
Use test_Poisson{1,2,3}D(p)
to test the solver. p
indicates that on each the edge of each dimension, there are
The Multigrid_Solver()
will first call Multigrid{1,2,3}D_Vcycle_GenMat()
to generate the coefficient matrices and restriction operators on each level and store them, then it will call Multigrid_Vcycle()
to perform V-cycle computation until the relative residual norm is smaller than the given threshold. Multigrid_Solver()
use Gauss-Seidel method as the default pre- and post-smoother, with 1 pre- and post-smoothing.
Here is a brief comparison: