[petsc-users] SNES first residual

Praveen C cpraveen at gmail.com
Mon Sep 25 08:17:21 CDT 2017


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/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170925/a26fea6b/attachment.html>


More information about the petsc-users mailing list