/*-------------
-----------------  */
lc = 5;
lcFine = 1;

//---Geometry Parameters
D = 54.2;
R = D/2;
wR = 0.1*R;

width = 101.1;
height = 101.1;
lengthLeft = 10*D;
lengthRight = 20*D;

ptArc = 50;
ptRad = 10;
ptDepth = 10;
progArc = 1;
progRad = 1.1;

//******* Define points
// Points in the Cylinder
Point(1) = {0, 0, 0, lc};		 // center
Point(2) = {R, 0, 0, lc};	Point(3) = {R+wR, 0, 0, lcFine};		// circumferential points
Point(4) = {0, R, 0, lc};	Point(5) = {0, R+wR, 0, lcFine};
Point(6) = {-R, 0, 0, lc};	Point(7) = {-(R+wR), 0, 0, lc};
Point(8) = {0, -R, 0, lc};	Point(9) = {0, -(R+wR), 0, lcFine};

// points in surrounding box
Point(10) = {lengthRight, height/2, 0, lc}; 
Point(11) = {-lengthLeft, height/2, 0, lc };
Point(12) = {-lengthLeft, -height/2, 0, lc };
Point(13) = {lengthRight, -height/2, 0, lc }; 


//---------Define lines, surfaces, volumes----------------------------------------------------------------------
// Line() = {}; Circle() = {};
//************************************ Cylinder wall*****************************************************
  Line(1) = {2,3}; 
  Circle(2) = {3,1,5};	Line(3) = {5,4};	Circle(4) = {4,1,2}; 
  Circle(5) = {5,1,7};	Line(6) = {7,6};	Circle(7) = {6,1,4};
  Circle(8) = {7,1,9};	Line(9) = {9,8};	Circle(10) = {8,1,6};
  Circle(11) = {9,1,3};	Circle(12) = {8,1,2};

  Line Loop(1) = {1,2,3,4};		Plane Surface(1) = {1};
  Line Loop(2) = {-3,5,6,7};		Plane Surface(2) = {2};
  Line Loop(3) = {-6,8,9,10};		Plane Surface(3) = {3};
  Line Loop(4) = {-9,11,-1,-12};	Plane Surface(4) = {4};
  
  
  Physical Volume(101) = {3, 4, 1, 2};


  //------Transfinite tation

  Transfinite Line{2,5,8,11} = ptArc Using Progression progArc;
  Transfinite Line{4,7,10,12} = ptArc Using Progression (1/progArc);
  Transfinite Line{1,-3,-6,-9} = ptRad Using Progression progRad;

  Transfinite Surface(1) = {2,3,5,4}; Recombine Surface{1};
  Transfinite Surface(2) = {4,5,7,6}; Recombine Surface{2};
  Transfinite Surface(3) = {6,7,9,8}; Recombine Surface{3};
  Transfinite Surface(4) = {8,9,3,2}; Recombine Surface{4};



  Extrude {0, 0, width} {
    Surface{2, 1, 4, 3}; Layers{ptDepth}; Recombine;
  }
//*************************************************************************************************************


//**************************** Surrounding box ****************************************************************
  Line(13) = {10,11}; Line(14) = {11,12}; Line(15) = {12,13}; Line(16) = {13,10}; 
  Line Loop (5) = {13,14,15,16}; 
  Line Loop(190) = {11, 2, 5, 8};	//line loop of hole (cylinder wall boundary)
  Plane Surface(5) = {5, 190};

  Extrude {0, 0, width} {
			  Surface{5}; // Layers{ptDepth};
			  }

//   volume(2) = {5,3,4,1,2};
  Physical Volume(212) = {5,3,4,1,2};