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

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

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

Join Date: Jul 2014
Posts: 13
Rep Power: 11
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
radius     = 1;   // Radius of the circle
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, 182 views)

 January 26, 2015, 09:26 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,930 Rep Power: 38 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, 09:37 #3 New Member   Join Date: Jul 2014 Posts: 13 Rep Power: 11 Wow that was quick! And it also solved it, great! Thank you very much.

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

Akbalom
Join Date: Aug 2019
Location: Istanbul, Turkey
Posts: 7
Rep Power: 6
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, 50 views)

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

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post skrishnamoorthy OpenFOAM Meshing & Mesh Conversion 3 August 9, 2017 23:48 ChasingNeutrons OpenFOAM Meshing & Mesh Conversion 0 November 22, 2016 13:55 [snappyHexMesh] Layers:problem with curvature giulio.topazio OpenFOAM Meshing & Mesh Conversion 10 August 22, 2012 10:03 vitor Main CFD Forum 4 April 28, 2010 09:15 Frank Muldoon Main CFD Forum 1 January 5, 1999 11:09

All times are GMT -4. The time now is 01:32.

 Contact Us - CFD Online - Privacy Statement - Top