Face Mesh bug (2DMESH)
Hello I found a continuous defect 2D Mesh error with a long and thin face in the xz plan.
I did a small test case. With only one surface it's ok. With two surface the mesh failed.
It seem's to be the in "OLD_CODE_DELAUNAY" in meshGface.cpp In my case all the points[i]->u are equal and so the XX (random) value is add why? ... Any way if there is more than 2 value with the same "doc.points[i].where.h" this lead to intersect then error. My fix (brute force) is to look at all the current value and find an other random value when there is already 2 equal value. I suppose there is a better way to fix it ...
Hope it help ...
bpigeard
***meshGFace.cpp
{ // compute the bounding box in parametric space SVector3 dd(bbox.max(), bbox.min()); double LC2D = norm(dd); DocRecord doc(points.size() + 4); for(unsigned int i = 0; i < points.size(); i++){ double XX = CTX::instance()->mesh.randFactor * LC2D * (double)rand() / (double)RAND_MAX; double YY = CTX::instance()->mesh.randFactor * LC2D * (double)rand() / (double)RAND_MAX; // printf("%22.15E %22.15E \n",XX,YY); int cntfind; do { cntfind = 0; for (size_t j = 0; j < i; j++) { if (doc.points[j].where.h == points[i]->u + XX) { cntfind += 1; if (cntfind > 1) { XX = CTX::instance()->mesh.randFactor * LC2D * (double)rand() / (double)RAND_MAX; break; } } } } while (cntfind >1); doc.points[i].where.h = points[i]->u + XX; doc.points[i].where.v = points[i]->v + YY; doc.points[i].data = points[i]; doc.points[i].adjacent = NULL;
}
TestCase.geo***
Geometry.Tolerance = 0.000001; // Default 1e-8 Mesh.RandomFactor = 1e-5; // Default 1e-9 Mesh.CharacteristicLengthMin = 1e-6; // Default 0 Mesh.CharacteristicLengthMax = 40; // Default 1e+22 Mesh.CharacteristicLengthExtendFromBoundary = 1; //Default 1 //Mesh.Algorithm = 8; Default 2 Mesh.Algorithm = 8; // mesh algorithm 1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad Mesh.RecombineAll = 0; // Default 0 Mesh.RecombinationAlgorithm = 0; // Default 1 0=standard, 1=blossom
cl = 2; cl22 = cl*1; //Elem Size for Layer Metal 1 Physical Volume ( "Metal 1",3) = {};
DefineConstant[ model = {1, Choices{1="OneSurFace", 2="TwoSurFace"},GmshOption "Reset", Name "Parameters/0Surface"} ];
//Start Polygon Metal418 (Metal 1) Point(1264) = {746.585000, 1506.315000, 296.610000, 1.000000cl22}; Point(1265) = {1471.615000, 1506.315000, 296.610000, 1.000000cl22}; Line(1634) = {1264, 1265};
// Start Poly Extrude Metal418[] Metal 1 Metal418[] = {}; Point(1288) = {746.585000, 1506.315000, 297.140000, 1.000000cl22 }; Point(1289) = {1471.615000, 1506.315000, 297.140000, 1.000000cl22 }; Line(1666) = {1288,1289}; Line(1675) = {1289,1265}; Line(1674) = {1288,1264};
If(model == 2) Point(1263) = {746.585000, 1508.775000, 296.610000, 1.000000*cl22}; Line(1633) = {1263, 1264};
Point(1287) = {746.585000, 1508.775000, 297.140000, 1.000000*cl22 }; Line(1665) = {1287,1288}; Line(1673) = {1287,1263};
Metal418[6] = news; Line Loop(Metal418[6]) = { 1633, -1674, -1665, 1673 }; Plane Surface(Metal418[6]) = {Metal418[6]};
EndIf
Metal418[7] = news; Line Loop(Metal418[7]) = { 1634, -1675, -1666, 1674 }; Plane Surface(Metal418[7]) = {Metal418[7]};