The multigrid method is an effective way to solve large linear systems of equations. Its complexity is proportional to the number of unknowns in the system of equations. This can be achieved by using the hierarchical mesh structure of AMDiS. The multigrid idea is based on the following two principles:
\begin{itemize}
\item{\it Smoothing principle}: Classical iterative methods often have a strong smoothing effect on the error.
\item{\it Coarse grid principle}: A quantity that is smooth on a given grid can be approximated on a coarser grid without any essential loss of information.
\end{itemize}
To solve $L_h u_h = f_h$ on the fine grid, we start with an arbitrary initial guess of the solution $u_h$. Then we apply the following steps, until a given tolerance criterion for the solution is fulfilled:
\begin{enumerate}
\item Apply some smoothing steps to $u_h$ on the fine grid (pre-smoothing).
\item Compute the fine grid residual $d_h = f_h - L_h u_h$.
\item Restrict the residual $d_h$ to the coarse grid ($d_h \rightarrow d_H$).
\item Solve the defect equation $L_H v_H = d_H$ on the coarse grid.
\item Interpolate $v_H$ to the fine grid ($v_H \rightarrow v_h$).
\item Correct the solution: $u_h = u_h + v_h$.
\item Apply some smoothing steps to $u_h$ on the fine grid (post-smoothing).
\end{enumerate}
To solve the defect equation on the coarse level, we can apply the multigrid method recursively. This can be done once ({\it V-cycle}) or twice ({\it W-cycle}). At the coarsest level, the system of equations can be solved by a direct solver or again some smoothing steps are applied to it (in AMDiS, so far, no direct solver is applied at the coarsest level).
To use the multigrid solver in AMDiS, only the parameter file has to be modified. So, we omit the other sections here.
First, we have to avoid, that DOFs at coarse levels are freed, if they are not used at finer levels.
\begin{lstlisting}{}
multigridMesh->preserve coarse dofs: 1
\end{lstlisting}
Now, we choose \verb+mg+ as solver, which is the key for the multigrid solver in AMDiS.
\begin{lstlisting}{}
multigrid->solver: mg
\end{lstlisting}
The next three lines are not multigrid specific. They determine the solver tolerance, the maximal number of solver iterations, and the pre-conditioner.
The entry \verb+use galerkin operator+ determines, how the system on coarse levels is assembled. If the value is set to 1, the system of the finest level is successively restricted to coarser levels by the galerkin operator (which is only defined for linear Lagrange elements). If the value is set to 0, the system of coarser levels is assembled using the usual problem operators on the coarser meshes.
The \verb+mg cycle index+ determines the number of recursive multigrid calls within each level. A value of $1$ results in V-cycle iterations, a value of $2$ in W-cycle iterations (in principle, also higher values could be chosen).
Currently, as smoother only a relaxed Gauss-Seidel method is implemented (\verb+gs+). The value \verb+smoother->omega+ is the relaxation parameter.
The meaning of \verb+pre smoothing steps+, \verb+post smoothing steps+ and \verb+coarse level smoothing+\verb+steps+ is explained above.
\verb+min level+ is the coarsest multigrid level. By default it is 0.
\verb+min level gap+ describes the number of mesh levels that at least are skipped between two multigrid levels. \verb+max mg levels+ sets the maximum number of allowed multigrid levels. If necessary, more than \verb+min level gap+ levels are skipped, to fulfill this requirement.