/********************************************************************* 
 *
 *  Gmsh mesh for triangular obstacle of Sanquer's Thesis
 * 
 *  By Wladimyr M. C. Dourado, 06/Aug/03 SJC/BR
 *
 *********************************************************************/

// Including the parameters

Include "triang-obst-parameters.geo" ;


// Defining the lastest point, curve, surface etc number
// When including in other geometry files these must to be correctly set
lastp = 0;
lastc = 0;
lasts = 0;
lastv = 0;

// The new anisotropic 2D mesh generator can be selected with:

Mesh.Algorithm = 2 ;

// One can force a 4 step Laplacian smoothing of the mesh with:

Mesh.Smoothing = 4 ;

/********************************************************************* 
 * GEOMETRY DEFINITION
 * 
 *********************************************************************/

p1=newp+lastp; Point(p1) = {xpd1,ypd1,Z0,lc_died};
p2=newp+lastp; Point(p2) = {xpd2,ypd2,Z0,lc_died};
p3=newp+lastp; Point(p3) = {xpd3,ypd3,Z0,lc_died};

p4=newp+lastp; Point(p4) = {X0-l_ent,Y0+delta,Z0,lc};
p5=newp+lastp;
Symmetry { 0,1,0,Y0-h } {
  Duplicata { Point{p4}; }
}
p6=newp+lastp;Point(p6) = {X0-1.5*ht,Y0+delta,Z0,lc_he};
p7=newp+lastp;
Symmetry { 0,1,0,Y0-h } {
  Duplicata { Point{p6}; }
}
/*
p8=newp;Point(p8) = {X0-l_ent,Y0+h,Z0,lc};
p9=newp;Point(p9) = {X0-1.5*(d*Cos(alpha/2.)),Y0+h,Z0,lc_he};
*/
/********************* 
 * LINES DEFINITION
 * 
 *********************/
l1 = newc+lastc; Line(l1) = {p4,p6};
l2 = newc+lastc; Line(l2) = {p5,p7};
l3 = newc+lastc; Line(l3) = {p4,p5};
l4 = newc+lastc; Line(l4) = {p6,p7};

/********************* 
 * SURFACES DEFINITION
 * 
 *********************/
l5 = newc+lastc; Line Loop(l5) = {l4,-l2,-l3,l1}; 
s1 = news; Ruled Surface(s1) = {l5};

/********************* 
 * PHYSICAL DEFINITION
 * 
 *********************/
Physical Point(cc_parede_canal) = {p4,p6};
Physical Point(cc_parede_canal) = {p5,p7};


Physical Line(cc_entrada) = {l3};
Physical Line(cc_parede_canal) = {l1};
Physical Line(cc_parede_canal) = {l2};
Physical Line(dominio1) = {l4};


/********************************************************************* 
 * MESH DEFINITION
 * 
 *********************************************************************/


Transfinite Line {l3,l4} = 2*nyc Using Bump syc;
Transfinite Line {l1,l2} = nxsec Using Bump sxsec;
Transfinite Surface {s1} = {p4,p6,p7,p5};
Recombine Surface {s1};

 
