Commit 34e52b8c authored by Franjo's avatar Franjo
Browse files

Merge branch 'task-qualityControls' into development

parents 87b7c279 771a8434
*.dep *.dep
*lnInclude* *lnInclude*
*linux* *linux*
cfMesh.* cfMesh*
**/lnInclude/* **/lnInclude/*
**/Make/**/* **/Make/**/*
log
log.*
*~
...@@ -764,6 +764,54 @@ void checkMeshDict::checkRenameBoundary() const ...@@ -764,6 +764,54 @@ void checkMeshDict::checkRenameBoundary() const
} }
} }
//Mesh quality criteria specified by the user
void checkMeshDict::checkQualitySettings() const
{
if( meshDict_.found("meshQualitySettings") )
{
const dictionary& qualityDict = meshDict_.subDict("meshQualitySettings");
//- read maximum non-orthogonality defined by the user
if( qualityDict.found("maxNonOrthogonality") )
{
readScalar(qualityDict.lookup("maxNonOrthogonality"));
}
//- read maximum skewness defined by the user
if( qualityDict.found("maxSkewness") )
{
readScalar(qualityDict.lookup("maxSkewness"));
}
//- read minimum volume of the face pyramid defined by the user
if( qualityDict.found("minPyramidVolume") )
{
readScalar(qualityDict.lookup("minPyramidVolume"));
}
//- read face flatness defined by the user
if( qualityDict.found("faceFlatness") )
{
readScalar(qualityDict.lookup("faceFlatness"));
}
//- read minimum tetrahedral part of a cell defined by the user
if( qualityDict.found("minCellPartTetrahedra") )
{
readScalar(qualityDict.lookup("minCellPartTetrahedra"));
}
//- read minimum area of a face defined by the user
if( qualityDict.found("minimumFaceArea") )
{
readScalar(qualityDict.lookup("minimumFaceArea"));
}
}
}
void checkMeshDict::checkEntries() const void checkMeshDict::checkEntries() const
{ {
checkBasicSettings(); checkBasicSettings();
...@@ -785,6 +833,8 @@ void checkMeshDict::checkEntries() const ...@@ -785,6 +833,8 @@ void checkMeshDict::checkEntries() const
checkBoundaryLayers(); checkBoundaryLayers();
checkRenameBoundary(); checkRenameBoundary();
checkQualitySettings();
} }
void checkMeshDict::updatePatchCellSize void checkMeshDict::updatePatchCellSize
......
...@@ -92,6 +92,9 @@ class checkMeshDict ...@@ -92,6 +92,9 @@ class checkMeshDict
//- check renameBoundary entry //- check renameBoundary entry
void checkRenameBoundary() const; void checkRenameBoundary() const;
//- check entry for mesh quality
void checkQualitySettings() const;
//- perform all checks //- perform all checks
void checkEntries() const; void checkEntries() const;
......
...@@ -289,6 +289,9 @@ namespace help ...@@ -289,6 +289,9 @@ namespace help
DynList<bool>& OkPoints DynList<bool>& OkPoints
); );
//- calculate quality metric of a tetrahedron
inline scalar tetQuality(const tetrahedron<point, point>& tet);
//- check if the vertex is on the positive side of the face plane //- check if the vertex is on the positive side of the face plane
inline bool isVertexVisible(const point& p, const plane& pl); inline bool isVertexVisible(const point& p, const plane& pl);
......
...@@ -1612,6 +1612,17 @@ inline bool isFaceConvexAndOk ...@@ -1612,6 +1612,17 @@ inline bool isFaceConvexAndOk
return valid; return valid;
} }
inline scalar tetQuality(const tetrahedron<point, point>& tet)
{
return
tet.mag()
/(
8.0/(9.0*sqrt(3.0))
*pow3(min(tet.circumRadius(), GREAT))
+ ROOTVSMALL
);
}
inline point nearestPointOnTheEdge inline point nearestPointOnTheEdge
( (
const point& edgePoint0, const point& edgePoint0,
......
...@@ -82,6 +82,66 @@ bool checkFaceAreas ...@@ -82,6 +82,66 @@ bool checkFaceAreas
const boolList* changedFacePtr = NULL const boolList* changedFacePtr = NULL
); );
//- Check quality of tetrahedra
bool checkTetQuality
(
const polyMeshGen&,
const bool report = false,
const scalar minTetQuality = VSMALL,
labelHashSet* setPtr = NULL,
const boolList* changedFacePtr = NULL
);
//- Check minimum face twist
bool checkMinTwist
(
const polyMeshGen&,
const bool report = false,
const scalar minTwist = VSMALL,
labelHashSet* setPtr = NULL,
const boolList* changedFacePtr = NULL
);
//- Check the area of internal faces versus boundary faces
bool checkCellDeterminant
(
const polyMeshGen&,
const bool report = false,
const scalar warnDet = 1e-3,
labelHashSet* setPtr = NULL,
const boolList* changedFacePtr = NULL
);
//- Check volume ratio
void checkMinVolRatio
(
const polyMeshGen&,
scalarField&,
const boolList* changedFacePtr = NULL
);
bool checkMinVolRatio
(
const polyMeshGen&,
const bool report = false,
const scalar warnVolRatio = 0.01,
labelHashSet* setPtr = NULL,
const boolList* changedFacePtr = NULL
);
//- Check face triangle twist
bool checkTriangleTwist
(
const polyMeshGen&,
const bool report = false,
const scalar minTwist = VSMALL,
labelHashSet* setPtr = NULL,
const boolList* changedFacePtr = NULL
);
//- Check for negative part tetrahedra //- Check for negative part tetrahedra
//- Cells are decomposed into tetrahedra formed by //- Cells are decomposed into tetrahedra formed by
//- the cell centre, face centre and the edge vertices //- the cell centre, face centre and the edge vertices
...@@ -238,6 +298,15 @@ bool checkGeometry(const polyMeshGen&, const bool report = false); ...@@ -238,6 +298,15 @@ bool checkGeometry(const polyMeshGen&, const bool report = false);
//- Check mesh for correctness. Returns false for no error. //- Check mesh for correctness. Returns false for no error.
bool checkMesh(const polyMeshGen&, const bool report = false); bool checkMesh(const polyMeshGen&, const bool report = false);
//- Read the user defined mesh quality settings
label findBadFacesAdditionalChecks
(
const polyMeshGen& mesh,
const bool report,
labelHashSet& badFaces,
const boolList* activeFacePtr = NULL
);
//- checks for bad faces making the mesh unusable //- checks for bad faces making the mesh unusable
//- checks for negative pyramids and zero area faces //- checks for negative pyramids and zero area faces
label findBadFacesRelaxed label findBadFacesRelaxed
......
...@@ -292,8 +292,20 @@ void meshOptimizer::untangleMeshFV ...@@ -292,8 +292,20 @@ void meshOptimizer::untangleMeshFV
mesh_.removeFaceSubset(subsetId); mesh_.removeFaceSubset(subsetId);
subsetId = mesh_.addFaceSubset("badFaces"); subsetId = mesh_.addFaceSubset("badFaces");
const labelList& owner = mesh_.owner();
const labelList& neighbour = mesh_.neighbour();
const label badCellsId =
mesh_.addCellSubset("badCells");
forAllConstIter(labelHashSet, badFaces, it) forAllConstIter(labelHashSet, badFaces, it)
{
mesh_.addFaceToSubset(subsetId, it.key()); mesh_.addFaceToSubset(subsetId, it.key());
mesh_.addCellToSubset(badCellsId, owner[it.key()]);
if( neighbour[it.key()] < 0 )
continue;
mesh_.addCellToSubset(badCellsId, neighbour[it.key()]);
}
} }
Info << "Finished untangling the mesh" << endl; Info << "Finished untangling the mesh" << endl;
......
...@@ -68,4 +68,11 @@ objectRefinements ...@@ -68,4 +68,11 @@ objectRefinements
} }
} }
meshQualitySettings
{
maxNonOrthogonality 30;
minTetQuality 1e-10;
}
// ************************************************************************* // // ************************************************************************* //
...@@ -60,5 +60,10 @@ localRefinement ...@@ -60,5 +60,10 @@ localRefinement
cellSize 0.625; cellSize 0.625;
} }
} }
meshQualitySettings
{
maxNonOrthogonality 50;
}
// ************************************************************************* // // ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment