1
$\begingroup$

I am struggling to recombine the remaining triangular cells into unstructured quadrangular ones in this geometry using Gmsh. Do I need to add auxiliary lines somewhere or do some geometries just don't allow these type of cells?

enter image description here

The .geo script:

// Gmsh project created on Wed Jul 29 13:32:48 2020
SetFactory("OpenCASCADE");
//+
Point(1) = {-4.1, -2.7, 0, 1.0};
//+
Point(2) = {-3.6, -2.7, 0, 1.0};
//+
Point(3) = {3.6, -2.7, 0, 1.0};
//+
Point(4) = {4.1, -2.7, 0, 1.0};
//+
Point(5) = {4.1, -2.2, 0, 1.0};
//+
Point(6) = {4.1, 2.2, 0, 1.0};
//+
Point(7) = {4.1, 2.7, 0, 1.0};
//+
Point(8) = {3.6, 2.7, 0, 1.0};
//+
Point(9) = {-3.6, 2.7, 0, 1.0};
//+
Point(10) = {-4.1, 2.7, 0, 1.0};
//+
Point(11) = {-4.1, 2.2, 0, 1.0};
//+
Point(12) = {-4.1, -2.2, 0, 1.0};
//+
Point(13) = {-3.6, -2.2, 0, 1.0};
//+
Point(14) = {3.6, -2.2, 0, 1.0};
//+
Point(15) = {3.6, 2.2, 0, 1.0};
//+
Point(16) = {-3.6, 2.2, 0, 1.0};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 4};
//+
Line(4) = {4, 5};
//+
Line(5) = {5, 6};
//+
Line(6) = {6, 7};
//+
Line(7) = {7, 8};
//+
Line(8) = {8, 9};
//+
Line(9) = {9, 10};
//+
Line(10) = {10, 11};
//+
Line(11) = {11, 12};
//+
Line(12) = {12, 1};
//+
Line(13) = {13, 14};
//+
Line(14) = {14, 15};
//+
Line(15) = {15, 16};
//+
Line(16) = {16, 13};
//+
Line(17) = {12, 13};
//+
Line(18) = {13, 2};
//+
Line(19) = {14, 3};
//+
Line(20) = {14, 5};
//+
Line(21) = {15, 6};
//+
Line(22) = {15, 8};
//+
Line(23) = {16, 11};
//+
Line(24) = {16, 9};
//+
Point(17) = {-2.1, -0.7, 0, 1.0};
//+
Point(18) = {2.1, -0.7, 0, 1.0};
//+
Point(19) = {2.1, 0.7, 0, 1.0};
//+
Point(20) = {-2.1, 0.7, 0, 1.0};
//+
Point(21) = {-2.1, 0.5, 0, 1.0};
//+
Point(22) = {1.9, 0.5, 0, 1.0};
//+
Point(23) = {1.9, -0.5, 0, 1.0};
//+
Point(24) = {-2.1, -0.5, 0, 1.0};
//+
Line(25) = {17, 18};
//+
Line(26) = {18, 19};
//+
Line(27) = {19, 20};
//+
Line(28) = {20, 21};
//+
Line(29) = {21, 22};
//+
Line(30) = {22, 23};
//+
Line(31) = {23, 24};
//+
Line(32) = {24, 17};
//+
Curve Loop(1) = {11, 17, -16, 23};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {12, 1, -18, -17};
//+
Plane Surface(2) = {2};
//+
Curve Loop(3) = {2, -19, -13, 18};
//+
Plane Surface(3) = {3};
//+
Curve Loop(4) = {3, 4, -20, 19};
//+
Plane Surface(4) = {4};
//+
Curve Loop(5) = {14, 21, -5, -20};
//+
Curve Loop(6) = {14, 21, -5, -20};
//+
Plane Surface(5) = {6};
//+
Curve Loop(7) = {21, 6, 7, -22};
//+
Curve Loop(8) = {22, -7, -6, -21};
//+
Plane Surface(6) = {8};
//+
Curve Loop(9) = {15, 24, -8, -22};
//+
Curve Loop(10) = {27, 28, 29, 30, 31, 32, 25, 26};
//+
Curve Loop(11) = {15, 24, -8, -22};
//+
Plane Surface(7) = {11};
//+
Curve Loop(12) = {23, -10, -9, -24};
//+
Plane Surface(8) = {12};
//+
Curve Loop(13) = {16, 13, 14, 15};
//+
Curve Loop(14) = {27, 28, 29, 30, 31, 32, 25, 26};
//+
Plane Surface(9) = {13, 14};
//+
Transfinite Surface {1, 2, 3, 4, 5, 6, 7, 8};
//+
Transfinite Curve {12, 18, 1, 17, 19, 3, 4, 20, 21, 22, 6, 7, 23, 9, 10, 24} = 6 Using Progression 1;
//+
Transfinite Curve {13, 2, 16, 11, 15, 8, 14, 5} = 35 Using Progression 1;
//+
Recombine Surface {1, 2, 3, 4, 5, 6, 7, 8};
$\endgroup$
2
$\begingroup$

To get the triangles in the last surface Recombined into quadrilaterals, you simply need to add the surface #9 into the last line:

Recombine Surface {1, 2, 3, 4, 5, 6, 7, 8, 9};

This will result in:

enter image description here

Also, you might be interested in the

Mesh.RecombineAll = 1;

option. And playing with the 2-D Recombination algorithm via Mesh.RecombinationAlgorithm might allow you to achieve elements that fit your purpose better (0: simple, 1: blossom, 2: simple full-quad, 3: blossom full-quad).

Unfortunately, you cannot make the surface #9 Transfinite as well that easily (which would have enabled structured quadrilateral mesh).

The only solution I am aware of is to manually split #9 into several simple 4-corner surfaces.

However, the screenshot above seems to satisfy the requirements you have specified.

$\endgroup$
1
  • $\begingroup$ Thank you! The problem was I was trying to add another line with Recombine Surface {9}. I thought I had to do so since the surface #9 wasn't "Transfinited". And yes, that solves my problem and thank you for the hints! $\endgroup$ – Lucas Vieira Jul 29 '20 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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