SetFactory("OpenCASCADE");

Mesh.Algorithm = 1; // MeshAdapt

d_1 = 40; 
d_2 = 5; 
d_3 = 2; 
//d4 = 0.02;

cl1_xy = 2;
cl2_xy = 10;
//cl1_z = d4;
cl2_z = d_2/3;

cl1 = cl1_xy;
cl2 = cl2_xy;
cl3 = 20;

z0 = 0;
z1 = z0 + d_1;
z2 = z1 + d_2 * cl2_xy / cl2_z;
z3 = z2 + d_3 * cl2_xy / cl2_z;
//z4 = z3 + d4 * cl1_xy / cl1_z;

Point(1480) = {-90, 1.5, z3, cl2};
Point(1481) = {-90, 171.5, z3, cl2};
Point(1482) = {310, 1.5, z3, cl2};
Point(1483) = {310, 171.5, z3, cl2};
Point(1484) = {-90, 1.5, z2, cl2};
Point(1485) = {-90, 1.5, z1, cl2};
Point(1486) = {-90, 1.5, z0, cl3};
Point(1487) = {-90, 171.5, z2, cl2};
Point(1488) = {-90, 171.5, z1, cl2};
Point(1489) = {-90, 171.5, z0, cl3};
Point(1490) = {310, 171.5, z0, cl3};
Point(1491) = {310, 171.5, z1, cl2};
Point(1492) = {310, 171.5, z2, cl2};
Point(1493) = {310, 1.5, z2, cl2};
Point(1494) = {310, 1.5, z1, cl2};
Point(1495) = {310, 1.5, z0, cl3};
Line(1239) = {1480, 1482};
Line(1240) = {1482, 1483};
Line(1241) = {1483, 1481};
Line(1242) = {1481, 1480};
Line(1243) = {1485, 1494};
Line(1244) = {1494, 1491};
Line(1245) = {1491, 1488};
Line(1246) = {1488, 1485};
Line(1247) = {1484, 1493};
Line(1248) = {1493, 1492};
Line(1249) = {1492, 1487};
Line(1250) = {1487, 1484};
Line(1251) = {1489, 1486};
Line(1252) = {1486, 1495};
Line(1253) = {1495, 1490};
Line(1254) = {1490, 1489};
Line(1255) = {1486, 1485};
Line(1256) = {1485, 1484};
Line(1257) = {1484, 1480};
Line(1258) = {1482, 1493};
Line(1259) = {1493, 1494};
Line(1260) = {1494, 1495};
Line(1261) = {1490, 1491};
Line(1262) = {1491, 1492};
Line(1263) = {1492, 1483};
Line(1264) = {1481, 1487};
Line(1265) = {1487, 1488};
Line(1266) = {1488, 1489};
Line Loop(1274) = {1261, -1244, 1260, 1253};
Plane Surface(1274) = {1274};
Line Loop(1276) = {1243, 1260, -1252, 1255};
Plane Surface(1276) = {1276};
Line Loop(1278) = {1261, 1245, 1266, -1254};
Plane Surface(1278) = {1278};
Line Loop(1280) = {1266, 1251, 1255, -1246};
Plane Surface(1280) = {1280};
Line Loop(1282) = {1243, -1259, -1247, -1256};
Plane Surface(1282) = {1282};
Line Loop(1288) = {1265, 1246, 1256, -1250};
Plane Surface(1288) = {1288};
Line Loop(1290) = {1245, -1265, -1249, -1262};
Plane Surface(1290) = {1290};
Line Loop(1292) = {1262, -1248, 1259, 1244};
Plane Surface(1292) = {1292};
Line Loop(1298) = {1251, 1252, 1253, 1254};
Plane Surface(1298) = {1298};
Line Loop(1300) = {1243, 1244, 1245, 1246};
Plane Surface(1300) = {1300};
Line Loop(1302) = {1249, 1250, 1247, 1248};
Plane Surface(1302) = {1302};
Line Loop(1317) = {1247, -1258, -1239, -1257};
Plane Surface(317) = {1317};
Line Loop(1318) = {1240, -1263, -1248, -1258};
Plane Surface(1318) = {1318};
Line Loop(1319) = {1241, 1264, -1249, 1263};
Plane Surface(1319) = {1319};
Line Loop(1320) = {1242, -1257, -1250, -1264};
Plane Surface(1320) = {1320};
//Line Loop(10) = {239, 240, 241, 242, 8, -9, -322, -19, 20, -5, 6, -7};
//Plane Surface(10) = {10};
Surface Loop(11) = {1276, 1274, 1278, 1280, 1298, 1300};
Volume(11) = {11};
Surface Loop(12) = {1282, 1292, 1290, 1288, 1300, 1302};
Volume(12) = {12};
