This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Unknown file type (".xdmf") for file "meshes/kinking.xdmf"

+1 vote

Dear all,

I am using fenics with dockers and I am trying to convert a xml (large) mesh to xdmf format. I ran into this error:

*** -------------------------------------------------------------------------
*** Error: Unable to open file.
*** Reason: Unknown file type (".xdmf") for file "meshes/kinking.xdmf".
*** Where: This error was encountered inside File.cpp.
*** Process: 0


*** DOLFIN version: 2016.2.0
*** Git changeset: 0f003bc07ee5fd583fb956245016d5972b80fea1

which seems to me that I do not have HDF5. In the fenics dockers instruction, it is written 'the stable image is a great place to start experimenting with FEniCS and includes PETSc, SLEPc, slepc4py, petsc4py, MPI, HDF5 and many other difficult dependencies already compiled for you.' I really have no idea now.

I appreciate your help.

Phu

asked Jan 4, 2017 by pnguyen FEniCS Novice (140 points)

Thanks a lot, Johann. With your help, I passed that error. My code is as follows

mesh = Mesh(subdir + meshname + ".xml")
xdmf = XDMFFile(mesh.mpi_comm(), subdir + meshname + ".xdmf")
xdmf.write(mesh)
#File(subdir + meshname + ".xdmf") << mesh
return Mesh(subdir + meshname + ".xdmf")

Yet, I got the same error at the 'Mesh(subdir + meshname + ".xdmf")'.

You need to use XDMFFile:

mesh2 = Mesh()                                 
file = XDMFFile(mpi_comm_world(), filename)    
file.read(mesh2)                               
...