[petsc-users] SNES always ends at iteration 0
Mark Adams
mfadams at lbl.gov
Sun Dec 12 20:53:00 CST 2021
On Sun, Dec 12, 2021 at 7:47 PM celestechevali at gmail.com <
celestechevali at gmail.com> wrote:
> Thank you so much for your reply !
>
> In fact I didn't know how to set tolerances, so I proceeded without
> specifying the tolerances, hoping that this could lead to the
> implementation of default values...
>
> I just added *SNESSetFromOptions(snes); *However, it doesn't make any
> difference... But it's true that the "tol" values are somehow set to
> zero...
>
> *atol = 0.000000, rtol = 0.000000, stol = 0.000000, maxit = 50, maxf =
> 10000*
>
I'm not sure where this output comes from. This does not look like PETSc
"view" output. The default values are small (eg, 1e-8).
maxit=50 and maxf=10000 look like the defaults. Maybe you are printing
floats incorrectly.
Your output below is converging due to maxit=50.
rtol==0 would never converge because the relative residual can essentially
never be 0.
You can also use -ksp_monitor to view the linear solver iterations and
-ksp_converged_reason to have the solver print the reason that it
"converged".
-snes_converged_reason makes the SNES print why it decided to stop
iterating.
These parameters should give you more information about the case where you
see no output (unless the code is hung).
Mark
>
>
> * 0 SNES Function norm 7.604910424038e+02*
>
> Is it possible that it has something to do with my makefile ?
>
> Since I didn't figure out the PETSc makefile format (which seems to be
> different from standard C makefile format), I named my source code as
> *ex1.c* to make use of the default settings for PETSc example programs...
>
> And in my makefile I wrote :
>
>
>
>
> *include ${PETSC_DIR}/lib/petsc/conf/variablesinclude
> ${PETSC_DIR}/lib/petsc/conf/testex1: ex1.o*
>
> Is it possible the "tol" values are set to 0 by the default setting used
> for example programs ?
>
> Thank you so much for your help.
>
> PS: I just tried the same code with less degrees of freedom and this time
> it worked... But for a large system it didn't...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *atol = 0.000000, rtol = 0.000000, stol = 0.000000, maxit = 50, maxf =
> 10000 0 SNES Function norm 1.164809703659e+00 1 SNES Function norm
> 1.311388740736e-01 2 SNES Function norm 7.232579319557e-02 3 SNES
> Function norm 4.984271911548e-02 4 SNES Function norm 3.224387373805e-02
> 5 SNES Function norm 6.898280568053e-03 6 SNES Function norm
> 6.297558001575e-03 7 SNES Function norm 5.358028396052e-03 8 SNES
> Function norm 4.591005105466e-03 9 SNES Function norm 4.063981130201e-03
> 10 SNES Function norm 3.715929394609e-03 11 SNES Function norm
> 3.428330101253e-03 12 SNES Function norm 3.177113603032e-03 13 SNES
> Function norm 2.958574186594e-03 14 SNES Function norm 2.769227811865e-03
> 15 SNES Function norm 2.605947870584e-03 16 SNES Function norm
> 2.465934405221e-03 17 SNES Function norm 2.346761136962e-03 18 SNES
> Function norm 2.246362261451e-03 19 SNES Function norm 2.163102452591e-03
> 20 SNES Function norm 2.095849101382e-03 21 SNES Function norm
> 2.043740325461e-03 22 SNES Function norm 2.005106316761e-03 23 SNES
> Function norm 1.975748994170e-03 24 SNES Function norm 1.949413335428e-03
> 25 SNES Function norm 1.920795414593e-03 26 SNES Function norm
> 1.886883259141e-03 27 SNES Function norm 1.846374653045e-03 28 SNES
> Function norm 1.799050087038e-03 29 SNES Function norm 1.745284156916e-03
> 30 SNES Function norm 1.685885151987e-03 31 SNES Function norm
> 1.621850994665e-03 32 SNES Function norm 1.554258940064e-03 33 SNES
> Function norm 1.484213253375e-03 34 SNES Function norm 1.412768267404e-03
> 35 SNES Function norm 1.340893218332e-03 36 SNES Function norm
> 1.269412489589e-03 37 SNES Function norm 1.199029202116e-03 38 SNES
> Function norm 1.130300263372e-03 39 SNES Function norm 1.063694395854e-03
> 40 SNES Function norm 9.995826338243e-04 41 SNES Function norm
> 9.383610129089e-04 42 SNES Function norm 8.807543352645e-04 43 SNES
> Function norm 8.288695938590e-04 44 SNES Function norm 7.898873173876e-04
> 45 SNES Function norm 7.752509690373e-04 46 SNES Function norm
> 7.625724154377e-04 47 SNES Function norm 7.503152403370e-04 48 SNES
> Function norm 7.364744378378e-04 49 SNES Function norm 7.202926541551e-04
> 50 SNES Function norm 7.015245603442e-04 *
>
> Mark Adams <mfadams at lbl.gov> 于2021年12月13日周一 01:11写道：
>
>> The three "tol" values should be finite. It sounds like you set them to 0.
>> Don't do that and use the defaults to start.
>> The behavior with zero tolerances is not defined.
>> You can use -snes_monitor to print out the iterations.
>>
>> On Sun, Dec 12, 2021 at 6:22 PM celestechevali at gmail.com <
>> celestechevali at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I encountered a strange problem concerning the convergence of SNES.
>>>
>>> In my recent test runs I found that SNES always stops at iteration 0...
>>>
>>> At first I thought there may be an error with the tolerance setting, so
>>> I output the tolerances :
>>>
>>>
>>>
>>> *atol = 0.000000, rtol = 0.000000, stol = 0.000000, maxit = 50, maxf =
>>> 10000 Norm of error 760.491 Iterations 0*
>>>
>>> Which are exactly the default values that I always used. However, for
>>> the same tolerance settings, the SNES solver converges successfully if I
>>> decrease the number of degrees of freedom in my system...
>>>
>>> I wish to know if anyone has experienced the same type of problems or
>>> has an idea about what could possibly cause the problem...
>>>
>>> Thank you so much in advance.
>>>
>>> I appreciate any advice that you provide.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211212/e8065c63/attachment-0001.html>
More information about the petsc-users
mailing list