SNESSetUp() and matrix-free options

Lisandro Dalcin dalcinl at
Thu May 7 15:33:46 CDT 2009

On Thu, May 7, 2009 at 5:24 PM, Jed Brown <jed at> wrote:
> Barry Smith wrote:
>> On May 7, 2009, at 3:00 PM, Lisandro Dalcin wrote:
>>> 2) What should happen if a user pass BOTH options -snes_mf and
>>> -snes_mf_operators? Error? One of them should overrides the other?
>>    An error.
> The tricky part here is, suppose the user wants to use one of these by
> default, so they put it in a .petscrc or -options_file.  Now they will
> get an error if they try to change it on the command line.

Although I did not mention it, that was one of the reason I proposed
to add a call for doing this in code...

> Is there a reasonable way to use whichever option comes last?

AFAIK, no...

> Or just have
> -snes_mf -snes_mf_type {...} so that the options system enforces that
> there is only one way to do it.  -snes_mf_operator -pc_type none is
> equivalent anyway.

Not, it is not equivalent... -snes_mf_operator -pc_type none will
still make a (pointless) call to user's Jacobian routine.

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-dev mailing list