3

I would like to create a hollow or thick semi-torus, for this, I use the following commands:

SetFactory ("OpenCASCADE");
Torus (1) = {0,0,0, 170,30, Pi};
Torus (2) = {0,0,0, 170,20, Pi};
BooleanDifference (8) = {Volume {1}; Delete; } {Volume {2}; Delete; };

When I try to create the 3D mesh it gives the following error:

PLC Error: A segment and a facet intersect at point
Info: (122,229,106,391, -9.48334).
Info: Segment: [314,311] # -1 (0)
Info: Facet: [7,54,60] # 1
Error: Invalid boundary mesh (segment-facet intersection) on surface 1, intersection (122.229,106.391, -9.48334)
Error: No elements in volume 8

Why is this happening? How can it be fixed?.

Anton Menshov
  • 2,266
  • 14
  • 34
  • 55
F.Mark
  • 147
  • 6

1 Answers1

0

There is no problem with your geometry definitions. Everything is legit.

However, in the GEO file, you are not specifying the desired element size for the mesh. And, in this particular case, GMSH fails to create a proper tetrahedral mesh with what it chooses as a default one.

The following will allow you to create a proper tetrahedral mesh on your hollow semi-torus:

Mesh.CharacteristicLengthMin = 5;
Mesh.CharacteristicLengthMax = 10;


SetFactory ("OpenCASCADE");
Torus (1) = {0,0,0, 170,30, Pi};
Torus (2) = {0,0,0, 170,20, Pi};
BooleanDifference (8) = {Volume {1}; Delete; } {Volume {2}; Delete; };

Here, I manually specified the min and max element size. My choice is arbitrary and is dictated mostly by getting a visually appealing mesh.

You can read more about various options of specifying mesh element size (and about the mesh element size itself) in the corresponding section of GMSH documentation.

Anton Menshov
  • 2,266
  • 14
  • 34
  • 55
  • Thank you very much, by any chance do you know if there is any command to make the density of tetahedra constant in the nanostructure? – F.Mark Apr 11 '20 at 18:54
  • @F.Mark it cannot be exactly constant. But you can define mesh element size in multiple ways and use different meshing algorithms within GMSH. It would be a topic for a separate question with details on what kind of mesh do you expect and some other mesh traits. – Anton Menshov Apr 11 '20 at 19:36
  • Thanks so much, One more question, if I have several volumes in contact, ie, a parallelepiped built of several cubes, GMSH assumes that they form a single geometry for build the mesh? – F.Mark Apr 12 '20 at 10:55
  • No, it does not. Your mesh by default would be node-connected withing each cube but disconnected (no nodes matching) across cubes. – Anton Menshov Apr 12 '20 at 16:17
  • Thanks, in the case of the hollow torus, in the code is necessary to put the instruction Physical Surface or Physical Volume, for indicate the walls? – F.Mark Apr 15 '20 at 07:38