MPI_ERR_RANK: invalid rank When reading mesh from .msh file generated by Gmsh

I created a mesh for a circle domain using Gmsh (GUI version), and save it as .msh file.


Then I’d like to read the .msh file using dolfinx.io.gmshio.read_from_msh() and save it as .xdmf file. The reading code is as following:

import dolfinx
from mpi4py import MPI

path = "../data/mesh/"

domain = dolfinx.io.gmshio.read_from_msh(path + "circle.msh", MPI.COMM_WORLD)[0]

dolfinx.io.XDMFFile(MPI.COMM_WORLD, path + "circle.xdmf", "w").write_mesh(domain)

Howerver, some errors output:

Info    : Reading '../data/mesh/circle.msh'...
Info    : 4 entities
Info    : 8133 nodes
Info    : 8227 elements
Info    : Done reading '../data/mesh/circle.msh'
MPI_ERR_RANK: invalid rank
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI COMMUNICATOR 8 DUP FROM 4
with errorcode 6.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

Process finished with exit code 6

Without having the mesh it is impossible to give guidance. Usually this type of error means that you have either:

  1. Not applied physical entities to all the surfaces, lines etc you want to read in.
  2. You have used the option

Mesh.SaveAll
Save all elements, even if they don’t belong to physical groups (for some mesh formats, this removes physical groups altogether)
Default value: 0
Saved in: -

from GMSH, adding extra entities to your mesh.

Thanks. This is the .geo and .msh files.

The problem is with your geo file.
In general, I would not advice using geo files, as both adding a Physical Point and the Physical Surface through that interface creates an invalid mesh.

I would strongly suggest using the Python API.
You can use embed to embed the point within your mesh.
http://gmsh.info/doc/cookbook/geometry/embed-point.html

I’ve just made a tutorial where i try to explain some of the features of gmsh at: Meshes from external sources — FEniCS Tutorial @ Sorbonne
but there are also many gmsh tutorials available at the gmsh home pages.

Thank you very much. I will learn it.