[petsc-dev] reading vector from HDF5 with DMPlex

Matthew Knepley knepley at gmail.com
Mon Feb 15 01:36:52 CST 2016


Sorry I took too long. It has been hectic this semester. The logic is
somewhat complicated with
regard to global and local here, but it is to ensure that boundary values
are put in on output. I
am not sure how to make it more transparent, but I am willing to take
suggestions.

  Thanks,

    Matt

On Sun, Feb 14, 2016 at 9:16 PM, Adrian Croucher <a.croucher at auckland.ac.nz>
wrote:

> OK, I think I've figured out what the problem was here. The
> 'cell_geometry' vector I wrote to the HDF5 file was actually a local vector
> (not global). If I first do DMLocalToGlobal on it and then VecView the
> global vector, it turns up under the 'fields' group, and I can access it
> for reading back in.
>
> Cheers, Adrian
>
> On 12/02/16 18:07, Adrian Croucher wrote:
>
>> hi
>>
>> I'm having trouble reading in a vector on a DMPlex from an HDF5 file. The
>> attached minimal program (readdmvec2.F90) illustrates the problem.
>>
>> What it does is:
>> - reads in a DMPlex from file (ghotcol.exo) and sets it up (distributes,
>> constructs ghost cells and default section)
>> - uses DMGetGlobalVector() to get the vector
>> - sets its object name to 'cell_geometry'
>> - opens the HDF5 file (hotcol_ss.h5) in a viewer and tries to read the
>> vector using VecLoad()
>>
>> The VecLoad() dies, saying "object 'cell_geometry' doesn't exist" in the
>> HDF5 file. (Full error message is below.)
>>
>> But it does exist- it shows up as a dataset in the '/' group in h5dump. I
>> can also read it in from a Python script and h5py, e.g.:
>>
>> >>> import h5py
>> >>> f = h5py.File('hotcol_ss.h5')
>> >>> f['cell_geometry'][:]
>>
>> Any idea why VecLoad() can't find it? I get the same error running on any
>> number of processors.
>>
>> The program that writes 'cell_geometry' to the HDF5 file also
>> subsequently writes time-dependent simulation results to the same file
>> (that's what the other datasets are in there) using
>> DMSetOutputSequenceNumber() and VecView(). I am wondering if the problem is
>> related to this, because if I just write a simple vector out to the file by
>> itself it seems to read back in ok.
>>
>> Cheers, Adrian
>>
>>
>>
> --
> Dr Adrian Croucher
> Senior Research Fellow
> Department of Engineering Science
> University of Auckland, New Zealand
> email: a.croucher at auckland.ac.nz
> tel: +64 (0)9 923 84611
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160215/15d1e1c2/attachment.html>


More information about the petsc-dev mailing list