CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

How to create a 2D boundary layer in gmsh?

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

Like Tree3Likes
  • 1 Post By naffrancois
  • 1 Post By naffrancois
  • 1 Post By Time4Tea

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 8, 2021, 22:02
Unhappy How to create a 2D boundary layer in gmsh?
  #1
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Hi, I am wondering if anyone can help?

I am not very experienced with gmsh and I am trying to figure out how to use the 2D boundary layer function, but I am struggling. I have made a .geo file for a simple square geometry with a boundary layer on the lower face, as follows:

Code:
Point(1) = {0.0000, 0.0000, 0.0000};
    Point(2) = {40.0000, 0.0000, 0.0000};
    Point(3) = {40.0000, 40.0000, 0.0000};
    Point(4) = {0.0000, 40.0000, 0.0000};
    
    Line(5) = {1,2};
    Line(6) = {2,3};
    Line(7) = {3,4};
    Line(8) = {4,1};
    
    Curve Loop(1) = {5,6,7,8};
    
    Plane Surface(1) = {1};
    
    Field[1] = BoundaryLayer;
    Field[1].AnisoMax = 1000;
    Field[1].Quads = 1;
    Field[1].Thickness = 5;
    Field[1].CurvesList = {5};
    Field[1].Thickness = 3;
    Field[1].NbLayers = 10;
    Field[1].PointsList = {1,2};
    Field[1].Quads = 1;
    Field[1].Ratio = 1.1;
    Field[1].Size = 0.2;
    Field[1].SizeFar = 2;
    
    Background Field = 1;
However, when I try to mesh the geometry, it is not creating the boundary mesh. The documentation doesn't seem to provide a lot of detail on how the boundary layer feature works and there isn't any error message indicating what is wrong.


Does anyone have any idea why it is not working?
Time4Tea is offline   Reply With Quote

Old   November 9, 2021, 04:30
Default
  #2
Senior Member
 
Join Date: Oct 2011
Posts: 195
Rep Power: 13
naffrancois is on a distinguished road
Hello,

Try to replace :

Background Field = 1;

by

BoundaryLayer Field = 1;

seems to work for me with v4.8.4, I followed this thread: http://onelab.info/pipermail/gmsh/2019/013093.html

Good luck
Time4Tea likes this.
naffrancois is offline   Reply With Quote

Old   November 9, 2021, 09:57
Default
  #3
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Quote:
Originally Posted by naffrancois View Post
Try to replace :

Background Field = 1;

by

BoundaryLayer Field = 1;

Hi, thanks for your reply. I did as you suggested and replaced 'Background Field = 1' with 'BoundaryLayer Field = 1' and it is now making the boundary layer mesh. However, the results don't look great. Using the following .geo script:


Code:
SetFactory("OpenCASCADE");

Point(1) = {0.0000, 0.0000, 0.0000,0.5};
Point(2) = {40.0000, 0.0000, 0.0000,0.5};
Point(3) = {40.0000, 40.0000, 0.0000,3};
Point(4) = {0.0000, 40.0000, 0.0000,3};

Line(5) = {1,2};
Line(6) = {2,3};
Line(7) = {3,4};
Line(8) = {4,1};

Line Loop(1) = {5,6,7,8};
Plane Surface(1) = {1};

//Boundary Layer
Field[1] = BoundaryLayer;
Field[1].Quads = 1;
Field[1].Thickness = 2;
Field[1].EdgesList = {5};
Field[1].NbLayers = 6;
Field[1].NodesList = {1,2};
Field[1].Ratio = 1.2;
Field[1].hwall_n = 0.1;
Field[1].hfar = 1.5;
Field[1].IntersectMetrics = 1;

BoundaryLayer Field = 1;

Mesh.Algorithm = 6;
 Recombine Surface {1};
Results in the mesh shown in the following image:


i.e. there seems to be some strange behavior going on at the edges. However, in the example shown at the link you posted, that isn't happening. Do you have any idea what is wrong?
Time4Tea is offline   Reply With Quote

Old   November 9, 2021, 10:05
Default
  #4
Senior Member
 
Join Date: Oct 2011
Posts: 195
Rep Power: 13
naffrancois is on a distinguished road
Weird, your script works as expected on my machine, see attachment

I am using linux binaries from version 4.8.4

