# Gmsh - a very thin boundary layer

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 1, 2021, 11:25 Gmsh - a very thin boundary layer #1 Member   Join Date: Mar 2019 Posts: 80 Rep Power: 5 Hi everybody I will show an excerpt from a script that I wrote after reading up on tutorial t10.geo of the gmsh user manual: Field[1] = Distance; ..... Field[2] = Threshold; Field[2].IField = 1; Field[2].LcMin = 1.0e-6; Field[2].LcMax = .1; Field[2].DistMin = 0.00; Field[2].DistMax = 1.0e-5; This is supposed to linearly interpolate cell size between Lcmin and Lcmax in the range DistMin to DistMax. The problem is that DistMax - DistMin << LcMax so that large cells close to LcMax of course do not fit within this range. I am wondering about how the software handles such cases. Regards to all

 February 3, 2021, 15:06 #2 Member   Join Date: Mar 2019 Posts: 80 Rep Power: 5 As an aside, for accuracy Field[1].NNodesByEdge should be of order LcMin but that does not answer my request. Anyhow I switched from using Field[1] = Distance to Field[1] = BoundaryLayer for a small circle inside a big box. Here is the code: lc = .1; Point(1) = {-0.9145, -.381, 0, lc} ; Point(2) = { 0.9145, -.381, 0, lc} ; Point(3) = { 0.9145, .381, 0, lc} ; Point(4) = {-0.9145, .381, 0, lc} ; Line(1) = {1,2} ; Line(2) = {2,3} ; Line(3) = {3,4} ; Line(4) = {4,1} ; Line Loop(1) = {1, 2, 3, 4} ; radius = .076; Point(5) = {radius, 0, 0, lc} ; Point(6) = {0, radius, 0, lc} ; Point(7) = {-radius, 0, 0, lc} ; Point(8) = {0, -radius, 0, lc} ; //center is at origin Point(9) = {0, 0, 0, lc} ; // start center end arc less than 180 deg Circle(5) = {5, 9, 6}; Circle(6) = {6, 9, 7}; Circle(7) = {7, 9, 8}; Circle(8) = {8, 9, 5}; Curve Loop(2) = {5, 6, 7, 8} ; Plane Surface(1) = {1, 2} ; //mesh exterior of circle only Field[1] = BoundaryLayer; Field[1].EdgesList = {5, 6, 7,8}; Field[1].hfar = lc; Field[1].hwall_n = 1.0e-6; // cell size 1/10 of boundary layer below Field[1].thickness = 1.0e-5; Background Field = 1; Strangely enough I only get two cells generated per quarter of a circle but you can see from the above .hwall that you would expect to generate 100000's of cells ! What is going on !? Any reply appreciated

 February 4, 2021, 16:41 #3 Member   Join Date: Mar 2019 Posts: 80 Rep Power: 5 Well folks, as a tip, there are at least 9 other keywords under Field[1] = BoundaryLayer; to experiment with. The problem is that that there is so many mesh commands and options listed under the Gmsh manual and there are quite a few of these that are unclear to me. I wish the authors of the Gmsh software would have written a more theoretical book on meshing. (for example what is the meaning of a mesh fan ?) Maybe I will find answers when I delve into the Gmsh source code itself or maybe I should contact the authors directly. Thanks anyways

 February 6, 2021, 19:43 #4 Member   Join Date: Mar 2019 Posts: 80 Rep Power: 5 Well, I'm going to make it as simple as can be. Just a plain rectangle filled with air and the bottom edge representing a solid boundary. Of course this is where the boundary layer will be situated. lc = .1; Point(1) = {-0.9145, -.381, 0, lc} ; Point(2) = { 0.9145, -.381, 0, lc} ; Point(3) = { 0.9145, .381, 0, lc} ; Point(4) = {-0.9145, .381, 0, lc} ; Line(1) = {1,2} ; Line(2) = {2,3} ; Line(3) = {3,4} ; Line(4) = {4,1} ; Line Loop(1) = {1, 2, 3, 4} ; Plane Surface(1) = {1} ; //air only Field[1] = BoundaryLayer; Field[1].NodesList = {1, 2}; Field[1].EdgesList = {1}; Field[1].hfar = lc; Field[1].hwall_n = 1.0e-6; // cell size 1/10 of boundary layer below Field[1].thickness = 1.0e-5; Background Field = 1; Guess what ? Still does not work. No boundary layer in the generated mesh. And up to now, I had no luck either with any extra keyword associated with BoundaryLayer that can be found in the Gmsh user manual. !?

 February 8, 2021, 15:44 #5 Member   Join Date: Mar 2019 Posts: 80 Rep Power: 5 Problem solved ! Just replace Background Field = 1; by BoundaryLayer Field = 1; and the generated mesh shows a boundary layer That was not obvious since nowhere is it discussed in the Gmsh manual and I had to find an example elsewhere on the internet. Also I was wrong in stating that there should be 100000's of cells because the vertical dimension is so small 1.0e-6: The horizontal dimension is unchanged (at lc = .1) And of course, for such problems do use Field[1] = BoundaryLayer; and not Field[1] = Distance; since the latter is not suitable for thin boundary layer in viscous air (there is no stretching of cell edge length in either direction and there would be 100000's of cells generated) And to answer my very first request DistMax - DistMin << LcMax is of course utterly meaningless for Field[1] = Distance; (all cells in range (Lcmin, LcMax) must fit within (DistMin, Distmax) I still have to get a reply from the authors about the physical meaning of the mesh fan. That's all for now. I hope most of you learned something from this thread.