66 const scalar severeNonorthogonalityThreshold =
70 scalar minDDotS = great;
71 scalar sumDDotS = 0.0;
73 label severeNonOrth = 0;
74 label errorNonOrth = 0;
82 if (ortho[facei] < severeNonorthogonalityThreshold)
84 if (ortho[facei] > small)
105 if (isMasterFace[facei])
107 minDDotS =
min(minDDotS, ortho[facei]);
108 sumDDotS += ortho[facei];
125 Info<<
" Mesh non-orthogonality Max: "
133 if (severeNonOrth > 0)
135 Info<<
" *Number of severely non-orthogonal (> "
137 << severeNonOrth <<
"." <<
endl;
141 if (errorNonOrth > 0)
145 Info<<
" ***Number of non-orthogonality errors: "
146 << errorNonOrth <<
"." <<
endl;
155 Info<<
" Non-orthogonality check OK." <<
endl;
209 if (isMasterFace[facei])
223 Info<<
" ***Max skewness = " << maxSkew
224 <<
", " << nWarnSkew <<
" highly skew faces detected"
225 " which may impair the quality of the results"
235 Info<<
" Max skewness = " << maxSkew <<
" OK." <<
endl;
274 <<
"directions should contain 0 or 1 but is now " <<
directions
291 const face&
f = fcs[facei];
296 label p1 =
f.nextLabel(fp);
300 scalar magD =
mag(d);
302 if (magD > rootVSmall)
307 label nEmptyDirs = 0;
308 label nNonEmptyDirs = 0;
311 if (
mag(d[cmpt]) > 1
e-6)
328 else if (nEmptyDirs == 1)
331 if (nNonEmptyDirs > 0)
336 else if (nEmptyDirs > 1)
352 Info<<
" ***Number of edges not aligned with or perpendicular to "
353 <<
"non-empty directions: " << nErrorEdges <<
endl;
361 setPtr->
insert(iter.key()[0]);
362 setPtr->
insert(iter.key()[1]);
372 Info<<
" All edges aligned with or perpendicular to "
373 <<
"non-empty directions." <<
endl;
389 const scalar warnDet = 1
e-3;
406 label nErrorCells = 0;
407 scalar minDet =
min(cellDeterminant);
408 scalar sumDet =
sum(cellDeterminant);
410 forAll(cellDeterminant, celli)
412 if (cellDeterminant[celli] < warnDet)
432 Info<<
" Cell determinant (wellposedness) : minimum: " << minDet
433 <<
" average: " << sumDet/nSummed
442 Info<<
" ***Cells with small determinant (< "
443 << warnDet <<
") found, number of cells: "
444 << nErrorCells <<
endl;
453 Info<<
" Cell determinant check OK." <<
endl;
466 const scalar minWeight,
489 label nErrorFaces = 0;
490 scalar minDet = great;
499 if (faceWght[facei] < minWeight)
511 if (isMasterFace[facei])
513 minDet =
min(minDet, faceWght[facei]);
514 sumDet += faceWght[facei];
528 Info<<
" Face interpolation weight : minimum: " << minDet
529 <<
" average: " << sumDet/nSummed
538 Info<<
" ***Faces with small interpolation weight (< " << minWeight
539 <<
") found, number of faces: "
540 << nErrorFaces <<
endl;
549 Info<<
" Face interpolation weight check OK." <<
endl;
562 const scalar minRatio,
577 label nErrorFaces = 0;
578 scalar minDet = great;
587 if (volRatio[facei] < minRatio)
599 if (isMasterFace[facei])
601 minDet =
min(minDet, volRatio[facei]);
602 sumDet += volRatio[facei];
616 Info<<
" Face volume ratio : minimum: " << minDet
617 <<
" average: " << sumDet/nSummed
626 Info<<
" ***Faces with small volume ratio (< " << minRatio
627 <<
") found, number of faces: "
628 << nErrorFaces <<
endl;
637 Info<<
" Face volume ratio check OK." <<
endl;
650 label noFailedChecks = 0;
658 if (noFailedChecks == 0)
662 Info<<
" Mesh topology OK." <<
endl;
671 Info<<
" Failed " << noFailedChecks
672 <<
" mesh topology checks." <<
endl;
682 label noFailedChecks = 0;
692 if (noFailedChecks == 0)
696 Info<<
" Mesh geometry OK." <<
endl;
705 Info<<
" Failed " << noFailedChecks
706 <<
" mesh geometry checks." <<
endl;
716 const label noFailedChecks =
720 if (noFailedChecks == 0)
733 Info<<
" Failed " << noFailedChecks
734 <<
" mesh checks." <<
endl;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
bool insert(const Key &key)
Insert a new entry.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
void resize(const label newSize)
Resize the hash table for efficiency.
void size(const label)
Override size to be inconsistent with allocated storage.
static const direction nComponents
Number of components in this vector space.
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
Mesh consisting of general polyhedral cells.
virtual bool checkFaceSkewness(const bool report=false, labelHashSet *setPtr=nullptr) const
Check face skewness.
virtual bool checkFaceOrthogonality(const bool report=false, labelHashSet *setPtr=nullptr) const
Check non-orthogonality.
virtual bool checkEdgeAlignment(const bool report, const Vector< label > &directions, labelHashSet *setPtr) const
Check edge alignment for 1D/2D cases.
virtual bool checkFaceWeight(const bool report, const scalar minWeight=0.05, labelHashSet *setPtr=nullptr) const
Check for face weights.
virtual bool checkCellDeterminant(const bool report, labelHashSet *setPtr) const
virtual bool checkVolRatio(const bool report, const scalar minRatio=0.01, labelHashSet *setPtr=nullptr) const
Check for neighbouring cell volumes.
bool checkClosedCells(const bool report=false, labelHashSet *setPtr=nullptr, labelHashSet *highAspectSetPtr=nullptr, const Vector< label > &solutionD=Vector< label >::one) const
Check cells for closedness.
bool checkFacePyramids(const bool report=false, const scalar minPyrVol=-small, labelHashSet *setPtr=nullptr) const
Check face pyramid volume.
bool checkCellsZipUp(const bool report=false, labelHashSet *setPtr=nullptr) const
Check cell zip-up.
bool checkFaceAreas(const bool report=false, labelHashSet *setPtr=nullptr) const
Check for negative face areas.
bool checkUpperTriangular(const bool report=false, labelHashSet *setPtr=nullptr) const
Check face ordering.
const vectorField & cellCentres() const
bool checkClosedBoundary(const bool report=false) const
Check boundary for closedness.
bool checkCellVolumes(const bool report=false, labelHashSet *setPtr=nullptr) const
Check for negative cell volumes.
bool checkFaceVertices(const bool report=false, labelHashSet *setPtr=nullptr) const
Check uniqueness of face vertices.
bool checkPoints(const bool report=false, labelHashSet *setPtr=nullptr) const
Check for unused points.
const vectorField & faceAreas() const
bool checkFaceFaces(const bool report=false, labelHashSet *setPtr=nullptr) const
Check face-face connectivity.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define InfoInFunction
Report an information message using Foam::Info.
scalar closedThreshold
Data to control mesh checking.
bool checkTopology(const polyMesh &mesh, const bool report=false)
Check mesh topology for correctness.
scalar skewThreshold
Skewness warning threshold.
bool checkMesh(const polyMesh &mesh, const bool report=false)
Check mesh for correctness. Returns false for no error.
scalar aspectThreshold
Aspect ratio warning threshold.
scalar planarCosAngle
Threshold where faces are considered coplanar.
scalar nonOrthThreshold
Non-orthogonality warning threshold in deg.
bool checkGeometry(const polyMesh &mesh, const bool report=false)
Check mesh geometry (& implicitly topology) for correctness.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
label checkGeometry(const polyMesh &mesh, const bool allGeometry, const autoPtr< surfaceWriter > &, const autoPtr< setWriter > &)
Check the geometry.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
label checkTopology(const polyMesh &mesh, const bool allTopology, const bool allGeometry, const autoPtr< surfaceWriter > &surfWriter, const autoPtr< Foam::setWriter > &setWriter)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedTensor skew(const dimensionedTensor &dt)
dimensionedScalar acos(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
const scalarField & cellVols
Unit conversion functions.