n = 3; // increase this to refine

Point(1) = {0.000000000000 , 1000.200000000000 , 0};
Point(2) = {0.003819265821 , 1000.198226950355 , 0}; 
Point(3) = {0.142840541693 , 1000.033687943262 , 0};
Point(4) = {0.185180128855 , 999.939025369880 , 0};
Point(5) = {78.248252373483 , 444.491404684162 , 0}; 
Point(6) = {80.000000000000 , 419.440246511351 , 0}; 
Point(7) = {80.000000000000 , 0.000000000000 , 0};
Point(8) = {2000.000000000000 , 0.000000000000 , 0};
Point(9) = {2000.000000000000 , 800.000000000000 , 0};
Point(10) = {400.000000000000 , 800.000000000000 , 0}; 
Point(11) = {234.142135623731 , 965.857864376269 , 0}; 
Point(12) = {248.284271247462 , 1000.000000000000 , 0}; 
Point(13) = {2000.000000000000 , 1000.000000000000 , 0};
Point(14) = {2000.000000000000 , 11000.000000000000 , 0}; 
Point(15) = {150.000000000000 , 11000.000000000000 , 0}; 
Point(16) = {2000.000000000000 , 14204.293994002423 , 0};
Point(17) = {2000.000000000000 , 28795.706005997577 , 0}; 
Point(18) = {150.000000000000 , 32000.000000000000 , 0}; 
Point(19) = {2000.000000000000 , 32000.000000000000 , 0}; 
Point(20) = {2000.000000000000 , 92000.000000000000 , 0};
Point(21) = {0.000000000000 , 92000.000000000000 , 0}; 
// Point(22) = {0.000000000000 , 92000.000000000000 , 0}; 
Point(23) = {0.000000000000 , 1000.195000000000 , 0}; 
Point(24) = {0.000000000000 , 999.913000000000 , 0}; 
Point(25) = {-100.000000000000 , 419.440246511351 , 0};
Point(26) = {248.284271247462 , 980.000000000000 , 0}; 

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

Point(27) = {0, 11000, 0};
Point(28) = {0, 32000, 0};

Line(21) = {1, 27};
Line(22) = {27, 28};
Line(23) = {28, 21};
Line(24) = {28, 18};
Line(25) = {27, 15};
Line(26) = {1, 12};

Line Loop(27) = {23, -20, -19, -18, -24};
Plane Surface(28) = {27};
Line Loop(29) = {17, -24, -22, 25, 15, 16};
Plane Surface(30) = {29};
Line Loop(31) = {14, -25, -21, 26, 12, 13};
Plane Surface(32) = {31};

Line(33) = {10, 5};
Line Loop(34) = {4, -33, 10, 11, -26, 1, 2, 3};
Plane Surface(35) = {34};
Line Loop(36) = {33, 5, 6, 7, 8, 9};
Plane Surface(37) = {36};

nv = 5*n;
nh1 = 2*n;
nh2 = 8*n;

Transfinite Line {19, 23} = 16 * nv;
Transfinite Line {22, 16} = 6 * nv;
Transfinite Line {13, 21} = 6 * nv;

Transfinite Line {20} = nh1 + nh2 - 1;
Transfinite Line {24, 25, 26, 33} = nh1;
Transfinite Line {18, 15, 17, 12, 14} = nh2;

Transfinite Line {1, 2, 3} = 2; // should remove those small lines
Transfinite Line {11} = nh1; // should remove this small line
Transfinite Line {4} = nv;
Transfinite Line {10} = nv-nh1+4;

Transfinite Line {5} = 2; // should remove this small line
Transfinite Line {6} = nv;
Transfinite Line {8} = nv+nh1;
Transfinite Line {7,9} = nh2;

Transfinite Surface {28} = {28, 19, 20, 21};
Transfinite Surface {30} = {27, 16, 17, 28};
Transfinite Surface {32} = {1, 13, 14, 27};
Transfinite Surface {35} = {5, 10, 12, 1};
Transfinite Surface {37} = {7, 8, 9, 10};

Recombine Surface{28,30,32,35,37};

Mesh.Smoothing = 20;
