[petsc-users] Example 1 of Vector section

Matthew Knepley knepley at gmail.com
Mon Sep 24 20:26:27 CDT 2018


On Mon, Sep 24, 2018 at 9:02 PM Fazlul Huq <huq2090 at gmail.com> wrote:

> Hello All,
>
> I am looking through the example problems given in PETSc. In the very
> first example, ex1 of vector section, I don't understand the following
> part, especially the term "PETSC_SMALL". What does this mean?
>

This checks that we get the norm we expect. PETSC_SMALL is a small
difference we are willing to accept
due to roundoff error.

   Matt


> Here, in the second line we already assign zero to v. What is the meaning
> of "if" condition then?
>
> ierr = VecScale(x,two);CHKERRQ(ierr);
>   ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
>   v    = norm-2.0*PetscSqrtReal((PetscReal)n); if (v > -PETSC_SMALL && v <
> PETSC_SMALL) v = 0.0;
>   ierr = PetscPrintf(PETSC_COMM_WORLD,"VecScale
> %g\n",(double)v);CHKERRQ(ierr);
>
>
> All the best.
> 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
>


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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180924/2f1815c7/attachment.html>


More information about the petsc-users mailing list