The purpose of this project is to implement the simple and popular MAC scheme for solving Stokes equations in two dimensions.
Reference
f
and Dirichlet boundary condition g_D
for the analytic solution:Given a pressure approximation, relax the momentum equation to update velocity. See Project: Multigrid Methods on the matrix free implemenation of G-S relaxation.
Note that the boundary or near boundary dof should be updated diffeently. The stencil should be changed according to different boundary conditions.
u
;rp = g-Bu
;Ap*ep = rp
by G-S;u = u + B'*ep
;p = p - Ap*ep
.Every step can be implemented in a matrix-free version; see Progamming of MAC for Stokes equations.
Use DGS as an iterative method to solve the Stokes equation. The iteration steps could be very large but will converges.
The two level method is
Note: the index map between coarse and fine grids are slightly different for u,v,p
; see Progamming of MAC for Stokes equations.
Test your two level methods for different levels. It should convergence in less than 20 steps and indepedent of the number of levels.
Recrusively apply the two-level method to the coarse grid problem in the previous step to get a V-cycle method.
Test the convergence of Vcycle method. Record the iteration steps needed to push the relative residual smaller than a tolerance.
Compute the error between the computed approximation to the exact solution and show the convergence rate in terms of mesh size h
.