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

gmsh boundary layer mesh for channel flow

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 4, 2022, 08:58
Question gmsh boundary layer mesh for channel flow
  #1
New Member
 
Join Date: May 2022
Posts: 18
Rep Power: 4
Boone is on a distinguished road
Hi,

I would like to mesh a periodic channel flow with structured grid using gmsh.


I firstly mesh it with transfinite lines and it works but I do not succeed in keeping the first cell size to obtain y+=1 when refining the mesh:
Code:
n = 50;
nb_points = n;
r=1.02;
 nb_points_centre = 26;

SetFactory("OpenCASCADE");
//+
Point(1) = {0, 1/3, 0, 1.0};
//+
Point(2) = {0, 1, 0, 1.0};
//+
Point(3) = {1, 1, 0, 1.0};
//+
Point(4) = {1, 1/3, 0, 1.0};
//+
Point(11) = {1, 0.7, 0, 1.0};
//+
Point(13) = {0, 0.7, 0, 1.0};
//+
Line(1) = {4, 11};
//+
Line(2) = {11, 3};
//+
Line(4) = {1, 13};
//+
Line(5) = {13, 2};
//+
//+
Line(8) = {1, 4};
//+
Line(9) = {13, 11};
//+
Line(10) = {2, 3};
Line Loop(13) = {8, 1, -9, -4};
//+
Plane Surface(1) = {13};
//+
Line Loop(14) = {9, 2, -10, -5};
//+
Plane Surface(2) = {14};
Symmetry {0, 1, 0, -1} {
  Duplicata { Surface{1}; Surface{2}; }
}
Coherence;
Transfinite Line {1, 4} = nb_points Using Progression r;
Transfinite Line {10, 11} = nb_points_centre;
Transfinite Line {8,9} = 1;
Transfinite Line {9, 12} = 1;
Transfinite Line {17, 18} = nb_points_centre;
//+
Transfinite Line {14, 15} = nb_points Using Progression r;
//+
Transfinite Line {13, 16} = 1;
//+
Transfinite Line {16, 12} = 1;

Extrude {0, 0, 1} {
//  Surface{1, 2, 3, 4}; Recombine;
  Surface{1, 2, 3, 4}; Layers{1}; Recombine;
}
Recombine Surface "*";
 Transfinite Surface "*";
Could you please help me to mesh my domain with fixed first cell size using transfinite lines ?


I also tried to use the Boundarylayer function but I do not manage to set the thickness of the boundary layer equal to the half of my channel and/or to specify the size of the cells that are beyond the boundary layer. Below is a code example for a simple rectangle:

Code:
SetFactory("OpenCASCADE");
Rectangle(1) = {0, 0, 0, 1, 1, 0}; 

Transfinite Surface "*";
Recombine Surface "*";


Field[1] = BoundaryLayer;
Field[1].EdgesList = {1}; 
Field[1].NodesList = {1, 2}; 
Field[1].hwall_n = 0.01;
Field[1].thickness = 1;
Field[1].ratio = 1.1;
Field[1].Quads = 1;
BoundaryLayer Field = 1;
This gives me the attached mesh (see picture: Capture d’écran du 2022-11-04 13-51-47.png). In the picture we see that the boundary layer thickness is about 1/3 of the rectangle height despite the
Code:
Field[1].thickness = 1;
Could you please help me to solve that issue ?


How can I set the size of the cells that are above the boundary layer ?


Thanks a lot,

Boone
Boone is offline   Reply With Quote

Old   November 4, 2022, 11:19
Default
  #2
Senior Member
 
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 679
Rep Power: 21
bigfootedrockmidget is on a distinguished road
use this for the overall mesh size:

Code:
Mesh.CharacteristicLengthMin = 0.02;
Mesh.CharacteristicLengthMax = 0.02;

I think there is a limit to the size of the boundary layer thickness with respect to the total size of the domain, I could not make the boundary layer thickness larger than 0.4. For larger values, the thickness of the boundary layer was the same.
bigfootedrockmidget is offline   Reply With Quote

Old   November 4, 2022, 12:39
Default
  #3
New Member
 
Join Date: May 2022
Posts: 18
Rep Power: 4
Boone is on a distinguished road
Thanks for your answer. In the meantime I found a way to solve this issue with the background function. It works well for a single boundary layer but when multiple boundaries are used it does not work. I read that we should use the Field[] = Min; to solve this but I do not manage to make it work.


I give my script below. If someone knows how to make it works with several backgronud functions it would be great =).

Code:
SetFactory("OpenCASCADE");

Dext=0.023;
dy0=0.00219133;
r=1.05;
Ly_wall=0.7-1/3;
Ly_center=0.3;
Rectangle(1) = {0, 1/3, 0, 1, Ly_wall, 0}; 
Rectangle(2) = {0, 0.7, 0, 1, Ly_center, 0}; 
Rectangle(3) = {0, 1, 0, 1, Ly_center, 0}; 
Rectangle(4) = {0, 1+Ly_center, 0, 1, Ly_wall, 0}; 


Coherence;

Transfinite Surface "*";
Recombine Surface "*";

Transfinite Line {5, 6} = Ly_center/Dext;
Transfinite Line {8, 9} = Ly_center/Dext;

Field[4] = BoundaryLayer;
Field[4].EdgesList = {13}; 
Field[4].NodesList = {9, 10}; 
Field[4].hwall_n = dy0;
Field[4].hfar = Dext;
Field[4].thickness = Ly_wall;
Field[4].ratio = r;
Field[4].Quads = 1;
BoundaryLayer Field = 4;
// Background Field = 4;

Field[1] = BoundaryLayer;
Field[1].EdgesList = {1}; 
Field[1].NodesList = {1, 2}; 
Field[1].hwall_n = dy0;
Field[1].hfar = Dext;
Field[1].thickness = Ly_wall;
Field[1].ratio = r;
Field[1].Quads = 1;
BoundaryLayer Field = 1;
//Background Field = 1;

//+
Field[5] = Min;
//+
Field[5].FieldsList = {1};
//+
Background Field = 5;
Thanks again
Boone is offline   Reply With Quote

Reply

Tags
boundary layer grid, channel flow, gmsh, mesh, structure mesh


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] Error defining boundary layer around cube snappyHexMesh crizpi21 OpenFOAM Meshing & Mesh Conversion 5 October 16, 2021 11:56
GMSH extrude a boundary layer from an unstructured Mesh Hillie Mesh Generation & Pre-Processing 2 July 7, 2017 04:38
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 04:52
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 11:56


All times are GMT -4. The time now is 06:58.