-ksp_monitor

Barry Smith bsmith at mcs.anl.gov
Thu Mar 16 12:50:53 CST 2006



On Thu, 16 Mar 2006, abdul-rahman at tu-harburg.de wrote:

> Hi all,
>
> Is there a simple way to control the output of residual monitor ? i.e.,
> instead of every iteration, can I output every N iterations to screen ?
>
    Yes, you simply provide your own KSPMonitor routine and then set it with
KSPSetMonitor() see manual page. KSP in src/ksp/ksp/interface/iterativ.c

> As for the true residuals, can I store them? I know how to get the
> preconditioned residuals. Seems to me the true residuals are in the vt2
> temp variable I saw in KSPInitialResidual.

    You must obtain the true residuals with KSPBuildResidual(). For some methods,
such as GMRES, the true residual and its norm are NEVER computed (they are not
part of the algorithm), so you cannot just pull it out of some data structure
you need to call KSPBuildResidual().

   Note that if you use right preconditioning the true residual is the
preconditioned residual, making life easy.

    Barry

>
> Many thanks,
>
> Razi
>
>




More information about the petsc-users mailing list