I/O from XDMF/HDF5 files in dolfin-x

Thank you, this helped me realize at least the part of the issue. It works for the real build, also in Jupyterlab, but it doesn’t work for the complex one. Also not if I reproduce your approach. Do you have any suggestion for that? Is there maybe any way to use the complex build but write the real and imaginary parts separately with a4dx?

Regarding the vtk files, I am getting the following error with the nightly build:


RuntimeError Traceback (most recent call last)
Cell In[1], line 42
39 with io.XDMFFile(comm, f"./0_{comm.size}proc.xdmf", “w”) as xdmf:
40 # Should work
41 xdmf.write_mesh(mesh_new)
—> 42 xdmf.write_function(w)
44 with io.XDMFFile(comm, f"./1_{comm.size}proc.xdmf", “w”) as xdmf:
45 # Should work
46 xdmf.write_mesh(mesh)

File /usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/io/utils.py:234, in XDMFFile.write_function(self, u, t, mesh_xpath)
218 def write_function(self, u: Function, t: float = 0.0, mesh_xpath=“/Xdmf/Domain/Grid[@GridType=‘Uniform’][1]”):
219 “”“Write function to file for a given time.
220
221 Note:
(…)
232
233 “””
→ 234 super().write_function(getattr(u, “_cpp_object”, u), t, mesh_xpath)

RuntimeError: Degree of output Function must be same as mesh degree. Maybe the Function needs to be interpolated?

This happens for both the real and complex build and it does not happen in stable.