50 scalar sumMagClosedBoundary = 0;
54 for(
label faceI =
mesh.nInternalFaces();faceI<areas.size();++faceI)
56 sumClosed += areas[faceI];
57 sumMagClosedBoundary +=
mag(areas[faceI]);
74 if( maxOpen > SMALL*
max(1.0, sumMagClosedBoundary) )
78 "bool checkClosedBoundary(const polyMeshGen&, const bool report)"
79 ) <<
"Possible hole in boundary description" <<
endl;
81 Info<<
"Boundary openness in x-direction = "
84 Info<<
"Boundary openness in y-direction = "
87 Info<<
"Boundary openness in z-direction = "
96 Info<<
"Boundary openness in x-direction = "
99 Info<<
"Boundary openness in y-direction = "
102 Info<<
"Boundary openness in z-direction = "
105 Info<<
"Boundary closed (OK)." <<
endl;
116 const scalar aspectWarn,
122 const label nFaces =
mesh.faces().size();
124 label nErrorClosed = 0;
127 # pragma omp parallel for schedule(guided) reduction(+ : nErrorClosed)
133 if(
min(curCell) < 0 ||
max(curCell) > nFaces )
137 "bool checkClosedCells("
138 "const polyMeshGen&, const bool, const scalar, labelHashSet*)"
139 ) <<
"Cell " << cI <<
" contains face labels out of range: "
140 << curCell <<
" Max face index = " << nFaces <<
endl;
145 # pragma omp critical
154 if( nErrorClosed > 0 )
158 "bool checkClosedCells("
159 "const polyMeshGen&, const bool, const scalar, labelHashSet*)"
160 ) << nErrorClosed <<
" cells with invalid face labels found"
179 sumClosed[own[faceI]] += areas[faceI];
180 sumMagClosed[own[faceI]] +=
mag(areas[faceI]);
182 if( nei[faceI] == -1 )
186 sumClosed[nei[faceI]] -= areas[faceI];
187 sumMagClosed[nei[faceI]] +=
mag(areas[faceI]);
191 scalar maxOpenCell = 0;
194 scalar maxAspectRatio = 0;
211 maxOpenCell =
max(maxOpenCell, maxOpen);
213 if( maxOpen > SMALL*
max(1.0, sumMagClosed[cellI]) )
217 Pout<<
"Cell " << cellI <<
" is not closed. "
218 <<
"Face area vectors sum up to " <<
mag(sumClosed[cellI])
219 <<
" directionwise " << sumClosed[cellI] <<
" or "
220 <<
mag(sumClosed[cellI])
221 /(
mag(sumMagClosed[cellI]) + VSMALL)
222 <<
" of the area of all faces of the cell. " <<
endl
223 <<
" Area magnitudes sum up to "
224 << sumMagClosed[cellI] <<
endl;
236 1.0/6.0*sumMagClosed[cellI]/
pow(vols[cellI], 2.0/3.0);
238 maxAspectRatio =
max(maxAspectRatio, aspectRatio);
240 if( aspectRatio > aspectWarn )
244 Pout<<
"High aspect ratio for cell " << cellI
245 <<
": " << aspectRatio <<
endl;
262 "bool checkClosedCells("
263 "const polyMeshGen&, const bool, const scalar, labelHashSet*)"
264 ) << nOpen <<
" open cells found. Max cell openness: "
265 << maxOpenCell <<
endl;
274 "bool checkClosedCells("
275 "const polyMeshGen&, const bool, const scalar, labelHashSet*)"
276 ) << nAspect <<
" high aspect ratio cells found. "
277 <<
"Max aspect ratio: " << maxAspectRatio
285 Info<<
"Max cell openness = " << maxOpenCell
286 <<
" Max aspect ratio = " << maxAspectRatio
287 <<
". All cells OK.\n" <<
endl;
302 scalar minVolume = GREAT;
303 scalar maxVolume = -GREAT;
305 label nNegVolCells = 0;
309 if( vols[cellI] < VSMALL )
314 "bool checkCellVolumes("
315 "const polyMeshGen&, const bool, labelHashSet*)"
316 ) <<
"Zero or negative cell volume detected for cell "
317 << cellI <<
". Volume = " << vols[cellI] <<
endl;
325 minVolume =
min(minVolume, vols[cellI]);
326 maxVolume =
max(maxVolume, vols[cellI]);
333 if( minVolume < VSMALL )
337 "bool checkCellVolumes("
338 "const polyMeshGen&, const bool, labelHashSet*)"
339 ) <<
"Zero or negative cell volume detected. "
340 <<
"Minimum negative volume: "
341 << minVolume <<
".\nNumber of negative volume cells: "
342 << nNegVolCells <<
". This mesh is invalid"
351 Info<<
"Min volume = " << minVolume
352 <<
". Max volume = " << maxVolume
353 <<
". Total volume = " <<
sum(vols)
354 <<
". Cell volumes OK.\n" <<
endl;
365 const scalar minFaceArea,
375 scalar minArea = VGREAT;
376 scalar maxArea = -VGREAT;
379 # pragma omp parallel if( own.size() > 100 )
382 scalar localMaxArea(-VGREAT), localMinArea(VGREAT);
385 # pragma omp for schedule(guided)
389 if( changedFacePtr && !changedFacePtr->operator[](faceI) )
392 const scalar magFaceArea =
mag(faceAreas[faceI]);
394 if( magFaceArea < minFaceArea )
398 if( nei[faceI] != -1 )
400 Pout<<
"Zero or negative face area detected for "
401 <<
"internal face " << faceI <<
" between cells "
402 << own[faceI] <<
" and " << nei[faceI]
403 <<
". Face area magnitude = "
404 << magFaceArea <<
endl;
408 Pout<<
"Zero or negative face area detected for "
409 <<
"boundary face " << faceI <<
" next to cell "
410 << own[faceI] <<
". Face area magnitude = "
411 << magFaceArea <<
endl;
418 # pragma omp critical
424 localMinArea =
Foam::min(localMinArea, magFaceArea);
425 localMaxArea =
Foam::max(localMaxArea, magFaceArea);
429 # pragma omp critical
432 minArea =
Foam::min(minArea, localMinArea);
433 maxArea =
Foam::max(maxArea, localMaxArea);
440 if( minArea < VSMALL )
444 "bool checkFaceAreas("
445 "const polyMeshGen&, const bool, const scalar,"
446 " labelHashSet*, const boolList*)"
447 ) <<
"Zero or negative face area detected. Minimum negative area: "
448 << minArea <<
". This mesh is invalid"
457 Info<<
"Minumum face area = " << minArea
458 <<
". Maximum face area = " << maxArea
459 <<
". Face area magnitudes OK.\n" <<
endl;
470 const scalar minPartTet,
483 label nNegVolCells = 0;
486 # pragma omp parallel for if( owner.size() > 100 ) \
487 schedule(guided) reduction(+ : nNegVolCells)
491 if( changedFacePtr && !(*changedFacePtr)[faceI] )
494 const face&
f = faces[faceI];
505 cCentres[owner[faceI]]
508 if( tetOwn.
mag() < minPartTet )
513 # pragma omp critical
515 Pout<<
"Zero or negative cell volume detected for cell "
516 << owner[faceI] <<
"." <<
endl;
522 if( neighbour[faceI] < 0 )
530 cCentres[neighbour[faceI]]
533 if( tetNei.
mag() < minPartTet )
538 # pragma omp critical
540 Pout<<
"Zero or negative cell volume detected for cell "
541 << neighbour[faceI] <<
"." <<
endl;
553 # pragma omp critical
568 const label start = procBnd[patchI].patchStart();
569 const label size = procBnd[patchI].patchSize();
572 for(
label faceI=0;faceI<size;++faceI)
574 if( setPtr->
found(faceI+start) )
581 procBnd[patchI].neiProcNo(),
585 toOtherProc << sendData;
595 procBnd[patchI].neiProcNo()
598 fromOtherProc >> receivedData;
600 const label start = procBnd[patchI].patchStart();
602 setPtr->
insert(start+receivedData[i]);
608 if( nNegVolCells != 0 )
612 "bool checkCellPartTetrahedra("
613 "const polyMeshGen&, const bool, const scalar,"
614 " labelHashSet*, const boolList*)"
615 ) << nNegVolCells <<
" zero or negative part tetrahedra detected."
623 Info<<
"Part cell tetrahedra OK.\n" <<
endl;
642 const label nInternalFaces =
mesh.nInternalFaces();
644 faceDotProduct.setSize(own.
size());
645 faceDotProduct = 1.0;
648 # pragma omp parallel if( nInternalFaces > 1000 )
652 # pragma omp for schedule(dynamic, 100)
654 for(
label faceI=0;faceI<nInternalFaces;++faceI)
656 if( changedFacePtr && !(*changedFacePtr)[faceI] )
659 const vector d = centres[nei[faceI]] - centres[own[faceI]];
660 const vector&
s = areas[faceI];
662 faceDotProduct[faceI] = (d &
s)/(
mag(d)*
mag(
s) + VSMALL);
669 mesh.procBoundaries();
671 forAll(procBoundaries, patchI)
673 const label start = procBoundaries[patchI].patchStart();
675 vectorField cCentres(procBoundaries[patchI].patchSize());
677 cCentres[faceI] = centres[own[start+faceI]];
682 procBoundaries[patchI].neiProcNo(),
686 toOtherProc << cCentres;
689 forAll(procBoundaries, patchI)
695 procBoundaries[patchI].neiProcNo()
698 fromOtherProc >> otherCentres;
701 const label start = procBoundaries[patchI].patchStart();
703 # pragma omp parallel
707 # pragma omp for schedule(dynamic, 100)
711 const label faceI = start + fI;
713 if( changedFacePtr && !(*changedFacePtr)[faceI] )
716 const point& cOwn = centres[own[faceI]];
717 const point& cNei = otherCentres[fI];
718 const vector d = cNei - cOwn;
719 const vector&
s = areas[faceI];
721 faceDotProduct[faceI] = (d &
s)/(
mag(d)*
mag(
s) + VSMALL);
732 const scalar nonOrthWarn,
743 const label nInternalFaces =
mesh.nInternalFaces();
746 const scalar severeNonorthogonalityThreshold =
747 ::cos(nonOrthWarn/180.0*M_PI);
749 scalar minDDotS = VGREAT;
750 scalar sumDDotS = 0.0;
752 label severeNonOrth = 0;
753 label errorNonOrth = 0;
757 # pragma omp parallel if( nInternalFaces > 1000 ) \
758 reduction(+ : severeNonOrth, errorNonOrth, sumDDotS)
761 scalar localMinDDotS(VGREAT);
763 # pragma omp for schedule(guided)
765 for(
label faceI=0;faceI<nInternalFaces;++faceI)
767 if( changedFacePtr && !(*changedFacePtr)[faceI] )
770 const scalar dDotS = faceDotProduct[faceI];
772 if( dDotS < severeNonorthogonalityThreshold )
780 # pragma omp critical
782 Pout<<
"Severe non-orthogonality for face " << faceI
783 <<
" between cells " << own[faceI]
784 <<
" and " << nei[faceI]
786 <<
::acos(dDotS)/M_PI*180.0
793 # pragma omp critical
807 # pragma omp critical
814 localMinDDotS =
Foam::min(dDotS, localMinDDotS);
819 # pragma omp critical
821 minDDotS =
Foam::min(minDDotS, localMinDDotS);
824 counter += nInternalFaces;
829 mesh.procBoundaries();
831 const label start = procBoundaries[0].patchStart();
834 # pragma omp parallel \
835 reduction(+ : severeNonOrth, errorNonOrth, sumDDotS, counter)
838 scalar localMinDDotS(VGREAT);
841 # pragma omp for schedule(dynamic, 100)
843 for(
label faceI=start;faceI<own.
size();++faceI)
845 if( changedFacePtr && !(*changedFacePtr)[start+faceI] )
848 const scalar dDotS = faceDotProduct[faceI];
850 if( dDotS < severeNonorthogonalityThreshold )
858 # pragma omp critical
866 Pout<<
"Severe non-orthogonality for face "
877 # pragma omp critical
879 setPtr->
insert(start+faceI);
891 # pragma omp critical
893 setPtr->
insert(start+faceI);
898 localMinDDotS =
Foam::min(dDotS, localMinDDotS);
899 sumDDotS += 0.5 * dDotS;
905 # pragma omp critical
907 minDDotS =
Foam::min(minDDotS, localMinDDotS);
921 if( minDDotS < severeNonorthogonalityThreshold )
923 Info<<
"Number of non-orthogonality errors: " << errorNonOrth
924 <<
". Number of severely non-orthogonal faces: "
925 << severeNonOrth <<
"." <<
endl;
933 Info<<
"Mesh non-orthogonality Max: "
934 <<
::acos(minDDotS)/M_PI*180.0
936 ::acos(sumDDotS/counter)/M_PI*180.0
941 if( errorNonOrth > 0 )
945 "checkFaceDotProduct("
946 "const polyMeshGen&, const bool, const scalar,"
947 " labelHashSet*, const boolList*)"
948 ) <<
"Error in non-orthogonality detected" <<
endl;
955 Info<<
"Non-orthogonality check OK.\n" <<
endl;
965 const scalar minPyrVol,
979 label nErrorPyrs = 0;
982 # pragma omp parallel for schedule(guided) reduction(+ : nErrorPyrs)
986 if( changedFacePtr && !(*changedFacePtr)[faceI] )
998 if( pyrVol > -minPyrVol )
1003 # pragma omp critical
1005 Pout<<
"bool checkFacePyramids("
1006 <<
"const bool, const scalar, labelHashSet*) : "
1007 <<
"face " << faceI <<
" points the wrong way. " <<
endl
1008 <<
"Pyramid volume: " << -pyrVol
1009 <<
" Face " << faces[faceI] <<
" area: "
1010 << faces[faceI].mag(
points)
1011 <<
" Owner cell: " << owner[faceI] <<
endl
1012 <<
"Owner cell vertex labels: "
1013 <<
mesh.cells()[owner[faceI]].labels(faces)
1020 if( neighbour[faceI] != -1 )
1023 const scalar pyrVol =
1027 ctrs[neighbour[faceI]]
1030 if( pyrVol < minPyrVol )
1035 # pragma omp critical
1037 Pout<<
"bool checkFacePyramids("
1038 <<
"const bool, const scalar, labelHashSet*) : "
1039 <<
"face " << faceI <<
" points the wrong way. " <<
endl
1040 <<
"Pyramid volume: " << -pyrVol
1041 <<
" Face " << faces[faceI] <<
" area: "
1042 << faces[faceI].mag(
points)
1043 <<
" Neighbour cell: " << neighbour[faceI] <<
endl
1044 <<
"Neighbour cell vertex labels: "
1045 <<
mesh.cells()[neighbour[faceI]].labels(faces)
1058 # pragma omp critical
1073 mesh.procBoundaries();
1076 forAll(procBoundaries, patchI)
1078 const label start = procBoundaries[patchI].patchStart();
1079 const label size = procBoundaries[patchI].patchSize();
1082 for(
label faceI=0;faceI<size;++faceI)
1084 if( setPtr->
found(start+faceI) )
1085 markedFaces.
append(faceI);
1091 procBoundaries[patchI].neiProcNo(),
1095 toOtherProc << markedFaces;
1098 forAll(procBoundaries, patchI)
1104 procBoundaries[patchI].neiProcNo()
1106 fromOtheProc >> receivedData;
1108 const label start = procBoundaries[patchI].patchStart();
1110 setPtr->
insert(start+receivedData[i]);
1114 if( nErrorPyrs > 0 )
1119 "bool checkFacePyramids("
1120 "const polyMeshGen&, const bool, const scalar,"
1121 " labelHashSet*, const boolList*)"
1122 ) <<
"Error in face pyramids: " << nErrorPyrs
1123 <<
" faces pointing the wrong way!"
1131 Info<<
"Face pyramids OK.\n" <<
endl;
1148 const label nInternalFaces =
mesh.nInternalFaces();
1153 faceSkewness.setSize(own.
size());
1158 # pragma omp parallel for schedule(dynamic, 100)
1160 for(
label faceI=0;faceI<nInternalFaces;++faceI)
1162 if( changedFacePtr && !changedFacePtr->operator[](faceI) )
1165 const scalar dOwn =
mag(fCentres[faceI] - centres[own[faceI]]);
1166 const scalar dNei =
mag(fCentres[faceI] - centres[nei[faceI]]);
1168 const point faceIntersection =
1169 centres[own[faceI]]*dNei/(dOwn+dNei)
1170 + centres[nei[faceI]]*dOwn/(dOwn+dNei);
1172 faceSkewness[faceI] =
1173 mag(fCentres[faceI] - faceIntersection)
1174 /(
mag(centres[nei[faceI]] - centres[own[faceI]]) + VSMALL);
1181 mesh.procBoundaries();
1183 forAll(procBoundaries, patchI)
1185 const label start = procBoundaries[patchI].patchStart();
1187 vectorField cCentres(procBoundaries[patchI].patchSize());
1189 cCentres[faceI] = centres[own[start+faceI]];
1194 procBoundaries[patchI].neiProcNo(),
1198 toOtherProc << cCentres;
1201 forAll(procBoundaries, patchI)
1203 const label start = procBoundaries[patchI].patchStart();
1209 procBoundaries[patchI].neiProcNo()
1212 fromOtheProc >> otherCentres;
1216 # pragma omp parallel
1220 # pragma omp for schedule(dynamic, 100)
1224 const label faceI = start + fI;
1228 !changedFacePtr->operator[](faceI)
1232 const point& cOwn = centres[own[faceI]];
1233 const point& cNei = otherCentres[fI];
1234 const scalar dOwn =
mag(fCentres[faceI] - cOwn);
1235 const scalar dNei =
mag(fCentres[faceI] - cNei);
1237 const point faceIntersection =
1238 cOwn*dNei/(dOwn+dNei)
1239 + cNei*dOwn/(dOwn+dNei);
1241 faceSkewness[faceI] =
1242 mag(fCentres[faceI] - faceIntersection)
1243 /(
mag(cOwn - cNei) + VSMALL);
1253 forAll(boundaries, patchI)
1255 label faceI = boundaries[patchI].patchStart();
1256 const label end = faceI + boundaries[patchI].patchSize();
1258 for(;faceI<end;++faceI)
1260 const vector d = fCentres[faceI] - centres[own[faceI]];
1263 const scalar magn =
mag(
n);
1275 faceSkewness[faceI] =
mag(d - dn) / (
mag(d) + VSMALL);
1284 const scalar warnSkew,
1294 scalar maxSkew = 0.0;
1295 scalar sumSkew = 0.0;
1297 label nWarnSkew = 0;
1301 # pragma omp parallel \
1302 reduction(+ : sumSkew, nWarnSkew)
1305 scalar localMaxSkew(0.0);
1308 # pragma omp for schedule(dynamic, 100)
1310 forAll(faceSkewness, faceI)
1312 if( changedFacePtr && !changedFacePtr->operator[](faceI) )
1315 const scalar skewness = faceSkewness[faceI];
1318 if( skewness > warnSkew )
1323 # pragma omp critical
1325 Pout<<
" Severe skewness for face " << faceI
1326 <<
" skewness = " << skewness <<
endl;
1332 # pragma omp critical
1340 localMaxSkew =
Foam::max(localMaxSkew, skewness);
1341 sumSkew += skewness;
1345 # pragma omp critical
1347 maxSkew =
Foam::max(maxSkew, localMaxSkew);
1358 "checkFaceSkewness("
1359 "const polyMeshGen&, const bool, const scalar,"
1360 "labelHashSet*, const boolList*)"
1361 ) <<
"Large face skewness detected. Max skewness = " << maxSkew
1362 <<
" Average skewness = " << sumSkew/faceSkewness.size()
1363 <<
".\nThis may impair the quality of the result." <<
nl
1364 << nWarnSkew <<
" highly skew faces detected."
1372 Info<<
"Max skewness = " << maxSkew
1373 <<
" Average skewness = " << sumSkew/faceSkewness.size()
1374 <<
". Face skewness OK.\n" <<
endl;
1393 const label nInternalFaces =
mesh.nInternalFaces();
1395 faceUniformity.setSize(owner.
size());
1396 faceUniformity = 0.5;
1399 # pragma omp parallel for schedule(dynamic, 100)
1401 for(
label faceI=0;faceI<nInternalFaces;++faceI)
1403 if( changedFacePtr && !changedFacePtr->operator[](faceI) )
1408 Foam::mag(centres[owner[faceI]] - fCentres[faceI])
1412 Foam::mag(centres[neighbour[faceI]] - fCentres[faceI])
1415 faceUniformity[faceI] =
Foam::min(dOwn, dNei) / (dOwn + dNei);
1421 mesh.procBoundaries();
1423 forAll(procBoundaries, patchI)
1425 scalarField dst(procBoundaries[patchI].patchSize());
1426 const label start = procBoundaries[patchI].patchStart();
1430 const label fI = start + faceI;
1431 dst[faceI] =
Foam::mag(centres[owner[fI]] - fCentres[fI]);
1437 procBoundaries[patchI].neiProcNo(),
1444 forAll(procBoundaries, patchI)
1446 const label start = procBoundaries[patchI].patchStart();
1452 procBoundaries[patchI].neiProcNo()
1455 fromOtheProc >> otherDst;
1459 const label fI = start + faceI;
1461 Foam::mag(centres[owner[fI]] - fCentres[fI]);
1462 const scalar dNei = otherDst[faceI];
1463 faceUniformity[fI] =
Foam::min(dOwn, dNei) / (dOwn + dNei);
1473 const scalar warnUniform,
1482 const label nInternalFaces =
mesh.nInternalFaces();
1484 scalar maxUniformity = 0.0;
1485 scalar minUniformity = VGREAT;
1487 scalar sumUniformity = 0.0;
1489 label severeNonUniform = 0;
1492 # pragma omp parallel \
1493 reduction(+ : sumUniformity, severeNonUniform)
1496 scalar localMinUniformity(VGREAT);
1497 scalar localMaxUniformity(0.0);
1500 # pragma omp for schedule(guided)
1502 for(
label faceI=0;faceI<nInternalFaces;++faceI)
1504 if( changedFacePtr && !changedFacePtr->operator[](faceI) )
1507 const scalar uniformity = faceUniformity[faceI];
1509 if( uniformity < warnUniform )
1514 # pragma omp critical
1522 localMaxUniformity =
Foam::max(localMaxUniformity, uniformity);
1523 localMinUniformity =
Foam::min(localMinUniformity, uniformity);
1524 sumUniformity += uniformity;
1528 # pragma omp critical
1531 maxUniformity =
Foam::max(maxUniformity, localMaxUniformity);
1532 minUniformity =
Foam::min(minUniformity, localMinUniformity);
1536 label counter = nInternalFaces;
1541 mesh.procBoundaries();
1543 forAll(procBoundaries, patchI)
1545 const label start = procBoundaries[patchI].patchStart();
1546 const label size = procBoundaries[patchI].patchSize();
1548 for(
label fI=0;fI<size;++fI)
1550 const label faceI = start + fI;
1552 const scalar uniformity = faceUniformity[faceI];
1554 if( uniformity < warnUniform )
1562 maxUniformity =
Foam::max(maxUniformity, uniformity);
1563 minUniformity =
Foam::min(minUniformity, uniformity);
1564 sumUniformity += 0.5 * uniformity;
1567 if( procBoundaries[patchI].owner() )
1581 if( minUniformity < warnUniform )
1582 Info<<
"Number of severely non-uniform faces: "
1583 << severeNonUniform <<
"." <<
endl;
1589 Info<<
"Mesh non-uniformity Max: "
1591 <<
" Min: " << minUniformity
1592 <<
" average: " << sumUniformity/counter
1623 const scalar maxDeg,
1628 if( maxDeg < -SMALL || maxDeg > 180+SMALL )
1632 "bool checkFaceAngles("
1633 "const polyMeshGen&, const bool, const scalar,"
1634 " labelHashSet*, const boolList*)"
1635 ) <<
"maxDeg should be [0..180] but is now " << maxDeg
1639 const scalar maxSin =
Foam::sin(maxDeg/180.0*M_PI);
1644 faceNormals /=
mag(faceNormals) + VSMALL;
1646 scalar maxEdgeSin = 0.0;
1651 # pragma omp parallel reduction(+ : nConcave)
1654 scalar localMaxEdgeSin(0.0);
1655 label errorFaceI(-1);
1658 # pragma omp for schedule(guided)
1662 if( changedFacePtr && !changedFacePtr->operator[](faceI) )
1665 const face&
f = faces[faceI];
1669 scalar magEPrev =
mag(ePrev);
1670 ePrev /= magEPrev + VSMALL;
1675 label fp1 =
f.fcIndex(fp0);
1679 scalar magE10 =
mag(e10);
1680 e10 /= magE10 + VSMALL;
1682 if( magEPrev > SMALL && magE10 > SMALL )
1684 vector edgeNormal = ePrev ^ e10;
1685 scalar magEdgeNormal =
mag(edgeNormal);
1687 if( magEdgeNormal < maxSin )
1694 edgeNormal /= magEdgeNormal;
1696 if( (edgeNormal & faceNormals[faceI]) < SMALL )
1699 # pragma omp critical
1702 if( faceI != errorFaceI )
1713 Foam::max(localMaxEdgeSin, magEdgeNormal);
1725 # pragma omp critical
1727 maxEdgeSin =
Foam::max(maxEdgeSin, localMaxEdgeSin);
1735 if( maxEdgeSin > SMALL )
1737 scalar maxConcaveDegr =
1741 Warning<<
"There are " << nConcave
1742 <<
" faces with concave angles between consecutive"
1743 <<
" edges. Max concave angle = "
1745 <<
" degrees.\n" <<
endl;
1749 Info<<
"All angles in faces are convex or less than " << maxDeg
1750 <<
" degrees concave.\n" <<
endl;
1758 "bool checkFaceAngles("
1759 "const polyMeshGen&, const bool, const scalar,"
1760 " labelHashSet*, const boolList*)"
1761 ) << nConcave <<
" face points with severe concave angle (> "
1762 << maxDeg <<
" deg) found.\n"
1780 const scalar warnFlatness,
1785 if( warnFlatness < 0 || warnFlatness > 1 )
1789 "bool checkFaceFlatness("
1790 "const polyMeshGen&, const bool, const scalar,"
1791 " labelHashSet*, const boolList*)"
1792 ) <<
"warnFlatness should be [0..1] but is now " << warnFlatness
1806 scalar minFlatness = GREAT;
1807 scalar sumFlatness = 0;
1811 # pragma omp parallel if( faces.size() > 1000 ) \
1812 reduction(+ : nSummed, nWarped) reduction(+ : sumFlatness)
1815 scalar minFlatnessProc = VGREAT;
1818 # pragma omp for schedule(guided)
1822 if( changedFacePtr && !(*changedFacePtr)[faceI] )
1825 const face&
f = faces[faceI];
1827 if(
f.size() > 3 && magAreas[faceI] > VSMALL )
1829 const point& fc = fctrs[faceI];
1842 vector n = 0.5*((nextPoint - thisPoint)^(fc - thisPoint));
1846 scalar flatness = magAreas[faceI] / (sumA+VSMALL);
1848 sumFlatness += flatness;
1851 minFlatnessProc =
Foam::min(minFlatnessProc, flatness);
1853 if( flatness < warnFlatness )
1860 # pragma omp critical
1869 # pragma omp critical
1872 minFlatness =
Foam::min(minFlatness, minFlatnessProc);
1880 mesh.procBoundaries();
1883 forAll(procBoundaries, patchI)
1885 const label start = procBoundaries[patchI].patchStart();
1886 const label size = procBoundaries[patchI].patchSize();
1888 for(
label i=0;i<size;++i)
1889 if( setPtr->
found(start+i) )
1890 markedFaces[patchI].
append(i);
1894 forAll(procBoundaries, patchI)
1899 procBoundaries[patchI].neiProcNo(),
1903 toOtherProc << markedFaces[patchI].
size();
1907 forAll(procBoundaries, patchI)
1912 procBoundaries[patchI].neiProcNo(),
1916 fromOtheProc >> nMarkedOnOtherProcs[patchI];
1920 forAll(procBoundaries, patchI)
1922 if( markedFaces[patchI].size() == 0 )
1928 procBoundaries[patchI].neiProcNo(),
1929 markedFaces[patchI].byteSize()
1932 toOtherProc << markedFaces[patchI];
1935 forAll(procBoundaries, patchI)
1937 if( nMarkedOnOtherProcs[patchI] == 0 )
1944 procBoundaries[patchI].neiProcNo(),
1945 nMarkedOnOtherProcs[patchI]*
sizeof(
label)
1947 fromOtheProc >> receivedData;
1949 const label start = procBoundaries[patchI].patchStart();
1951 if( !setPtr->
found(start+receivedData[i]) )
1952 setPtr->
insert(start+receivedData[i]);
1966 Info<<
"Face flatness (1 = flat, 0 = butterfly) : average = "
1967 << sumFlatness / nSummed <<
" min = " << minFlatness <<
endl;
1972 Info<<
"There are " << nWarped
1973 <<
" faces with ratio between projected and actual area < "
1975 <<
".\nMinimum ratio (minimum flatness, maximum warpage) = "
1976 << minFlatness <<
nl <<
endl;
1980 Info<<
"All faces are flat in that the ratio between projected"
1981 <<
" and actual area is > " << warnFlatness <<
nl <<
endl;
1989 "bool checkFaceFlatness("
1990 "const polyMeshGen&, const bool, const scalar,"
1991 " labelHashSet*, const boolList*)"
1992 ) << nWarped <<
" faces with severe warpage (flatness < "
1993 << warnFlatness <<
") found.\n"
2127 const scalar relativeThreshold
2141 const scalar warnNonOrtho =
2142 minNonOrtho + relativeThreshold * (1.0 - minNonOrtho);
2144 Info <<
"Worst non-orthogonality " <<
Foam::acos(minNonOrtho) * 180.0 / M_PI
2145 <<
" selecting faces with non-orthogonality greater than "
2148 forAll(checkValues, faceI)
2152 activeFacePtr && activeFacePtr->operator[](faceI) &&
2153 checkValues[faceI] < warnNonOrtho
2166 const scalar warnSkew = (1.0 - relativeThreshold) * maxSkew;
2167 forAll(checkValues, faceI)
2170 activeFacePtr && activeFacePtr->operator[](faceI) &&
2171 checkValues[faceI] > warnSkew
2175 Info <<
"Maximum skewness in the mesh is " << maxSkew
2176 <<
" selecting faces with skewness greater than " << warnSkew <<
endl;
2180 Info <<
"Selected " << nBadFaces
2182 <<
" faces" <<
endl;