
D = 1e0;
L = 4e0;
N = 20;
N_ch = 20;
pf_bump = 5.0;
pf = 1.1;

Point(1) = {-D/2, -D/2,  0};
Point(2) = {+D/2, -D/2,  0};
Point(3) = {-D/2, +D/2,  0};
Point(4) = {+D/2, +D/2,  0};

Point(5) = {-D/2, -D/2,  L};
Point(6) = {+D/2, -D/2,  L};
Point(7) = {-D/2, +D/2,  L};
Point(8) = {+D/2, +D/2,  L};

Point(9)  = {-D/2, -D/2,  L+D};
Point(10) = {+D/2, -D/2,  L+D};
Point(11) = {-D/2, +D/2,  L+D};
Point(12) = {+D/2, +D/2,  L+D};

Point(13) = {L+D/2, +D/2,  L+D};
Point(14) = {L+D/2, -D/2,  L+D};
Point(15) = {L+D/2, +D/2,  L};
Point(16) = {L+D/2, -D/2,  L};

Line(1) = {1,2};
Line(2) = {2,4};
Line(3) = {4,3};
Line(4) = {3,1};

Line(5) = {5,6};
Line(6) = {6,8};
Line(7) = {8,7};
Line(8) = {7,5};

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

Line(13) = {5,9};
Line(14) = {6,10};
Line(15) = {7,11};
Line(16) = {8,12};

Line(17)  = {9,10};
Line(18)  = {10,12};
Line(19)  = {12,11};
Line(20)  = {11,9};

Line(21) = {15, 13};
Line(22) = {14, 13};
Line(23) = {15, 16};
Line(24) = {8, 15};
Line(25) = {12, 13};
Line(26) = {6, 16};
Line(27) = {10, 14};
Line(28) = {14, 16};

Line Loop(1) = {1, 2, 3, 4};
Line Loop(2) = {1, 10, -5, -9};
Line Loop(3) = {3, 11, -7, -12};
Line Loop(4) = {2, 12, -6, -10};
Line Loop(5) = {4, 9, -8, -11};

Line Loop(6)  = {17, 18, 19, 20};
Line Loop(7)  = {7, 15, -19, -16};
Line Loop(8)  = {16, -18, -14, 6};
Line Loop(9)  = {15, 20, -13, -8};
Line Loop(10) = {5, 14, -17, -13};

Line Loop(11) = {24, 21, -25, -16};
Line Loop(12) = {26, -28, -27, -14};
Line Loop(13) = {24, 23, -26, 6};
Line Loop(14) = {25, -22, -27, 18};
Line Loop(15) = {21, -22, 28, -23};

Line Loop(16) = {7, 8, 5, 6};

Plane Surface(1) = {1}; // inflow

Plane Surface(2) = {2}; // side channel 1
Plane Surface(3) = {3}; // side channel 1
Plane Surface(4) = {4}; // side channel 1
Plane Surface(5) = {5}; // side channel 1

Plane Surface(6)  = {6};  // end of the box
Plane Surface(7)  = {7};  // side box
Plane Surface(8)  = {8};  // side box
Plane Surface(9)  = {9};  // side box
Plane Surface(10) = {10}; // side box

Plane Surface(11) = {11}; // side channel 2
Plane Surface(12) = {12}; // side channel 2
Plane Surface(13) = {13}; // side channel 2
Plane Surface(14) = {14}; // side channel 2
Plane Surface(15) = {15}; // outflow
Plane Surface(16) = {16};

Transfinite Line{1}  = N+1 Using Bump 1./pf_bump;
Transfinite Line{2}  = N+1 Using Bump 1./pf_bump;
Transfinite Line{3}  = N+1 Using Bump 1./pf_bump;
Transfinite Line{4}  = N+1 Using Bump 1./pf_bump;

Transfinite Line{5}  = N+1 Using Bump 1./pf_bump;
Transfinite Line{6}  = N+1 Using Bump 1./pf_bump;
Transfinite Line{7}  = N+1 Using Bump 1./pf_bump;
Transfinite Line{8}  = N+1 Using Bump 1./pf_bump;

Transfinite Line{9}  = N_ch+1 Using Progression 1./pf;
Transfinite Line{10} = N_ch+1 Using Progression 1./pf;
Transfinite Line{11} = N_ch+1 Using Progression 1./pf;
Transfinite Line{12} = N_ch+1 Using Progression 1./pf;

Transfinite Line{13} = N+1 Using Bump 1./pf_bump;
Transfinite Line{14} = N+1 Using Bump 1./pf_bump;
Transfinite Line{15} = N+1 Using Bump 1./pf_bump;
Transfinite Line{16} = N+1 Using Bump 1./pf_bump;
Transfinite Line{17} = N+1 Using Bump 1./pf_bump;
Transfinite Line{18} = N+1 Using Bump 1./pf_bump;
Transfinite Line{19} = N+1 Using Bump 1./pf_bump;
Transfinite Line{20} = N+1 Using Bump 1./pf_bump;

Transfinite Line{21} = N+1 Using Bump 1./pf_bump;
Transfinite Line{22} = N+1 Using Bump 1./pf_bump;
Transfinite Line{23} = N+1 Using Bump 1./pf_bump;
Transfinite Line{24} = N_ch+1 Using Progression pf;
Transfinite Line{25} = N_ch+1 Using Progression pf;
Transfinite Line{26} = N_ch+1 Using Progression pf;
Transfinite Line{27} = N_ch+1 Using Progression pf;
Transfinite Line{28} = N+1 Using Bump 1./pf_bump;

Transfinite Surface{1:16};
Recombine Surface{1:16};

Surface Loop(1) = {1, 2, 4, 3, 5, 16};
Volume(1) = {1};

Surface Loop(2) = {7, 9, 6, 10, 8, 16};
Volume(2) = {2};

Surface Loop(3) = {11, 13, 15, 14, 12, 8};
Volume(3) = {3};

Transfinite Volume{1:3};
