Problem with dolfin-convert

4 months ago by
Im using fenics version 2017.2.0. running using docker (starting container using:
docker run -ti -p -v $(pwd):/home/fenics/shared -w /home/fenics/shared

Mesh is generated using pygmsh:
import pygmsh

geom = pygmsh.opencascade.Geometry(

rectangle = geom.add_rectangle([-1.0, -1.0, 0.0], 2.0, 2.0)
disk_w = geom.add_disk([-1.0, 0.0, 0.0], 0.5)
disk_e = geom.add_disk([+1.0, 0.0, 0.0], 0.5)
geom.boolean_union([rectangle, disk_w, disk_e])

points, cells, point_data, cell_data, field_data = pygmsh.generate_mesh(geom)

import meshio
meshio.write('mesh.msh', points, cells)​

When I try to use dolfin-convert (typed dolfin-convert mesh.msh mesh.xml inside container) to convert .msh to .xml I get:

Converting from Gmsh format (.msh, .gmsh) to DOLFIN XML format
Traceback (most recent call last):
  File "/usr/local/bin/dolfin-convert", line 132, in <module>
  File "/usr/local/bin/dolfin-convert", line 79, in main
    meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/", line 1304, in convert2xml
    convert(ifilename, XmlHandler(ofilename), iformat=iformat)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/", line 1325, in convert
    gmsh2xml(ifilename, handler)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/", line 288, in gmsh2xml
    elem_type = int(element[1])
ValueError: invalid literal for int() with base 10: ''

How to use dolfin-convert inside container to sonvert mesh to .xml format?

Community: FEniCS Project

1 Answer

3 months ago by
If you're using meshio, you could as well just write it to `xml` straight away. It does support dolfin! (And XDMF for that matter.)
Please login to add an answer/comment or follow this question.

Similar posts:
Search »