D = 30;
d = 15;
t = 5;
lc = 5;
lc2=2; // raffinement en sortie
lc3=2; // raffinement en entree

/* premier grand cercle C1 */ 
Point(1) = {0, 0, 0, lc};
Point(2) = {D/2, 0, 0, lc};
Point(3) = {0, D/2, 0, lc};
Point(4) = {-D/2, 0, 0, lc};
Point(5) = {0, -D/2, 0, lc};

/*second  grand cercle C2*/ 
Point(17) = {0, D/2, 5*D, lc2};
Point(19) = {D/2, 0, 5*D, lc2};
Point(24) = {0, -D/2, 5*D, lc2};
Point(29) = {-D/2, 0, 5*D, lc2};

/*troisieme grand cercle C3*/ 
Point(11) = {0, 0, 5*D+t, lc2};
Point(12) = {D/2, 0, 5*D+t, lc2};
Point(13) = {0, D/2, 5*D+t, lc2};
Point(14) = {-D/2, 0, 5*D+t, lc2};
Point(15) = {0, -D/2, 5*D+t, lc2};

/*quatrième grand cercle C4*/ 
Point(16) = {0, 0, 15*D+t, lc};
Point(43) = {0, D/2, 15*D+t, lc};
Point(45) = {D/2, 0, 15*D+t, lc};
Point(50) = {0, -D/2, 15*D+t, lc};
Point(55) = {-D/2, 0, 15*D+t, lc};

/* premier petit cercle c1 */ 
Point(6) = {0, 0, 5*D, lc3};
Point(7) = {d/2, 0, 5*D, lc3};
Point(8) = {0, d/2, 5*D, lc3};
Point(9) = {-d/2, 0, 5*D, lc3};
Point(10) = {0, -d/2, 5*D, lc3};

/*second petit cercle c2*/ 
Point(56) = {0,0,5*D+t, lc3};
Point(30) = {0, d/2, 5*D+t, lc3};
Point(32) = {d/2, 0, 5*D+t, lc3};
Point(37) = {0, -d/2, 5*D+t, lc3};
Point(42) = {-d/2, 0, 5*D+t, lc3};

/* C1 */
Circle(1) = {2, 1, 5};
Circle(2) = {5, 1, 4};
Circle(3) = {4, 1, 3};
Circle(4) = {3, 1, 2};

/* c1 */
Circle(5) = {7, 6, 10};
Circle(6) = {10, 6, 9};
Circle(7) = {9, 6, 8};
Circle(8) = {8, 6, 7};

/* C3 */
Circle(9) = {12, 11, 15};
Circle(10) = {15, 11, 14};
Circle(11) = {14, 11, 13};
Circle(12) = {13, 11, 12};

/* C2 */
Circle(20) = {17, 6, 19};
Circle(21) = {19, 6, 24};
Circle(22) = {24, 6, 29};
Circle(23) = {29, 6, 17};

/* C4 */
Circle(24) = {45, 16, 43};
Circle(25) = {43, 16, 55};
Circle(26) = {55, 16, 50};
Circle(27) = {50, 16, 45};


//Creation cylindre 1 
Line(29) = {14, 55};
Line(30) = {43, 13};
Line Loop(31) = {30, -11, 29, -25};
Ruled Surface(32) = {31};
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{32}; }
}
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{33}; }
}
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{37}; }
}


// creation cylindre 3
Line(42) = {17, 3};
Line(43) = {4, 29};
Line Loop(44) = {43, 23, 42, -3};
Ruled Surface(45) = {44};
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{45}; }
}
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{46}; }
}
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{48}; }
}

/* c2*/
Circle(51) = {30, 11, 42};
Circle(52) = {42, 11, 37};
Circle(53) = {37, 11, 32};
Circle(54) = {32, 11, 30};

// Creation cylindre 2
Line(55) = {30, 8};
Line(56) = {42, 9};
Line Loop(57) = {56, 7, -55, 51};
Ruled Surface(58) = {57};
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{58}; }
}
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{59}; }
}
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Duplicata { Surface{61}; }
}


// Def surface ext
Line Loop(64) = {51, 52, 53, 54};
Line Loop(66) = {8, 5, 6, 7};
Line Loop(68) = {11, 12, 9, 10};
Plane Surface(69) = {64, 68};

Line Loop(70) = {23, 20, 21, 22};
Plane Surface(71) = {66, 70};

Line Loop(72) = {4, 1, 2, 3};
Plane Surface(73) = {72};

Line Loop(74) = {24, 25, 26, 27};
Plane Surface(75) = {74};

/*

Recombine Surface {32};
Recombine Surface {33};
Recombine Surface {37};

Recombine Surface {45};
Recombine Surface {46};
Recombine Surface {48};

Recombine Surface {58};
Recombine Surface {59};
Recombine Surface {61};

Recombine Surface {69};
Recombine Surface {71};
Recombine Surface {73};
Recombine Surface {75};

Recombine Surface {41};
Recombine Surface {63};
Recombine Surface {50};

*/

Surface Loop(76) = {41, 37, 33, 32, 69, 58, 59, 61, 63, 71, 46, 48, 50, 45, 73, 75};
Volume(77) = {76};

Physical Surface(78) = {73};
Physical Surface(81) = {50, 45, 46, 48, 58, 59, 61, 63, 69, 71, 32, 33, 37, 41};
Physical Surface(82) = {75};
Physical Volume(83) = {77};


