<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Dear PETSc community,
<p>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...</p>
<p>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:<br>
</p>
<p>We include <u>petsc_inlcude.h</u></p>
<p>
<blockquote type="cite">
<pre class="code-block-western">...
Vec :: glob_p
common /mpivector/ glob_p, loc_p
...
</pre>
</blockquote>
<u><br>
</u></p>
in our main program file <u>main.F90</u><br>
<blockquote type="cite">
<pre class="code-block-western">...
#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) )
</pre>
<p> </p>
</blockquote>
<br>
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:
<pre class="code-block-western"><blockquote type="cite"><pre class="code-block-western">subroutine SomeSubroutine( p )
double precision, dimension(gis:gie,gjs:gje,gks:gke) :: p</pre></blockquote>
<blockquote type="cite"><pre class="code-block-western">subroutine SomeSubroutine( p )
PetscScalar p (gis:gie,gjs:gje,gks:gke)</pre></blockquote>
</pre>
This is puzzling to us, because we do have the PetscScalar
configured as double precision real numbers.<br>
<br>
I also noticed that we are using <tt>VecGetArray</tt> instead of <tt>VecGetArrayF90</tt>.
Should we switch to the F90 version?<br>
<br>
Kind regards<br>
Bastian Löhrer
</body>
</html>