// Gmsh project created on Wed Feb 5 16:53:37 2016

//some important parameters

Nx1 = 50; Rx1 = 1.00;
Nx2 = 50; Rx2 = 1.00;
Nx3 = 50; Rx3 = 1.00;
Nx4 = 50; Rx4 = 1.00;

Ny1 = 50; Ry1 = 1.00;
Ny2 = 50; Ry2 = 1.00;
Ny3 = 50; Ry3 = 1.00;

Nc = 50; Rc = 1.00;
Np = 50; Rp = 1.00;
Nb = 50; Rb = 1.00;


// points for whole domain
Point(1) = {0, 0, 0, 0.1};
Point(2) = {5, 0, 0, 0.1};
Point(3) = {6, 0, 0, 0.1};
Point(4) = {10, 0, 0, 0.1};
Point(5) = {20, 0, 0, 0.1};

Point(6) = {0, 11, 0, 0.1};
Point(7) = {5, 11, 0, 0.1};
Point(8) = {6, 11, 0, 0.1};
Point(9) = {10, 11, 0, 0.1};
Point(10) = {20, 11, 0, 0.1};

Point(11) = {0, 4, 0, 0.1};
Point(12) = {5, 4, 0, 0.1};
Point(13) = {6, 4, 0, 0.1};
Point(14) = {10, 4, 0, 0.1};
Point(15) = {20, 4, 0, 0.1};

Point(16) = {0, 7, 0, 0.1};
Point(17) = {5, 7, 0, 0.1};
Point(18) = {6, 7, 0, 0.1};
Point(19) = {10, 7, 0, 0.1};
Point(20) = {20, 7, 0, 0.1};

//x
Line(1) = {1, 2}; Transfinite Line {1} = Nx1 Using Progression Rx1;
Line(2) = {2, 3}; Transfinite Line {2} = Nx2 Using Progression Rx2;
Line(3) = {3, 4}; Transfinite Line {3} = Nx3 Using Progression Rx3;
Line(4) = {4, 5}; Transfinite Line {4} = Nx4 Using Progression Rx4;
Line(5) = {6, 7}; Transfinite Line {5} = Nx1 Using Progression Rx1;
Line(6) = {7, 8}; Transfinite Line {6} = Nx2 Using Progression Rx2;
Line(7) = {8, 9}; Transfinite Line {7} = Nx3 Using Progression Rx3;
Line(8) = {9, 10}; Transfinite Line {8} = Nx4 Using Progression Rx4;

//y
Line(9) = {1, 11}; Transfinite Line {9} = Ny1 Using Progression Ry1;
Line(10) = {11, 16}; Transfinite Line {10} = Ny2 Using Bump Ry2;
Line(11) = {16, 6}; Transfinite Line {11} = Ny3 Using Progression Ry3;
Line(12) = {5, 15}; Transfinite Line {12} = Ny1 Using Progression Ry1;
Line(13) = {15, 20}; Transfinite Line {13} = Ny2 Using Bump Ry2;
Line(14) = {20, 10}; Transfinite Line {14} = Ny3 Using Progression Ry3;
 
//cylinder
Line(15) = {12, 17}; Transfinite Line {15} = Nc Using Bump Rc;
Line(16) = {17, 18}; Transfinite Line {16} = Nc Using Progression Rc;
Line(17) = {18, 13}; Transfinite Line {17} = Nc Using Bump Rc;
Line(18) = {13, 12}; Transfinite Line {18} = Nc Using Progression Rc;

//plate
Line(19) = {13, 14}; Transfinite Line {19} = Np Using Progression Rp;
Line(20) = {14, 19}; Transfinite Line {20} = Np Using Bump Rp;
Line(21) = {19, 18}; Transfinite Line {21} = Np Using Progression Rp;

//blocks
Line(22) = {11, 12}; Transfinite Line {22} = Nb Using Progression Rb;
Line(23) = {16, 17}; Transfinite Line {23} = Nb Using Progression Rb;
Line(24) = {14, 15}; Transfinite Line {24} = Nb Using Progression Rb;
Line(25) = {19, 20}; Transfinite Line {25} = Nb Using Progression Rb;
Line(26) = {2, 12};  Transfinite Line {26} = Nb Using Progression Rb;
Line(27) = {3, 13};  Transfinite Line {27} = Nb Using Progression Rb;
Line(28) = {4, 14};  Transfinite Line {28} = Nb Using Progression Rb;
Line(29) = {17, 7};  Transfinite Line {29} = Nb Using Progression Rb;
Line(30) = {18, 8};  Transfinite Line {30} = Nb Using Progression Rb;
Line(31) = {19, 9};  Transfinite Line {31} = Nb Using Progression Rb;

//plane surfaces
Line Loop(32) = {1, 26, -22, -9};
Plane Surface(33) = {32};
Line Loop(34) = {2, 27, 18, -26};
Plane Surface(35) = {34};
Line Loop(36) = {3, 28, -19, -27};
Plane Surface(37) = {36};
Line Loop(38) = {4, 12, -24, -28};
Plane Surface(39) = {38};
Line Loop(40) = {24, 13, -25, -20};
Plane Surface(41) = {40};
Line Loop(42) = {19, 20, 21, 17};
Plane Surface(43) = {42};
Line Loop(44) = {18, 15, 16, 17};
Plane Surface(45) = {44};
Line Loop(46) = {22, 15, -23, -10};
Plane Surface(47) = {46};
Line Loop(48) = {23, 29, -5, -11};
Plane Surface(49) = {48};
Line Loop(50) = {16, 30, -6, -29};
Plane Surface(51) = {50};
Line Loop(52) = {21, 30, 7, -31};
Plane Surface(53) = {52};
Line Loop(54) = {25, 14, -8, -31};
Plane Surface(55) = {54};

Transfinite Surface {33};
Transfinite Surface {35};
Transfinite Surface {37};
Transfinite Surface {39};
Transfinite Surface {41};
Transfinite Surface {43};
Transfinite Surface {45};
Transfinite Surface {47};
Transfinite Surface {49};
Transfinite Surface {51};
Transfinite Surface {53};
Transfinite Surface {55};

Recombine Surface {33};
Recombine Surface {35};
Recombine Surface {37};
Recombine Surface {39};
Recombine Surface {41};
Recombine Surface {43};
Recombine Surface {45};
Recombine Surface {47};
Recombine Surface {49};
Recombine Surface {51};
Recombine Surface {53};
Recombine Surface {55};

Extrude {0, 0, 11} {
  Surface{33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55};
  Layers{11};
  Recombine;
}

Physical Surface("inlet") = {76, 230, 252};
Physical Surface("outlet") = {134, 156, 310};
Physical Surface("top") = {248, 270, 292, 314};
Physical Surface("bottom") = {64, 86, 108, 130};
Physical Surface("cylinder") = {209, 45, 186, 200, 94, 204};
Physical Surface("plate") = {182, 164, 116, 187, 43};
Physical Surface("frontPlanes") = {77, 231, 253, 143, 165, 319};
Physical Surface("backPlanes") = {33, 47, 49, 39, 41, 55};
