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

Error when saving the mesh with .msh format‏

0 votes

Hi,

I am studying the temperature distribution in isolated district heating pipes.

I have generated a mesh of the pipe in 2D with the program Gmsh and saved it as "DoublePipes2D.msh", and on my python code I have the following:

mesh = Mesh('DoublePipes2D.msh')
V = FunctionSpace(mesh, 'Lagrange', 1),

but when running the python code, I get an Error:

Error: Unable to open file.
Reason: Unknown file type (".msh") for file "DoublePipes2D.msh".
Where: This error was encountered inside File.cpp.

Which format should I use?

Thanks
Desirée

asked Jul 7, 2014 by Desirée Cabrera FEniCS Novice (280 points)

1 Answer

+2 votes

Take a look at the dolfin-convert utility (installed with FEniCS). That might do the trick to get it into xml.

answered Jul 7, 2014 by mwelland FEniCS User (8,410 points)

That is, in shell run

$ dolfin-convert DoublePipes2D.msh DoublePipes2D.xml

and then load the mesh from converted file

mesh = Mesh('DoublePipes2D.xml')

Thanks for your answers. I tried that but when writting

$ dolfin-convert DoublePipes2D.msh DoublePipes2D.xml

on the shell run, I get this message:

"dolfin-convert" is not recognized as an internal or external command, operable program or batch file.

Why is that happening?

This post on Launchpad might be useful.

Ok thank you. Now it allows me to generate the .XML but I have the same problem as Niklas. It gives an error message:
"dolfin-order is not recognized as an internal or external command..."

I tried to create a file dolfin-convert.bat, as Johannes Ring suggested, but when writting the following in the sell run:

python "%~dp0\dolfin-convert" %*

I got this error: python: can't open file '%~dp0\dolfin-convert%*': [Errno2] No such file or directory.

I suggest you post your problem on the FeniCS support
http://fenicsproject.org/mailman/listinfo/fenics-support

Ok! thank you for your help MiroK

If your geometry isn't too complex, you might be able to do a workaround:

http://fenicsproject.org/documentation/dolfin/dev/python/demo/documented/mesh-generation/python/documentation.html

...