By the way, I guess this geometry is just for testing purposes otherwise if you just need to quad-mesh a square with refinement on one boundary, tranfinite tools are a way simpler approach
Attached Images
File Type: png gmsh.png (43.1 KB, 24 views)
Time4Tea likes this.
naffrancois is offline   Reply With Quote

Old   November 9, 2021, 10:34
Default
  #5
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Quote:
Originally Posted by naffrancois View Post
Weird, your script works as expected on my machine, see attachment

I am using linux binaries from version 4.8.4

By the way, I guess this geometry is just for testing purposes otherwise if you just need to quad-mesh a square with refinement on one boundary, tranfinite tools are a way simpler approach

Hmm ... yes that is very strange. What you are getting there is pretty close to what I had hoped to achieve. The version I am using seems to be 4.8.4, which I downloaded and compiled directly from the git repository. I might submit this as a bug report and see if the developers have any idea what might be causing it.


Thanks again for your help!


P.S. yes, that simple geometry is just a test case to try to get the boundary layer feature working. The real cases I want to analyze are also 2D but a bit more complex - they are rectangular, with a curved boundary re-entrant in one corner (which is where I want to apply the boundary layer).
naffrancois likes this.
Time4Tea is offline   Reply With Quote

Old   November 9, 2021, 11:12
Default
  #6
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Unless it could be down to different default settings you are using (e.g. meshing algorithm)?
Time4Tea is offline   Reply With Quote

Old   November 9, 2021, 11:15
Default
  #7
Senior Member
 
Join Date: Oct 2011
Posts: 195
Rep Power: 13
naffrancois is on a distinguished road
I downloaded 4.8.4 specifically to run your script, so I did not modify any defaults and ran the script as is. Have you tried to use the precompiled binaries instead of compiling from source ?
naffrancois is offline   Reply With Quote

Old   November 9, 2021, 11:23
Default
  #8
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Quote:
Originally Posted by naffrancois View Post
I downloaded 4.8.4 specifically to run your script, so I did not modify any defaults and ran the script as is. Have you tried to use the precompiled binaries instead of compiling from source ?

Ok. No, I haven't tried the precompiled binaries, but thanks for the suggestion. I will download and give them a try
Time4Tea is offline   Reply With Quote

Old   November 9, 2021, 11:31
Default
  #9
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Quote:
Originally Posted by naffrancois View Post
I downloaded 4.8.4 specifically to run your script, so I did not modify any defaults and ran the script as is. Have you tried to use the precompiled binaries instead of compiling from source ?

I just downloaded the 4.8.4 binary directly from gmsh.info and it seems to be doing exactly the same thing, giving the odd behavior at the edges.



Perhaps the issue is with one of the libraries that gmsh depends on (opencascade perhaps)?
Time4Tea is offline   Reply With Quote

Old   November 9, 2021, 11:37
Default
  #10
Senior Member
 
Join Date: Oct 2011
Posts: 195
Rep Power: 13
naffrancois is on a distinguished road
are you running on a linux system ? Sorry I do not have any idea what the reason may be
naffrancois is offline   Reply With Quote

Old   November 9, 2021, 12:02
Default
  #11
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
Quote:
Originally Posted by naffrancois View Post
are you running on a linux system ? Sorry I do not have any idea what the reason may be

Yes, I'm running on Arch Linux. So, my libraries should be fairly recent.
Time4Tea is offline   Reply With Quote

Old   November 10, 2021, 09:36
Default
  #12
Senior Member
 
Lee Strobel
Join Date: Jun 2016
Posts: 133
Rep Power: 8
Time4Tea is on a distinguished road
So, I downloaded the MacOS version of gmsh and with that the boundary layer meshing seems to work fine. So, it must be some sort of bug with the Linux version.


I also applied to join the gmsh gitlab group, so I could report the bug; however, I received an e-mail back saying the request had been denied. Has anyone else reported problems joining their gitlab?
Time4Tea is offline   Reply With Quote

Reply

Tags
gmsh, mesh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] layer not added Rasmusiwersen OpenFOAM Meshing & Mesh Conversion 1 January 2, 2020 10:43
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 02:44
[Gmsh] Gmsh Boundary Layer - Wing bcorr OpenFOAM Meshing & Mesh Conversion 0 April 18, 2012 14:38
[snappyHexMesh] Boundary layer generation problems ivan_cozza OpenFOAM Meshing & Mesh Conversion 0 October 6, 2010 14:47
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 07:43.