:orphan: # PCMG Use multigrid preconditioning. This preconditioner requires you provide additional information about the coarser grid matrices and restriction/interpolation operators. ## Options Database Keys - ***-pc_mg_levels -*** number of levels including finest - ***-pc_mg_cycle_type -*** provide the cycle desired - ***-pc_mg_type -*** multiplicative is the default - ***-pc_mg_log -*** log information about time spent on each level of the solver - ***-pc_mg_distinct_smoothup -*** configure up (after interpolation) and down (before restriction) smoothers separately (with different options prefixes) - ***-pc_mg_galerkin -*** use Galerkin process to compute coarser operators, i.e. Acoarse = R A R' - ***-pc_mg_multiplicative_cycles -*** number of cycles to use as the preconditioner (defaults to 1) - ***-pc_mg_dump_matlab -*** dumps the matrices for each level and the restriction/interpolation matrices to the Socket viewer for reading from MATLAB. - ***-pc_mg_dump_binary -*** dumps the matrices for each level and the restriction/interpolation matrices to the binary output file called binaryoutput ## Notes If one uses a Krylov method such `KSPGMRES` or `KSPCG` as the smoother then one must use `KSPFGMRES`, `KSPGCR`, or `KSPRICHARDSON` as the outer Krylov method When run with a single level the smoother options are used on that level NOT the coarse grid solver options When run with `KSPRICHARDSON` the convergence test changes slightly if monitor is turned on. The iteration count may change slightly. This is because without monitoring the residual norm is computed WITHIN each multigrid cycle on the finest level after the pre-smoothing (because the residual has just been computed for the multigrid algorithm and is hence available for free) while with monitoring the residual is computed at the end of each cycle. ## See Also `PCCreate()`, `PCSetType()`, `PCType`, `PC`, `PCMGType`, `PCEXOTIC`, `PCGAMG`, `PCML`, `PCHYPRE` `PCMGSetLevels()`, `PCMGGetLevels()`, `PCMGSetType()`, `PCMGSetCycleType()`, `PCMGSetDistinctSmoothUp()`, `PCMGGetCoarseSolve()`, `PCMGSetResidual()`, `PCMGSetInterpolation()`, `PCMGSetRestriction()`, `PCMGGetSmoother()`, `PCMGGetSmootherUp()`, `PCMGGetSmootherDown()`, `PCMGSetCycleTypeOnLevel()`, `PCMGSetRhs()`, `PCMGSetX()`, `PCMGSetR()`, `PCMGSetAdaptCR()`, `PCMGGetAdaptInterpolation()`, `PCMGSetGalerkin()`, `PCMGGetAdaptCoarseSpaceType()`, `PCMGSetAdaptCoarseSpaceType()` ## Level intermediate ## Location src/ksp/pc/impls/mg/mg.c ## Examples src/dm/impls/stag/tutorials/ex4.c
src/ksp/ksp/tutorials/ex35.cxx
src/ksp/ksp/tutorials/ex36.cxx
src/ksp/ksp/tutorials/ex42.c
src/snes/tutorials/ex12.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/mg/mg.c) [Index of all PC routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)