with Dirichlet Boundary Condition
The exact solution is
The coarsest grid should be solved to exact solution
The program provides two solvers
- Gauss-Seidel with residual L2-norm less than tolerance
LU decomposition(Not include)CG Solver(Not include)
tol = 1.0d-8
exact_solver = 1
Set arbitrary level. The coarsest grid should greater than 3
if (Level_Nx(Level_num).le.3) then
write(*,*) Level_num," level is high for ",Nx," grid "
stop
end if
Gauss-Seidel scheme is selected to be smoother
V Cycle Scheme
subroutine MG_Vcycle(Nx,dx,RHS,U,Level_num,tol,exact_solver,I_cycle)
implicit none
integer,intent(in) :: Nx,Level_num,exact_solver
real*8 ,intent(in) :: dx,tol
real*8,dimension(0:Nx), intent(in) :: RHS
real*8,dimension(0:Nx), intent(inout) :: U
integer,dimension(Level_num) :: Level_Nx
real*8 ,dimension(Level_num) :: Level_dx
real*8 :: rms0,rms,rmsc
integer :: Max_Iter,Relax_Iter
integer :: i,k,Level,iter
integer, intent(inout) :: I_cycle
The following tables are the result of Multigrid V cycle with 7, 8, and 9 levels
Solver | Np | Cycle | CPU Time |
---|---|---|---|
MG7 | 4096 | 7 | 0.0085 |
MG8 | 4096 | 7 | 0.0021 |
MG9 | 4096 | 7 | 0.0011 |
Solver | Np | Cycle | CPU Time |
---|---|---|---|
MG7 | 8192 | 7 | 0.0673 |
MG8 | 8192 | 7 | 0.0088 |
MG9 | 8192 | 7 | 0.0030 |
Solver | Np | Cycle | CPU Time |
---|---|---|---|
MG7 | 16384 | 7 | 0.5301 |
MG8 | 16384 | 7 | 0.0684 |
MG9 | 16384 | 7 | 0.0110 |
Use PGI Compiler
make
Run
./Run
See wikipedia