[petsc-users] Visualizing structured cell-centered data VTK

Buesing, Henrik hbuesing at eonerc.rwth-aachen.de
Wed Feb 7 07:03:12 CST 2018


> > I have structured cell-centered data and would like to visualize this with
> Paraview. Up to now I use PetscViewerVTKOpen and VecView to write data in
> *.vts format. I would like to tell PETSc that the fieldtype is
> PETSC_VTK_CELL_FIELD. I have found PetscViewerVTKAddField.
> >
> > Is this the way to go? I was thinking maybe a DMDASetFieldType exists, but
> did not find any. If yes, what is the PetscViewerVTKWriteFunction I need to
> provide?
> 
> DMDA does not explicitly support distinguishing between cell and point
> values.  PetscViewerVTKAddField is a developer level routine and you would
> need to implement a function similar to DMDAVTKWriteAll_VTS (not at all
> trivial and you need to read the code because it is responsible for almost
> everything).

I am looking at src/sys/classes/viewer/impls/vtk/vtkv.c. There is a reference to PETSC_VTK_POINT_FIELD vs. PETSC_VTK_CELL_FIELD. Judging from the output I get, I was assuming fieldtype=PETSC_VTK_POINT_FIELD. I would be totally fine with replacing POINT by CELL everywhere, since all my data is cell-centered. 

The only other references I find are in src/dm/impls/plex/plex.c and plexvtk.c and plexvtu.c. But do I go through plex when just using DMDACreate3d?

Thank you!
Henrik



More information about the petsc-users mailing list