Merge "Domaine.brep";

Physical Volume("Rocher") = {1};
Physical Volume("Pliocene") = {3};
Physical Volume("Alluvion") = {2};
Physical Surface("Base") = {2};
Physical Surface("ColG") = {1};
Physical Surface("ColD") = {6};
Physical Surface("ColF") = {3};
Physical Surface("ColB") = {5};
Physical Surface("ColF") += {15, 11};
Physical Surface("ColB") += {16, 14};

// Rocher
bbox() = BoundingBox Volume{1};
xmin = bbox(0);
rch_ymin = bbox(1);
zmin = bbox(2);
xmax = bbox(3);
rch_ymax = bbox(4);
zmax = bbox(5);
Printf("rch_ymin: ", rch_ymin);
Printf("rch_ymax: ", rch_ymax);

rch_min = 50;
rch_max = 60;
Field[1] = MathEval;
Field[1].F = Sprintf("(%g) * y/(%g) + (%g) - (%g)*y/(%g)", rch_max, rch_ymin, rch_min, rch_min, rch_ymin);

Field[2] = Restrict;
Field[2].IField = 1;
Field[2].RegionsList = {1};
fac() = Abs(Boundary{ Volume{1}; });
Field[2].FacesList = {fac()};
edg() = Abs(Boundary{ Surface{fac()}; });
Field[2].EdgesList = {edg()};

// Pliocene
bbox() = BoundingBox Volume{3};
xmin = bbox(0);
plc_ymin = bbox(1);
zmin = bbox(2);
xmax = bbox(3);
plc_ymax = bbox(4);
zmax = bbox(5);

plc_min = 30;
plc_max = 40;
Field[3] = MathEval;
Field[3].F = Sprintf("(%g) * y/(%g) + (%g) - (%g)*y/(%g)", plc_max, plc_ymin, plc_min, plc_min, plc_ymin);

Field[4] = Restrict;
Field[4].IField = 3;
Field[4].RegionsList = {3};
fac() = Abs(Boundary{ Volume{3}; });
Field[4].FacesList = {fac()};
edg() = Abs(Boundary{ Surface{fac()}; });
Field[4].EdgesList = {edg()};

// Alluviov
bbox() = BoundingBox Volume{2};
xmin = bbox(0);
alv_ymin = bbox(1);
zmin = bbox(2);
xmax = bbox(3);
alv_ymax = bbox(4);
zmax = bbox(5);

alv_min = 10;
alv_max = 20;
Field[5] = MathEval;
Field[5].F = Sprintf("(%g) * y/(%g) + (%g) - (%g)*y/(%g)", alv_max, alv_ymin, alv_min, alv_min, alv_ymin);

Field[6] = Restrict;
Field[6].IField = 5;
Field[6].RegionsList = {2};
fac() = Abs(Boundary{ Volume{2}; });
Field[6].FacesList = {fac()};
edg() = Abs(Boundary{ Surface{fac()}; });
Field[6].EdgesList = {edg()};

// Synthesis
Field[7] = Min;
Field[7].FieldsList = {2, 4, 6};
Background Field = 7;

Mesh.CharacteristicLengthExtendFromBoundary = 0;
Mesh.CharacteristicLengthFromPoints = 0;
Mesh.CharacteristicLengthFromCurvature = 0;
