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

Bastian Löhrer bastian.loehrer at tu-dresden.de
Thu Apr 4 09:20:36 CDT 2019


Dear Matt and Barry,

thank you for your responses; they were helpful.

The issue turned out to not be related to PETSc.
The problem was that I tried to pass only a (center) piece of the array 
to Catalyst which is not possible, and which leads to memory issues.

Thanks,
Bastian


On 14.03.19 06:05, Smith, Barry F. wrote:
>> On Mar 13, 2019, at 11:28 AM, Matthew Knepley via petsc-users <petsc-users at mcs.anl.gov> wrote:
>>
>> 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.
>    VecGetArrayF90() or DMDAVecGetArrayF90()
>>    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/

-- 
Dipl.-Ing. Bastian Löhrer
Institute of Fluid Mechanics
TU Dresden
Zeuner-Bau Zi 151
George-Bähr-Straße 3c
01062 Dresden
tel: 	+49 351 463-32545
fax: 	+49 351 463-35246
mail:	bastian.loehrer at tu-dresden.de



More information about the petsc-users mailing list