[petsc-users] Read and write HDF5 files

Matthew Knepley knepley at gmail.com
Thu Sep 8 07:38:33 CDT 2022

On Thu, Sep 8, 2022 at 7:44 AM Quentin Chevalier <
quentin.chevalier at polytechnique.edu> wrote:

> Hello PETSc users !
> I'm trying to use PETSc routine to read and write complex vectors to
> binary files in parallel.
> I'm using dolfinx and petsc4py inside a docker container. My end goal is
> to write a dolfinx Function object to file, then read it again.
> My current code goes something like :
> viewer = pet.Viewer().createHDF5("file.h5", 'w', comm)
> function.vector.view(viewer)
> And fails with traceback :
> petsc4py.PETSc.Error: error code 86
> [9] PetscViewerSetType() at
> /usr/local/petsc/src/sys/classes/viewer/interface/viewreg.c:435
> [9] Unknown type. Check for miss-spelling or missing package:
> https://petsc.org/release/install/install/#external-packages
> [9] Unknown PetscViewer type given: hdf5
> The relevant functions show on pydoc, what am I doing wrong ?

You have not built PETSc with HDF5 support. In order to do this, you need
to configure it using --with-hdf5-dir=/path/to/hdf5 or maybe



> Cheers,
> Quentin

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/20220908/d74e96bc/attachment.html>

More information about the petsc-users mailing list