54216

Gmsh issue with physical entities

Question:

I have a *.geo file that I have written with a python script. The main use of this *.geo file is to construct and save a triangular mesh. In gmsh you can label interest entities with the command Physical. For example Physical Point, Physical Line, etc.

Here comes the *.geo file:

// This is a test for *.geo h = 1.00E+01 ; Point( 1 ) = { 1.00E+00 , 1.00E+00 , 0.00E+00 ,h}; Point( 2 ) = { 7.00E+01 , 1.00E+00 , 0.00E+00 ,h}; Point( 3 ) = { 7.00E+01 , 7.00E+01 , 0.00E+00 ,h}; Point( 4 ) = { 1.00E+00 , 7.00E+01 , 0.00E+00 ,h}; Point( 5 ) = { 3.80E+01 , 2.70E+01 , 0.00E+00 ,h*0.5}; Point( 6 ) = { 3.80E+01 , 2.80E+01 , 0.00E+00 ,h*0.5}; Point( 7 ) = { 3.80E+01 , 2.90E+01 , 0.00E+00 ,h*0.5}; Point( 8 ) = { 3.80E+01 , 3.00E+01 , 0.00E+00 ,h*0.5}; Point( 9 ) = { 3.80E+01 , 3.10E+01 , 0.00E+00 ,h*0.5}; Point( 10 ) = { 3.80E+01 , 3.20E+01 , 0.00E+00 ,h*0.5}; Point( 11 ) = { 3.80E+01 , 3.30E+01 , 0.00E+00 ,h*0.5}; Point( 12 ) = { 3.90E+01 , 3.30E+01 , 0.00E+00 ,h*0.5}; Point( 13 ) = { 3.90E+01 , 3.40E+01 , 0.00E+00 ,h*0.5}; Point( 14 ) = { 3.90E+01 , 3.50E+01 , 0.00E+00 ,h*0.5}; Point( 15 ) = { 3.90E+01 , 3.60E+01 , 0.00E+00 ,h*0.5}; Point( 16 ) = { 4.00E+01 , 3.60E+01 , 0.00E+00 ,h*0.5}; Point( 17 ) = { 4.00E+01 , 3.70E+01 , 0.00E+00 ,h*0.5}; Point( 18 ) = { 4.10E+01 , 3.70E+01 , 0.00E+00 ,h*0.5}; Point( 19 ) = { 4.10E+01 , 3.80E+01 , 0.00E+00 ,h*0.5}; Point( 20 ) = { 4.10E+01 , 3.90E+01 , 0.00E+00 ,h*0.5}; Point( 21 ) = { 4.20E+01 , 3.90E+01 , 0.00E+00 ,h*0.5}; Point( 22 ) = { 4.20E+01 , 4.00E+01 , 0.00E+00 ,h*0.5}; Point( 23 ) = { 4.30E+01 , 4.00E+01 , 0.00E+00 ,h*0.5}; Point( 24 ) = { 4.40E+01 , 4.00E+01 , 0.00E+00 ,h*0.5}; Point( 25 ) = { 4.40E+01 , 4.10E+01 , 0.00E+00 ,h*0.5}; Point( 26 ) = { 4.50E+01 , 4.10E+01 , 0.00E+00 ,h*0.5}; Point( 27 ) = { 4.50E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 28 ) = { 4.60E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 29 ) = { 4.70E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 30 ) = { 4.80E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 31 ) = { 4.80E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 32 ) = { 4.90E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 33 ) = { 5.00E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 34 ) = { 5.10E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 35 ) = { 5.20E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 36 ) = { 5.30E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 37 ) = { 5.40E+01 , 4.30E+01 , 0.00E+00 ,h*0.5}; Point( 38 ) = { 5.40E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 39 ) = { 5.50E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 40 ) = { 5.60E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 41 ) = { 5.70E+01 , 4.20E+01 , 0.00E+00 ,h*0.5}; Point( 42 ) = { 5.70E+01 , 4.10E+01 , 0.00E+00 ,h*0.5}; Point( 43 ) = { 5.80E+01 , 4.10E+01 , 0.00E+00 ,h*0.5}; Point( 44 ) = { 5.80E+01 , 4.00E+01 , 0.00E+00 ,h*0.5}; Point( 45 ) = { 5.90E+01 , 4.00E+01 , 0.00E+00 ,h*0.5}; Point( 46 ) = { 6.00E+01 , 4.00E+01 , 0.00E+00 ,h*0.5}; Point( 47 ) = { 6.00E+01 , 3.90E+01 , 0.00E+00 ,h*0.5}; Point( 48 ) = { 6.10E+01 , 3.90E+01 , 0.00E+00 ,h*0.5}; Point( 49 ) = { 6.10E+01 , 3.80E+01 , 0.00E+00 ,h*0.5}; Point( 50 ) = { 6.10E+01 , 3.70E+01 , 0.00E+00 ,h*0.5}; Point( 51 ) = { 6.20E+01 , 3.70E+01 , 0.00E+00 ,h*0.5}; Point( 52 ) = { 6.20E+01 , 3.60E+01 , 0.00E+00 ,h*0.5}; Point( 53 ) = { 6.30E+01 , 3.60E+01 , 0.00E+00 ,h*0.5}; Point( 54 ) = { 6.30E+01 , 3.50E+01 , 0.00E+00 ,h*0.5}; Point( 55 ) = { 6.30E+01 , 3.40E+01 , 0.00E+00 ,h*0.5}; Point( 56 ) = { 6.30E+01 , 3.30E+01 , 0.00E+00 ,h*0.5}; Point( 57 ) = { 6.40E+01 , 3.30E+01 , 0.00E+00 ,h*0.5}; Point( 58 ) = { 6.40E+01 , 3.20E+01 , 0.00E+00 ,h*0.5}; Point( 59 ) = { 6.40E+01 , 3.10E+01 , 0.00E+00 ,h*0.5}; Point( 60 ) = { 6.40E+01 , 3.00E+01 , 0.00E+00 ,h*0.5}; Point( 61 ) = { 6.40E+01 , 2.90E+01 , 0.00E+00 ,h*0.5}; Point( 62 ) = { 6.40E+01 , 2.80E+01 , 0.00E+00 ,h*0.5}; Point( 63 ) = { 6.40E+01 , 2.70E+01 , 0.00E+00 ,h*0.5}; Point( 64 ) = { 6.30E+01 , 2.70E+01 , 0.00E+00 ,h*0.5}; Point( 65 ) = { 6.30E+01 , 2.60E+01 , 0.00E+00 ,h*0.5}; Point( 66 ) = { 6.30E+01 , 2.50E+01 , 0.00E+00 ,h*0.5}; Point( 67 ) = { 6.30E+01 , 2.40E+01 , 0.00E+00 ,h*0.5}; Point( 68 ) = { 6.20E+01 , 2.40E+01 , 0.00E+00 ,h*0.5}; Point( 69 ) = { 6.20E+01 , 2.30E+01 , 0.00E+00 ,h*0.5}; Point( 70 ) = { 6.10E+01 , 2.30E+01 , 0.00E+00 ,h*0.5}; Point( 71 ) = { 6.10E+01 , 2.20E+01 , 0.00E+00 ,h*0.5}; Point( 72 ) = { 6.10E+01 , 2.10E+01 , 0.00E+00 ,h*0.5}; Point( 73 ) = { 6.00E+01 , 2.10E+01 , 0.00E+00 ,h*0.5}; Point( 74 ) = { 6.00E+01 , 2.00E+01 , 0.00E+00 ,h*0.5}; Point( 75 ) = { 5.90E+01 , 2.00E+01 , 0.00E+00 ,h*0.5}; Point( 76 ) = { 5.80E+01 , 2.00E+01 , 0.00E+00 ,h*0.5}; Point( 77 ) = { 5.80E+01 , 1.90E+01 , 0.00E+00 ,h*0.5}; Point( 78 ) = { 5.70E+01 , 1.90E+01 , 0.00E+00 ,h*0.5}; Point( 79 ) = { 5.70E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 80 ) = { 5.60E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 81 ) = { 5.50E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 82 ) = { 5.40E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 83 ) = { 5.40E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 84 ) = { 5.30E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 85 ) = { 5.20E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 86 ) = { 5.10E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 87 ) = { 5.00E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 88 ) = { 4.90E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 89 ) = { 4.80E+01 , 1.70E+01 , 0.00E+00 ,h*0.5}; Point( 90 ) = { 4.80E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 91 ) = { 4.70E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 92 ) = { 4.60E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 93 ) = { 4.50E+01 , 1.80E+01 , 0.00E+00 ,h*0.5}; Point( 94 ) = { 4.50E+01 , 1.90E+01 , 0.00E+00 ,h*0.5}; Point( 95 ) = { 4.40E+01 , 1.90E+01 , 0.00E+00 ,h*0.5}; Point( 96 ) = { 4.40E+01 , 2.00E+01 , 0.00E+00 ,h*0.5}; Point( 97 ) = { 4.30E+01 , 2.00E+01 , 0.00E+00 ,h*0.5}; Point( 98 ) = { 4.20E+01 , 2.00E+01 , 0.00E+00 ,h*0.5}; Point( 99 ) = { 4.20E+01 , 2.10E+01 , 0.00E+00 ,h*0.5}; Point( 100 ) = { 4.10E+01 , 2.10E+01 , 0.00E+00 ,h*0.5}; Point( 101 ) = { 4.10E+01 , 2.20E+01 , 0.00E+00 ,h*0.5}; Point( 102 ) = { 4.10E+01 , 2.30E+01 , 0.00E+00 ,h*0.5}; Point( 103 ) = { 4.00E+01 , 2.30E+01 , 0.00E+00 ,h*0.5}; Point( 104 ) = { 4.00E+01 , 2.40E+01 , 0.00E+00 ,h*0.5}; Point( 105 ) = { 3.90E+01 , 2.40E+01 , 0.00E+00 ,h*0.5}; Point( 106 ) = { 3.90E+01 , 2.50E+01 , 0.00E+00 ,h*0.5}; Point( 107 ) = { 3.90E+01 , 2.60E+01 , 0.00E+00 ,h*0.5}; Point( 108 ) = { 3.90E+01 , 2.70E+01 , 0.00E+00 ,h*0.5}; Point( 109 ) = { 3.80E+01 , 2.70E+01 , 0.00E+00 ,h*0.5}; // Writing stuff for domain: 4 Line( 110 ) = { 1 , 2 , 3 , 4 , 1 }; Line Loop( 111 ) = { 110 }; Physical Line( "Border_0" ) = { 111 }; // Writing stuff for domain: 105 BSpline( 112 ) = { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 5}; Line Loop( 113 ) = { 112 }; Physical Line( "Border_1" ) = { 113 }; Plane Surface( 114 ) = { 113 }; Physical Surface( "Inclusion_1" ) = { 114 }; Plane Surface( 115 ) = {111,113}; Physical Surface( "Matrix_domain" ) = { 115 };

