[petsc-users] SNES and ghosted vector of unknowns

Barry Smith bsmith at mcs.anl.gov
Sat Apr 21 15:02:02 CDT 2012


On Apr 21, 2012, at 2:54 PM, Dominik Szczerba wrote:

> Thanks Barry for the hint.
> I am indeed solving my nonlinear system using the Picard scheme.
> I was once advised to set the Jacobian to my coefficient matrix "A" in
> the FormJacobian function passed to SNES to achieve this goal (I am
> still trying to get it to work with limited success though).
> Are you suggesting I should abandon this approach in favor of the new
> functionality in petsc-dev?

  Yes if you want to do Picard then you should use SNESSetPicard() that is what it designed for.

   Barry

> Regards,
> Dominik
> 
> On Sat, Apr 21, 2012 at 7:10 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>>   Domink,
>> 
>>     Sounds like you want to do a "Picard" iteration. You should use http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/SNES/SNESSetPicard.html  in petsc-dev
>>     Note with this you never compute f(x) = A(x)x - b(x)   you provide a function to compute b(x) and A(x).
>> 
>>     Please let us know if this new functionality doesn't serve your purpose.
>> 
>>      You would do the ghost point update in the function that computes b().
>> 
>> 
>>    Barry
>> 
>> 
>> On Apr 21, 2012, at 12:01 PM, Dominik Szczerba wrote:
>> 
>>> Thank a lot for the hints, but I still one little clarification. The
>>> FormFunction function has a signature
>>> 
>>> PetscErrorCode ScalarNonLinearSolver::FormFunction(SNES snes, Vec x,
>>> Vec f, void *ctx)
>>> 
>>> where I am supposed to compute A(x), b(x) and then fill f with f(x) =
>>> A(x)x - b(x)
>>> 
>>> The question is: should I call the ghost update on the passed argument
>>> x, or on my own x that I maintain in my application as a part of a KSP
>>> system? Or are they supposed to be actually the same?
>>> 
>>> Thanks a lot
>>> Dominik
>>> 
>>> On Fri, Apr 20, 2012 at 4:13 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>>>> On Fri, Apr 20, 2012 at 07:08, Matthew Knepley <knepley at gmail.com> wrote:
>>>>> 
>>>>> You can use
>>>>> 
>>>>> 
>>>>>   http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/SNES/SNESSetUpdate.html
>>>> 
>>>> 
>>>> Please don't do it this way, line searches and other methods will not work.
>>>> A ghosted vector is defined by the global entries, not the local form.
>>>> Update the local form when you want it to be current.
>> 



More information about the petsc-users mailing list