[petsc-users] Issue when passing DMDA array on to Paraview Catalyst
Matthew Knepley
knepley at gmail.com
Wed Mar 13 11:28:26 CDT 2019
On Wed, Mar 13, 2019 at 12:16 PM Bastian Löhrer via petsc-users <
petsc-users at mcs.anl.gov> wrote:
> 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.
>
I can't think of a reason it would not work. I would look at the pointer
you get inside
the Catalyst function using the debugger.
Note that you can also get an F90 array out if that is what Catalyst needs.
Thanks,
Matt
> Bastian
>
--
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/20190313/7dbffef7/attachment.html>
More information about the petsc-users
mailing list