[petsc-users] Only print converged reason when not converged

Barry Smith bsmith at petsc.dev
Tue Jul 28 20:42:42 CDT 2020


  Yes, this is a good idea. Simple extension of current code.

  The command line would then be 

    -snes_converged_reason ::failed

   add in petscviewer.h 

  a new PetscViewerFormat PETSC_VIEWER_FAILED, 

   add in viewera.c PetscViewerFormats FAILED.

   add in SNESReasonView   

    if (snes->reason > 0 && format != PETSC_VIEWER_FAILED) {

   
    Document it in SNESReasonView manual page
 
> On Jul 28, 2020, at 7:50 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Tue, Jul 28, 2020 at 8:09 PM Alexander Lindsay <alexlindsay239 at gmail.com <mailto:alexlindsay239 at gmail.com>> wrote:
> 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.
> 
> Can't you just define another ASCII format that prints what you want for ReasonView?
> 
>    Matt
>  
> On Tue, Jul 28, 2020 at 12:20 PM Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> wrote:
> 
>   KPSSetPostSolve(),  There is no SNESSetPostSolve()  but there could/should be.
> 
>    Barry
> 
>   Note inside the SNESSolve there are a bunch of pre and post hooks, don't get the confused with an outside SNESSetPostSolve()
> 
>> On Jul 28, 2020, at 1:12 PM, Fande Kong <fdkong.jd at gmail.com <mailto:fdkong.jd at gmail.com>> wrote:
>> 
>> One alternative is to support a plugable KSP/SNESReasonView system. We then could hook up KSP/SNESReasonView_MOOSE.
>> 
>> 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? 
>> 
>> Thanks,
>> 
>> Fande,
>> 
>> On Tue, Jul 28, 2020 at 12:02 PM Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> wrote:
>> 
>>   Alex,
>> 
>>     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().
>> 
>>    Barry
>> 
>> 
>> > On Jul 28, 2020, at 10:43 AM, Alexander Lindsay <alexlindsay239 at gmail.com <mailto:alexlindsay239 at 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
>> 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200728/910968f3/attachment-0001.html>


More information about the petsc-users mailing list