[petsc-users] SNES Line Search Monitor

Su Yan suyan0 at gmail.com
Sat Aug 17 18:46:13 CDT 2013


I am using PETSc 3.4.1. This problem is reproducible. I tested several
other cases, almost every case has the similar problem. Take this one as an
example:

with ./abc.bin -snes_monitor -snes_linesearch_monitor

 0 SNES Function norm 1.470975405802e+06
      Line search: lambdas = [1, 0.5, 0], fnorms = [7051.02, 735338,
1.47098e+06]
      Line search terminated: lambda = 0.999762, fnorms = 7026.38
  1 SNES Function norm 7.026377609722e+03
      Line search: lambdas = [1, 0.5, 0], fnorms = [189.711, 3514.55,
7026.38]
      Line search terminated: lambda = 0.999295, fnorms = 189.783
  2 SNES Function norm 1.897827226353e+02
      Line search: lambdas = [1, 0.5, 0], fnorms = [32.3811, 100.302,
189.783]
      Line search terminated: lambda = 1.01592, fnorms = 32.5125
  3 SNES Function norm 3.251248928384e+01
      Line search: lambdas = [1, 0.5, 0], fnorms = [0.00236829, 16.2564,
32.5125]
      Line search terminated: lambda = 1.00001, fnorms = 0.00233087
  4 SNES Function norm 2.330867616400e-03

with ./abc.bin -snes_monitor

  0 SNES Function norm 1.470975405802e+06
  1 SNES Function norm 7.026377609170e+03
  2 SNES Function norm 1.897827231670e+02
  3 SNES Function norm 3.251248934919e+01
  4 SNES Function norm 2.171496483661e-02

Significant difference can be observed. The equation I am solving is quite
ill-conditioned. Without L2 line search it is hard to converge in some
cases. Still try to figure out the reason.

Thanks,
Su

On Sat, Aug 17, 2013 at 8:49 AM, Peter Brune <brune at mcs.anl.gov> wrote:

>
>
>
> 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/5c0299a1/attachment.html>


More information about the petsc-users mailing list