62 syncTools::swapBoundaryCellPositions(mesh, cc, neighbourCc);
114 cellCtrs[own[facei]],
124 syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neighbourCc);
144 cellCtrs[own[facei]],
191 const point& fc = fCtrs[facei];
192 const vector& fa = fAreas[facei];
194 const scalar dOwn =
mag(fa & (fc-cellCtrs[own[facei]]));
195 const scalar dNei =
mag(fa & (cellCtrs[nei[facei]]-fc));
197 weight[facei] =
min(dNei,dOwn)/(dNei+dOwn+vSmall);
204 syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neiCc);
216 const point& fc = fCtrs[facei];
217 const vector& fa = fAreas[facei];
219 const scalar dOwn =
mag(fa & (fc-cellCtrs[own[facei]]));
220 const scalar dNei =
mag(fa & (neiCc[bFacei]-fc));
222 weight[facei] =
min(dNei,dOwn)/(dNei+dOwn+vSmall);
247 const scalar volOwn = vol[own[facei]];
248 const scalar volNei = vol[nei[facei]];
250 ratio[facei] =
min(volOwn,volNei)/(
max(volOwn, volNei)+vSmall);
257 syncTools::swapBoundaryCellList(mesh, vol, neiVol);
269 const scalar volOwn = vol[own[facei]];
270 const scalar volNei = neiVol[bFacei];
272 ratio[facei] =
min(volOwn,volNei)/(
max(volOwn, volNei)+vSmall);
284 const scalar nonOrthThreshold,
308 const scalar severeNonorthogonalityThreshold =
::cos(nonOrthThreshold);
311 scalar minDDotS = great;
312 scalar sumDDotS = 0.0;
314 label severeNonOrth = 0;
315 label errorNonOrth = 0;
319 PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(mesh));
323 if (ortho[facei] < severeNonorthogonalityThreshold)
325 if (ortho[facei] > small)
346 if (isMasterFace[facei])
348 minDDotS =
min(minDDotS, ortho[facei]);
349 sumDDotS += ortho[facei];
366 Info<<
" Mesh non-orthogonality Max: "
374 if (severeNonOrth > 0)
376 Info<<
" *Number of severely non-orthogonal (> "
377 <<
radToDeg(nonOrthThreshold) <<
" degrees) faces: "
378 << severeNonOrth <<
"." <<
endl;
382 if (errorNonOrth > 0)
386 Info<<
" ***Number of non-orthogonality errors: "
387 << errorNonOrth <<
"." <<
endl;
396 Info<<
" Non-orthogonality check OK." <<
endl;
407 const scalar skewThreshold,
439 const PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh));
445 if (
skew[facei] > skewThreshold)
452 if (isMasterFace[facei])
466 Info<<
" ***Max skewness = " << maxSkew
467 <<
", " << nWarnSkew <<
" highly skew faces detected"
468 " which may impair the quality of the results"
478 Info<<
" Max skewness = " << maxSkew <<
" OK." <<
endl;
509 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
518 <<
"directions should contain 0 or 1 but is now " <<
directions
523 if (nDirs == vector::nComponents)
535 const face&
f = fcs[facei];
540 const label p1 =
f.nextLabel(fp);
545 const scalar magD =
mag(d);
547 if (magD > rootVSmall)
552 label nEmptyDirs = 0;
553 label nNonEmptyDirs = 0;
554 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
556 if (
mag(d[cmpt]) > 1
e-6)
573 else if (nEmptyDirs == 1)
576 if (nNonEmptyDirs > 0)
581 else if (nEmptyDirs > 1)
597 Info<<
" ***Number of edges not aligned with or perpendicular to "
598 <<
"non-empty directions: " << nErrorEdges <<
endl;
606 setPtr->
insert(iter.key()[0]);
607 setPtr->
insert(iter.key()[1]);
617 Info<<
" All edges aligned with or perpendicular to "
618 <<
"non-empty directions." <<
endl;
635 const scalar warnDet = 1
e-3;
647 syncTools::getInternalOrCoupledFaces(mesh)
652 label nErrorCells = 0;
678 Info<<
" Cell determinant (wellposedness) : minimum: " << minDet
679 <<
" average: " << sumDet/nSummed
688 Info<<
" ***Cells with small determinant (< "
689 << warnDet <<
") found, number of cells: "
690 << nErrorCells <<
endl;
699 Info<<
" Cell determinant check OK." <<
endl;
713 const scalar minWeight,
736 label nErrorFaces = 0;
737 scalar minDet = great;
742 PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(mesh));
746 if (faceWght[facei] < minWeight)
758 if (isMasterFace[facei])
760 minDet =
min(minDet, faceWght[facei]);
761 sumDet += faceWght[facei];
775 Info<<
" Face interpolation weight : minimum: " << minDet
776 <<
" average: " << sumDet/nSummed
785 Info<<
" ***Faces with small interpolation weight (< " << minWeight
786 <<
") found, number of faces: "
787 << nErrorFaces <<
endl;
796 Info<<
" Face interpolation weight check OK." <<
endl;
810 const scalar minRatio,
825 label nErrorFaces = 0;
826 scalar minDet = great;
831 PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(mesh));
847 if (isMasterFace[facei])
864 Info<<
" Face volume ratio : minimum: " << minDet
865 <<
" average: " << sumDet/nSummed
874 Info<<
" ***Faces with small volume ratio (< " << minRatio
875 <<
") found, number of faces: "
876 << nErrorFaces <<
endl;
885 Info<<
" Face volume ratio check OK." <<
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.
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 const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
A patch is a list of labels that address the faces in the global face list.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label start() const
Return start label of this patch in the polyMesh face list.
const vectorField & faceCentres() const
const scalarField & cellVolumes() const
const vectorField & cellCentres() const
label nInternalFaces() const
const vectorField & faceAreas() const
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.
volScalarField scalarField(fieldObject, mesh)
#define InfoInFunction
Report an information message using Foam::Info.
const dimensionedScalar e
Elementary charge.
bool checkFaceWeight(const polyMesh &mesh, const bool report, const scalar minWeight=0.05, labelHashSet *setPtr=nullptr)
Check for face weights.
tmp< scalarField > faceOrthogonality(const polyMesh &mesh, const vectorField &fAreas, const vectorField &cellCtrs)
Generate orthogonality field. (1 for fully orthogonal, < 1 for.
bool checkEdgeAlignment(const polyMesh &mesh, const bool report, const Vector< label > &directions, labelHashSet *setPtr)
Check edge alignment for 1D/2D cases.
tmp< scalarField > faceSkewness(const polyMesh &mesh, const pointField &points, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs)
Generate skewness field.
bool checkCellDeterminant(const polyMesh &mesh, const bool report, labelHashSet *setPtr)
bool checkVolRatio(const polyMesh &mesh, const bool report, const scalar minRatio=0.01, labelHashSet *setPtr=nullptr)
Check for neighbouring cell volumes.
scalar boundaryFaceSkewness(const primitiveMesh &mesh, const pointField &p, const vectorField &fCtrs, const vectorField &fAreas, const label facei, const point &ownCc)
Skewness of single boundary face.
tmp< scalarField > cellDeterminant(const primitiveMesh &mesh, const Vector< label > &directions, const vectorField &faceAreas, const PackedBoolList &internalOrCoupledFace)
Generate cell determinant field.
tmp< scalarField > faceWeights(const polyMesh &mesh, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs)
Generate interpolation factors field.
tmp< scalarField > volRatio(const polyMesh &mesh, const scalarField &vol)
Generate volume ratio field.
bool checkFaceOrthogonality(const polyMesh &mesh, const scalar nonOrthThreshold, const bool report=false, labelHashSet *setPtr=nullptr)
Check face orthogonality.
bool checkFaceSkewness(const polyMesh &mesh, const scalar skewThreshold, const bool report=false, labelHashSet *setPtr=nullptr)
Check face skewness.
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar radToDeg(const scalar rad)
Convert radians to degrees.
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)
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)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedTensor skew(const dimensionedTensor &dt)
dimensionedScalar acos(const dimensionedScalar &ds)
const scalarField & cellVols