# [Gmsh] Unsolved problem! mesh cannot adapt from fine to coarse in a simple 2D geo

ryan kim realnumeric at gmail.com
Wed Apr 22 10:38:41 CEST 2015

```I have used gmsh in my application for a while. However, one kind of simple
and standard geometry still makes bad mesh result. The geometry is just a
rectangular plane with four small holes at each corner like this:
-------------------------------------
|                                    |
|                                    |
|     __                    __    |
|     |  |                    |   |   |
|     ---                     ----   |
|                                    |
|                                    |
|     __                     __   |
|     |   |                    |   |  |
|     ----                     ----  |
|                                    |
|                                    |
|____________________ |

Surprisingly, gmsh generated fine mesh not only around the four holes, but
also in the area between the holes. Therefore, the entire mesh size is
huge. The ideal mesh should only have fine mesh around the holes at corner
since coarse mesh is enough for the center area.

problem. However, no good solution has been provided. Someone suggested
using
Mesh.CharacteristicLengthExtendFromBoundary= 0;
However, it indeed generated coarse mesh at the center but the triangle
quality is bad with very sharp angle.
Using fields: "Attractor", and "Threshold" as in tutorial t10 does not work
as well.

Here is the script of the simple test case as described above. I also
attached the bad mesh result as I mentioned. Hope someone can discuss this
classic problem with me.

lc = 10;
lc1 = 1;
Point(1) = {-100, -100, 0, lc};
Point(2) = {100, -100,  0, lc} ;
Point(3) = {100, 100, 0, lc} ;
Point(4) = {-100,  100, 0, lc} ;
Line(1) = {1,2} ;
Line(2) = {3,2} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;
Line Loop(1) = {4,1,-2,3};

Point(5) = {49, 49, 0, lc1};
Point(6) = {49, 51,  0, lc1} ;
Point(7) = {51, 51, 0, lc1} ;
Point(8) = {51, 49, 0, lc1} ;
Line(6) = {5,6} ;
Line(7) = {7,6} ;
Line(8) = {7,8} ;
Line(9) = {8,5} ;
Line Loop(2) = {9,6,-7,8};

Point(11) = {49, -49, 0, lc1};
Point(12) = {49, -51, 0, lc1};
Point(13) = {51, -51, 0, lc1};
Point(14) = {51, -49, 0, lc1};
Line(10) = {11,12} ;
Line(11) = {13,12} ;
Line(12) = {13,14} ;
Line(13) = {14,11} ;
Line Loop(3) = {13,10,-11,12};

Point(15) = {-49, 49, 0, lc1};
Point(16) = {-49, 51,  0, lc1} ;
Point(17) = {-51, 51, 0, lc1} ;
Point(18) = {-51, 49, 0, lc1} ;
Line(14) = {15,16} ;
Line(15) = {17,16} ;
Line(16) = {17,18} ;
Line(17) = {18,15} ;
Line Loop(4) = {17,14,-15,16};

Point(19) = {-49, -49, 0, lc1};
Point(20) = {-49, -51,  0, lc1} ;
Point(21) = {-51, -51, 0, lc1} ;
Point(22) = {-51, -49, 0, lc1} ;
Line(18) = {19,20} ;
Line(19) = {21,20} ;
Line(20) = {21,22} ;
Line(21) = {22,19} ;
Line Loop(5) = {21,18,-19,20};

Plane Surface(1) = {1, 2, 3, 4, 5} ;
//Mesh.CharacteristicLengthExtendFromBoundary= 0;

Thanks,
Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20150422/c17f89f0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Type: image/png
Size: 42515 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20150422/c17f89f0/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...