CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] Gmsh Layers Command (https://www.cfd-online.com/Forums/openfoam-meshing/151406-gmsh-layers-command.html)

dsn April 9, 2015 23:03

Gmsh Layers Command
 
Hi everyone,

I have started learning gmsh and kinda got stuck at one command.

I try to create multiple layers on a particular surface using the command

Code:

Layers { { expression-list }, { expression-list } }
Can someone tell me how exactly should the expression list in the sceond bracket be specified. What does it mean exactly?

The code below is taken from a tutorial case, if someone can please explain what those 0.5 and 1 mean and how to define them, it would be great

Code:

Extrude {0,0,h} {
  Surface{6}; Layers{ {8,2}, {0.5,1} };
}

Thanks once again as always!!!!

alexeym April 10, 2015 01:46

Hi,

Did you check documentation?

http://www.geuz.org/gmsh/doc/texinfo...ructured-grids

Quote:

In the first Layers form, expression gives the number of elements to be created in the (single) layer. In the second form, the first expression-list defines how many elements should be created in each extruded layer, and the second expression-list gives the normalized height of each layer (the list should contain a sequence of n numbers 0 < h1 < h2 < … < hn <= 1).
Your question is answered in the second sentence of the quote.

dsn April 10, 2015 12:06

2 Attachment(s)
Hi,

I did read the manual but I couldnt understand what they exactly mean by the height of the layer because when I used it in my code shown below to mesh a simple box geometry it gives me an error. I have attached the geometry, error generated and the code.

Can you Please take a look and let me know what is going wrong.

Code:

Point(1) = {0.6, -0.2, 0.1, 1.0};
Extrude {1, 0, 0} {
  Point{1}; Layers{20};
}
Extrude {0, 1, 0} {
  Point{2};Layers{20};
}
Extrude {-1, 0, 0} {
  Point{3};Layers{20};
}
Extrude {0, -1, 0} {
  Point{4};Layers{20};
}
Line Loop(5) = {4, 1, 2, 3};
Plane Surface(6) = {5};

Extrude {0, 0, 2} {
  Surface{6}; Layers{{10,5}, {0.5,0.5}};
}

Thanks a ton!!

alexeym April 10, 2015 17:02

Hi,

I am not quite sure that I have got what you are trying to achieve (i.e. why use extrude instead of just creating straight lines). I did not checked Gmsh sources yet, but I think, the last value in relative heights should be 1 (at least if you put 1 in your case, error disappears). Also see comment in t3.geo before Extrude command.

dsn April 10, 2015 18:28

1 Attachment(s)
Hi,

I am trying to create a structured mesh for this geometry but i am just not able to do it. Also, I am unable to create a structured mesh for a geometry which has two blocks sitting next to each other..can you please help because im really stuck at this...:(

Code:

Point(1) = {0.9, -0.2, -0, 1.0};
Point(2) = {1, -0.2, 0, 1.0};
Point(3) = {1, -0.1, -0, 1.0};
Point(4) = {1, 0.1, -0, 1.0};
Point(5) = {0.9, 0.1, -0, 1.0};
Point(6) = {1.4, -0.1, 0, 1.0};
Point(7) = {1.4, 0.1, -0, 1.0};
Point(8) = {1.4, -0.2, 0, 1.0};

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

Line Loop(11) = {4, 5, 1, 2, 3};
Plane Surface(12) = {11};
Line Loop(13) = {7, -2, 8, 6};
Plane Surface(14) = {13};

Transfinite Line {7, 8} = 40 Using Progression 1;
Transfinite Line {2, 6} = 40 Using Progression 1;
Transfinite Surface {14} = {7, 6, 3, 4} Left;

Transfinite Line {2, 3, 5} = 40 Using Progression 1;
Transfinite Surface {14} = {4, 3, 6, 7} Right;
Recombine Surface {14};
Transfinite Surface {12} = {1, 2, 4, 5} Right;
Recombine Surface {12};
Transfinite Line {4, 1} = 10 Using Progression 1;


alexeym April 11, 2015 07:36

2 Attachment(s)
Hi,

I was not able to guess what geometry you are trying to mesh (L-shaped channel?). Please find example mesh of two adjacent blocks attached to the message. If you attach just a sketch of the geometry you are trying to mesh, maybe I will be able to help you.

dsn April 11, 2015 10:14

Hi,

Thank you so much for the example. That really helps. I have a question, for the transfinite algorithm to create structured mesh i.e no rtiangles or tetrahedra is it necessary for the lines being selected have equal number of points distributed?

alexeym April 11, 2015 13:27

Hi,

In fact I do not know exactly but in my meshes I keep number of points on opposite lines equal. Guess if number of points is different recombination algorithm may fail.

Alessandro1589 June 16, 2015 15:20

2d Mesh
 
Hi guys!
What happen if i set Layer >1 and use mesh for 2D simulation in Open Foam,(so set "empty" for the faces that are along 3d dimension)?
Have you got any idea?

Best Regards


All times are GMT -4. The time now is 00:27.