lc = 1.0; L = 3.0; x_P = 0.0; y_P = 0.0; z_P = 0.0; Point(1) = {x_P, y_P, z_P, lc}; // center of the cube // Points on a surface Point(2) = {x_P - L/2, y_P - L/2, 0, lc}; Point(3) = {x_P + L/2, y_P - L/2, 0, lc}; Point(4) = {x_P + L/2, y_P + L/2, 0, lc}; Point(5) = {x_P - L/2, y_P + L/2, 0, lc}; // Line between points Line(1) = {2, 3}; Line(2) = {3, 4}; Line(3) = {4, 5}; Line(4) = {5, 2}; // Generate surface Line Loop(5) = {4, 1, 2, 3}; Plane Surface(6) = {5}; // Extrude surface to get the cube Extrude {0, 0, L} { Surface{6}; } Physical Surface(3) = { 6, 15, 23, 19, 27, 28 }; Physical Volume(1) = { 1 };