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] Problem in mesh saving (https://www.cfd-online.com/Forums/openfoam-meshing/188169-problem-mesh-saving.html)

Jibran May 24, 2017 09:32

Problem in mesh saving
 
2 Attachment(s)
Hello everyone,

I am facing a minor problem while saving the mesh created from a Gmsh script file. I can see the complete mesh when I run the script (snapshot is attached named 'mesh_complete') however only part of the mesh is saved in the 'mesh.msh' file (snapshot named 'mesh_quarter').

The script I am using can be found below.

Code:

cc = 6;
cd = 4;
cz = 8;

cr=0.05;
zmax=0.5;
cx=Sqrt(cr*cr/2.0);

sl=1/3.0;
sx=sl/2.0;

nc = cc + 1;
nd = cd + 1;


// Section 1
Point(1) = {0, 0, 0};
Point(2) = {cx, cx, 0};
Point(3) = {sx, sx, 0};
Point(4) = {-sx, sx, 0};
Point(5) = {-cx, cx, 0};

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

Transfinite Line{1,3} = nd;
Transfinite Line{2,4} = nc;
Transfinite Surface{1} = {2,3,4,5};
Recombine Surface{1};


Rotate {{0, 0, 1}, {0, 0, 0}, Pi} {
  Duplicata { Surface{1}; }
}
Transfinite Line{8,6} = nd;
Transfinite Line{9,7} = nc;
Transfinite Surface{5} = {6,7,11,15};
Recombine Surface{5};


Rotate {{0, 0, 1}, {0, 0, 0}, -Pi/2} {
  Duplicata { Surface{1}; }
}
Transfinite Line{14,12} = nc;
Transfinite Surface{10} = {2,3,11,15};
Recombine Surface{10};


Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{1}; }
}
Transfinite Line{19,17} = nc;
Transfinite Surface{15} = {4,5,6,7};
Recombine Surface{15};


// Extrusion in the third dimension
Extrude{0,0,zmax}{
Surface{1,5,10,15};
Layers{cz};Recombine;
}

Physical Surface("fixed") = {1};
Physical Volume("volume") = {1,5,10,15};

Mesh 3;
Coherence Mesh;
Save "mesh.msh";

I would be very grateful if someone spots the problem in my script or has any suggestion. Please note that I have already to save the mesh through GUI but I obtain the same result.

Many thanks

alexeym May 24, 2017 11:17

Hi,

You messed up physical surface and physical volume definitions. And since the only valid number in volume definition is 1, you got quarter of the mesh.

Jibran May 24, 2017 11:32

Quote:

Originally Posted by alexeym (Post 650132)
Hi,

You messed up physical surface and physical volume definitions. And since the only valid number in volume definition is 1, you got quarter of the mesh.


Hi Alexey,

Many thanks for the prompt response.
The volume definition was wrong. It should have been
Code:

Physical Volume("volume") = {1,2,3,4};
Works perfectly now. Thanks again


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