/*

 file  : file to proof gaps elements in own FEM code
         for thermomechanical problems
 author: Fernando Diego Carazo Rodriguez (buenaluna)
 date  : mar ago  3 09:44:00 ART 2010
         Today is Setting Orange, the 69th day of 
         Confusion in the YOLD 3176
*/

// longitud caracteristica
lc1= 0.01;
lc2= 0.01;

tol = 0.000001;

// puntos linea inferior
Point(1) = {0.0  , 0.0, 0.0, lc1};
Point(2) = {0.025, 0.0, 0.0, lc1};
Point(3) = {0.05 , 0.0, 0.0, lc1};

// puntos linea media inferior
Point(4)= {0.025, 0.02-tol, 0.0, lc1};
Point(5)= {0.05 , 0.02-tol, 0.0, lc1};

// puntos linea media superior
Point(6)= {0.0      , 0.02, 0.0, lc1};
Point(7)= {0.025-tol, 0.02, 0.0, lc2};
Point(8)= {0.025    , 0.02, 0.0, lc1};
Point(9)= {0.05     , 0.02, 0.0, lc1};

// puntos linea superior
Point(10)= {0.0      , 0.04, 0.0, lc1};
Point(11)= {0.025-tol, 0.04, 0.0, lc2};
Point(12)= {0.025    , 0.04, 0.0, lc1};
Point(13)= {0.05     , 0.04, 0.0, lc1};

// lineas horizontales
// lineas horizontales inferiores
Line(1)= {1,2};
Line(2)= {2,3};
	 
// lineas horizontales medias inferiores
Line(3)= {4,5};

// lineas horizontales medias superiores
Line(4)= {6,7};
Line(5)= {7,8};
Line(6)= {8,9};

// lineas horizontales superiores
Line(7)= {10,11};
Line(8)= {11,12};
Line(9)= {12,13};

// lineas verticales
// lineas verticales izquierdas
Line(10)= {3, 5};
Line(11)= {5, 9};
Line(12)= {9,13};

// lineas verticales izquierdas medias
Line(13)= {2, 4};
Line(14)= {4, 8};
Line(15)= {8,12};

// lineas verticales derechas medias
Line(16)= {7,11};
Line(17)= {1, 6};
Line(18)= {6,10};

// lineas totales
Line(19)= {2,8};
Line(20)= {6,8};

// ciclos de linas para defincion de superficies
// @ pieza, contacto pieza-molde y molde

// loops para el MOLDE
/* 1 - @ molde */
Line Loop(1)= {1,19,-20,-17}; 
/* 2 - @ molde */
Line Loop(2)= {2,10,-3,-13}; 
/* 3 - @ molde */
Line Loop(3)= {4,16,-7,-18};

// loops para los GAPS
/* 2 - @ gaps */
// loops para los GAPS
/* 1 - @ gaps */
Line Loop(4)= {3,11,-6,-14}; 
/* 2 - @ gaps */
Line Loop(5)= {5,15,-8,-16}; 

// loops para la PIEZA
/* 1 - @ pieza */
Line Loop(6)= {6,12,-9,-15};

// definimos las superficies
// @ molde
Plane Surface(1)= {1}; 
Plane Surface(2)= {2}; 
Plane Surface(3)= {3}; 

// @ gaps
Plane Surface(4)= {4}; 
Plane Surface(5)= {5}; 

// @ pieza
Plane Surface(6)= {6}; 

// definimos las lineas y superficies transfinitas 
// para llevar la malla de triangulos a cuadrilateros
// lineas paralelas con la misma progresion

// @ pieza y molde
Transfinite Line{ 1,20}= 3 Using Progression 1;
Transfinite Line{ 4, 7}= 3 Using Progression 1;
Transfinite Line{ 2, 3}= 3 Using Progression 1;
Transfinite Line{ 3, 6}= 3 Using Progression 1;
Transfinite Line{ 6, 9}= 3 Using Progression 1;
Transfinite Line{17,19}= 3 Using Progression 1;
Transfinite Line{13,10}= 3 Using Progression 1;
Transfinite Line{18,16}= 3 Using Progression 1;
Transfinite Line{16,15}= 3 Using Progression 1;
Transfinite Line{15,12}= 3 Using Progression 1;
	    
// @ gaps
Transfinite Line{ 5, 8}  = 1 Using Progression 1;
Transfinite Line{14,11}= 1 Using Progression 1;

// definimos las superficies transfinitas
// @ molde, gaps y pieza
Transfinite Surface{1};
Transfinite Surface{2};
Transfinite Surface{3};
Transfinite Surface{4};
Transfinite Surface{5};
Transfinite Surface{6};

// recombinamos las superficies @ mallar con rectangulos
// @ todo
// aqui es donde los traingulos son reemplzados por quads
Recombine Surface '*';
