SNESSetUp() and matrix-free options

Barry Smith bsmith at
Wed May 6 15:53:49 CDT 2009

On May 6, 2009, at 3:37 PM, Lisandro Dalcin wrote:

> On Wed, May 6, 2009 at 5:25 PM, Barry Smith <bsmith at>  
> wrote:
>>   Lisandro,
>>     The checking of the options can be moved to  
>> SNESSetFromOptions() that
>> then set some flag in the snes object;
>> but the actual action of MatCreateSNESMF() etc must continue to  
>> take place
>> in the setup.
> Could you elaborate a bit more on this requeriment on the call to
> MatCreateSNESMF()?

     Hmmm, maybe it would ok to move all of it into  
My thought was it had to be in the SNESSetUp() so that it would  
override anything
set by the user code. But so long as SNESSetFromOptions() is called  
after SNESSetJacobian()
then it will override.

    It is ok with me if you try moving it all.


> The problem I see is that SNESSetFromOptions() calls
> KSPSetFromOptions(), but before that, we should be calling
> KSPSetOperators() because KSPSetFromOptions() sets some defaults based
> on the actual subtypes of the Mat operators... Likely we have a
> chicken-and-egg problem here...
> -- 
> 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