This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

parallel output of a time series in hdf5 format

0 votes

I found that pvd is not well suited for my code. I want to use h5 format to save the solution at each time step in parallel. I want to know the hdf5 equivalent of

# solve for u and save at every time step 
f = File("output.pvd")
while t < T:
    u.vector() = u0.vector()
    solve.solve()    # solve for u
    f << u, t

that paraview can read easily.

asked Mar 24, 2014 by bshankar FEniCS Novice (790 points)

Hi, can you tell us why you think HDF5 format is better?
Thanks

The main reason was portability. 'pvd' outputs many files (equal to the # of processors used to run the code). And some benchmarks indicate that HDF5 is faster.

Thanks, I'll take a look at HDF5 too...

1 Answer

+4 votes
 
Best answer
f = HDF5File('foo.h5')

But as I know, XDMF format is suited for visualization. (In fact it uses HDF5 as a backend.) So,

f = XDMFFile('foo.xdmf')

Explore f.parameters using

 info(f.parameters, True)

to avoid duplicate mesh storage when appropriate.

answered Mar 24, 2014 by Jan Blechta FEniCS Expert (51,420 points)
selected Mar 24, 2014 by bshankar

xdmf is really good. Thanks!

Hi guys, Looking at the xdmffile parameters, 'rewrite_function_mesh' is self explanatory, but what does ' flush_output' mean exactly?
Thanks

flush_output avoids buffering (at some performance cost) so that files should be consistent and ready for reading at every single time during calculation.

There is also new integer parameter multi_file which can serve to workaround issue 278.

Thanks. I was playing around with it and found that it helped with the issue 278.

...