<div dir="ltr">Thank you! It works.<div><br></div><div>Best,</div><div>Li</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 28, 2019 at 8:12 AM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Fri, Sep 27, 2019 at 9:19 AM Li Luo via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@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 dir="ltr">Thank you for the suggestions, I'll try it.</div></blockquote><div><br></div><div>I think an easier way to do what you want is</div><div><br></div><div>  -snes_max_linear_solve_fail 10</div><div><br></div><div>from</div><div><br></div><div>  <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetMaxLinearSolveFailures.html" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetMaxLinearSolveFailures.html</a></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 dir="ltr"><div>Best,</div><div>Li</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2019 at 5:27 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
  Li,<br>
<br>
   It is possible, but as Hong said probably never appropriate. Especially if KSP has iterated for 10,000 iterations. If you want SNES to "try" the direction given by a failed solve you should use a much smaller maximum number of iterations for KSP.<br>
<br>
   Anways, to do what you desire <br>
<br>
#include <petsc/private/kspimpl.h><br>
<br>
call KSPSetPostSolve() and in your post solve() function simply do ksp->reason = KSP_CONVERGED_ITS.<br>
<br>
 Barry<br>
<br>
<br>
<br>
<br>
> On Sep 26, 2019, at 10:58 AM, Zhang, Hong via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> Li :<br>
> You can use '-ksp_max_it 20000' to change maximum iteration count. However, it does not make sense to continue after it fails at 10000 iterations. You should figure out why linear solver diverges. Run your code with '-ksp_monitor' or '-ksp_monitor_true_residual'.<br>
> Hong<br>
> <br>
> Dear developer,<br>
> <br>
> I am using SNES for solving a nonlinear system.  For some cases, SNES diverged -3 with "DIVERGED_LINEAR_SOLVE" when the linear solver reached its maximum iteration count (i.e -ksp_max_it 10000).<br>
> Is that possible to let SNES continue even though the linear solver reaches the maximum number of iterations? Just take the result at 10000 for the Jacobian solution and then update the Newton step?<br>
> <br>
> Best,<br>
> Li<br>
> <br>
> <br>
> <br>
> This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email.<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><p style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;border:medium none;margin:6pt 0in 0pt"><span style="font-family:"trebuchet ms",sans-serif"><span style="line-height:normal"><font size="2">Postdoctoral Fellow<br></font></span></span></p><font style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif" size="2"><font face="trebuchet ms, sans-serif">Extreme Computing Research Center</font><br><font face="trebuchet ms, sans-serif">King Abdullah University of Science & Technology</font></font><div><font size="2"><font face="trebuchet ms, sans-serif"><font color="#444444"><a href="https://sites.google.com/site/rolyliluo/" target="_blank">https://sites.google.com/site/rolyliluo/</a></font><br></font></font></div></div></div>

<br>
<div><hr></div><font face="Arial" size="1">This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email.</font></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_5024528240966106132gmail_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>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><p style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;border:medium none;margin:6pt 0in 0pt"><span style="font-family:"trebuchet ms",sans-serif"><span style="line-height:normal"><font size="2">Postdoctoral Fellow<br></font></span></span></p><font style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif" size="2"><font face="trebuchet ms, sans-serif">Extreme Computing Research Center</font><br><font face="trebuchet ms, sans-serif">King Abdullah University of Science & Technology</font></font><div><font size="2"><font face="trebuchet ms, sans-serif"><font color="#444444"><a href="https://sites.google.com/site/rolyliluo/" target="_blank">https://sites.google.com/site/rolyliluo/</a></font><br></font></font></div></div></div>

<br>
<div><hr></div><font face="Arial" size="1">This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email.</font>