////////////////////////////////////////////////
//                                            //
// TENSILE TEST SPECIMEN                      //
//                                            //
// I. J. Sanchez - 25-11-04                   //
//                                            //
////////////////////////////////////////////////
//Reference point
//---------------
x0 = 0;
y0 = 0;
z0 = 0;

//Characteristics lengths for mesh
//--------------------------------
h1 = 1;
h2 = 1;
h3 = 1;

h = 5;

//h1_down = 0.1;
//h2_down = 0.3;
//h3_down = 0.5;



//Charasteristics lengths for geometry:
//-----------------------------------------------
L_main_tr = 8;
L_main = 20;

L_ext_tr = 20;
L_ext = 22;

R_1 = 3;
R_2 = 2.5;
/////////////////////////////////////////////////
//                                             //
//             !---L_main----!                 //
//    _________               _________        //
//   !         !_____________!    !    !       //
//   !    _           !           !    !       //
//   !   !_!          !           !    !       //
//   !   R_2    ______!______     !    !       //
//   !_________!R_1   !      !____!____!       //
//                    !           !            //
//   !---------!      !           !            //
//       L_ext        !           !            //
//                L_main_tr       !            //
//                             L_ext_tr        //
//					       //
/////////////////////////////////////////////////



//Some lengths useful for mesh:
//-----------------------------
L_m = 2;



//Points definitions:
//--------------------------------------------------------------------------------------
Point(1)  = { x0,                              y0 + L_main_tr/2,           z0,  h1    };

Point(2)  = { x0 + L_m,                        y0 + L_main_tr/2,           z0,  h2    };
Point(3)  = { x0 + L_main/2 - R_1,             y0 + L_main_tr/2 + R_1,     z0,  h     };
Point(4)  = { x0 + L_main/2 - R_1,             y0 + L_main_tr/2,           z0,  h3    };
Point(5)  = { x0 + L_main/2,                   y0 + L_main_tr/2 + R_1,     z0,  h3    };
Point(6)  = { x0 + L_main/2,                   y0 + L_ext_tr/2,            z0,  h     };
Point(7)  = { x0 + L_main/2 + L_ext,           y0 + L_ext_tr/2,            z0,  h     };

Point(8)  = { x0 + L_main/2 + L_ext,          -y0 - L_ext_tr/2,           z0,  h      };
Point(9)  = { x0 + L_main/2,                  -y0 - L_ext_tr/2,           z0,  h      };
Point(10) = { x0 + L_main/2,                  -y0 - L_main_tr/2 - R_1,    z0,  h3     };
Point(11) = { x0 + L_main/2 - R_1,            -y0 - L_main_tr/2,          z0,  h3     };
Point(12) = { x0 + L_main/2 - R_1,            -y0 - L_main_tr/2 - R_1,    z0,  h      };
Point(13) = { x0 + L_m,                       -y0 - L_main_tr/2,          z0,  h2     };

Point(14)  = {x0,                             -y0 - L_main_tr/2,          z0,  h1     };

Point(15)  = {-x0 - L_m,                      -y0 - L_main_tr/2,          z0,  h2     };
Point(16)  = {-x0 - L_main/2 + R_1,           -y0 - L_main_tr/2 - R_1,    z0,  h      };
Point(17)  = {-x0 - L_main/2 + R_1,           -y0 - L_main_tr/2,          z0,  h3     };
Point(18)  = {-x0 - L_main/2,                 -y0 - L_main_tr/2 - R_1,    z0,  h3     };
Point(19)  = {-x0 - L_main/2,                 -y0 - L_ext_tr/2,           z0,  h      };
Point(20)  = {-x0 - L_main/2 - L_ext,         -y0 - L_ext_tr/2,           z0,  h      };

Point(21)  = {-x0 - L_main/2 - L_ext,          y0 + L_ext_tr/2,           z0,  h      };
Point(22)  = {-x0 - L_main/2,                  y0 + L_ext_tr/2,           z0,  h      };
Point(23)  = {-x0 - L_main/2,                  y0 + L_main_tr/2 + R_1,    z0,  h3     };
Point(24)  = {-x0 - L_main/2 + R_1,            y0 + L_main_tr/2,          z0,  h3     };
Point(25)  = {-x0 - L_main/2 + R_1,            y0 + L_main_tr/2 + R_1,    z0,  h      };
Point(26)  = {-x0 - L_m,                       y0 + L_main_tr/2,          z0,  h2     };

//Point(27)  = { x0 + L_main/2 + L_ext/2,        y0,                        z0,  h      };
//Point(28)  = { x0 + L_main/2 + L_ext/2 + R_2,  y0,                        z0,  h      };
//Point(29)  = { x0 + L_main/2 + L_ext/2,        y0 + R_2,                  z0,  h      };
//Point(30)  = { x0 + L_main/2 + L_ext/2 - R_2,  y0,                        z0,  h      };
//Point(31)  = { x0 + L_main/2 + L_ext/2,        y0 - R_2,                  z0,  h      };

//Point(32)  = {-x0 - L_main/2 - L_ext/2,        y0,                        z0,  h      };
//Point(33)  = {-x0 - L_main/2 - L_ext/2 - R_2,  y0,                        z0,  h      };
//Point(34)  = {-x0 - L_main/2 - L_ext/2,        y0 + R_2,                  z0,  h      };
//Point(35)  = {-x0 - L_main/2 - L_ext/2 + R_2,  y0,                        z0,  h      };
//Point(36)  = {-x0 - L_main/2 - L_ext/2,        y0 - R_2,                  z0,  h      };



//Lines and circles definitions:
//------------------------------
Line(1) = {1,2};
Line(2) = {2,4};

Circle(20) = {4,3,5};

Line(3) = {5,6};
Line(4) = {6,7};
Line(5) = {7,8};
Line(6) = {8,9};
Line(7) = {9,10};

Circle(21) = {10,12,11};

Line(8)  = {11,13};
Line(9)  = {13,14};
Line(10) = {14,15};
Line(11) = {15,17};

Circle(22) = {17,16,18};

Line(12) = {18,19};
Line(13) = {19,20};
Line(14) = {20,21};
Line(15) = {21,22};
Line(16) = {22,23};

Circle(23) = {23,25,24};

Line(17) = {24,26};
Line(18) = {26,1};

//Circle (24) = {28,27,29};
//Circle (25) = {29,27,30};
//Circle (26) = {30,27,31};
//Circle (27) = {31,27,28};

//Circle (28) = {33,32,34};
//Circle (29) = {34,32,35};
//Circle (30) = {35,32,36};
//Circle (31) = {36,32,33};



//Line loop definition:
//------------------------------
Line Loop (30) = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23};
//Line Loop (31) = {24,25,26,27};
//Line Loop (32) = {28,29,30,31};



//Surface definition:
//------------------------------
//Plane Surface(40) = {30,31,32};
Plane Surface(40) = {30};
Rotate {{1,0,0},{x0,y0,z0},Pi/2}{Duplicata{Surface{40};}}


//Extruding geometry
//----------------------------
Extrude Surface {40, {1,0,0}, {x0,y0,z0}, Pi/2};
Extrude Surface {41, {1,0,0}, {x0,y0,z0}, Pi/2};

//Defining physical volumes
//-------------------------
Physical Volume (300) = {1,2};

//Transfinite Line {1,3} = 11 ;
//Transfinite Line {4,2} = 5 ;
//Transfinite Surface{6} = {1,4,3,2};

//Physical Line(100) = {11};
//Physical Line(101) = {21};
//Physical Line(102) = {6,7,8,9,10};

//Physical Surface(200) = {40};
