[Gmsh] meshing two bodies with redundant common boundary

NENNIG Benoit benoit.nennig at supmeca.fr
Wed Oct 15 11:47:00 CEST 2014

Dear Gmsh users,

I am trying to mesh two bodies coming from one step file (coming from FreeCAD), like a shape inside a cube.
The first volume is the shape and the second one is its complement with respect to the cube.

I need coincident/compatible mesh on the common boundary. However, the common boundary is present twice in the step file and gmsh behavior is not clear (for me) :
- sometimes the mesh is coincident, if the boundary is made of planes
- sometimes the mesh is not coincident for some surfaces of the common boundary, but is ok for at least one surface of the common boundary

When I observed non compatible mesh I try to use :
Surf2LineM[] = Boundary { Surface{7};};
Surf2LineS[] = Boundary { Surface{23};};
Periodic Surface 23 { Surf2LineS[]}= 7 {Surf2LineM[] };

It seems to work only if I specify 'Periodic Surface' for the no coincident mesh surface, otherwise gmsh crashes.

Then I use 
Coherence Mesh;
to remove the redundant mesh

Can you tell me what is the best way to impose coincident mesh on surfaces present twice ?
How to know which one of the 2 surfaces mesh is used for the volume mesh ?
Why it works for some surfaces and not all ? 


gmsh 2.8.4 - linux 64 bits