CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

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

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2015, 08:13
Default GMSH: Structured mesh of a square inside a circle
  #1
New Member
 
Join Date: Jul 2014
Posts: 13
Rep Power: 11
wc3speler is on a distinguished road
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
File Type: png meshGoal.png (6.0 KB, 183 views)
wc3speler is offline   Reply With Quote

Old   January 26, 2015, 08:26
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
alexeym is offline   Reply With Quote

Old   January 26, 2015, 08:37
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 13
Rep Power: 11
wc3speler is on a distinguished road
Wow that was quick! And it also solved it, great!

Thank you very much.
wc3speler is offline   Reply With Quote

Old   September 18, 2019, 16:13
Default GMSH; Mesh occurs inside airfoil geometry
  #4
New Member
 
Akbalom
Join Date: Aug 2019
Location: Istanbul, Turkey
Posts: 7
Rep Power: 6
AKBALOM is on a distinguished road
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
File Type: jpg airfoil.jpg (65.8 KB, 50 views)
AKBALOM is offline   Reply With Quote

Reply

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


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Gmsh: Structured Mesh problems skrishnamoorthy OpenFOAM Meshing & Mesh Conversion 3 August 9, 2017 22:48
[Gmsh] Gmsh: Unstructured to Structured Mesh geometry ChasingNeutrons OpenFOAM Meshing & Mesh Conversion 0 November 22, 2016 12:55
[snappyHexMesh] Layers:problem with curvature giulio.topazio OpenFOAM Meshing & Mesh Conversion 10 August 22, 2012 09:03
Structured Mesh in GMSH vitor Main CFD Forum 4 April 28, 2010 08:15
unstructured vs. structured grids Frank Muldoon Main CFD Forum 1 January 5, 1999 10:09


All times are GMT -4. The time now is 20:40.