[Gmsh] Control mesh size through API

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu Jan 29 09:06:40 CET 2015


> On 12 Dec 2014, at 00:26, Bin Wen <dracifer at gmail.com> wrote:
> 
> I also have figured out that the unexpected small element size is somehow the result of the large size of the domain I am trying to discretize. When I try to mesh a 1x1 square, the mesh control works perfectly. However, when I enlarge the square to 100x100, the mesh control does not perform properly. I did set the characteristic length according to the domain size. Not sure if there is any parameter that I should notice in order to correct this size effect. Thanks
> 
> 2014-12-11 10:00 GMT-06:00 Bin Wen <dracifer at gmail.com>:
> I have figured out how to control mesh using background fields through API. But have another question. 
> 
> I am trying to mesh a complex shaped polygon (many edges) using triangle elements. And I expect to have fine mesh close to the zigzag boundary but coarse mesh in the middle of the domain. I am using the background field to control the element size. All those methods in t10 (Attractor+Threshold, MathEval, Box) work well on the rectangle domain that I used for test. However, they do not give me expected results on the real shape. All methods generate very dense mesh through out the domain (the element size in the middle is a little bit larger than the boundary, but they are too small comparing with what I specified). 
> 
> One reason I could guess is that the boundary of the polygon is composed of a set of short segments. Therefore, they make the initial element small. But I suppose that should only make the elements near the boundary to be small. I expect the mesh in the middle of the domain to be very coarse. I have disabled CharacteristicLengthExtendFromBoundary option. 
> 
> I really appreciated if you could shed any light on this. Many thanks.
> 

Set Mesh.CharacteristicLengthExtendFromBoundary=0 in your script.



> Bin
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine