The question is pretty much the title. Note that I have lots of experience using open-source meshing tool, e.g. Gmsh and OpenFoam blockMesh & snappyHexMesh. Nevertheless, I have no idea on how to generate the 2D mesh shown below when doing some simple test in SU2 (CFD code).

I believe some commercial meshing kits can do this job, but no experience using any commercial codes as I mainly work with open-source mesh/CFD codes.

Any idea which mesh libraries (e.g. CGAL, OpenMesh) can make hybrid 2D tri/quad mesh?


Update 1: The quad-mesh around the rectangle seems like beautiful O-Grid style. Any idea achieve this?

enter image description here

up vote 6 down vote accepted

You can use Gmsh for this purpose. I show an example below.

// Points
Point(1) = {-2, -2, 0, 1.0};
Point(2) = {2, -2, 0, 1.0};
Point(3) = {2, 2, 0, 1.0};
Point(4) = {-2, 2, 0, 1.0};
Point(5) = {-10, -10, 0, 2.0};
Point(6) = {10, -10, 0, 2.0};
Point(7) = {10, 10, 0, 2.0};
Point(8) = {-10, 10, 0, 2.0};

// Lines
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 5};

// Surfaces
Line Loop(1) = {3, 4, 1, 2};
Plane Surface(1) = {1};
Line Loop(2) = {7, 8, 5, 6};
Plane Surface(2) = {-1, -2};

// Meshing
Transfinite Line {3, 4, 1, 2} = 10 Using Progression 1;
Transfinite Surface {1};
Recombine Surface {1};

Obtaining the following mesh. enter image description here

Update

// Points
Point(1) = {0, 0, 0, 1.0};
Point(2) = {-1, -1, 0, 1.0};
Point(3) = {1, -1, 0, 1.0};
Point(4) = {1, 1, 0, 1.0};
Point(5) = {-1, 1, 0, 1.0};
Point(6) = {-5*Sqrt(2)/2, -5*Sqrt(2)/2, 0, 1.0};
Point(7) = {5*Sqrt(2)/2, -5*Sqrt(2)/2, 0, 1.0};
Point(8) = {5*Sqrt(2)/2, 5*Sqrt(2)/2, 0, 1.0};
Point(9) = {-5*Sqrt(2)/2, 5*Sqrt(2)/2, 0, 1.0};
Point(10) = {-10, -10, 0, 2.0};
Point(11) = {10, -10, 0, 2.0};
Point(12) = {10, 10, 0, 2.0};
Point(13) = {-10, 10, 0, 2.0};

// Lines
Line(1) = {2, 3};
Line(2) = {3, 4};
Line(3) = {4, 5};
Line(4) = {5, 2};
Line(5) = {6, 2};
Line(6) = {7, 3};
Line(7) = {8, 4};
Line(8) = {9, 5};
Line(9) = {10, 11};
Line(10) = {11, 12};
Line(11) = {12, 13};
Line(12) = {13, 10};
Circle(13) = {8, 1, 9};
Circle(14) = {9, 1, 6};
Circle(15) = {6, 1, 7};
Circle(16) = {7, 1, 8};

// Surfaces
Line Loop(1) = {11, 12, 9, 10};
Line Loop(2) = {13, 14, 15, 16};
Plane Surface(1) = {1, 2};
Line Loop(3) = {7, 3, -8, -13};
Plane Surface(2) = {-3};
Line Loop(4) = {14, 5, -4, -8};
Plane Surface(3) = {4};
Line Loop(5) = {1, -6, -15, 5};
Plane Surface(4) = {-5};
Line Loop(6) = {6, 2, -7, -16};
Plane Surface(5) = {-6};

// Meshing
Transfinite Line {8, 7, 6, 5} = 10 Using Progression 1;
Transfinite Line {14, 13, 16, 15, 1, 4, 3, 2} = 10 Using Progression 1;
Transfinite Surface {3};
Transfinite Surface {2};
Transfinite Surface {5};
Transfinite Surface {4};
Recombine Surface {2, 3, 4, 5};

enter image description here

  • Well done. However, the rectangle should be a hole, and mesh around the boundary should be quad-mesh. – KOF Dec 4 at 19:38
  • @KOF, your question was about getting a hybrid mesh, not getting your particular mesh. – nicoguaro Dec 4 at 19:40
  • I knew transfinite in Gmsh can make quad-mesh, but can you make the 2D mesh shown above using this approach? – KOF Dec 4 at 19:47
  • @KOF, see my update. – nicoguaro Dec 4 at 20:04
  • Pretty close. thanks. I would prefer O-grid style more around the obstacle. – KOF Dec 4 at 20:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.