<div dir="ltr"><div dir="ltr">On Tue, Mar 7, 2023 at 12:03 PM Angus, Justin Ray via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov">petsc-dev@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-3083750946028205497">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_-3083750946028205497WordSection1">
<p class="MsoNormal">Hi Barry,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Very helpful. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m still having some trouble with reconciling your answer to question number 2 based on some recent observations I have had. I’ve shared 1 slide concerning that observation, which I will briefly describe below.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have a code that uses petsc but also has a native JFNK solver that works in the standard textbook way and always uses the full newton step. I recently found that the SNES newton solver in petsc with default options was failing on step
 1 of a simulation, while our native solver worked fine. The fix for petsc was to switch from backtracking line search to basic.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Based in the information in the slide, can you make sense of this behavior?</p></div></div></div></blockquote><div><br></div><div>Sure. It is completely possible to converge using full steps when you do not converge using BT. All of the convergence proofs</div><div>are predicated on starting "close enough" to the solution. You can start far away, take full steps, and by chance get into the basin of</div><div>convergence. BT, that is trying to guarantee convergence, will fail. There are a very small number of cases for which we can</div><div>guarantee global convergence.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-3083750946028205497"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_-3083750946028205497WordSection1">
<p class="MsoNormal">-Justin<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Date: </b>Tuesday, March 7, 2023 at 8:52 AM<br>
<b>To: </b>"Angus, Justin Ray" <<a href="mailto:angus1@llnl.gov" target="_blank">angus1@llnl.gov</a>><br>
<b>Cc: </b>"<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>" <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>><br>
<b>Subject: </b>Re: [petsc-dev] SNESNEWTONLS<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal">On Mar 7, 2023, at 11:36 AM, Angus, Justin Ray via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>> wrote:<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hello,<span style="font-size:12pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"> <span style="font-size:12pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal">I’ve been using the default newton line search nonlinear solver in petsc. I recently discovered that the default line search method is bt – backtracking. I have two questions.<span style="font-size:12pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"> <span style="font-size:12pt"><u></u><u></u></span></p>
</div>
<ol style="margin-top:0in" start="1" type="1">
<li class="m_-3083750946028205497MsoListParagraph" style="margin-top:0in;margin-bottom:0in">
How exactly does the backtracking line search use the L2 norm of the function to modify the newton step? What is the formula?<span style="font-size:12pt"><u></u><u></u></span></li></ol>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">   <a href="https://urldefense.us/v3/__https:/petsc.org/main/src/snes/linesearch/impls/bt/linesearchbt.c.html*SNESLINESEARCHBT__;Iw!!G2kpM7uM-TzIFchu!gRMzIDCT2gk_bmfyFDMW_2hqc18xUq_eOd-GQOXGkPsHzw_F01t55J_ab98JKVI$" target="_blank">https://petsc.org/main/src/snes/linesearch/impls/bt/linesearchbt.c.html#SNESLINESEARCHBT</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<ol style="margin-top:0in" start="1" type="1">
<li class="m_-3083750946028205497MsoListParagraph" style="margin-top:0in;margin-bottom:0in">
<span style="font-size:12pt"><u></u> <u></u></span></li><li class="m_-3083750946028205497MsoListParagraph" style="margin-top:0in;margin-bottom:0in">
Why is backtracking default? I would think that the basic method, which is a standard Newton method, would be default.<span style="font-size:12pt"><u></u><u></u></span></li></ol>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">   All SNES Newton line searches use the full Newton step if it satisfies the Wolf conditions (there is some decrease in the function norm) and if the full Newton step is selected there is no nontrivial extra costs from using a line search
 (since the line search is never done) so there is no reason not to default to using SNESLINESEARCHBT. While using ONLY the full-step there may not convergence for many situations.  Hence our default.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<ol style="margin-top:0in" start="2" type="1">
<li class="m_-3083750946028205497MsoListParagraph" style="margin-top:0in;margin-bottom:0in">
<span style="font-size:12pt"><u></u> <u></u></span></li></ol>
<div>
<p class="MsoNormal"> <span style="font-size:12pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal">-Justin<span style="font-size:12pt"><u></u><u></u></span></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
</div>
</div>

</div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>