[petsc-users] SNES Line Search Monitor

Peter Brune brune at mcs.anl.gov
Sat Aug 17 08:49:19 CDT 2013


On Sat, Aug 17, 2013 at 1:40 AM, Su Yan <suyan0 at gmail.com> wrote:

> Hi, I ran into something really weird when I tried to solve a nonlinear
> equation with Newton method and line search. Specifically, I used
> SNESSetType(snesMbr, SNESNEWTONLS); and
> PetscOptionsSetValue("-snes_linesearch_type", "l2");
>
>
Which version of PETSc are you using?


> When I execute my program abc.bin with the following command:
>
> ./abc.bin -snes_monitor -snes_linesearch_monitor
>
> I got the following output:
>
> 0 SNES Function norm 1.457697974866e+07
>        Line search: lambdas = [1, 0.5, 0], fnorms = [669102, 7.35102e+06,
> 1.4577e+07]
>        Line search terminated: lambda = 1.00553, fnorms = 652606
> 1 SNES Function norm 6.526060362905e+05
>        Line search: lambdas = [1, 0.5, 0], fnorms = [3406.6, 326873,
> 652606]
>        Line search terminated: lambda = 1.00171, fnorms = 2801.6
> 2 SNES Function norm 2.801596249480e+03
>        Line search: lambdas = [1, 0.5, 0], fnorms = [2.51242, 1401.2,
> 2801.6]
>        Line search terminated: lambda = 1.00029, fnorms = 2.09292
> 3 SNES Function norm 2.092918540169e+00
>        Line search: lambdas = [1, 0.5, 0], fnorms = [0.000123295, 1.04646,
> 2.09292]
>        Line search terminated: lambda = 1, fnorms = 0.000122588
> 4 SNES Function norm 1.225883678418e-04
>
> Converged Reason: FNORM_RELATIVE
>
> The nonlinear problem converged normally with a relative f_norm set as
> 1E-7.
>
> However, if I execute exactly the same program, but with a slightly
> different runtime command:
>
> ./abc.bin -snes_monitor
>
> I got the following output:
>
>  0 SNES Function norm 1.457697974975e+07
> 1 SNES Function norm 6.526060348917e+05
> 2 SNES Function norm 2.801608208510e+03
> 3 SNES Function norm 2.450488738084e+03
> 4 SNES Function norm 3.269507987119e+02
> 5 SNES Function norm 3.016606325384e+02
> 6 SNES Function norm 2.463851989463e+02
> 7 SNES Function norm 1.546266418976e+02
> 8 SNES Function norm 1.492518400407e+02
> 9 SNES Function norm 1.477122410995e+02
> 10 SNES Function norm 1.503359418680e+02
> 11 SNES Function norm 1.504759910776e+02
> 12 SNES Function norm 1.417592634863e+02
> 13 SNES Function norm 3.047096130411e+05
>
>
Is this problem reproducible?  Note that even your 0th norm is very
slightly different, and the first three norms are quite similar.


> and the solver diverged.
>
> The only difference was that whether I used "-snes_linesearch_monitor" or
> not.
>
> In my understanding, this runtime option only turns on the screen print.
> So why did it make such a big difference? Is there anything special with
> this option turned on? Hope someone could help me out.
>

This is correct.  It should not influence the solution at all, and all it
does is enable printing.  Also, the l2 line search takes significantly more
work for well-behaved Newton convergence than bt, as bt automatically
accepts the full step.  l2 is mostly meant for cases where the step is
automatically ill-scaled.

- Peter


>
> Thanks a lot.
>
> Regards,
> Su
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130817/f6a2d7c4/attachment.html>


More information about the petsc-users mailing list