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] element connectivity in gmsh file (https://www.cfd-online.com/Forums/openfoam-meshing/169586-element-connectivity-gmsh-file.html)

mayankpatni April 13, 2016 12:24

element connectivity in gmsh file
 
Dear All,

I am new to OpenFOAM Gmsh. I am using below commands to generate a 2D mesh with 2nd order:

// Gmsh project created on Wed Apr 13 13:55:50 2016

lc = 1e-5;


Point(1) = {-10,0,-10,lc};
Point(2) = {10,0,-10,lc} ;
Point(3) = {10,0,10,lc} ;
Point(4) = {-10,0,10,lc} ;

Line(1) = {1,2} ;
Line(2) = {2,3} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;

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

Plane Surface(6) = {5};

Transfinite Line{1,2,3,4} = 3;
Transfinite Surface{6};
Recombine Surface{6};


When I save the msh file and read to check the element connectivity, it gives as below :

$Elements
16
1 15 2 0 1 1
2 15 2 0 2 2
3 15 2 0 3 3
4 15 2 0 4 4
5 8 2 0 1 1 5 6
6 8 2 0 1 5 2 7
7 8 2 0 2 2 8 9
8 8 2 0 2 8 3 10
9 8 2 0 3 3 11 12
10 8 2 0 3 11 4 13
11 8 2 0 4 4 14 15
12 8 2 0 4 14 1 16
13 10 2 0 6 4 14 17 11 15 18 19 13 20
14 10 2 0 6 11 17 8 3 19 21 10 12 22
15 10 2 0 6 14 1 5 17 16 6 23 18 24
16 10 2 0 6 17 5 2 8 23 7 9 21 25
$EndElements


Ideally it should be only 4 elements (4 9-noded elements). How to remove the elements from 1-12 ?

Any suggestions would be helpful.

Thanks !

aljazari April 15, 2016 10:09

Quote:

c = 1e-5;


Point(1) = {-10,0,-10,lc};
Point(2) = {10,0,-10,lc} ;
Point(3) = {10,0,10,lc} ;
Point(4) = {-10,0,10,lc} ;

Line(1) = {1,2} ;
Line(2) = {2,3} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;

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

Plane Surface(6) = {5};

Transfinite Line{1,2,3,4} = 3;
Transfinite Surface{6};
Recombine Surface{6};

Physical Surface(1) = {6};

You need to add a physical surface. This should leave you with four elements.

mayankpatni April 15, 2016 10:17

Hello Abdulhaq,

Thank you so much for your reply. This is what I was looking. :)

I have one more question. When I read the mesh file, its like
************************************************** ***

$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
9
1 -10 0 -10
2 10 0 -10
3 10 0 10
4 -10 0 10
5 -1.232614010859834e-11 0 -10
6 10 0 -1.232614010859834e-11
7 1.232614010859834e-11 0 10
8 -10 0 1.232614010859834e-11
9 0 0 1.519298140712631e-23
$EndNodes
$Elements
4
1 3 2 1 6 4 8 9 7
2 3 2 1 6 7 9 6 3
3 3 2 1 6 8 1 5 9
4 3 2 1 6 9 5 2 6
$EndElements

************************************************** ***
How to get the coordinates as 0 instead of very small numbers for nodes 5-9 ?

5 -1.232614010859834e-11 0 -10
6 10 0 -1.232614010859834e-11
7 1.232614010859834e-11 0 10
8 -10 0 1.232614010859834e-11
9 0 0 1.519298140712631e-23

Regards
Mayank

aljazari April 15, 2016 11:27

You are welcome.

There is no apparent way to control the precision.

Smoothing the mesh replaced the node which contained "e-23" with 0 but nothing else.

You can smooth the mesh either from the command line:

Quote:

gmsh -2 input.geo -smooth 20
or by adding the following in the geometry file:

Quote:

Mesh.Smoothing = 20;


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