SNESSetUp() and matrix-free options

Barry Smith bsmith at mcs.anl.gov
Wed Jul 22 10:03:09 CDT 2009


On Jul 22, 2009, at 9:39 AM, Lisandro Dalcin wrote:

> On Wed, Jul 22, 2009 at 12:26 AM, Barry Smith<bsmith at mcs.anl.gov>  
> wrote:
>>>
>>> Can we at least agree on the simple rules below:
>>>
>>> 1) KSPSetFromOptions() requires a previous call to KSPSetOperators()
>>>
>>> 2) SNESSetFromOptions() requires a previous call to:
>>>  a) SNESSetFunction(), and also SNESSetJacobian() unless matrix- 
>>> free is
>>> used.
>>>  b) just SNESSetJacobian() if the problem is actually linear (a case
>>> that SNESComputeFunction() seems to handle)
>>>
>>> 3) TSSetFromOptions() should have similar requirements in order to
>>> being able to satisfy (1) or (2) depending on the problem type.
>>>
>>> Barry, does all this make sense?
>>
>>  Sometimes, so what went wrong with the broken TS example and can  
>> it fit in
>> this paradgm?
>>
>
> Well, now the example is not broken because I changed SNES to create a
> the missing snes->vec_func from the Jacobian matrix if that is
> available... All this works because TSSetFromOptions() calls
> SNESSetOperators() before issuing SNESSetFromOptions().

    This does not seem right. Having TSSetFromOptions() calling  
SNESSetJacobian() and KSPSetOperators()
seems like a bad design. Maybe some decade we should revisit this  
business.

   Barry


> However,
> nonlinear TS has an asymmetry with SNES and with TS itself:
> TSSetRHSFunction() should take a Vec from the user, like
> SNESSetFunction. This way, the TS will have a Vec to feed SNES.
>
>
>>   This is tough when there are nested sub KSP inside PCs and  
>> picking these
>> is done at
>> the command line.
>
> OK.. You are right...  this is a nightmare...
>
> Asking users to call SNESSetJacobian() should not be required for
> matrix-free, but calling KSPSetFromOptions() without having the
> operators set in KSP is broken...
>
> Did you realize that -ksp_fischer_guess is broken if the operators are
> not set in KSP? I know, using Fischer's method is a nonsense for
> SNES... But perhaps they do make sense for a sub-KSP inside a PC...
>
>
>
> -- 
> 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