[petsc-users] ksp_monitor_true_residual_norm

Barry Smith bsmith at mcs.anl.gov
Fri Apr 13 19:01:56 CDT 2012


   Write a one line monitor that calls the true residual monitor when desired:

    PetscErrorCode  myKSPMonitorTrueResidualNorm(KSP ksp,PetscInt n,PetscReal rnorm,void *dummy)
    {
        if (n % 10) {
           ierr = KSPMonitorTrueResidualNorm(ksp,n,rnorm,dummy);CHKERRQ(ierr);
        }
    }

    then call this on the KPS

   ierr = KSPMonitorSet(ksp,myKSPMonitorTrueResidualNorm,PETSC_VIEWER_STDOUT,0);CHKERRQ(ierr);


On Apr 13, 2012, at 6:52 PM, Randall Mackie wrote:

> In using ksp_monitor_true_residual_norm, is it possible to change how often this information is printed out?
> That is, instead of every iteration, say I only want to see it every 10 or 20 iterations. Is there an easy way
> to do this, other than creating my own monitor and doing it myself?
> 
> Thanks, Randy M.



More information about the petsc-users mailing list