<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
p.m-3083750946028205497msolistparagraph, li.m-3083750946028205497msolistparagraph, div.m-3083750946028205497msolistparagraph
{mso-style-name:m-3083750946028205497msolistparagraph;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:561595417;
mso-list-template-ids:1792409964;}
@list l0:level1
{mso-level-start-at:2;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1
{mso-list-id:920724658;
mso-list-template-ids:-202615380;}
@list l2
{mso-list-id:2026011420;
mso-list-template-ids:1759945758;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word;overflow-wrap: break-word;-webkit-nbsp-mode: space;line-break:after-white-space">
<div class="WordSection1">
<p class="MsoNormal">Barry,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">“It defaults to a huge value linesearch->maxstep = 1e8;” – That is the answer!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">The newton step being taken in the slide I sent is 2.7e10.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Thank you.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Justin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Barry Smith <bsmith@petsc.dev><br>
<b>Date: </b>Tuesday, March 7, 2023 at 9:34 AM<br>
<b>To: </b>"Angus, Justin Ray" <angus1@llnl.gov><br>
<b>Cc: </b>Matthew Knepley <knepley@gmail.com>, "petsc-dev@mcs.anl.gov" <petsc-dev@mcs.anl.gov><br>
<b>Subject: </b>Re: [petsc-dev] SNESNEWTONLS<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Mar 7, 2023, at 12:19 PM, Angus, Justin Ray <angus1@llnl.gov> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Matthew,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you for the reply. But my question was really related to what Barry had said – the BT method will use the full step as long as it leads to some decease in the function norm. The full step does indeed satisfy this condition, but the
BT method does not seem to be using the full step. Why?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Is it because the step value is larger than the default maxstep? I don’t know what that value is or how to find it.<o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"> The easiest way is to run in a debugger and put in a break point for SNESLineSearchApply_BT(). Step to see exactly what decision it is making<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> You can see the parameters used by running with -snes_view_pre (here pre means to display the parameters before the solve is done). <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> The line search default values are set in SNESLineSearchCreate() in src/snes/linesearch/interface/linesearch.c It defaults to a huge value linesearch->maxstep = 1e8;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> If you use VSCode or some other programming environment you can set it up to find things in the PETSc source easily <a href="https://urldefense.us/v3/__https:/petsc.org/release/docs/manual/other/*visual-studio-code-users__;Iw!!G2kpM7uM-TzIFchu!kQU20Vj5R0UB_QFB21x9Xjasg-Ho2l-QtzxZdjA8AKCBr2ieX1aHpvjO04tN68k$">https://petsc.org/release/docs/manual/other/#visual-studio-code-users</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> Barry<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-Justin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<div>
<p class="MsoNormal"><b><span style="font-size:12.0pt">From:<span class="apple-converted-space"> </span></span></b><span style="font-size:12.0pt">Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>><br>
<b>Date:<span class="apple-converted-space"> </span></b>Tuesday, March 7, 2023 at 9:16 AM<br>
<b>To:<span class="apple-converted-space"> </span></b>"Angus, Justin Ray" <<a href="mailto:angus1@llnl.gov">angus1@llnl.gov</a>><br>
<b>Cc:<span class="apple-converted-space"> </span></b>Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>>, "<a href="mailto:petsc-dev@mcs.anl.gov">petsc-dev@mcs.anl.gov</a>" <<a href="mailto:petsc-dev@mcs.anl.gov">petsc-dev@mcs.anl.gov</a>><br>
<b>Subject:<span class="apple-converted-space"> </span></b>Re: [petsc-dev] SNESNEWTONLS</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
</div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal">Hi Barry,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Very helpful.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Based in the information in the slide, can you make sense of this behavior?<o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Sure. It is completely possible to converge using full steps when you do not converge using BT. All of the convergence proofs<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">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<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">convergence. BT, that is trying to guarantee convergence, will fail. There are a very small number of cases for which we can<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">guarantee global convergence.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> Thanks,<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> Matt<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal">-Justin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<div>
<p class="MsoNormal"><b><span style="font-size:12.0pt">From:<span class="apple-converted-space"> </span></span></b><span style="font-size:12.0pt">Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Date:<span class="apple-converted-space"> </span></b>Tuesday, March 7, 2023 at 8:52 AM<br>
<b>To:<span class="apple-converted-space"> </span></b>"Angus, Justin Ray" <<a href="mailto:angus1@llnl.gov" target="_blank">angus1@llnl.gov</a>><br>
<b>Cc:<span class="apple-converted-space"> </span></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:<span class="apple-converted-space"> </span></b>Re: [petsc-dev] SNESNEWTONLS</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<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:<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal">Hello,<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<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.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<ol style="margin-top:0in" start="1" type="1">
<li class="m-3083750946028205497msolistparagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l2 level1 lfo1">
How exactly does the backtracking line search use the L2 norm of the function to modify the newton step? What is the formula?<o:p></o:p></li></ol>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<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><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<ol style="margin-top:0in" start="1" type="1">
<li class="m-3083750946028205497msolistparagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l1 level1 lfo2">
<span style="font-size:12.0pt"> </span><o:p></o:p></li><li class="m-3083750946028205497msolistparagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l1 level1 lfo2">
Why is backtracking default? I would think that the basic method, which is a standard Newton method, would be default.<o:p></o:p></li></ol>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<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.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<ol style="margin-top:0in" start="2" type="1">
<li class="m-3083750946028205497msolistparagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l0 level1 lfo3">
<span style="font-size:12.0pt"> </span><o:p></o:p></li></ol>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">-Justin<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">--<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">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<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><a href="https://urldefense.us/v3/__http:/www.cse.buffalo.edu/*knepley/__;fg!!G2kpM7uM-TzIFchu!j3AGZCLzChJI9AkGBKcae0TA2fNh_B_Y_Isx1koEbyAOIQVPHznYaIG73_xzqJw$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
</div>
</body>
</html>