Mesh.RecombinationAlgorithm = 1; //Blossom
Mesh.Algorithm=1; //MeshAdapt

dist = 3.95;

width_outer = 15;
height_outer = 12;
pad = 2;
width_pad = width_outer - pad;
height_pad = height_outer - pad;

r_inner = 1;
r_contact = 2;

scale_center = 1e-1;
scale_tip = 1e-1;
scale_inner = 1e-1;
scale_outer = 5e-1;
scale_pad = 5e-1;
scale_contact = 1e-1;

//center
Point(1) = {0,0,0,scale_inner};

//left and right particle center
Point(2) = {-dist/2,0,0,scale_inner};
Point(3) = {+dist/2,0,0,scale_inner};

//outer corners
Point(4) = {+width_outer,+height_outer,0,scale_outer};
Point(5) = {-width_outer,+height_outer,0,scale_outer};
Point(6) = {-width_outer,-height_outer,0,scale_outer};
Point(7) = {+width_outer,-height_outer,0,scale_outer};

//padding corners
Point(8) = {+width_pad,+height_pad,0,scale_pad};
Point(9) = {-width_pad,+height_pad,0,scale_pad};
Point(10) = {-width_pad,-height_pad,0,scale_pad};
Point(11) = {+width_pad,-height_pad,0,scale_pad};

//contact
contact_dist = Sqrt(r_contact*r_contact - dist*dist/4);
Point(12) = {0,+contact_dist,0,scale_tip};
Point(13) = {-dist/2,+r_contact,0,scale_contact};
Point(14) = {-dist/2-r_contact,0,0,scale_contact};
Point(15) = {-dist/2,-r_contact,0,scale_contact};
Point(16) = {0,-contact_dist,0,scale_tip};
Point(17) = {+dist/2,-r_contact,0,scale_contact};
Point(18) = {+dist/2+r_contact,0,0,scale_contact};
Point(19) = {+dist/2,+r_contact,0,scale_contact};

//inner left
Point(20) = {-dist/2+r_inner,0,0,scale_inner};
Point(21) = {-dist/2,+r_inner,0,scale_inner};
Point(22) = {-dist/2-r_inner,0,0,scale_inner};
Point(23) = {-dist/2,-r_inner,0,scale_inner};

//inner right
Point(24) = {+dist/2+r_inner,0,0,scale_inner};
Point(25) = {+dist/2,+r_inner,0,scale_inner};
Point(26) = {+dist/2-r_inner,0,0,scale_inner};
Point(27) = {+dist/2,-r_inner,0,scale_inner};

//outer
Line(1) = {4,5};
Line(2) = {5,6};
Line(3) = {6,7};
Line(4) = {7,4};
Line Loop(5) = {1:4};

//padding
Line(6) = {8,9};
Line(7) = {9,10};
Line(8) = {10,11};
Line(9) = {11,8};
Line Loop(10) = {6:9};

//contact
Circle(11) = {13,2,12};
Circle(12) = {14,2,13};
Circle(13) = {15,2,14};
Circle(14) = {16,2,15};
Circle(15) = {17,3,16};
Circle(16) = {18,3,17};
Circle(17) = {19,3,18};
Circle(18) = {12,3,19};
Line Loop(19) = {11:18};

//inner left
Circle(20) = {21,2,20};
Circle(21) = {22,2,21};
Circle(22) = {23,2,22};
Circle(23) = {20,2,23};
Line Loop(24) = {20:23};

//inner right
Circle(25) = {24,3,27};
Circle(26) = {27,3,26};
Circle(27) = {26,3,25};
Circle(28) = {25,3,24};
Line Loop(29) = {25:28};

Plane Surface(1) = {5,10};
Plane Surface(2) = {10,19};
Plane Surface(3) = {19,24,29};
Plane Surface(4) = {24};
Plane Surface(5) = {29};
Recombine Surface {1,2,3,4,5};

Physical Surface(6) = {1,2,3,4,5};
