CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] How to add a prismatic-cell boundary layer in GMSH?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2015, 12:33
Default How to add a prismatic-cell boundary layer in GMSH?
  #1
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 250
Rep Power: 22
klausb will become famous soon enough
Hello,

how can I add a boundary layer mesh made up of the "typical" prismatic boundary layer cells to my GMSH mesh? I red a lot about using extrusions but I didn't succeed.

The airfoil geometry is made up of a spline and a straight line connecting the two end points at the trailing edge.

It's basically 2D but extruded to 3D to be usable in OpenFoam.

How does it work?

This is my current code:

//---------------------------------------------------------------------------------------------------------------

//adapted FX66-S-196-V1 airfoil coordinates with straight trailing edge
cl__1 = 0.005;
Point(1001) = {1, 0.0003, 0, cl__1};
Point(1002) = {0.99039, 0.00284, 0, cl__1};
Point(1003) = {0.973469, 0.00729, 0, cl__1};
Point(1004) = {0.948439, 0.01357, 0, cl__1};
Point(1005) = {0.91573, 0.02193, 0, cl__1};
Point(1006) = {0.87592, 0.03242, 0, cl__1};
Point(1007) = {0.85355, 0.03845, 0, cl__1};
Point(1008) = {0.82967, 0.04501, 0, cl__1};
Point(1009) = {0.80438, 0.05197, 0, cl__1};
Point(1010) = {0.77779, 0.05936, 0, cl__1};
Point(1011) = {0.75, 0.066989, 0, cl__1};
Point(1012) = {0.72114, 0.07482, 0, cl__1};
Point(1013) = {0.69134, 0.08272, 0, cl__1};
Point(1014) = {0.66072, 0.09067, 0, cl__1};
Point(1015) = {0.62941, 0.09844, 0, cl__1};
Point(1016) = {0.59755, 0.10607, 0, cl__1};
Point(1017) = {0.56526, 0.11321, 0, cl__1};
Point(1018) = {0.5327, 0.11995, 0, cl__1};
Point(1019) = {0.5, 0.12585, 0, cl__1};
Point(1020) = {0.4673, 0.13095, 0, cl__1};
Point(1021) = {0.43474, 0.13467, 0, cl__1};
Point(1022) = {0.40245, 0.13691, 0, cl__1};
Point(1023) = {0.37059, 0.1369, 0, cl__1};
Point(1024) = {0.33928, 0.13537, 0, cl__1};
Point(1025) = {0.30866, 0.13243, 0, cl__1};
Point(1026) = {0.27866, 0.12848, 0, cl__1};
Point(1027) = {0.25, 0.12348, 0, cl__1};
Point(1028) = {0.22221, 0.11772, 0, cl__1};
Point(1029) = {0.19562, 0.11114, 0, cl__1};
Point(1030) = {0.17033, 0.10398, 0, cl__1};
Point(1031) = {0.14645, 0.09621, 0, cl__1};
Point(1032) = {0.12408, 0.08803, 0, cl__1};
Point(1033) = {0.10332, 0.07946, 0, cl__1};
Point(1034) = {0.08427, 0.07067, 0, cl__1};
Point(1035) = {0.066989, 0.0617, 0, cl__1};
Point(1036) = {0.05156, 0.05273, 0, cl__1};
Point(1037) = {0.03806, 0.04383, 0, cl__1};
Point(1038) = {0.02653, 0.0352, 0, cl__1};
Point(1039) = {0.01702, 0.02692, 0, cl__1};
Point(1040) = {0.00961, 0.01918, 0, cl__1};
Point(1041) = {0.00428, 0.01223, 0, cl__1};
Point(1042) = {0.00107, 0.00621, 0, cl__1};
Point(1043) = {0, 0, 0, cl__1};
Point(1044) = {0.00107, -0.00354, 0, cl__1};
Point(1045) = {0.00428, -0.00784, 0, cl__1};
Point(1046) = {0.00961, -0.01211, 0, cl__1};
Point(1047) = {0.01704, -0.01639, 0, cl__1};
Point(1048) = {0.02653, -0.02065, 0, cl__1};
Point(1049) = {0.03806, -0.02489, 0, cl__1};
Point(1050) = {0.05156, -0.02903, 0, cl__1};
Point(1051) = {0.0669899, -0.03307, 0, cl__1};
Point(1052) = {0.08427, -0.03695, 0, cl__1};
Point(1053) = {0.10332, -0.04063, 0, cl__1};
Point(1054) = {0.12408, -0.0441, 0, cl__1};
Point(1055) = {0.14645, -0.04729, 0, cl__1};
Point(1056) = {0.17033, -0.05022, 0, cl__1};
Point(1057) = {0.19562, -0.05279, 0, cl__1};
Point(1058) = {0.22221, -0.05503, 0, cl__1};
Point(1059) = {0.25, -0.05681, 0, cl__1};
Point(1060) = {0.27866, -0.0582, 0, cl__1};
Point(1061) = {0.30866, -0.05901, 0, cl__1};
Point(1062) = {0.33928, -0.05931, 0, cl__1};
Point(1063) = {0.37059, -0.0588, 0, cl__1};
Point(1064) = {0.40245, -0.05743, 0, cl__1};
Point(1065) = {0.43474, -0.05451, 0, cl__1};
Point(1066) = {0.4673, -0.05076, 0, cl__1};
Point(1067) = {0.5, -0.04628, 0, cl__1};
Point(1068) = {0.5327, -0.04161, 0, cl__1};
Point(1069) = {0.56526, -0.03667, 0, cl__1};
Point(1070) = {0.59755, -0.03186, 0, cl__1};
Point(1071) = {0.62941, -0.02707, 0, cl__1};
Point(1072) = {0.66072, -0.02256, 0, cl__1};
Point(1073) = {0.69134, -0.01827, 0, cl__1};
Point(1074) = {0.72114, -0.01435, 0, cl__1};
Point(1075) = {0.75, -0.0108, 0, cl__1};
Point(1076) = {0.77779, -0.00764, 0, cl__1};
Point(1077) = {0.80438, -0.00489, 0, cl__1};
Point(1078) = {0.82967, -0.0026, 0, cl__1};
Point(1079) = {0.85355, -0.00068, 0, cl__1};
Point(1080) = {0.87592, 0.0008, 0, cl__1};
Point(1081) = {0.91573, 0.00254, 0, cl__1};
Point(1082) = {0.948439, 0.00288, 0, cl__1};
Point(1083) = {0.973469, 0.00206, 0, cl__1};
Point(1084) = {0.99039, 0.00066, 0, cl__1};
Point(1085) = {1, -0.00025, 0, cl__1};
Spline(1000) = {1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085};

//straight trailing edge line, closing spline
Line(1) = {1001, 1085};


//domain boundaries
edge_lc = 0.2;

Point(2000) = {-2, 4, 0, edge_lc};
Point(2001) = {-2, -4, 0, edge_lc};
Point(2002) = {7, -4, 0, edge_lc};
Point(2003) = {7, 4, 0, edge_lc};

// outer boundary lines
Line(2) = {2000, 2001};
Line(3) = {2001, 2002};
Line(4) = {2002, 2003};
Line(5) = {2003, 2000};

//create boundary
Line Loop (1) = {2, 3, 4, 5};
// Tell gmsh the spline should also be a line loop
Line Loop (2) = {1000};
//closing trailing edge line should also be a line loop and part of the boundary
Line Loop (3) = {1};
// combine the three into a surface, gmsh makes a hole automagically
Plane Surface(1) = {1,2,3};


//creating and extruding the mesh to 3D required by OpenFoam
Extrude {0, 0, 1} {
Surface{1};
Layers{1};
Recombine;
}


//defining 3D surfaces to be used as OpenFoam patches
Physical Surface("back") = {1};
Physical Surface("front") = {1032};
Physical Surface("top") = {1023};
Physical Surface("outlet") = {1019};
Physical Surface("bottom") = {1015};
Physical Surface("inlet") = {1011};
Physical Surface("airfoil") = {1027, 1031};

Physical Volume("internal") = {1};

//---------------------------------------------------------------------------------------------------------------

Find attached the geo file and a picture of the FX66-S-196-V1 airfoil to be meshed.

Klaus
Attached Images
File Type: jpg FX66-S-196-V1.jpg (78.3 KB, 228 views)
Attached Files
File Type: gz fx66-s-196_v1.geo.tar.gz (1.6 KB, 14 views)
klausb is offline   Reply With Quote

Old   February 21, 2015, 05:13
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Why you have decided that you have not succeed with extrude? You have got 1 layer of cells in extrude direction. I.e. boundary layer consists of prisms, triangular prisms.

If you would like to have hexagonal cells in the boundary layer, you should not just use extrude, you also have to use transfinite lines and surfaces for meshing (http://www.geuz.org/gmsh/doc/texinfo...ructured-grids).

Though it is much easier to use, for example, Construct2D (http://sourceforge.net/projects/construct2d/, see attached picture with the generated mesh for NACA0012 airfoil) to build quality airfoil mesh. There is one nuance - software generate mesh in Plot3D format, so you have to convert it.
Attached Images
File Type: png naca0012-mesh.png (51.4 KB, 250 views)
alexeym is offline   Reply With Quote

Old   February 21, 2015, 07:43
Default How to extrude the airfoil shape in normal direction, not x,y,z?
  #3
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 250
Rep Power: 22
klausb will become famous soon enough
Thank you for your feedback,

I was thinking of GMSH because I'll have to do 3D simulations as well, 2D is just for validation of required settings based on data available for the selected airfoil.

As you saw, I extruded the unstructured 2D mesh into the z direction which is no problem and is only required as OpenFoam works only in 3D so 2D is solved as a "pseudo" 3D case using 1 layer of cells created by extruding the 2D mesh 1 layer into z direction.

My problem is the boundary layer mesh, made up of prismatic cells which needs to meet y+ = 1. So apparently I need to extrude the airfoil shape normal to the airfoil surface (2D) in GMSH.

Apparently I'll have to work with different meshing tools for 2D and 3D simulations.

Klaus
klausb is offline   Reply With Quote

Old   February 21, 2015, 17:21
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well,

If you'd like to get hexagonal mesh and would like to have control over boundary layer with Gmsh, you should create geometry like on the figure attached. I.e. every plane should have 4 corners. After this you can set boundary lines of the plane as transfinite and control density of the mesh in certain areas with "Transfinite Line {...} = N". Then you can extrude 2D mesh into 3D. You can continue division of geometry to get more control over mesh density in different parts of the mesh.

If you are trying to mesh 3D geometry, you need to divide your geometry into volumes with 6 (or 5 according to documentation) corners.
Attached Images
File Type: png subdivision.png (10.1 KB, 104 views)
alexeym is offline   Reply With Quote

Old   November 22, 2016, 17:30
Default
  #5
Member
 
Jack
Join Date: May 2015
Posts: 98
Rep Power: 10
Jack001 is on a distinguished road
Hi alexeym,

Have you managed to create a mesh resembling the one in your picture using gmsh? I have a starting point for a mesh of an airfoil but the only thing that is missing is being able to control the refinement at the trailing/leading edge!

If you have any ideas that would be much appreciated. I can also share my code if that would help.
Jack001 is offline   Reply With Quote

Reply

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] Help with Snappy: no layers growing GianF OpenFOAM Meshing & Mesh Conversion 2 September 23, 2020 08:26
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
[snappyHexMesh] Boundary layer in a pipe Clementhuon OpenFOAM Meshing & Mesh Conversion 6 March 12, 2012 12:41
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15
Warning 097- AB Siemens 6 November 15, 2004 04:41


All times are GMT -4. The time now is 04:31.