[petsc-users] Ksp Initial residual norm

Edoardo alinovi edoardo.alinovi at gmail.com
Sun Feb 3 13:16:49 CST 2019


Thank you very much Barry for the suggestion.

Unfortunately, I am using Fortran and not C++ . Do you have an equivalent
trick in this case? :)
------

Edoardo Alinovi, Ph.D.

DICCA, Scuola Politecnica,
Universita' degli Studi di Genova,
1, via Montallegro,
16145 Genova, Italy

Email: edoardo.alinovi at dicca.unige.it
Tel: +39 010 353 2540





Il giorno dom 3 feb 2019 alle ore 20:03 Smith, Barry F. <bsmith at mcs.anl.gov>
ha scritto:

>
>    If you use the default KSP convergence tests (which almost everyone
> does) the initial residual norm is stored in ksp->rnorm0. Thus to access it
> you need to include the private header file that defines the KSP object
> kspimpl.h so something like
>
> #include <petsc/private/kspimpl.h>
>
>    PetscErrorCode KSPGetInitialResidualNorm(KSP ksp,PetscReal *norm0)
>   {
>    *norm0 = ksp->rnorm0;
>    return 0;
>   }
>
> should work.
>
>    Barry
>
>
>
>
>
>
> > On Feb 3, 2019, at 8:27 AM, Edoardo alinovi via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
> >
> > Dear all,
> >
> > I have a very simple question for you. How can I get the initial
> residual from a ksp solver? I can easily extract the final (preconditioned)
> residual norm  but  when I try to use to do the same with the initial
> residual using:
> >
> > kspInitialResidual()
> >
> > PETSc tells me that this feature is not supported. I am actually doing
> it applying the definition of residual "by hand", but I am wondering if
> somenthing already built-in is available or not.
> >
> > Thank you very much!
> > ------
> >
> > Edoardo Alinovi, Ph.D.
> >
> > DICCA, Scuola Politecnica,
> > Universita' degli Studi di Genova,
> > 1, via Montallegro,
> > 16145 Genova, Italy
> >
> > Email: edoardo.alinovi at dicca.unige.it
> > Tel: +39 010 353 2540
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190203/32b3f73e/attachment.html>


More information about the petsc-users mailing list