# [Gmsh] GMSH: Structured mesh of a square inside a circle

 Register Blogs Members List Search Today's Posts Mark Forums Read

January 26, 2015, 08:13
GMSH: Structured mesh of a square inside a circle
#1
New Member

Join Date: Jul 2014
Posts: 13
Rep Power: 8
Hi everyone!

I am trying to make in GMSH a fully structured mesh consisting of a small square inside a large circular domain, see the attached picture. One of my attempts is the following:

Code:
```// ---------------- Parameters ----------------
nLayers    = 5;   // Number of layers of the circular mesh part (in radial direction)
elem_close = 0.1; // Element size
width_st   = 0.4; // Width of the strucured box
height_st  = 0.4; // Height of the structured box
width_n    = 20;  // Elements in the x-direction
height_n   = 20;  // Elements in the y-direction

// ---------------- Circle ----------------
Point(1) = {0, 0, 0, 1e22};
Point(2) = {radius, 0, 0, 1e22};
Point(3) = {-radius, 0, 0, 1e22};
Point(4) = {0, -radius, 0, 1e22};
Point(5) = {0, radius, 0, 1e22};

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

Line Loop(6) = {1, 2, 3, 4};
Transfinite Line{1, 2, 3, 4} = nLayers Using Progression 1;

// ---------------- Box part -----------------
Point(10) = {-width_st/2,-height_st/2, 0, elem_close};
Point(11) = {width_st/2,-height_st/2, 0, elem_close};
Point(12) = {width_st/2,height_st/2, 0, elem_close};
Point(13) = {-width_st/2, height_st/2, 0, elem_close};

Line(10) = {10,11};
Line(11) = {11,12};
Line(12) = {12,13};
Line(13) = {13,10};

Line Loop(10) = {10,11,12,13};

// Surfaces
Plane Surface(10) = {10};
Transfinite Line{10,12} = width_n;
Transfinite Line{11,13} = height_n;
Transfinite Surface(10);
Recombine Surface(10); // hexahedra's

// Surface between square and circle
Plane Surface(1) = {6,10};

Extrude {0,0,5} {
Surface{1,10};
Layers{1};
Recombine;
}```
When I mesh this, the domain between the square and the edge of the circle becomes unstructered. How can I get the mesh as in the enclosed picture?

Thanks a lot!
Attached Images
 meshGoal.png (6.0 KB, 162 views)

 January 26, 2015, 08:26 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,926 Rep Power: 35 Hi, Transfinite algorithm can be used for surfaces with 3 or 4 corners or for volumes with 5 or 6 faces (http://www.geuz.org/gmsh/doc/texinfo...ructured-grids). Volume around inner cuboid does not have required number of faces, so it is meshed with tetrahedra. If you are trying to mesh a cylinder, you should divide outer circle other way. See for example - https://bitbucket.org/mrklein/gmsh-m...cylinder-1.geo.

 January 26, 2015, 08:37 #3 New Member   Join Date: Jul 2014 Posts: 13 Rep Power: 8 Wow that was quick! And it also solved it, great! Thank you very much.

September 18, 2019, 16:13
GMSH; Mesh occurs inside airfoil geometry
#4
New Member

Akbalom
Join Date: Aug 2019
Location: Istanbul, Turkey
Posts: 7
Rep Power: 3
Hi,,

When spline command is used to connect points airfoil geometry, after the mesh construct, there would be a mesh inside de airfoil layer. Whereas, plane surface is defined outer layer of airfoil. Attachment is here.
Attached Images
 airfoil.jpg (65.8 KB, 26 views)

 Tags circle+square, gmsh, mesh for aero-acoustics