[petsc-dev] SNESNONE type for nonlinear preconditioner?

Jed Brown jed at jedbrown.org
Thu Mar 6 02:11:13 CST 2014


Geoff Oxberry <goxberry at gmail.com> writes:

> I saw Peter's talk at SIAM CSE 2013 and thought nonlinear preconditioning
> looked really cool; now I have a problem where I want to try it out. I've
> looked at snes/ex35, and it looks like adding one from options would
> involve:
>
> - calling SNESGetNPC to associate the nonlinear preconditioner SNES with an
> outer SNES solver
> - calling SNESSetType on the nonlinear preconditioner to set some default
> value
> - calling SNESGetFromOptions to set a new nonlinear preconditioner from
> options (if available)

You can just call SNESSetFromOptions on the outer SNES and then use
-npc_snes_type xyz and an NPC will be created for you.  Don't need any
of the code above.

src/snes/interface/snes.c-  /* if someone has set the SNES NPC type, create it. */
src/snes/interface/snes.c-  ierr = SNESGetOptionsPrefix(snes, &optionsprefix);CHKERRQ(ierr);
src/snes/interface/snes.c:  ierr = PetscOptionsHasName(optionsprefix, "-npc_snes_type", &pcset);CHKERRQ(ierr);
src/snes/interface/snes.c-  if (pcset && (!snes->pc)) {
src/snes/interface/snes.c-    ierr = SNESGetNPC(snes, &snes->pc);CHKERRQ(ierr);
src/snes/interface/snes.c-  }

> What if I want that nonlinear preconditioner to do nothing by default? Is
> there an SNESNONE, comparable to PCNONE?

Just don't turn it on (don't pass -snes_npc_type)?  Might be able to do
0 steps of Richardson.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140306/22a4cd1e/attachment.sig>


More information about the petsc-dev mailing list