You can also do this with a monitor and get the converged reason to do what you want:
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESMonitorSet.html#SNESMonitorSet On Tue, Jul 28, 2020 at 12:09 PM Mark Adams <mfad...@lbl.gov> wrote: > You can add your own convergence test and do anything that you want: > > > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetConvergenceTest.html > > On Tue, Jul 28, 2020 at 11:44 AM Alexander Lindsay < > alexlindsay...@gmail.com> wrote: > >> To help debug the many emails we get about solves that fail to converge, >> in MOOSE we recently appended `-snes_converged_reason >> -ksp_converged_reason` for every call to `SNESSolve`. Of course, now we >> have users complaining about the new text printed to their screens that >> they didn't have before. Some of them have made a reasonable request to >> only print the convergence reason when the solve has actually failed to >> converge. Is there some way we can only print the reason if we've diverged, >> e.g. if reason < 0 ? >> >> Alex >> >