The created *.msh file, contains the mesh, has identified the Physical labels, but I can not find the corresponding element sets.

Answer1:

There is definitely something wrong in how you write the file. In GMSH, you would usually have Line(100) = {1,2}; connecting only two points and then Line Loop that would create the loops out of the lines. Here, this is violated both for the straight segments (forming a square) and for the BSplines (forming a circular-like) inclusion.

I've manually edited the file to achieve the (supposedly, expected) result:

Line( 210 ) = { 1 , 2 }; Line( 211) = {2,3}; Line( 212) = {3,4}; Line(213) = {4,1}; Line Loop( 111 ) = { 210,211,212,213 }; Physical Line( "Border_0" ) = { 210, 211,212,213}; // Writing stuff for domain: 105 BSpline (310) = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34}; BSpline (311) = {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60}; BSpline (312) = {60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86}; BSpline (313) = {86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 5,6,7,8}; Line Loop( 113 ) = { 310,311,312,313 }; Physical Line( "Border_1" ) = { 310, 311,312,313}; Plane Surface( 114 ) = { 113 }; Physical Surface( "Inclusion_1" ) = { 114 }; Plane Surface( 115 ) = {111,113}; Physical Surface( "Matrix_domain" ) = { 115 };

Now, I split the "circle" into 4 segments as it recommended to have arc angles <180 degrees in GMSH. And though BSpline is not necessarily a Circle (command for an arc in GMSH), I tend to use this convention here as well.

Similarly, the actual Lines (not Line Loops) have to be added to the Physical Line.

Now, I guess, you can find your elements (if I correctly understood your question).

<a href="https://i.stack.imgur.com/5f4KK.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/5f4KK.png" data-original="https://i.stack.imgur.com/5f4KK.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Recommend