[petsc-users] Proper way to abort/restart SNESSolve due to exceptions
Zou, Ling
ling.zou at inl.gov
Fri Mar 31 10:28:48 CDT 2017
Hi All,
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.
Here are some pseudo code I have:
while(no_converged)
{
try
{
SNESSolve(...);
if (SNESSolve converged)
no_converged = false;
}
catch(int err)
{
/* do some clean work here? */
dt = 0.5 * dt;
}
}
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 *immediately* do SNESSolve again. I would expect that there
should be some clean work needed before another SNESSolve call, as I
commented in the code.
I found two related email threads:
http://lists.mcs.anl.gov/pipermail/petsc-users/2014-August/022597.html
http://lists.mcs.anl.gov/pipermail/petsc-users/2015-February/024367.html
But I don't see a clear answer there.
Any comments on this issue?
Best,
Ling
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170331/5aedbd22/attachment-0001.html>
More information about the petsc-users
mailing list