// Gmsh project created on Sat May 26 11:14:54 2007
l1 = 0.75;
l2 = 0.04;
l3 = 0.075;

//sleeve diameter
Point(1) = {0, 0, 15.8, l1};
Point(2) = {-1.6, 0, 15.8, l1};
Point(5) = {0, 1.6, 15.8, l1};

Point(6) = {0, 0, 11.8, l1};
Point(7) = {-1.6, 0, 11.8, l1};
Point(10) = {0, 1.6, 11.8, l1};


//direction diameter
Point(11) = {-1.8, 0, 11.8, l1};
Point(14) = {0, 1.8, 11.8, l1};

Point(15) = {0, 0, 3.6, l1};
Point(16) = {-1.8, 0, 3.6, l1};
Point(19) = {0, 1.8, 3.6, l1};

//main diameter
Point(20) = {-2, 0, 3.6, l1};
Point(23) = {0, 2, 3.6, l1};

Point(24) = {0, 0, 1.4, l1};
Point(25) = {-2, 0, 1.4, l1};
Point(28) = {0, 2, 1.4, l1};


//first cone
Point(29) = {0, 0, 0.8, l1};
Point(30) = {-1.4, 0, 0.8, l1};
Point(33) = {0, 1.4, 0.8, l1};


//second cone, morphing into sphere
R = 0.65; //sphere radius
alpha = 60 *Pi / 180; //half of the angle at the indentor tip
Z1 = R / Sin(alpha) - R;  //distance from cone tip to the sphere tip
R1 = R * Sin(Pi * 0.5 - alpha);
Z2 = R1 / Tan(alpha);
Z3 = Z1 + R;
Point(34) = {0, 0, Z2, l3};
Point(35) = {-R1, 0, Z2, l3};
Point(38) = {0, R1, Z2, l3};

//sphere tip
Point(39) = {0, 0, Z1, l2};

//sphere center
Point(40) = {0, 0, Z3, l1};


// --------------------------------- lines -------------------------------


//sleeve diameter
Circle(1) = {5,1,2};
Circle(2) = {10,6,7};
Line(3) = {5,1};
Line(4) = {2,1};
Line(5) = {10,6};
Line(6) = {7,6};
Line(7) = {5,10};
Line(8) = {1,6};
Line(9) = {2,7};

//direction diameter
Circle(10) = {14,6,11};
Circle(11) = {19,15,16};
Line(12) = {14,19};
Line(13) = {11,16};
Line(14) = {6,15};
Line(15) = {19,15};
Line(16) = {16,15};
Line(17) = {14,10};
Line(18) = {11,7};

//main diameter
Circle(19) = {23,15,20};
Circle(20) = {28,24,25};
Line(21) = {23,28};
Line(22) = {15,24};
Line(23) = {20,25};
Line(24) = {25,24};
Line(25) = {28,24};
Line(26) = {23,19};
Line(27) = {20,16};

//first cone
Circle(28) = {33,29,30};
Line(29) = {33,29};
Line(30) = {30,29};
Line(31) = {28,33};
Line(32) = {24,29};
Line(33) = {25,30};

//second cone, morphing into sphere
Circle(34) = {38,34,35};
Line(35) = {38,34};
Line(36) = {35,34};
Line(37) = {29,34};
Line(38) = {33,38};
Line(39) = {30,35};

//sphere tip
Circle(40) = {38,40,39};
Circle(41) = {35,40,39};
Line(42) = {34,39};



//----------------- Surfaces ----------------------

//sleeve diameter
Line Loop(43) = {4,-3,1};
Plane Surface(44) = {43};
Line Loop(45) = {6,-5,2};
Plane Surface(46) = {45};
Line Loop(47) = {7,5,-8,-3};
Plane Surface(48) = {47};
Line Loop(49) = {6,-8,-4,9};
Plane Surface(50) = {49};
Line Loop(51) = {7,2,-9,-1};
Ruled Surface(52) = {51};


//direction diameter
Line Loop(53) = {12,11,-13,-10};
Ruled Surface(54) = {53};
Line Loop(55) = {17,2,-18,-10};
Plane Surface(56) = {55};
Line Loop(57) = {12,15,-14,-5,-17};
Plane Surface(58) = {57};
Line Loop(59) = {6,14,-16,-13,18};
Plane Surface(60) = {59};
Line Loop(61) = {15,-16,-11};
Plane Surface(62) = {61};

//main diameter
Line Loop(63) = {21,20,-23,-19};
Ruled Surface(64) = {63};
Line Loop(65) = {26,11,-27,-19};
Plane Surface(66) = {65};
Line Loop(67) = {21,25,-22,-15,-26};
Plane Surface(68) = {67};
Line Loop(69) = {16,22,-24,-23,27};
Plane Surface(70) = {69};
Line Loop(71) = {20,24,-25};
Plane Surface(72) = {71};


//first cone
Line Loop(73) = {31,28,-33,-20};
Ruled Surface(74) = {73};
Line Loop(75) = {29,-32,-25,31};
Plane Surface(76) = {75};
Line Loop(77) = {24,32,-30,-33};
Plane Surface(78) = {77};
Line Loop(79) = {29,-30,-28};
Plane Surface(80) = {79};

//second cone, morphing into sphere
Line Loop(81) = {38,34,-39,-28};
Ruled Surface(82) = {81};
Line Loop(83) = {30,37,42,-41,-39};
Plane Surface(84) = {83};
Line Loop(85) = {40,-42,-37,-29,38};
Plane Surface(86) = {85};

//sphere tip
Line Loop(87) = {40,-41,-34};
Ruled Surface(88) = {87};


//---------------- Volumes -------------------------

Surface Loop(89) = {44,50,48,52,46};
Volume(90) = {89};
Surface Loop(91) = {56,58,54,60,62,46};
Volume(92) = {91};
Surface Loop(93) = {72,70,68,64,66,62};
Volume(94) = {93};
Surface Loop(95) = {80,74,76,78,72};
Volume(96) = {95};
Surface Loop(97) = {84,86,88,82,80};
Volume(98) = {97};


//---------------- Physical -----------------------

Physical Volume(99) = {98,96,94,92,90};
Physical Surface(100) = {88};
