Importing 3D .msh file into Fenics as mesh

As you have not created any physical curves/surfaces/volumes, you only need to convert the mesh, as described here: Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio
In your case, that would be:


import meshio
msh = meshio.read("mesh.msh")

tetra_cells = []
for cell in msh.cells:
    if  cell.type == "tetra":
        if len(tetra_cells) == 0:
            tetra_cells = cell.data
        else:
            tetra_cells = np.vstack([tetra_cells, cell.data])

tetra_mesh = meshio.Mesh(points=msh.points, cells={"tetra": tetra_cells})
meshio.write("mesh.xdmf", tetra_mesh)

This XDMF-file can be loaded in to dolfin as described in many other posts in this forum. Note that if you want to tag boundaries, you need to follow the instructions in the post Im linking to, saving each of the boundary-meshes to a separate file.

1 Like