FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
777 stars 181 forks source link

Time stamps for XDMF mesh #3334

Open mcjbo opened 3 months ago

mcjbo commented 3 months ago

Describe new/missing feature

In legacy dolfin, functions were written to XDMF file by XDMFFile.write(u, t). If the mesh changed for any other t, the new mesh was written to file again along with u. This allowed time dependent meshes in XDMF files.

However, in current dolfinx we write functions to file by

XDMFFile.write_mesh(mesh)
XDMFFile.write_function(u, t)

In commit #2532, false claims about time steps for write_mesh were removed from doc. If there ever was a time stamp feature, I would highly encourage the developers to bring it back. See for instance this post in the discourse. Otherwise, to work with time dependent meshes, one would have to work with VTK files, making output files and post visualization much more costly.

Suggested user interface

XDMFFile.write_mesh(mesh, t)
XDMFFile.write_function(u, t)
jorgensd commented 2 months ago

We are likely not going to pursue the XDMF file format further, as it is no longer maintained by Kitware (last PR is from 4 years ago at: https://gitlab.kitware.com/xdmf/xdmf).

Note that for outputting, we encourage users to use VTXWriter which has a MeshUpdatePolicy: https://docs.fenicsproject.org/dolfinx/v0.8.0/python/generated/dolfinx.io.html#dolfinx.io.VTXWriter

mesh_policy – Controls if the mesh is written to file at the first time step only when a Function is written to file, or is re-written (updated) at each time step. Has an effect only for Function output