I ask this question because I do not see (m)any examples and I'd like to avoid to spend hours or days to work into a mesher only to see that it is impossible:

Consider the sketch below. As you see, I have a box with a mesh. Inside this box, there's also a circle. This is sort of an "internal boundary" and I would like that some nodes exactly stick on the circle and the edges between "inner" and "outer" elements approximate the circle shape as good as possible. In real world, the circle could be a way more complex structure, and there could even be inner-inner surfaces.

A few questions arise:

  • Does this task have a "name" (to facilitate internet searches)?
  • Is it a task that every reasonable mesher can handle or do I need something special?
  • I currently try GMESH. Is that possible with GMESH? (An example would be greatly appreciated.)
  • Or do you recommend something different?


  • $\begingroup$ Let me see if I understand what you want. You want to have a face split in two regions by a contour, and you want to mesh both regions, being sure that the contour is explicitly meshed. Am I right? I something like this: imgur.com/Niqj1Bs what you want? $\endgroup$
    – nicoguaro
    May 3, 2016 at 16:30
  • $\begingroup$ Absolutely right. I think it's nothing very sophisticated, but on the other hand it does not seem to be very common. $\endgroup$
    – Michael
    May 3, 2016 at 16:31

4 Answers 4


What you mention is common, at least in my field. What you need to consider is the definition of the regions. The inside region is defined by one contour/loop: the circle. The outer region is defined by two contours/loops: the square and the circle. There are different ways of representing these. One of them is BRep.

I have done this type of meshes in different software: Gmsh, Triangle, Ansys, Abaqus. Particularly in Gmsh, you can see the .geo file below

Point(1) = {-2, -2, 0, 1.0};
Point(2) = {2, -2, 0, 1.0};
Point(3) = {2, 2, 0, 1.0};
Point(4) = {-2, 2, 0, 1.0};
Point(5) = {-1, 0, 0, 1.0};
Point(6) = {0, -1, 0, 1.0};
Point(7) = {1, 0, 0, 1.0};
Point(8) = {0, 1, 0, 1.0};
Point(9) = {0, 0, 0, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Circle(5) = {5, 9, 6};
Circle(6) = {6, 9, 7};
Circle(7) = {7, 9, 8};
Circle(8) = {8, 9, 5};
Line Loop(9) = {8, 5, 6, 7};
Plane Surface(10) = {9};
Line Loop(11) = {3, 4, 1, 2};
Plane Surface(12) = {9, 11};

And the mesh is the same as shown before

enter image description here


Besides the softwares pointed-at in other answers, if you are working in 2D, then Shewchuk's triangle software [1] can do the job. If you are working in 3D, then Si's tetgen software [2] has this functionality. To optimize the mesh (2D or 3D), you can use the MMGTools suite [3],[4]. My own software GEOGRAM [5] also has some mesh optimization functionalities.

[1] https://www.cs.cmu.edu/~quake/triangle.html

[2] http://wias-berlin.de/software/tetgen/

[3] https://www.mmgtools.org/

[4] https://gforge.inria.fr/projects/mmg3d/

[5] http://alice.loria.fr/software/geogram/doc/html/index.html


Meshing a geometry with an "internal region" is not an operation that all meshers can perform. Some allow you to specify one or more internal regions but then automatically assume these are holes.

I have not seen a gmsh example like you show but am not certain it cannot create such a mesh.

However the netgen mesher:


has an example that is very similar to yours. If you install Netgen 6.1, load the small geometry example, netgen6.1/share/netgen/squarecircle.in2d, and then push the "Generate Mesh" button in the GUI, you will get a mesh very similar to the one you show above. This mesh can be written to a file in a variety of formats including gmsh.


If you have the resources to obtain a license, Cubit from Sandia National Labs has this capability. I have used it often in the past to generate many meshes like the one in your example.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.