[petsc-users] Example 23 of ksp problems
Fazlul Huq
huq2090 at gmail.com
Thu Nov 29 13:37:41 CST 2018
Thanks!
Sincerely,
Huq
On Tue, Nov 27, 2018 at 10:57 AM Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>
> This is an ad hoc way of checking that the error from the linear solve
> is "reasonable". Note that PETSC_MACHINE_EPSILON
> depends on the precision of the floating point used so for more precise
> floating point (in going from half precision to quad precision) we expect
> the error
> to be smaller (depending on the machine epsilon). The 1000 is an arbitrary
> number, it could be 100 or 10,000 or anything in between could be
> reasonable. Note that using a 1.0 is probably not reasonable because it is
> not reasonable to expect the error to be only a machine epsilon away from
> the "exact" answer.
>
> Barry
>
> If you are not familiar with the term machine epsilon you can google it.
>
>
>
> > On Nov 26, 2018, at 9:30 PM, Fazlul Huq via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
> >
> > Hello PETSc developers,
> >
> > I went through the ex23.c of ksp section attached herewith but I don't
> understand the following part:
> > ***********************************************
> > tol=1000.*PETSC_MACHINE_EPSILON
> > ************************************************
> > and,
> > ************************************************
> > ierr = VecAXPY(x,-1.0,u);CHKERRQ(ierr);
> > ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
> > ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
> > if (norm > tol) {
> > ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g, Iterations
> %D\n", (double)norm,its);CHKERRQ(ierr);
> > }
> > ************************************************
> > I don't understand what is "tol" here and "*PETSC_MACHINE_EPSILON"?
> > The if condition is also not clear to me.
> >
> > Thanks.
> > Sincerely,
> > Huq
> > --
> >
> > Fazlul Huq
> > Graduate Research Assistant
> > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
> > University of Illinois at Urbana-Champaign (UIUC)
> > E-mail: huq2090 at gmail.com
> > <ex23.c>
>
>
--
Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2090 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181129/ae2517bf/attachment.html>
More information about the petsc-users
mailing list