[petsc-users] Residual calculation in Richardson
Jed Brown
jedbrown at mcs.anl.gov
Wed Jun 6 13:20:57 CDT 2012
I don't have a problem with a KSPBuildResidual_Richardson, but what about
also removing the part that forms the residual at the end of each iteration
so that it is skipped if KSP_NORM_NONE?
On Tue, Jun 5, 2012 at 2:02 PM, John Fettig <john.fettig at gmail.com> wrote:
> When using the defaults for Richardson, it calculates the
> (unpreconditioned) residual directly on line 138. However, this isn't
> made available to the convergence monitor because
> ksp->ops->buildresidual = KSPDefaultBuildResidual;
>
> So if you build the residual explicitly in the convergence monitor it
> must calculate it again. Could we do this instead?
>
> #undef __FUNCT__
> #define __FUNCT__ "KSPBuildResidual_Richardson"
> PetscErrorCode KSPBuildResidual_Richardson(KSP ksp, Vec t, Vec v, Vec *V)
> {
> PetscErrorCode ierr;
> KSP_Richardson *ctx;
>
> PetscFunctionBegin;
> ctx = (KSP_Richardson *)ksp->data;
> if (ctx->selfscale) {
> KSPDefaultBuildResidual(ksp,t,v,V);
> } else {
> if (v) {
> ierr = VecCopy( ksp->work[0], v );CHKERRQ(ierr);
> if (V) *V = v;
> } else if (V) {
> *V = ksp->work[0];
> }
> }
> PetscFunctionReturn(0);
> }
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120606/ff34b1e5/attachment.html>
More information about the petsc-users
mailing list