cl1 = 0.05;
// cl2 = 0.01;
L = 0.1;
Point(1) = {0, 0, 0, cl1};
Point(2) = {4*L, 0, 0, cl1};
Point(3) = {4*L, 4*L, 0, cl1};
Point(4) = {0, 4*L, 0, cl1};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
//
// Arrangement to have a finer mesh near the top and bottom walls
// First, use attractor field
Field[1] = Attractor;
Field[1].NNodesByEdge = 100;
Field[1].EdgesList = {1,3,4};
//Field[1].EdgesList = {1,3,4,2};
// Second, use threshold field
Field[2] = Threshold;
Field[2].IField = 1;
Field[2].LcMin = cl1 / 10;
Field[2].LcMax = cl1;
Field[2].DistMin = L/2;
Field[2].DistMax = L/1;
// Third, use background field
Field[7] = Min;
Field[7].FieldsList = {2};
Background Field = 7;
//
// Back to performing the usual procedures for meshing.
Line Loop(7) = {3, 4, 1, 2};
Plane Surface(8) = {7};
//
Physical Line(111) = {4};
Physical Line(222) = {3};
Physical Line(333) = {2};
Physical Line(444) = {1};
Physical Surface(13) = {8};
