
// Some parameters (those inside DefineConstant will appear in the GUI)
DefineConstant[
  R1 = {0.2, Min 0.05, Max 1, Step 0.05, Name "Input/Left radius [m]"},
  R2 = {0.3, Min 0.05, Max 1, Step 0.05, Name "Input/Right radius [m]"},
  D = {1.6, Min R1+R2+0.2, Max 5, Step 0.1, Name "Input/Length [m]"}
];
lc = 0.08;

Point(1) = {0, 0, 0, lc};
Point(2) = {0, R1, 0, lc};
Point(3) = {-R1, 0, 0, lc};
Point(4) = {0, -R1, 0, lc};
Point(5) = {R1, 0, 0, lc};
Point(6) = {0, R1 + 0.1, 0, lc};
Point(7) = {-R1 - 0.1, 0, 0, lc};
Point(8) = {0, -R1 - 0.1, 0, lc};
Point(9) = {R1 + 0.1, 0, 0, lc};
Point(10) = {0, R1 + 0.2, 0, lc};
Point(11) = {-R1 - 0.2, 0, 0, lc};
Point(12) = {0, -R1 - 0.2, 0, lc};

Point(14) = {D, 0, 0, lc};
Point(15) = {D, R2, 0, lc};
Point(16) = {D - R2, 0, 0, lc};
Point(17) = {D, -R2, 0, lc};
Point(18) = {D + R2, 0, 0, lc};
Point(19) = {D + R2 + 0.2, 0, 0, lc};
Point(20) = {D, -R2 - 0.2, 0, lc};
Point(21) = {D, R2 + 0.2, 0, lc};

Line(1) = {10, 21};
Line(2) = {12, 20};
Circle(3) = {10, 1, 11};
Circle(4) = {11, 1, 12};
Circle(5) = {20, 14, 19};
Circle(6) = {19, 14, 21};
Circle(7) = {18, 14, 15};
Circle(8) = {15, 14, 16};
Circle(9) = {16, 14, 17};
Circle(10) = {17, 14, 18};
Circle(11) = {5, 1, 2};
Circle(12) = {2, 1, 3};
Circle(13) = {3, 1, 4};
Circle(14) = {4, 1, 5};
Circle(15) = {9, 1, 6};
Circle(16) = {6, 1, 7};
Circle(17) = {7, 1, 8};
Circle(18) = {8, 1, 9};

Line Loop(19) = {1, -6, -5, -2, -4, -3};
Line Loop(20) = {15, 16, 17, 18};
Line Loop(21) = {8, 9, 10, 7};
Plane Surface(22) = {19, 20, 21};
Line Loop(23) = {11, 12, 13, 14};
Plane Surface(24) = {20, 23};
Extrude {0, 0, 0.1} {
  Surface{22};
}
Extrude {0, 0, 0.1} {
  Surface{24};
}
Extrude {0, 0, 0.1} {
  Surface{138};
}
Extrude {0, 0, -0.1} {
  Surface{24};
}

// Two physical groups needed by the GetDP solver
Physical Volume(1) = {1,2,3,4};
Physical Surface(2) = {222};

// Some Gmsh options
Mesh.Optimize = 1; // optimize 3D mesh
Mesh.Algorithm = 6; // use 2D Frontal algo
View.Format = "%12e"; // displayed number format
View.ShowTime = 1; // show eigenvalue in colorbar
