[petsc-users] Norm of RHS in BCGS
Matthew Knepley
knepley at gmail.com
Tue Mar 22 09:20:17 CDT 2016
On Tue, Mar 22, 2016 at 9:08 AM, Norihiro Watanabe <norihiro.w at gmail.com>
wrote:
> Unfortunately -ksp_converged_reason prints the number of iterations
> but no information about final errors.
>
If you want the actual residuals (not errrors), you could use
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPGetResidualHistory.html
Matt
> Thanks,
> Nori
>
> On Tue, Mar 22, 2016 at 3:06 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
> > On Tue, Mar 22, 2016 at 9:02 AM, Norihiro Watanabe <norihiro.w at gmail.com
> >
> > wrote:
> >>
> >> What I wanted to do is displaying final converged errors without using
> >> -ksp_monitor. Because my problem includes a lot of time steps and
> >> nonlinear iterations, log output from -ksp_monitor for each linear
> >> solve is sometimes too much. But you are right. It doesn't make sense
> >> to call the expensive function just for the log output.
> >
> >
> > Maybe something like -ksp_converged_reason?
> >
> > Thanks,
> >
> > Matt
> >
> >>
> >> Thanks,
> >> Nori
> >>
> >> On Tue, Mar 22, 2016 at 2:45 PM, Matthew Knepley <knepley at gmail.com>
> >> wrote:
> >> > On Tue, Mar 22, 2016 at 8:25 AM, Norihiro Watanabe
> >> > <norihiro.w at gmail.com>
> >> > wrote:
> >> >>
> >> >> Thank you Matt!
> >> >>
> >> >> Actually I don't want to change a norm type used in a convergence
> >> >> check. I just want to output a relative error which PETSc actually
> >> >> used for a convergence check (for log output in my program without
> >> >> -ksp_*) and thought I need to have a norm of a preconditioned RHS to
> >> >> compute it by myself. Or is there any function available in PETSc
> >> >> which returns the relative error or the tolerance multiplied by the
> >> >> norm of a preconditioned RHS? I couldn't find it.
> >> >
> >> >
> >> > If you want the action of the preconditioner, you can pull it out
> >> >
> >> > KSPGetPC()
> >> >
> >> > and apply it
> >> >
> >> > PCApply()
> >> >
> >> > but I still do not understand why you want this. Do you want to check
> >> > the
> >> > norms
> >> > yourself? The PCApply() could be expensive to calculate again.
> >> >
> >> > Thanks,
> >> >
> >> > Matt
> >> >
> >> >>
> >> >>
> >> >> Best,
> >> >> Nori
> >> >>
> >> >>
> >> >> On Tue, Mar 22, 2016 at 1:51 PM, Matthew Knepley <knepley at gmail.com>
> >> >> wrote:
> >> >> > On Tue, Mar 22, 2016 at 2:50 AM, Norihiro Watanabe
> >> >> > <norihiro.w at gmail.com>
> >> >> > wrote:
> >> >> >>
> >> >> >> Hi,
> >> >> >>
> >> >> >> Is it correct that a norm of a preconditioned RHS vector is used
> to
> >> >> >> compute a relative error in BCGS?
> >> >> >
> >> >> >
> >> >> > Yes, but you can verify this using -ksp_view
> >> >> >
> >> >> >>
> >> >> >> I'm testing BCGS + BoomerAMG. With "-info", PETSc says "initial
> >> >> >> right
> >> >> >> hand side norm" is 2.223619476717e+10 (see below) but an actual
> norm
> >> >> >> of the RHS I passed is 4.059007e-02. If yes, is there any way to
> get
> >> >> >> a
> >> >> >> norm of a preconditioned RHS?
> >> >> >
> >> >> >
> >> >> > Do you mean unpreconditioned? You can try
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetNormType.html
> >> >> >
> >> >> > or use
> >> >> >
> >> >> > -ksp_monitor_true_residual
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Matt
> >> >> >
> >> >> >>
> >> >> >> [0] KSPConvergedDefault(): Linear solver has converged. Residual
> >> >> >> norm
> >> >> >> 2.036064453512e-02 is less than relative tolerance
> >> >> >> 9.999999960042e-13
> >> >> >> times initial right hand side norm 2.223619476717e+10 at
> iteration 6
> >> >> >>
> >> >> >>
> >> >> >> Regards,
> >> >> >> Nori
> >> >> >>
> >> >> >> --
> >> >> >> Norihiro Watanabe
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > 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
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Norihiro Watanabe
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > 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
> >>
> >>
> >>
> >> --
> >> Norihiro Watanabe
> >
> >
> >
> >
> > --
> > 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
>
>
>
> --
> Norihiro Watanabe
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160322/119fca87/attachment.html>
More information about the petsc-users
mailing list