Go to the documentation of this file.
38 const bool detailedReport,
44 Info<<
"bool polyMesh::checkFaceOrthogonality("
45 <<
"const bool, labelHashSet*) const: "
46 <<
"checking mesh non-orthogonality" <<
endl;
63 const scalar severeNonorthogonalityThreshold =
67 scalar minDDotS = GREAT;
68 scalar sumDDotS = 0.0;
70 label severeNonOrth = 0;
71 label errorNonOrth = 0;
75 PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*
this));
79 if (ortho[faceI] < severeNonorthogonalityThreshold)
81 if (ortho[faceI] > SMALL)
97 if (detailedReport && errorNonOrth == 0)
101 <<
"Severe non-orthogonality for face "
103 <<
" between cells " << own[faceI]
104 <<
" and " << nei[faceI]
114 if (isMasterFace[faceI])
116 minDDotS =
min(minDDotS, ortho[faceI]);
117 sumDDotS += ortho[faceI];
134 Info<<
" Mesh non-orthogonality Max: "
142 if (severeNonOrth > 0)
144 Info<<
" *Number of severely non-orthogonal (> "
145 << primitiveMesh::nonOrthThreshold_ <<
" degrees) faces: "
146 << severeNonOrth <<
"." <<
endl;
150 if (errorNonOrth > 0)
154 Info<<
" ***Number of non-orthogonality errors: "
155 << errorNonOrth <<
"." <<
endl;
164 Info<<
" Non-orthogonality check OK." <<
endl;
179 const bool detailedReport,
185 Info<<
"bool polyMesh::checkFaceSkewnesss("
186 <<
"const bool, labelHashSet*) const: "
187 <<
"checking face skewness" <<
endl;
216 if (
skew[faceI] > skewThreshold_)
222 if (detailedReport && nWarnSkew == 0)
225 if (isInternalFace(faceI))
228 <<
"Severe skewness " <<
skew[faceI]
229 <<
" for face " << faceI
230 <<
" between cells " << own[faceI]
231 <<
" and " << nei[faceI];
236 <<
"Severe skewness " <<
skew[faceI]
237 <<
" for boundary face " << faceI
238 <<
" on cell " << own[faceI];
242 if (isMasterFace[faceI])
256 Info<<
" ***Max skewness = " << maxSkew
257 <<
", " << nWarnSkew <<
" highly skew faces detected"
258 " which may impair the quality of the results"
268 Info<<
" Max skewness = " << maxSkew <<
" OK." <<
endl;
292 Info<<
"bool polyMesh::checkEdgeAlignment("
293 <<
"const bool, const Vector<label>&, labelHashSet*) const: "
294 <<
"checking edge alignment" <<
endl;
298 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
307 <<
"directions should contain 0 or 1 but is now " <<
directions
312 if (nDirs == vector::nComponents)
324 const face&
f = fcs[faceI];
329 label p1 =
f.nextLabel(fp);
333 scalar magD =
mag(d);
335 if (magD > ROOTVSMALL)
340 label nEmptyDirs = 0;
341 label nNonEmptyDirs = 0;
342 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
344 if (
mag(d[cmpt]) > 1
e-6)
361 else if (nEmptyDirs == 1)
364 if (nNonEmptyDirs > 0)
369 else if (nEmptyDirs > 1)
385 Info<<
" ***Number of edges not aligned with or perpendicular to "
386 <<
"non-empty directions: " << nErrorEdges <<
endl;
394 setPtr->
insert(iter.key()[0]);
395 setPtr->
insert(iter.key()[1]);
405 Info<<
" All edges aligned with or perpendicular to "
406 <<
"non-empty directions." <<
endl;
421 const scalar warnDet = 1
e-3;
425 Info<<
"bool polyMesh::checkCellDeterminant(const bool"
426 <<
", labelHashSet*) const: "
427 <<
"checking for under-determined cells" <<
endl;
435 syncTools::getInternalOrCoupledFaces(*
this)
440 label nErrorCells = 0;
441 scalar minDet =
min(cellDeterminant);
442 scalar sumDet =
sum(cellDeterminant);
444 forAll (cellDeterminant, cellI)
446 if (cellDeterminant[cellI] < warnDet)
466 Info<<
" Cell determinant (wellposedness) : minimum: " << minDet
467 <<
" average: " << sumDet/nSummed
476 Info<<
" ***Cells with small determinant (< "
477 << warnDet <<
") found, number of cells: "
478 << nErrorCells <<
endl;
487 Info<<
" Cell determinant check OK." <<
endl;
503 const scalar minWeight,
509 Info<<
"bool polyMesh::checkFaceWeight(const bool"
510 <<
", labelHashSet*) const: "
511 <<
"checking for low face interpolation weights" <<
endl;
524 label nErrorFaces = 0;
525 scalar minDet = GREAT;
530 PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*
this));
534 if (faceWght[faceI] < minWeight)
546 if (isMasterFace[faceI])
548 minDet =
min(minDet, faceWght[faceI]);
549 sumDet += faceWght[faceI];
563 Info<<
" Face interpolation weight : minimum: " << minDet
564 <<
" average: " << sumDet/nSummed
573 Info<<
" ***Faces with small interpolation weight (< " << minWeight
574 <<
") found, number of faces: "
575 << nErrorFaces <<
endl;
584 Info<<
" Face interpolation weight check OK." <<
endl;
598 const scalar minRatio,
604 Info<<
"bool polyMesh::checkVolRatio(const bool"
605 <<
", labelHashSet*) const: "
606 <<
"checking for volume ratio < " << minRatio <<
endl;
613 label nErrorFaces = 0;
614 scalar minDet = GREAT;
619 PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*
this));
623 if (volRatio[faceI] < minRatio)
635 if (isMasterFace[faceI])
637 minDet =
min(minDet, volRatio[faceI]);
638 sumDet += volRatio[faceI];
652 Info<<
" Face volume ratio : minimum: " << minDet
653 <<
" average: " << sumDet/nSummed
662 Info<<
" ***Faces with small volume ratio (< " << minRatio
663 <<
") found, number of faces: "
664 << nErrorFaces <<
endl;
673 Info<<
" Face volume ratio check OK." <<
endl;
702 return checkFaceOrthogonality
739 return checkEdgeAlignment
755 return checkCellDeterminant
768 const scalar minWeight,
772 return checkFaceWeight
787 const scalar minRatio,
791 return checkVolRatio(cellVolumes(), report, minRatio, setPtr);
799 const bool detailedReport
804 Pout<<
"bool polyMesh::checkMeshMotion("
805 <<
"const pointField&, const bool, const bool) const: "
806 <<
"checking mesh motion" <<
endl;
812 makeFaceCentresAndAreas(newPoints, fCtrs, fAreas);
818 makeCellCentresAndVols(fCtrs, fAreas, cellCtrs,
cellVols);
855 bool nonOrthoError = checkFaceOrthogonality
866 if (!
error && (debug || report))
868 Pout<<
"Mesh motion check OK." <<
endl;
bool checkCellDeterminant(const vectorField &faceAreas, const bool report, labelHashSet *setPtr, const Vector< label > &meshD) const
bool checkVolRatio(const scalarField &cellVols, const bool report, const scalar minRatio, labelHashSet *setPtr) const
void resize(const label newSize)
Resize the hash table for efficiency.
void checkFaceSkewness(const polyMeshGen &, scalarField &, const boolList *changedFacePtr=NULL)
Check face skewness.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensionedTensor skew(const dimensionedTensor &dt)
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Unit conversion functions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool checkFaceAreas(const polyMeshGen &, const bool report=false, const scalar minFaceArea=VSMALL, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Check for negative face areas.
dimensioned< scalar > mag(const dimensioned< Type > &)
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
const scalarField & cellVols
label size() const
Return number of elements in table.
bool checkFaceSkewness(const pointField &points, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check face skewness.
bool checkFaceOrthogonality(const vectorField &fAreas, const vectorField &cellCtrs, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check non-orthogonality.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool checkFacePyramids(const polyMeshGen &, const bool report=false, const scalar minPyrVol=-SMALL, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Check face pyramid volume.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
bool checkCellVolumes(const polyMeshGen &, const bool report=false, labelHashSet *setPtr=NULL)
Check for negative cell volumes.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar acos(const dimensionedScalar &ds)
const dimensionedScalar e
Elementary charge.
bool insert(const Key &key)
Insert a new entry.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
bool checkEdgeAlignment(const pointField &p, const bool report, const Vector< label > &directions, labelHashSet *setPtr) const
A face is a list of labels corresponding to mesh vertices.
virtual bool checkMeshMotion(const pointField &newPoints, const bool report=false, const bool detailedReport=false) const
Check mesh motion for correctness given motion points.
bool checkFaceWeight(const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs, const bool report, const scalar minWeight, labelHashSet *setPtr) const
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define WarningInFunction
Report a warning using Foam::Warning.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar cos(const dimensionedScalar &ds)