# [Gmsh] Strucutred mesh for 1/8th of a hollow sphere with quads and 8-node Hexahedron

Rahul Sharma rsh891 at gmail.com
Fri Jun 3 17:09:46 CEST 2016

```Hello everyone,

Fortunately I am able to solve this problem. Thanks to Salome (
http://www.salome-platform.org/forum/forum_10/984341982) from which I took
reference and able to mesh the sphere with only hexahedral mesh in gmsh.
The code for meshing a hollow sphere with only hexahedral elements is given
below:
a = 1/Sqrt(3);
b = 2/Sqrt(3);

Point(1)   = {0, 0, 0, 0.1};
Point(2)   = {1, 0, 0, 0.1};
Point(3)   = {2, 0, 0, 0.1};
Point(4)   = {0, 1, 0, 0.1};
Point(5)   = {0, 2, 0, 0.1};
Point(6)   = {0, 0, 1, 0.1};
Point(7)   = {0, 0, 2, 0.1};
Point(8)   = {Cos(Pi/4),Cos(Pi/4),0, 0.1};   // XY Plane inner sphere
Point(9)   = {2*Cos(Pi/4),2*Cos(Pi/4),0, 0.1}; // XY Plane outer sphere
Point(10)  = {0, Cos(Pi/4),Cos(Pi/4),0.1};   // YZ Plane inner sphere
Point(11)  = {0, 2*Cos(Pi/4),2*Cos(Pi/4),0.1};   // YZ Plane outer sphere
Point(12)  = {Cos(Pi/4), 0,Cos(Pi/4),0.1};   // XZ Plane inner sphere
Point(13)  = {2*Cos(Pi/4), 0, 2*Cos(Pi/4),0.1};   // XZ Plane outer sphere
Point(14)  = {a, a, a, 0.1};
Point(15)  = {b, b, b, 0.1};

Line(1) = {2, 3};
Line(2) = {4, 5};
Line(3) = {6, 7};
Line(4) = {8, 9};
Line(5) = {10, 11};
Line(6) = {12, 13};
Circle(7) = {2, 1, 12};
Circle(8) = {12, 1, 6};
Circle(9) = {6, 1, 10};
Circle(10) = {10, 1, 4};
Circle(11) = {4, 1, 8};
Circle(12) = {8, 1, 2};
Circle(13) = {3, 1, 13};
Circle(14) = {13, 1, 7};
Circle(15) = {7, 1, 11};
Circle(16) = {11, 1, 5};
Circle(17) = {5, 1, 9};
Circle(18) = {9, 1, 3};
Circle(19) = {12, 1, 14};
Circle(20) = {14, 1, 8};
Circle(21) = {14, 1, 10};
Circle(22) = {13, 1, 15};
Circle(23) = {15, 1, 9};
Circle(24) = {15, 1, 11};
Line(37) = {14, 15};

Line Loop(25) = {16, -2, -10, 5};
Plane Surface(26) = {25};
Line Loop(27) = {15, -5, -9, 3};
Plane Surface(28) = {27};
Line Loop(29) = {2, 17, -4, -11};
Plane Surface(30) = {29};
Line Loop(31) = {4, 18, -1, -12};
Plane Surface(32) = {31};
Line Loop(33) = {3, -14, -6, 8};
Plane Surface(34) = {33};
Line Loop(35) = {6, -13, -1, 7};
Plane Surface(36) = {35};
Line Loop(38) = {22, -37, -19, 6};
Plane Surface(39) = {38};
Line Loop(40) = {37, 23, -4, -20};
Plane Surface(41) = {40};
Line Loop(42) = {24, -5, -21, 37};
Plane Surface(43) = {42};
Line Loop(44) = {21, -9, -8, 19};
Ruled Surface(45) = {44};
Line Loop(46) = {21, 10, 11, -20};
Ruled Surface(47) = {46};
Line Loop(48) = {19, 20, 12, 7};
Ruled Surface(49) = {48};
Line Loop(50) = {22, 24, -15, -14};
Ruled Surface(51) = {50};
Line Loop(52) = {13, 22, 23, 18};
Ruled Surface(53) = {52};
Line Loop(54) = {23, -17, -16, -24};
Ruled Surface(55) = {54};

Surface Loop(56) = {53, 36, 32, 49, 41, 39};
Volume(57) = {56};
Surface Loop(58) = {51, 28, 45, 34, 43, 39};
Volume(59) = {58};
Surface Loop(60) = {30, 26, 55, 47, 43, 41};
Volume(61) = {60};

Transfinite Line {1,2,3,4,5,6,37}       = 6 Using Progression 1;
Transfinite Line {9,12,15,18,19,22}     = 6 Using Progression 1;
Transfinite Line {20,21,23,24,10,11,16,17,7,8,13,14} = 7 Using Progression
1;

Transfinite Surface {26,28,30,32,34,36,39,41,43,45,47,49,51,53,55};
Recombine Surface {26,28,30,32,34,36,39,41,43,45,47,49,51,53,55};

Transfinite Volume {57,59,61};
Recombine Volume {57,59,61};

On Tue, May 31, 2016 at 1:49 PM, Rahul Sharma <rsh891 at gmail.com> wrote:

> Hello,
>
> I am trying to mesh 1/8th of a hollow sphere which consists of three plane
> surfaces and two ruled surfaces, I am trying to get a mesh with all quads
> and 8-node Hexahedron elements however when I use transfinite surface and
> recombine surface and volume command ,tip of the sphere section is
> converted into prism elements that is what I don't want.
>
> Please take a look at the geo file
>
> Point(1)  = {0, 0, 0, 1};
> Point(2)  = {1, 0, 0, 1};
> Point(3)  = {2, 0, 0, 1};
> Point(4)  = {0, 1, 0, 1};
> Point(5)  = {0, 2, 0, 1};
> Point(6)  = {0, 0, 1, 1};
> Point(7)  = {0, 0, 2, 1};
>
> Line(1) = {4, 5};
> Line(2) = {2, 3};
> Line(3) = {6, 7};
> Circle(4) = {5, 1, 3};
> Circle(5) = {3, 1, 7};
> Circle(6) = {5, 1, 7};
> Circle(7) = {4, 1, 2};
> Circle(8) = {2, 1, 6};
> Circle(9) = {4, 1, 6};
>
> Line Loop(10) = {6, -3, -9, 1};
> Plane Surface(11) = {10};
> Line Loop(12) = {1, 4, -2, -7};
> Plane Surface(13) = {12};
> Line Loop(14) = {3, -5, -2, 8};
> Plane Surface(15) = {14};
> Line Loop(16) = {9, -8, -7};
> Ruled Surface(17) = {16};
> Line Loop(18) = {6, -5, -4};
> Ruled Surface(19) = {18};
>
> Surface Loop(20) = {19, 11, 15, 13, 17};
> Volume(21) = {20};
>
> Transfinite Line{1:3}     = 3 Using Progression 1;
> Transfinite Line{4,6,7,9} = 6 Using Progression 1;
> Transfinite Line{5,8}     = 7 Using Progression 1;
>
> Transfinite Surface{11,13,15,17,19};
> Recombine Surface{11,13,15,17,19};
>
> Transfinite Volume{21};
> Recombine Volume{21};
>
> --------------------------------------
> The mesh I want is similar to this (
> ).
>
>
> --
> Warm Regards,
>
> *Rahul Sharma*
> Structural Optimization and computaion mechanics
> Delft University of Technology
> Netherlands
>
>

--
Warm Regards,

*Rahul Sharma*