This is a continuation of the discussion at:

https://bitbucket.org/fenics-project/dolfin/pull-request/52

The question is how best to save a time-series of Function in HDF5, when the cell and dof layout remains constant.

It has been suggested to use:

u = Function(V)
h0 = HDF5File('Timeseries_of_Function.h5', 'w')
h0.write(u, '/Function')
# Then later
h0.write(u.vector(), "/Vector/0")
h0.write(u.vector(), "/Vector/1")

and to read back:

u = Function(V)
h0 = HDF5File('Timeseries_of_Function.h5', 'r')
h0.read(u, "/Function")
h0.read(u.vector(), "/Function/vector")

The problem with this, is not so much the saving of the vector, but the reading back. It works OK if the vector is distributed in the same way, but will fail
in the general case.

To fix the problem, there needs to be some kind of connection between the original Function and the subsequent Vectors. This could be provided at write time, by storing a link back to the original Function when writing a Vector, or at read time by specifying a base Function and an alternative Vector to read.

Chris R.
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to