Dear PETSc community,

I'm working with a code that uses PETSc (version 3.3). We are about to upgrade our code to make it compatible with PETSc 3.9 but that's another story...

We have come across an issue which makes us wonder if we are handling the PETSc variables in the right way so it would be great if anyone of you could comment on the following code snippets:

We include _petsc_inlcude.h_

...
       Vec :: glob_p
       common /mpivector/  glob_p,   loc_p
...
_
_

in our main program file _main.F90_
...

#include "./fluid/petsc_include.h"

...

       PetscScalar loc_p_v(1)
       PetscOffset loc_p_i
...
       call DMCreateGlobalVector(da1dof, glob_p  , ierr)
       call DMCreateLocalVector(da1dof,  loc_p   , ierr)
       call VecGetArray(loc_p,    loc_p_v,    loc_p_i,   ierr)
...
       call SomeSubroutine ( loc_p_v     (loc_p_i  +1) )


as well as any other files containing subroutines. The issue we have is the observation that it now makes a difference how the argument of the subroutine is declared, i.e. p does not contain the same values in both of the following implementations:

subroutine SomeSubroutine( p )
    double precision, dimension(gis:gie,gjs:gje,gks:gke) :: p

subroutine SomeSubroutine( p )
    PetscScalar p (gis:gie,gjs:gje,gks:gke)

This is puzzling to us, because we do have the PetscScalar configured as double precision real numbers.

I also noticed that we are using VecGetArray instead of VecGetArrayF90. Should we switch to the F90 version?

Kind regards
Bastian Löhrer

Reply via email to