I figured it out. The problem is, that if one chooses to create a mesh in fenicsX using a special argument of the xdmf-writer, then - under some choice of the element number/mesh structure - the xdmf file is corrupted.
If one creates a mesh like this:
msh = create_box(MPI.COMM_WORLD,
[[0.0, 0.0, 0.0], [Lx, Ly, Lz]],
[Nx,Ny,Nz],
cell_type=CellType.hexahedron)
Then, the “bad” way to write to xdmf is
from dolfinx import io
xdmf_file = io.XDMFFile(msh.comm, "my_file.xdmf", "w", encoding=io.XDMFFile.Encoding.ASCII)
xdmf_file.write_mesh(msh)
xdmf_file.close()
while the good way (the one that worked for me) is this:
from dolfinx import io
xdmf_file = io.XDMFFile(msh.comm, "my_file.xdmf", "w")
xdmf_file.write_mesh(msh)
xdmf_file.close()