[petsc-users] Solving Poisson equation with multigrid

Jed Brown jedbrown at mcs.anl.gov
Fri May 17 21:01:12 CDT 2013


Michele Rosso <mrosso at uci.edu> writes:

> I noticed that the problem appears even if I use CG with the default 
> preconditioner: commenting KSPSetDM() solves the problem.

Okay, this issue can't show up if you use SNES, but it's a consequence
of making geometric multigrid work with a pure KSP interface.  You can
either use KSPSetComputeOperators() to put your assembly in a function
(which will also be called on coarse levels if you use -pc_type mg
without Galerkin coarse operators) or you can can provide the Jacobian
using KSPSetOperators() as usual, but also call KSPSetDMActive() so that
the DM is not used for computing/updating the Jacobian.

The logic is cleaner in petsc-3.4 and I think it just does the right
thing in your case.

> So basically without a proper grid (it seems no grid with an even 
> numbers of nodes qualifies) and with my own system matrix, I cannot use 
> any type of multigrid
> pre-conditioner?

You can use all the AMG methods without setting a DM.


More information about the petsc-users mailing list