[Gmsh] mesh a cylinder with hole

Mikhail Artemyev artemiev.mikhail at gmail.com
Thu May 1 20:59:50 CEST 2014


Hi Alberto,
The model you're trying to mesh is not so trivial to be defined the way 
you did it.
First of all you have to define the curved surfaces correctly.
Since they are ruled surfaces they have to be described by 3 or 4 lines,
therefore I would suggest to define the following part of the model
(it's not the part of your model exactly - just a draft to show an idea)

// ----- part.geo ----

cl = 0.1;
R  = 1.0; // radius of the cylinder
H  = 1.0; // height of the cylinder
r  = 0.2; // radius of the hole
// y-coord of an intersection between
// the hole and side surface of the cylinder
y = Sqrt(R*R - r*r);

Point(1) = { R, 0, 0, cl };
Point(2) = { 0, 0, 0, cl };
Point(3) = { r, y, 0, cl };
Point(4) = { 0, R, 0, cl };
Point(5) = { 0, R, r, cl };
Point(11) = { R, 0, H, cl };
Point(12) = { 0, 0, H, cl };
Point(13) = { r, y, H, cl };
Point(14) = { 0, R, H, cl };
Circle(1) = { 1, 2, 3 };
Circle(2) = { 3, 4, 5 };
Circle(11) = { 11, 12, 13 };
Circle(12) = { 13, 12, 14 };
Line(21) = { 1, 11 };
Line(22) = { 3, 13 };
Line(23) = { 5, 14 };
Line Loop(1) = { 1, 22, -11, -21 };
Line Loop(2) = { 2, 23, -12, -22 };
Ruled Surface(1) = { 1 };
Ruled Surface(2) = { 2 };

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

Using this part and a combination of commands Symmetry and Duplicata
should let you build what you wanted.

Best regards,
Mikhail



On 05/01/2014 05:00 AM, gmsh-request at ace20.montefiore.ulg.ac.be wrote:
> Dear gmsh developers and users,
>
>
>
> I have a problem to mesh a cylinder with a hole. I don't know how to create the
> volume. The hole crosses the cylinder on the curved surface as below
>
> ////////
>
> Point(1) =
> {0, 0, 0, 1.0};
>
> Point(2) = {0, 1, 0, 1.0};
>
> Point(3) = {-1, 0, 0, 1.0};
>
> Circle(1) = {2, 1, 3};
>
>
>
> For i In {1: 3 : 1}
>
> Rotate {{0,0,1}, {0, 0, 0}, Pi/2} {
>
>    Duplicata { Line{i}; }
>
> }
>
> EndFor
>
>
>
> Extrude {0, 0, -5} {
>
>    Line{1, 2, 3, 4};
>
> }
>
> Extrude {0, 0, 5} {
>
>    Line{1, 2, 3, 4};
>
> }
>
> Point(28) = {0, 4, 0, 1.0};
>
> Point(29) = {0, 4, 5, 1.0};
>
> Point(30) = {-5, 4, 0, 1.0};
>
> Circle(37) = {30, 28, 29};
>
>
>
> For i In {37: 39 : 1}
>
> Rotate {{0,1,0}, {0, 0, 0}, Pi/2} {
>
>    Duplicata { Line{i}; }
>
> }
>
> EndFor
>
> Extrude {0, -7, 0} {
>
>    Line{37,38,39,40};
>
> }
>
> /////
>
> Is there someone that could help me?Thanks a lot
>
> Alberto
>
>