[petsc-users] SNES first residual

Matthew Knepley knepley at gmail.com
Mon Sep 25 08:19:04 CDT 2017


If you want to control SNES convergence, you should use your own
convergence check


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetConvergenceTest.html

    Matt

On Mon, Sep 25, 2017 at 9:17 AM, Praveen C <cpraveen at gmail.com> wrote:

> Hello Matt
>
> I want to get the first residual norm within my code to decide on
> convergence.
>
> I am solving a steady state problem with pseudo-timestepping and SNES.
>
> Currently I am calling my FormFunction before call to SNES and using
> VecNorm.
>
> while(res_norm > res_tol)
> {
> uold = u;
> FormFunction(snes,u,r,&ctx);
> VecNorm(u,NORM_2,&res_norm);
> SNESSolve(snes,NULL,u);
> }
>
> But this leads to a duplication of function evaluation.
>
> What I want is something like this
>
> while(res_norm > res_tol)
> {
> uold = u;
> SNESSolve(snes,NULL,u);
> // get res_norm = first residual of SNES
> }
>
> Best
> praveen
>
> On Mon, Sep 25, 2017 at 6:31 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> Does -snes_monitor not give that?
>>
>>   Thanks,
>>
>>      Matt
>>
>> On Mon, Sep 25, 2017 at 8:32 AM, Praveen C <cpraveen at gmail.com> wrote:
>>
>>> Dear all
>>>
>>> Is there a way to get the residual in first step of SNES ?
>>>
>>> Thanks
>>> praveen
>>>
>>
>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
>>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170925/68e15991/attachment.html>


More information about the petsc-users mailing list