[petsc-users] Issue when passing DMDA array on to Paraview Catalyst

Bastian Löhrer bastian.loehrer at tu-dresden.de
Wed Mar 13 11:11:59 CDT 2019


Dear PETSc users,

I am having difficulties passing PETSc data on to Paraview Catalyst and 
it may be related to the way we handle the PETSs data in our Fortran code.

We have DMDA objects, which we pass on to subroutines this way:

>   ...
>   call DMCreateLocalVector(da1dof, loc_p, ierr)
>   ...
>   call VecGetArray(loc_p, loc_p_v, loc_p_i, ierr)
>   call process( loc_p_v(loc_p_i+1) )
>   ...
>

Inside the subroutine (process in this example) we treat the 
subroutine's argument as if it were an ordinary Fortran array:

>   subroutine process( p )
>
>     use gridinfo ! provides gis, gie, ... etc.
>
>     implicit none
>
> #include "petsc_include.h"
>
>     PetscScalar, dimension(gis:gie,gjs:gje,gks:gke) :: p
>     PetscInt i,j,k
>
>     do k = gks, gke
>       do j = gjs, gje
>         do i = gis, gie
>
>             p(i,j,k) = ...
>
>         enddo
>       enddo
>     enddo
>
>   end subroutine process
>
I find this procedure a little quirky, but it has been working 
flawlessly for years.

However, I am now encountering difficulties when passing this 
variable/array p on to a Paraview Catalyst adaptor subroutine. Doing so 
I end up with very strange values there. When replacing p with an 
ordinary local Fortran array everything is fine.

Bastian



More information about the petsc-users mailing list