[Gmsh] mesh a hemisphere using hexahedral

Margarita Satraki margarita.satraki at gmail.com
Wed Nov 2 13:35:12 CET 2011


Hi,

I'm trying to mesh a hemisphere using only hexahedral and I followed the
logic behind the code given here:
http://geuz.org/pipermail/gmsh/2005/001609.html

I'm probably doing something wrong with the Transfinite function and I get
errors such as:
"Cannot tetrahedralize volume with quadrangles on boundary"
But what I want is the software to hexahedralize. Can you spot the problem
with the code?

Many thanks!

Margarita

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

l = 1;
r1 = 0.5;
r2 = 1;
n = 10;
r3=1.224744871391589;

// interior cube
Point(1) = {0,0,0,l};
Point(2) = {r1,r1,-r1,l};
Point(3) = {-r1,r1,-r1,l};
Point(4) = {-r1,-r1,-r1,l};
Point(5) = {r1,-r1,-r1,l};
Line(1) = {2,3};
Line(2) = {3,4};
Line(3) = {4,5};
Line(4) = {5,2};
Transfinite Line{1:4} = n;
Line Loop(5) = {4,1,2,3};
Plane Surface(6) = {5};
Transfinite Surface{6} = {2,3,4,5};
Recombine Surface{6};
Extrude Surface {6, {0.0,0.0,r1}};

// force transfinite grid in interior cube
Transfinite Line {3,22,11,13,8,4,14,9,1,18,10,2} = n;
Transfinite Surface {6} = {4,5,2,3};
Transfinite Surface {15} = {5,6,7,2};
Transfinite Surface {19} = {11,7,2,3};
Transfinite Surface {23} = {4,15,11,3};
Transfinite Surface {27} = {15,6,5,4};
Transfinite Surface {28} = {15,6,7,11};
Recombine Surface{6,15,19,23,27,28};
Transfinite Volume{1} = {4,5,2,3,15,6,7,11};

// exterior shell
Point(102) = {r2,-r2,-r2,l};
Point(103) = {-r2,-r2,-r2,l};
Point(104) = {-r3,-r3,-0,l};
Point(105) = {r3,-r3,-0,l};
Circle(29) = {103,1,102};
Circle(30) = {102,1,105};
Circle(31) = {105,1,104};
Circle(32) = {104,1,103};
Line Loop(33) = {29,30,31,32};
Ruled Surface(45) = {33};
Rotate { {0,0,1},{0,0,0}, Pi/2 } { Duplicata{ Surface{45}; } }
Rotate { {0,0,1},{0,0,0}, Pi } { Duplicata{ Surface{45}; } }
Rotate { {0,0,1},{0,0,0}, 3*Pi/2 } { Duplicata{ Surface{45}; } }



Line Loop(58) = {51, 55, 29, 47};
Ruled Surface(59) = {58};
Line(60) = {11, 121};
Line(61) = {116, 3};
Line(62) = {15, 104};
Line(63) = {103, 4};
Line(64) = {6, 105};
Line(65) = {102, 5};
Line(66) = {7, 113};
Line(67) = {108, 2};
Line Loop(68) = {61, 18, 60, -52};
Plane Surface(69) = {68};
Line Loop(70) = {67, 14, 66, -48};
Plane Surface(71) = {70};
Line Loop(72) = {65, 13, 64, -30};
Plane Surface(73) = {72};
Line Loop(74) = {22, 62, 32, 63};
Plane Surface(75) = {74};
Line Loop(76) = {10, 62, 57, -60};
Plane Surface(77) = {76};
Line Loop(78) = {9, 60, 53, -66};
Plane Surface(79) = {78};
Line Loop(80) = {8, 66, 49, -64};
Plane Surface(81) = {80};
Line Loop(82) = {4, -67, -47, 65};
Plane Surface(83) = {82};
Line Loop(84) = {29, 65, -3, -63};
Plane Surface(85) = {84};
Line Loop(86) = {2, -63, -55, 61};
Plane Surface(87) = {86};
Line Loop(88) = {51, 61, -1, -67};
Plane Surface(89) = {88};
Line Loop(91) = {11, 64, 31, -62};
Plane Surface(92) = {91};

Transfinite Line
{49,31,32,53,8,9,10,11,47,51,57,29,55,30,48,52,32,65,64,63,62,60,61,66,67}
= n;
Transfinite Surface {77} = {15,11,121,104};
Transfinite Surface {75} = {103,4,15,104};
Transfinite Surface {69} = {3,11,121,116};
//Transfinite Surface {23} = {};
Transfinite Surface {87} = {103,116,4,3};
Transfinite Surface {54} = {103,116,121,104};
Recombine Surface{77,75,69,23,87,54};
Surface Loop(99) = {77, 54, 75, 69, 23, 87};
Volume(100) = {99};

Transfinite Surface {79} = {11,7,113,121};
//Transfinite Surface {69} = {3,11,121,116};
Transfinite Surface {71} = {2,108,113,7};
Transfinite Surface {50} = {116,108,113,121};
//Transfinite Surface {19} = {11,7,2,3};
Transfinite Surface {89} = {2,3,116,108};
Recombine Surface{79,69,71,50,19,89};
Surface Loop(93) = {50, 79, 89, 19, 71, 69};
Volume(94) = {93};

Transfinite Surface {81} = {7,6,105,113};
//Transfinite Surface {71} = {2,108,113,7};
Transfinite Surface {73} = {5,6,105,102};
Transfinite Surface {83} = {2,5,102,108};
Transfinite Surface {46} = {102,105,113,108};
//Transfinite Surface {15} = {};
Recombine Surface{81,71,73,83,46,15};
Surface Loop(95) = {81, 46, 71, 73, 15, 83};
Volume(96) = {95};

Transfinite Surface {92} = {6,15,105,104};
//Transfinite Surface {27} = {};
Transfinite Surface {45} = {105,104,103,102};
//Transfinite Surface {73} = {};
//Transfinite Surface {75} = {};
Transfinite Surface {85} = {4,5,102,103};
Recombine Surface{92,27,45,73,75,85};
Surface Loop(97) = {92, 45, 73, 75, 85, 27};
Volume(98) = {97};

//Transfinite Surface {89} = {};
//Transfinite Surface {87} = {};
//Transfinite Surface {83} = {};
//Transfinite Surface {6} = {};
Transfinite Surface {59} = {102,108,116,103};
//Transfinite Surface {85} = {};
Recombine Surface{89,87,83,6,59,85};
Surface Loop(101) = {59, 85, 83, 89, 87, 6};
Volume(102) = {101};

Transfinite Volume{100} = {15,11,3,4,121,104,103,116};
Transfinite Volume{94} = {2,3,11,7,113,121,116,108};
Transfinite Volume{96} = {2,5,6,7,102,105,108,113};
Transfinite Volume{98} = {4,5,6,15,102,103,104,105};
Transfinite Volume{102} = {2,3,4,5,102,108,103,116};
Physical Volume(1) = {1, 94:102:2};
Mesh 3;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20111102/da5c55bf/attachment.html>