PetscScalar, PetscReal

Jed Brown jed at
Thu Nov 12 05:33:45 CST 2009

jarunan at wrote:
> Hello,
> I would like to ask about PetscScalar.
> - What is PetscScalar by default?(double precision real number?)
> - Is PetscReal represent double precision real number?
> - Is PetscScalar need more memory than PetscReal?

By default they are both double precision reals and thus use the same
amount of memory.  When built with complex, PetscScalar is complex,
hence takes twice as much space.  You should use Scalar for all "state"
variables, Real is for parameters or time that only make sense as reals.

> By the way, in the Petsc command I cannot use Integer or normal real
> array from fortran. I have to convert every variables I need Petsc
> command to PetscInt, PetscReal or PetscScalar. Is it meant to be so? In
> the last version, I used to be able to use common integer or real in
> Petsc code.

Can you be more specific about what no longer works.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the petsc-users mailing list