[petsc-dev] [petsc-users] Pre-conditioners in PETSc

Jed Brown jed at 59A2.org
Tue Feb 22 12:51:45 CST 2011

On Tue, Feb 22, 2011 at 18:14, Ethan Coon <ecoon at lanl.gov> wrote:

> > Also suppose the succeeding statement of KSPSetOperators is
> KSPSetFromOptions(ksp_context) and I pass "-pc_type none" at the terminal,
> would this mean that Pmat is not at all needed
> >
> > in PETSc's calculations??
> Correct, pmat is not used in that case.  In that case, you still have to
> pass something in to KSPSetOperators, so Amat for both is the likely
> choice.

I thought it was silly that Pmat needed to be passed in even if it was not
used. It turns out that there was a copy-paste error in PCGetOperators()
that would overwrite pc->mat if pc->pmat was not set. I updated that
function and now PCNONE works even if Pmat was never set. Of course it still
makes sense to pass Amat in both slots even if you plan to use PCNONE. More
importantly, however, the new error message is at least sensible "null
argument" instead of the confusing "type not set" within a MatMult.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110222/d4c28a72/attachment.html>

More information about the petsc-dev mailing list