<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>  Yes, this is a good idea. Simple extension of current code.<div class=""><br class=""></div><div class="">  The command line would then be <div class=""><br class=""></div><div class="">    -snes_converged_reason ::failed</div><div class=""><br class=""></div><div class="">   add in petscviewer.h </div><div class=""><br class=""></div><div class="">  a new PetscViewerFormat PETSC_VIEWER_FAILED, </div><div class=""><br class=""></div><div class="">   add in viewera.c PetscViewerFormats FAILED.</div><div class=""><br class=""></div><div class="">   add in SNESReasonView   </div><div class=""><br class=""></div><div class="">    if (snes->reason > 0 && format != PETSC_VIEWER_FAILED) {</div><div class=""><br class=""></div><div class="">   </div><div class="">    Document it in SNESReasonView manual page<br class=""><div> <br class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2020, at 7:50 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Tue, Jul 28, 2020 at 8:09 PM Alexander Lindsay <<a href="mailto:alexlindsay239@gmail.com" class="">alexlindsay239@gmail.com</a>> wrote:<br class=""></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" class="">The only slight annoyance with doing this through a PostSolve hook as opposed to a pluggable ReasonView system is that if a user passed `-snes_converged_reason` on the command line, we would get redundant printout from SNESSolve and our PostSolve. Although I suppose we could solve this by intercepting their option, not passing it to PETSc, and then just using that info to control the output from our PostSolve (e.g. if a user passes -snes_converged_reason from the command line, then we should always print the reason, instead of just printing when we don't converge). So maybe the PostSolve will work fine.</div></blockquote><div class=""><br class=""></div><div class="">Can't you just define another ASCII format that prints what you want for ReasonView?</div><div class=""><br class=""></div><div class="">   Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 28, 2020 at 12:20 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank" class="">bsmith@petsc.dev</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class=""><br class=""></div>  KPSSetPostSolve(),  There is no SNESSetPostSolve()  but there could/should be.<div class=""><br class=""></div><div class="">   Barry</div><div class=""><br class=""><div class="">  Note inside the SNESSolve there are a bunch of pre and post hooks, don't get the confused with an outside SNESSetPostSolve()</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2020, at 1:12 PM, Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank" class="">fdkong.jd@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class="">One alternative is to support a plugable KSP/SNESReasonView system. We then could hook up KSP/SNESReasonView_MOOSE.</div><div dir="ltr" class=""><br class=""></div><div class="">We could call our views from SNES/KSP"done"Solve as well if such a system is not affordable.  What are the final functions we should call, where we guarantee SNES/KSP is already done? <br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Fande,</div></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 28, 2020 at 12:02 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank" class="">bsmith@petsc.dev</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="">
  Alex,<br class="">
<br class="">
    The actual printing is done with SNESReasonView() and KSPReasonView() I would suggest copying those files to Moose with a name change and removing all the code you don't want. Then you can call your versions immediately after SNESSolve() and KSPSolve().<br class="">
<br class="">
   Barry<br class="">
<br class="">
<br class="">
> On Jul 28, 2020, at 10:43 AM, Alexander Lindsay <<a href="mailto:alexlindsay239@gmail.com" target="_blank" class="">alexlindsay239@gmail.com</a>> wrote:<br class="">
> <br class="">
> 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 ?<br class="">
> <br class="">
> Alex<br class="">
<br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></blockquote></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></body></html>