The reasoning behind @Jesus_Vellojin answer is that dolfinx.io.gmshio
uses the GMSH Python API under the hood to extract the cells of interest using the physical groups:
It is also written explicitly in the docs:
https://docs.fenicsproject.org/dolfinx/v0.7.3/python/generated/dolfinx.io.gmshio.html#dolfinx.io.gmshio.model_to_mesh
In general, gmsh doesn’t store un-tagged surfaces, lines, etc, as written in
1.2.3 Elementary entities vs. physical groups
It is usually convenient to combine elementary geometrical entities into more meaningful groups, e.g. to define some mathematical (“domain”, “boundary with Neumann condition”), functional (“left wing”, “fuselage”) or material (“steel”, “carbon”) properties. Such grouping is done in Gmsh’s geometry module (see Geometry module) through the definition of “physical groups”.
By default in the native Gmsh MSH mesh file format (see Gmsh file formats), as well as in most other mesh formats, if physical groups are defined, the output mesh only contains those elements that belong to at least one physical group. (Different mesh file formats treat physical groups in slightly different ways, depending on their capability to define groups.) To save all mesh elements whether or not physical groups are defined, use theMesh.SaveAll
option (see Mesh options) or specify-save_all
on the command line. In some formats (e.g. MSH2), settingMesh.SaveAll
will however discard all physical group definitions.
in
If you save all entities in a GMSH model, you risk overlapping/duplicate cells/facets etc.