[petsc-users] Visualization and I/O

Zhang, Hong hongzhang at anl.gov
Wed Jun 30 23:37:02 CDT 2021


Alfredo,

TSTrajectory currently supports binary format only. See

https://www.mcs.anl.gov/petsc/petsc-current/src/ts/trajectory/impls/basic/trajbasic.c.html#TSTrajectorySet_Basic
https://www.mcs.anl.gov/petsc/petsc-current/src/ts/trajectory/impls/visualization/trajvisualization.c.html#TSTrajectorySet_Visualization

It should not be difficult to extend TSTrajectory for HDF5 support. You are welcome to contribute an MR to add this feature.

Thanks,
Hong (Mr.)

On Jun 30, 2021, at 9:17 PM, Alfredo J Duarte Gomez <aduarteg at utexas.edu<mailto:aduarteg at utexas.edu>> wrote:

Good evening,

My group and I are in the process of developing an application using PETSc, and we are currently planning and figuring out the best objects to do this. I currently have some questions about visualization and I/O.

Some of the most important features that we want in the process of developing this code is the ability for easy checkpoint/restarts and visualization. As we are working with a time dependent PDE, I have stumbled upon the "ts" and "tstrajectory" objects that seem to have some very helpful features. However, I am having some trouble extracting information out of the the "tstrajectory" object in an HDF5 format. I initially thought something like this would work, where tj was obtained using TSGetTrajectory(ts,&tj) after a successful solve of the ts object:

PetscViewer viewer;
PetscViewerHDF5Open(PETSC_COMM_WORLD,"output.h5",FILE_MODE_WRITE,&viewer);CHKERRQ(ierr);
TSTrajectoryView(tj,viewer);CHKERRQ(ierr);
PetscViewerDestroy(&viewer);CHKERRQ(ierr);

However, the output file comes out empty. Do I have to extract the solutions one by one? How would I do that? Does the HDF5 viewer only work with vector objects or can it be generalized to other objects? I am trying to maintain the highest degree of abstraction possible (i.e. multiple 2d ode solutions in one hdf5 file).

This seems favorable to me because it would be easy to use the HDF5 file for postprocessing/visualization and restarts, but let me know if you think this is a bad idea and it would be better to just use the HDF5 for output/postprocess and use native PETSc binary files for restarts.

Additionally, as I move towards large visualizations, I would like to use Paraview. I saw that the best way of doing this is to use the petsc_gen_xdmf.py script on an HDF5 solution file. Is this still the best way for PETSc visualization with Paraview?


Thank you,

--
Alfredo Duarte
Graduate Research Assistant
The University of Texas at Austin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210701/18d6ef5b/attachment.html>


More information about the petsc-users mailing list