How do I append a XDMFFile?

12 months ago by

My code uses HDF5 for checkpointing and restarting, and XDMF for visualization. Unfortunately when I restart and open the XDMFiles again, the default behavior is to overwrite. As far as I can find, there's no option to open a XDMFFile with append permissions. Is this correct? It seems something that should be possible.


Edit: For now I've changed my workflow such that I will always write the new time step solutions to a new XDMF file; but this is not a good solution. I should be able to keep everything in a single file.

Community: FEniCS Project

1 Answer

12 months ago by
OK, so each time step, save your fields to an HDF5File.

When you restart your simulations, load back the HDF5File in append mode.

When you are all done, iterate through the HDF5File fields you created and append them to a single XDMFFile.

Edit:  As of version 2017.1.0, use XDMFFiles for viewing data and HDF5Files for saving the state of a simulation.  For maximum efficiency, save a new and unique HDF5File for each run of your simulation.  Once your simulations are finished, iterate through the HDF5Files and append each field to a single XDMFFile.

Thanks for the idea.

This sounds impractical for large problem sizes. I'm developing a simulation that we plan to run on quite a large computer for quite large problems at some point, so I'd rather do this correctly now. What's stopping fenics from simply being able to append a XDMFFile?

written 12 months ago by Alexander G. Zimmerman  
This is a perfectly correct way of doing this for quite simply any problem or computer.  Separating the post-processing step from the solution process is preferred both in terms of efficiency and ease of implementation.
written 12 months ago by pf4d  
Alright, I'm convinced. I also noticed while playing with this that there's a chance of corrupting my existing solution files if I keep appending. Thanks!
written 11 months ago by Alexander G. Zimmerman  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »