CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (http://www.cfd-online.com/Forums/openfoam-meshing-open/)
-   -   gmsh and boundary layers (http://www.cfd-online.com/Forums/openfoam-meshing-open/82131-gmsh-boundary-layers.html)

kanuk November 17, 2010 18:01

gmsh and boundary layers
 
Hello,

I'm trying to run a test case of a 2-D airfoil (similar to the airFoil2D tutorial case). I am using gmsh as a meshing tool and followed the directions in http://openfoamwiki.net/index.php/2D...ial_using_GMSH.

Originally, I had been using an unstructured mesh (tets) and got good visual results, but I am trying to validate the case, so I have now meshed with a structured grid using a couple of boundary layers (primary and secondary). The problem is that once I specify all faces and volumes in the .geo file, mesh it (with no problems), convert it using gmshToFoam, I get very, very unstable behavior in my solution, even though my grid is refined. I have checked my 0/U, 0/p, 0/nut, 0/nuTilda, polyMesh/boundary and system/controlDict files, and nothing seems to be wrong. I think the problem is with my "interfaces" patch in the .msh file... I don't know for sure but I specified the boundary layers (which are labeled interfaces in gmsh) as "empty" in the above files, which seems correct to me.

Also, when running gmshToFoam I get the following error (see below). Why am I getting a faceZone_1??

////////////////////
Skipping tag at line 144939
Patch 0 gets name back
Patch 1 gets name interfaces
Patch 2 gets name airfoil
Patch 3 gets name front
Patch 4 gets name inlet
Patch 5 gets name outlet

--> FOAM Warning :
From function polyMesh::polyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 576
Found 57744 undefined faces in mesh; adding to default patch.
Finding faces of patch 0
Finding faces of patch 1
Finding faces of patch 2
Finding faces of patch 3
Finding faces of patch 4
Finding faces of patch 5

FaceZones:
Zone Size
1 879

Writing zone 0 to cellZone airvol and cellSet
Writing zone 1 to faceZone faceZone_1 and faceSet
End

///////////////////

As of this point, I am stumped, but will keep trying to find the solution. Anyone out there successfully ran a case with boundary layers?? Any help is really appreciated!

T.D. November 30, 2010 09:17

Quote:

Originally Posted by kanuk (Post 283827)
Hello,

I'm trying to run a test case of a 2-D airfoil (similar to the airFoil2D tutorial case). I am using gmsh as a meshing tool and followed the directions in http://openfoamwiki.net/index.php/2D...ial_using_GMSH.

Originally, I had been using an unstructured mesh (tets) and got good visual results, but I am trying to validate the case, so I have now meshed with a structured grid using a couple of boundary layers (primary and secondary). The problem is that once I specify all faces and volumes in the .geo file, mesh it (with no problems), convert it using gmshToFoam, I get very, very unstable behavior in my solution, even though my grid is refined. I have checked my 0/U, 0/p, 0/nut, 0/nuTilda, polyMesh/boundary and system/controlDict files, and nothing seems to be wrong. I think the problem is with my "interfaces" patch in the .msh file... I don't know for sure but I specified the boundary layers (which are labeled interfaces in gmsh) as "empty" in the above files, which seems correct to me.

Also, when running gmshToFoam I get the following error (see below). Why am I getting a faceZone_1??

////////////////////
Skipping tag at line 144939
Patch 0 gets name back
Patch 1 gets name interfaces
Patch 2 gets name airfoil
Patch 3 gets name front
Patch 4 gets name inlet
Patch 5 gets name outlet

--> FOAM Warning :
From function polyMesh::polyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 576
Found 57744 undefined faces in mesh; adding to default patch.
Finding faces of patch 0
Finding faces of patch 1
Finding faces of patch 2
Finding faces of patch 3
Finding faces of patch 4
Finding faces of patch 5

FaceZones:
Zone Size
1 879

Writing zone 0 to cellZone airvol and cellSet
Writing zone 1 to faceZone faceZone_1 and faceSet
End

///////////////////

As of this point, I am stumped, but will keep trying to find the solution. Anyone out there successfully ran a case with boundary layers?? Any help is really appreciated!

Hi,
you need to change the patches names in the constant/PolyMesh/boundary file to that of "back" "interfaces" "airfoil" "front" etc...

Good Luck

kanuk November 30, 2010 15:11

Thanks for your reply, T.D. After struggling with this for awhile, I realized the errors in my computations were entirely due to large aspect ratios of the elements. I have corrected this issue and things seem to work just fine.

claco January 21, 2011 13:01

Quote:

Originally Posted by kanuk (Post 283827)
Hello,

I'm trying to run a test case of a 2-D airfoil (similar to the airFoil2D tutorial case). I am using gmsh as a meshing tool and followed the directions in http://openfoamwiki.net/index.php/2D...ial_using_GMSH.

Originally, I had been using an unstructured mesh (tets) and got good visual results, but I am trying to validate the case, so I have now meshed with a structured grid using a couple of boundary layers (primary and secondary). The problem is that once I specify all faces and volumes in the .geo file, mesh it (with no problems), convert it using gmshToFoam, I get very, very unstable behavior in my solution, even though my grid is refined. I have checked my 0/U, 0/p, 0/nut, 0/nuTilda, polyMesh/boundary and system/controlDict files, and nothing seems to be wrong. I think the problem is with my "interfaces" patch in the .msh file... I don't know for sure but I specified the boundary layers (which are labeled interfaces in gmsh) as "empty" in the above files, which seems correct to me.

Also, when running gmshToFoam I get the following error (see below). Why am I getting a faceZone_1??

////////////////////
Skipping tag at line 144939
Patch 0 gets name back
Patch 1 gets name interfaces
Patch 2 gets name airfoil
Patch 3 gets name front
Patch 4 gets name inlet
Patch 5 gets name outlet

--> FOAM Warning :
From function polyMesh::polyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 576
Found 57744 undefined faces in mesh; adding to default patch.
Finding faces of patch 0
Finding faces of patch 1
Finding faces of patch 2
Finding faces of patch 3
Finding faces of patch 4
Finding faces of patch 5

FaceZones:
Zone Size
1 879

Writing zone 0 to cellZone airvol and cellSet
Writing zone 1 to faceZone faceZone_1 and faceSet
End

///////////////////

As of this point, I am stumped, but will keep trying to find the solution. Anyone out there successfully ran a case with boundary layers?? Any help is really appreciated!



Dear kanuk,

Can You please explain me how can I build boundary layers in GMSH environment?

Thank You in advance.

Claudio Comis

kanuk January 21, 2011 16:12

I'm not sure if I did it correctly, but it worked....

What I did was created a pseudo surface of thickness T around the surface I needed the boundary layer on, then treated this as its own surface.

Make use of the "transfinite line" operator, along with "using progression" (to get the y+) and lastly, "transfinite surface"....

The gmsh user guide should be very helpful with this.

Cheers
Dave

claco February 17, 2011 08:35

1 Attachment(s)
Quote:

Originally Posted by kanuk (Post 291624)
I'm not sure if I did it correctly, but it worked....

What I did was created a pseudo surface of thickness T around the surface I needed the boundary layer on, then treated this as its own surface.

Make use of the "transfinite line" operator, along with "using progression" (to get the y+) and lastly, "transfinite surface"....

The gmsh user guide should be very helpful with this.

Cheers
Dave




Dear Sirs,

I have a great problem.
I have build the geometry of a simple wind tunnel, with a bump located
on the bottom. I built a boundary layer; the other part of the 3D (a 2D extrude mesh) mesh is a structured mesh.
I succeeded in doing that, but a terrible problem remains: there is an
unwanted intersection between the boundary layer mesh and the rest of
the structured mesh.
I cannot find the proper commands to prevent this intersection.
I would like to made the structured mesh starting from the edges where the boundary layers end.
I enclose the simple .geo file along with a screen shot.
I hope You can Help me, or forward this e-mail to someone can resolve
this simple (and at the same time difficult) problem.


file.geo

lc = 0.5;

dx = 2.0;
dy = 1.0;
dz = 5.0;
dy_bl = 0.05;
nx = 100;
ny1 = 10;//0.9;//(dy/(2*dy_bl))*ny2;
ny2 = 100;
nz = 1;

//cx = dx/nx;
//cy = dy/ny;
//cz = (cx + cy)/2;

Point(1) = {0.0,0.0,0.0,lc};
Point(2) = {0,dy,0.0,lc};
Point(3) = {dx,dy,0.0,lc};
Point(4) = {dx,0,0.0,lc};
Point(5) = {dx,0,0.0,lc};
Point(6) = {dx/2,0,0.0,lc};
Point(7) = {dx/2-0.2,0,0.0,lc};
Point(8) = {dx/2-0.05,dy/8,0.0,lc};
Point(9) = {dx/2+0.05,dy/8,0.0,lc};
Point(10) = {dx/2+0.2,0,0.0,lc};
Point(11) = {0,dy_bl,0.0,lc};
Point(12) = {dx,dy_bl,0.0,lc};
Point(13) = {0,dy-dy_bl,0.0,lc};
Point(14) = {dx,dy-dy_bl,0.0,lc};
Line(2) = {2,3};
Line(3) = {14,12};
Line(5) = {11,13};
Line(1) = {1,11};
Line(6) = {12,4};
Line(7) = {13,2};
Line(8) = {3,14};


Spline(4) = {4,10,9,8,7,1};

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

Plane Surface(6) = {5};
old = Geometry.ExtrudeReturnLateralEntities;
Printf("lateral entities = %g", old);
Geometry.ExtrudeReturnLateralEntities = 0;
e1[]= Extrude {0,0,1.000000} {Surface{6}; Layers{1}; Recombine;};

cells[0] = 0;
heights[0] = 0.01;
For i In {1:5}
cells[i] = 1;
heights[i] = heights[i-1] * 1.2;
EndFor
tmp[] = Extrude {Surface{49}; Layers{cells[],heights[]}; Recombine;};
Printf("top surface = %g", tmp[0]);
Extrude {Surface{19}; Layers{cells[],heights[]}; Recombine;};
Geometry.ExtrudeReturnLateralEntities = old;

// Top surface
//Physical Surface(33) = {15};

// Bottom surface
//Physical Surface(34) = {23};

// Left surface
//Physical Surface(35) = {19};

// Right surface
//Physical Surface(36) = {27};

// Front surface
//Physical Surface(37) = {28};

// Back surface
//Physical Surface(38) = {6};

// Box volume
//Physical Volume (39) = {32};

Transfinite Line {1,8} = (ny1) + 1 Using Progression 1;
Transfinite Line {7,6} = (ny1) + 1 Using Progression 1;
Transfinite Line {5,3} = (ny2) + 1 Using Progression 1.0;
Transfinite Line {2,4} = nx + 1 Using Progression 1.0;
//Transfinite Line {1,3} = ny + 1 Using Progression 1.0;
//Transfinite Line {14,18,13,22} = nz + 1 Using Progression 1.0;

Transfinite Surface {6} = {3,2,1,4};
Recombine Surface {6};
//Transfinite Surface {27} = {5,14,2,3};
//Transfinite Surface {15} = {5,3,4,6};
//Transfinite Surface {28} = {6,10,14,5};
//Transfinite Surface {23} = {14,2,1,10};
//Transfinite Surface {19} = {6,10,1,4};
//Surface Loop(1000) = {14:28:2}; // the sphere (only need for internal mesh)
Surface Loop(1001) = {72};//tmp[{0:14:2}]}; // The outside of the BL
Surface Loop(1002) = {21,25,29,33,6,37,41,45,49,50}; // the box (entire farfield surface loop)

//Volume(1000) = {1000}; /// inside the sphere
//Volume(1) = {1002, 1001}; /// FarField

Mesh.Algorithm3D = 4;
Mesh.Smoothing = 100;
Mesh.Optimize=1;
Mesh.OptimizeNetgen=1;
Mesh.OptimizeNetgen=1;



Claudio Comis

msarkar May 2, 2011 02:52

Hi All,

I am a new user of Gmsh. I created the geo file and meshed it using Gmsh GUI. From mesh option, I change the element size factor to create finer mesh, e.g I used element size factor 0.05, 0.03, and 0.01. However, I did not get any explanations about element size factor. Could you please explain what is that element size factor in gmsh and how it controls element size? If element size factor is 0.01, is that mean target element size is 0.01?
Any help will be very much appreciated.

kanuk May 2, 2011 12:51

I'm not sure about "element size factor" but you normally specify the element characteristic length. If you say the characteristic length is 0.01 then the meshing program keeps all elements small enough to fit inside a sphere (or in 2-D a circle) of diameter 0.01. At least this is my interpretation...

msarkar May 4, 2011 02:37

Thank you kanuk for your reply.
If anyone has any idea about "element size factor" in Gmsh, please let me know.

msarkar May 9, 2011 07:21

Boundary Layer and Gmsh
 
Hi All,

I am using Gmsh to generate mesh. I want to create boundary layer around ellipse. I created four dummy surfaces (each of one quarter of ellipse) around the ellipse and tried to create boundary layer using transfinite line and surface. However, it did not work, gave error: Surface 30 cannot be meshed using transfinite algo. Could anyone tell me how to create boundary layer / structured mesh around ellipse using Gmsh?

Thanks
M.S.

KateEisenhower August 14, 2015 05:02

Quote:

Originally Posted by msarkar (Post 306786)
Hi All,

I am using Gmsh to generate mesh. I want to create boundary layer around ellipse. I created four dummy surfaces (each of one quarter of ellipse) around the ellipse and tried to create boundary layer using transfinite line and surface. However, it did not work, gave error: Surface 30 cannot be meshed using transfinite algo. Could anyone tell me how to create boundary layer / structured mesh around ellipse using Gmsh?

Thanks
M.S.

I know msarkar posted this question years ago. Anyways, mayhaps it will help other users.
If this error message occurs, very often it is because you didn't specify all lines defining the surface as transfinite lines.

Best regards,

Kate

tareqkh August 14, 2015 12:35

Quote:

Originally Posted by msarkar (Post 306786)
Hi All,

I am using Gmsh to generate mesh. I want to create boundary layer around ellipse. I created four dummy surfaces (each of one quarter of ellipse) around the ellipse and tried to create boundary layer using transfinite line and surface. However, it did not work, gave error: Surface 30 cannot be meshed using transfinite algo. Could anyone tell me how to create boundary layer / structured mesh around ellipse using Gmsh?

Thanks
M.S.

Hello Msarkar,

Could you please share the dimensions of your model? That would make things easier.

Regards,

Tareq


All times are GMT -4. The time now is 03:46.