PCMGSetGalerkin — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PCMGSetGalerkin

Causes the coarser grid matrices to be computed from the finest grid via the Galerkin process: \(A_{i-1} = r_i * A_i * p_i\).

## Synopsis

    #include "petscksp.h"
    PetscErrorCode PCMGSetGalerkin(PC pc, PCMGGalerkinType use)

Logically Collective

## Input Parameters

- pc - the multigrid context

- use - one of `PC_MG_GALERKIN_BOTH`, `PC_MG_GALERKIN_PMAT`, `PC_MG_GALERKIN_MAT`, or `PC_MG_GALERKIN_NONE`

## Options Database Key

- -pc_mg_galerkin (both|pmat|mat|none) - set the matrices to form via the Galerkin process

## Notes

Some codes that use `PCMG` such as `PCGAMG` use Galerkin internally while constructing the hierarchy and thus do not use the `PCMG` construction of the coarser grids.

If this is not used the coarser grid matrices are computed via re-discretization. That is by calling the function associated with the `DM` attached to the `PC`. For example, for nonlinear solves the function provided with `SNESSetJacobian()`.

## See Also

KSP: Linear System Solvers, `PCMG`, `PCMGGetGalerkin()`, `PCMGGalerkinType`, `PC_MG_GALERKIN_BOTH`, `PC_MG_GALERKIN_PMAT`, `PC_MG_GALERKIN_MAT`, `PC_MG_GALERKIN_NONE`

## Level

intermediate

## Location

src/ksp/pc/impls/mg/mg.c

## Examples

src/ksp/ksp/tutorials/ex56.c
src/ksp/ksp/tutorials/ex36.cxx
src/ksp/ksp/tutorials/ex35.cxx
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex70.c

## Implementations

PCMGSetGalerkin_MG() in src/ksp/pc/impls/mg/mg.c

Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages