[petsc-users] Example 23 of ksp problems

Fazlul Huq huq2090 at gmail.com
Mon Nov 26 23:08:02 CST 2018


Thanks.

When I checked the file I got following values (Link:
file:///home/huq2090/petsc-3.10.2/include/petscmath.h.html).

I don't know why I should consider the value you have mentioned?

#  define PETSC_MACHINE_EPSILON         1.19209290e-07F

#  define PETSC_MACHINE_EPSILON         2.2204460492503131e-16

#  define PETSC_MACHINE_EPSILON         FLT128_EPSILON

#  define PETSC_MACHINE_EPSILON         .00097656

Again, 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?
The if condition is also not clear to me.

Thanks.
Sincerely,
Huq


On Mon, Nov 26, 2018 at 10:58 PM Zhang, Hong <hzhang at mcs.anl.gov> wrote:

> 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
>>
>

-- 

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/20181126/e73c37df/attachment.html>


More information about the petsc-users mailing list