// parameters
nMshPntsX = 11;
nMshPntsY = 4;
bumpPar = 2.5;
height = 0.2;
nPnts = 201;
lChar = 4.0/9.0;//4/nMshPntsX+0.5;

// Define points
p1 = newp; Point(p1) = {0,0,0,lChar};
dX = 2/(nPnts-1);
x = 1;
For iPnt In {1:nPnts}

	y 			= 0.5*height*(1.0-Cos(Pi*(x-1.0)));

	Point(iPnt+1)		= {x,y,0,lChar};

	sinePnts[iPnt-1]	= iPnt+1;

	x 			+= dX;

EndFor
p2 = sinePnts[0];
p3 = sinePnts[nPnts-1];
p4 = newp; Point(p4) = {4,0,0,lChar};
p5 = newp; Point(p5) = {4,1,0,lChar};
p6 = newp; Point(p6) = {0,1,0,lChar};

// create lines
l1 = newl; Line(l1) = {p1,p2};
l2 = newl; Spline(l2) = {sinePnts[]};
l3 = newl; Line(l3) = {p3,p4};
l4 = newl; Line(l4) = {p4,p5};
l5 = newl; Line(l5) = {p5,p6};
l6 = newl; Line(l6) = {p6,p1};

// create line loop
ll1 = newl; Line Loop(ll1) = {l1,l2,l3,l4,l5,l6};

// create surface
s1 = news; Plane Surface(s1) = {ll1};

// define transfinite lines
Transfinite Line{l5} = nMshPntsX Using Bump bumpPar;
Transfinite Line{l1} = 3 Using Bump 1.0;
Transfinite Line{l2} = 7 Using Bump 1.0;
Transfinite Line{l3} = 3 Using Bump 1.0;
Transfinite Line{-l4,l6} = nMshPntsY Using Progression 1.0;

// define transfinite surfaces
Transfinite Surface{s1} = {p1,p4,p5,p6};

// define recombine surfaces
Recombine Surface{s1};

// extrude the surface
extrVol[] = Extrude {0,0,lChar} { Surface{s1}; Layers{ {2}, {1} };  Recombine;};

// define physical regions
Physical Surface(41) = {23,27,19};// bottom
Physical Surface(42) = {35};// top
Physical Surface(43) = {39};// inlet
Physical Surface(44) = {31};// outlet
Physical Surface(45) = {40};// right
Physical Surface(46) = {8};// left
Physical Volume(47) = {extrVol[1]};// volume
