[petsc-users] Example 23 of ksp problems

Zhang, Hong hzhang at mcs.anl.gov
Mon Nov 26 22:57:57 CST 2018


Huq:
#  define PETSC_MACHINE_EPSILON         2.2204460492503131e-16
See /petsc/include/petscmath.h
Hong

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<mailto:huq2090 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181127/3a5a35ba/attachment-0001.html>


More information about the petsc-users mailing list