<div dir="ltr">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");<div>
<br></div><div>When I execute my program abc.bin with the following command:</div><div><br></div><div>./abc.bin -snes_monitor -snes_linesearch_monitor</div><div><br></div><div>I got the following output:</div><div><div><br>
</div><div>0 SNES Function norm 1.457697974866e+07</div><div>       Line search: lambdas = [1, 0.5, 0], fnorms = [669102, 7.35102e+06, 1.4577e+07]</div><div>       Line search terminated: lambda = 1.00553, fnorms = 652606</div>
<div>1 SNES Function norm 6.526060362905e+05</div><div>       Line search: lambdas = [1, 0.5, 0], fnorms = [3406.6, 326873, 652606]</div><div>       Line search terminated: lambda = 1.00171, fnorms = 2801.6</div><div>2 SNES Function norm 2.801596249480e+03</div>
<div>       Line search: lambdas = [1, 0.5, 0], fnorms = [2.51242, 1401.2, 2801.6]</div><div>       Line search terminated: lambda = 1.00029, fnorms = 2.09292</div><div>3 SNES Function norm 2.092918540169e+00</div><div>       Line search: lambdas = [1, 0.5, 0], fnorms = [0.000123295, 1.04646, 2.09292]</div>
<div>       Line search terminated: lambda = 1, fnorms = 0.000122588</div><div>4 SNES Function norm 1.225883678418e-04</div><div> </div><div>Converged Reason: FNORM_RELATIVE</div></div><div><br></div><div>The nonlinear problem converged normally with a relative f_norm set as 1E-7.</div>
<div><br></div><div>However, if I execute exactly the same program, but with a slightly different runtime command:</div><div><br></div><div>./abc.bin -snes_monitor</div><div><br></div><div>I got the following output:</div>
<div><br></div><div><div> 0 SNES Function norm 1.457697974975e+07</div><div>1 SNES Function norm 6.526060348917e+05</div><div>2 SNES Function norm 2.801608208510e+03</div><div>3 SNES Function norm 2.450488738084e+03</div>
<div>4 SNES Function norm 3.269507987119e+02</div><div>5 SNES Function norm 3.016606325384e+02</div><div>6 SNES Function norm 2.463851989463e+02</div><div>7 SNES Function norm 1.546266418976e+02</div><div>8 SNES Function norm 1.492518400407e+02</div>
<div>9 SNES Function norm 1.477122410995e+02</div><div>10 SNES Function norm 1.503359418680e+02</div><div>11 SNES Function norm 1.504759910776e+02</div><div>12 SNES Function norm 1.417592634863e+02</div><div>13 SNES Function norm 3.047096130411e+05</div>
</div><div><br></div><div>and the solver diverged.</div><div><br></div><div>The only difference was that whether I used "-snes_linesearch_monitor" or not.</div><div><br></div><div>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.</div>
<div><br></div><div>Thanks a lot.</div><div><br></div><div>Regards,</div><div>Su</div><div><br></div></div>