[petsc-users] Visualizing structured cell-centered data VTK
Jed Brown
jed at jedbrown.org
Wed Feb 7 07:16:00 CST 2018
"Buesing, Henrik" <hbuesing at eonerc.rwth-aachen.de> writes:
>> > 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.
I think coordinates need to be PointData, not coordinates of cell
centroids. DMDA doesn't have that concept. (Maybe it should, but
adding it is no small task and hacking the output is likely to create a
lot of edge cases.)
> 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?
DMPlex is a different DM and can't be used to write structured output.
More information about the petsc-users
mailing list