<div dir="ltr">Hi All,<div><br></div><div>I have done some researching in the PETSc email archive, but did not find a decent way to do it. Assume that, during a SNESSolve, something unphysical happening and a C++ exception is send,  and now I want to stop the SNESSolve and let it try a smaller time step.</div><div>Here are some pseudo code I have:</div><div><br></div><div>while(no_converged)</div><div>{</div><div>  try</div><div>  {</div><div>    SNESSolve(...);</div><div>    if (SNESSolve converged)</div><div>      no_converged = false;</div><div>  }</div><div>  catch(int err)</div><div>  {</div><div>    /* do some clean work here? */</div><div>    dt = 0.5 * dt;</div><div>  }</div><div>}</div><div><br></div><div>It seems to me that it is not a good way to do, as if an exception is thrown during SNESSolve, the code go to the error catching, changing time step, and <b><u>immediately</u></b> do SNESSolve again. I would expect that there should be some clean work needed before another SNESSolve call, as I commented in the code.</div><div><br></div><div>I found two related email threads:</div><div><a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2014-August/022597.html">http://lists.mcs.anl.gov/pipermail/petsc-users/2014-August/022597.html</a><br></div><div><a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2015-February/024367.html">http://lists.mcs.anl.gov/pipermail/petsc-users/2015-February/024367.html</a><br></div><div><br></div><div>But I don't see a clear answer there.</div><div>Any comments on this issue?</div><div><br></div><div>Best,</div><div><br></div><div>Ling</div></div>