36 bool Foam::polyMesh::checkFaceOrthogonality
41 const bool detailedReport,
64 const scalar severeNonorthogonalityThreshold =
68 scalar minDDotS = GREAT;
69 scalar sumDDotS = 0.0;
71 label severeNonOrth = 0;
72 label errorNonOrth = 0;
80 if (ortho[facei] < severeNonorthogonalityThreshold)
82 if (ortho[facei] > SMALL)
86 setPtr->insert(facei);
96 setPtr->insert(facei);
98 if (detailedReport && errorNonOrth == 0)
102 <<
"Severe non-orthogonality for face "
104 <<
" between cells " << own[facei]
105 <<
" and " << nei[facei]
115 if (isMasterFace.test(facei))
117 minDDotS =
min(minDDotS, ortho[facei]);
118 sumDDotS += ortho[facei];
123 reduce(minDDotS, minOp<scalar>());
124 reduce(sumDDotS, sumOp<scalar>());
125 reduce(nSummed, sumOp<label>());
126 reduce(severeNonOrth, sumOp<label>());
127 reduce(errorNonOrth, sumOp<label>());
135 Info<<
" Mesh non-orthogonality Max: "
143 if (severeNonOrth > 0)
145 Info<<
" *Number of severely non-orthogonal (> "
147 << severeNonOrth <<
"." <<
endl;
151 if (errorNonOrth > 0)
155 Info<<
" ***Number of non-orthogonality errors: "
156 << errorNonOrth <<
"." <<
endl;
164 Info<<
" Non-orthogonality check OK." <<
endl;
171 bool Foam::polyMesh::checkFaceSkewness
178 const bool detailedReport,
213 if (
skew[facei] > skewThreshold_)
217 setPtr->insert(facei);
219 if (detailedReport && nWarnSkew == 0)
222 if (isInternalFace(facei))
225 <<
"Severe skewness " <<
skew[facei]
226 <<
" for face " << facei
227 <<
" between cells " << own[facei]
228 <<
" and " << nei[facei];
233 <<
"Severe skewness " <<
skew[facei]
234 <<
" for boundary face " << facei
235 <<
" on cell " << own[facei];
239 if (isMasterFace.test(facei))
246 reduce(maxSkew, maxOp<scalar>());
247 reduce(nWarnSkew, sumOp<label>());
253 Info<<
" ***Max skewness = " << maxSkew
254 <<
", " << nWarnSkew <<
" highly skew faces detected"
255 " which may impair the quality of the results"
264 Info<<
" Max skewness = " << maxSkew <<
" OK." <<
endl;
271 bool Foam::polyMesh::checkEdgeAlignment
275 const Vector<label>& directions,
294 if (directions[cmpt] == 1)
298 else if (directions[cmpt] != 0)
301 <<
"directions should contain 0 or 1 but is now " << directions
314 EdgeMap<label> edgesInError;
318 const face&
f = fcs[facei];
323 label p1 =
f.nextLabel(fp);
327 scalar magD =
mag(d);
329 if (magD > ROOTVSMALL)
334 label nEmptyDirs = 0;
335 label nNonEmptyDirs = 0;
338 if (
mag(d[cmpt]) > 1
e-6)
340 if (directions[cmpt] == 0)
355 else if (nEmptyDirs == 1)
358 if (nNonEmptyDirs > 0)
360 edgesInError.insert(edge(
p0, p1), facei);
363 else if (nEmptyDirs > 1)
366 edgesInError.insert(edge(
p0, p1), facei);
379 Info<<
" ***Number of edges not aligned with or perpendicular to "
380 <<
"non-empty directions: " << nErrorEdges <<
endl;
385 setPtr->resize(2*edgesInError.size());
388 setPtr->insert(iter.key()[0]);
389 setPtr->insert(iter.key()[1]);
398 Info<<
" All edges aligned with or perpendicular to "
399 <<
"non-empty directions." <<
endl;
406 bool Foam::polyMesh::checkCellDeterminant
411 const Vector<label>& meshD
414 const scalar warnDet = 1
e-3;
428 scalarField& cellDeterminant = tcellDeterminant.ref();
431 label nErrorCells = 0;
432 scalar minDet =
min(cellDeterminant);
433 scalar sumDet =
sum(cellDeterminant);
435 forAll(cellDeterminant, celli)
437 if (cellDeterminant[celli] < warnDet)
441 setPtr->insert(celli);
448 reduce(nErrorCells, sumOp<label>());
449 reduce(minDet, minOp<scalar>());
450 reduce(sumDet, sumOp<scalar>());
457 Info<<
" Cell determinant (wellposedness) : minimum: " << minDet
458 <<
" average: " << sumDet/nSummed
467 Info<<
" ***Cells with small determinant (< "
468 << warnDet <<
") found, number of cells: "
469 << nErrorCells <<
endl;
477 Info<<
" Cell determinant check OK." <<
endl;
484 bool Foam::polyMesh::checkFaceWeight
490 const scalar minWeight,
509 label nErrorFaces = 0;
510 scalar minDet = GREAT;
519 if (faceWght[facei] < minWeight)
524 setPtr->insert(facei);
531 if (isMasterFace.test(facei))
533 minDet =
min(minDet, faceWght[facei]);
534 sumDet += faceWght[facei];
539 reduce(nErrorFaces, sumOp<label>());
540 reduce(minDet, minOp<scalar>());
541 reduce(sumDet, sumOp<scalar>());
542 reduce(nSummed, sumOp<label>());
548 Info<<
" Face interpolation weight : minimum: " << minDet
549 <<
" average: " << sumDet/nSummed
558 Info<<
" ***Faces with small interpolation weight (< " << minWeight
559 <<
") found, number of faces: "
560 << nErrorFaces <<
endl;
568 Info<<
" Face interpolation weight check OK." <<
endl;
575 bool Foam::polyMesh::checkVolRatio
579 const scalar minRatio,
592 label nErrorFaces = 0;
593 scalar minDet = GREAT;
602 if (volRatio[facei] < minRatio)
607 setPtr->insert(facei);
614 if (isMasterFace.test(facei))
616 minDet =
min(minDet, volRatio[facei]);
617 sumDet += volRatio[facei];
622 reduce(nErrorFaces, sumOp<label>());
623 reduce(minDet, minOp<scalar>());
624 reduce(sumDet, sumOp<scalar>());
625 reduce(nSummed, sumOp<label>());
631 Info<<
" Face volume ratio : minimum: " << minDet
632 <<
" average: " << sumDet/nSummed
641 Info<<
" ***Faces with small volume ratio (< " << minRatio
642 <<
") found, number of faces: "
643 << nErrorFaces <<
endl;
651 Info<<
" Face volume ratio check OK." <<
endl;
658 bool Foam::polyMesh::checkFaceOrthogonality
664 return checkFaceOrthogonality
675 bool Foam::polyMesh::checkFaceSkewness
681 return checkFaceSkewness
694 bool Foam::polyMesh::checkEdgeAlignment
701 return checkEdgeAlignment
711 bool Foam::polyMesh::checkCellDeterminant
717 return checkCellDeterminant
727 bool Foam::polyMesh::checkFaceWeight
730 const scalar minWeight,
734 return checkFaceWeight
746 bool Foam::polyMesh::checkVolRatio
749 const scalar minRatio,
753 return checkVolRatio(cellVolumes(), report, minRatio, setPtr);
761 const bool detailedReport
766 Pout<<
"bool polyMesh::checkMeshMotion("
767 <<
"const pointField&, const bool, const bool) const: "
768 <<
"checking mesh motion" <<
endl;
774 makeFaceCentresAndAreas(newPoints, fCtrs, fAreas);
780 makeCellCentresAndVols(fCtrs, fAreas, cellCtrs,
cellVols);
783 bool error = checkCellVolumes
793 bool areaError = checkFaceAreas
804 bool pyrVolError = checkFacePyramids
817 bool nonOrthoError = checkFaceOrthogonality
830 Pout<<
"Mesh motion check OK." <<
endl;