// SET DIMENSIONS
R =0.5;
d1=0.25;
d2=25;

// CREATE POINTS
Point(0) = {0, 0, 0, d1};
Point(1) = {-R, 0, 0, d1};
Point(2) = {0, R, 0, d1};
Point(3) = {R, 0, 0, d1};
Point(4) = {0, -R, 0, d1};
Point(5) = {0, 0, R, d1};
Point(6) = {0, 0, -R, d1};

// CREATE LINES
Circle(1) = {3, 0, 2};
Circle(2) = {4, 0, 3};
Circle(3) = {2, 0, 1};
Circle(4) = {1, 0, 4};
Circle(5) = {2, 0, 6};
Circle(6) = {6, 0, 4};
Circle(7) = {4, 0, 5};
Circle(8) = {5, 0, 2};
Circle(9) = {5, 0, 3};
Circle(10) = {3, 0, 6};
Circle(11) = {6, 0, 1};
Circle(12) = {1, 0, 5};

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

// LOOP SPHERE SURFACES
Surface Loop(10) = {1,2,3,4,5,6,7,8};

// FAR FIELD CREATION
Dilate {{0, 0, 0}, {100, 100, 100}} {
  Duplicata { Surface{5}; Surface{3}; Surface{1}; Surface{4}; Surface{8}; Surface{7}; Surface{6}; Surface{2}; }
}
Characteristic Length {7,9,14,22,24,29} = d2;
Surface Loop(20) = {29,13,25,21,17,41,37,33};

// LOOP FARFIELD BND
Surface Loop(11) = {29, 33, 37, 13, 21, 25, 17, 41};

// VOLUME CREATION
Volume(1) = {10, 11};

//UNCOMMENT FOR BOUNDARY LAYER
Field[1] = BoundaryLayer;
//Field[1].EdgesList = {1,2,3,4,5,6,7,8,9,10,11,12};
Field[1].NodesList = {1,2,3,4,5,6};
//Field[1].FanNodesList= {};
Field[1].FacesList={1,2,3,4,5,6,7,8};
Field[1].AnisoMax = 60;
Field[1].hfar = 2.;
Field[1].hwall_n = 0.08;
Field[1].thickness = 0.5;
Field[1].ratio = 1.2;
Field[1].Quads = 1;
Field[1].IntersectMetrics = 1;
BoundaryLayer Field = 1;

Physical Surface("Wall",1) = {5, 1, 7, 6, 2, 3, 4, 8};
Physical Surface("FarField",2) = {29,13,25,21,17,41,37,33};
