Boolean operation meshing differences
Hello,
In an attempt to automate a 2D meshing procedure using gmsh 3.0.6., I am trying to mesh a structure of overlapping parts using the BooleanIntersection and BooleanDifference methods. Before I used BooleanFragments and manually computed which fragments to include back. This works for this case, but in more complex cases I ran into trouble when manually keeping track of the fragments. The new script is much more robust, and the resulting .msh seems exactly the same, but there are some extra nodes. The FEM computation gives an enourmous difference. Is there an obvious thing I'm doing wrong? (OLD CODE)
SetFactory("OpenCASCADE");
Mesh.CharacteristicLengthMin = 0.04;
Mesh.CharacteristicLengthMax = 0.04;
Rectangle(1) = {0, 0, 0, 1, 1, 0.0};
Disk(2) = { 0.9507, 0.3739, 0, 0.23};
Disk(3) = { 0.4505, 0.3595, 0, 0.23};
Disk(4) = { -0.04929999999999998, 0.3739, 0, 0.23};
BooleanFragments{ Surface{1:4}; Delete;}{}
Plane Surface(100) = {2};
Plane Surface(101) = {3};
Plane Surface(102) = {4};
Plane Surface(300) = {1:2};
Physical Surface(0) = {100:102};
Physical Surface(1) = {300};
// Visualizing
//Mesh 2 ;
//Hide "*";
//Show { Surface{300};}
//Color Black{Surface{300};}
//Show { Surface{100:102};}
//Color Orange{Surface{100:102};}
While this worked up to a certain point, structures have become too complex to programatically keep track of which parts to put back in. I am now trying a more robust solution: (NEW CODE)
SetFactory("OpenCASCADE");
Mesh.CharacteristicLengthMin = 0.04;
Mesh.CharacteristicLengthMax = 0.04;
Rectangle(1) = {0, 0, 0, 1, 1, 0.0};
Disk(2) = { 0.9507, 0.3739, 0, 0.23};
Disk(3) = { 0.4505, 0.3595, 0, 0.23};
Disk(4) = { -0.04929999999999998, 0.3739, 0, 0.23};
Fibers[] = BooleanIntersection{ Surface{ 2:4}; }{ Surface{1};};
Matrix[] = BooleanDifference{ Surface{1}; }{ Surface{2:4}; };
Physical Surface(0) = {Fibers[0]:Fibers[#Fibers[]-1]};
Physical Surface(1) = {Matrix[0]};
// Visualizing
//Mesh 2 ;
//Hide "*";
//Show { Surface{Fibers[0]:Fibers[#Fibers[]-1]};}
//Color Orange{Surface{Fibers[0]:Fibers[#Fibers[]-1]}; }
//Show { Surface{Matrix[0]:Matrix[#Matrix[]-1]};}
//Color Black{Surface{Matrix[0]:Matrix[#Matrix[]-1]};}
If anyone knows what might cause the difference to have additional nodes in .msh, which could cause a significant difference in FEM, I would appreciate it. If more info is required let me know.