diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
index 5b13fcad17..2c5492bd68 100644
--- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
+++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
@@ -53,8 +53,7 @@ Description
#include "polyAddFace.H"
#include "combineFaces.H"
#include "removePoints.H"
-#include "polyMeshCheck.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "polyTopoChangeMap.H"
#include "unitConversion.H"
#include "motionSmoother.H"
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
index 50d212c79b..f329e6a536 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
@@ -47,7 +47,7 @@ Description
#include "snapParameters.H"
#include "layerParameters.H"
#include "faceSet.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "polyTopoChange.H"
#include "cellModeller.H"
#include "uindirectPrimitivePatch.H"
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
index 173a8cda67..64de1960a8 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
@@ -61,9 +61,7 @@ Usage
#include "vtkSetWriter.H"
#include "IOdictionary.H"
-#include "checkTools.H"
-#include "checkTopology.H"
-#include "checkGeometry.H"
+#include "meshCheck.H"
#include "checkMeshQuality.H"
using namespace Foam;
@@ -196,7 +194,7 @@ int main(int argc, char *argv[])
// Reconstruct globalMeshData
mesh.globalData();
- meshTools::printMeshStats(mesh, allTopology);
+ meshCheck::printMeshStats(mesh, allTopology);
label nFailedChecks = 0;
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C b/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C
index 0e70f965f0..791a973c11 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C
@@ -27,9 +27,8 @@ License
#include "polyMesh.H"
#include "cellSet.H"
#include "faceSet.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "surfaceWriter.H"
-#include "checkTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -58,7 +57,7 @@ Foam::label Foam::checkMeshQuality
faces.write();
if (writer.valid())
{
- meshTools::mergeAndWrite(writer(), faces);
+ meshCheck::mergeAndWrite(writer(), faces);
}
}
}
diff --git a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C
index ee210c8890..1cc58770ba 100644
--- a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C
+++ b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C
@@ -25,7 +25,7 @@ License
#include "badQualityToCell.H"
#include "polyMesh.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "faceSet.H"
#include "addToRunTimeSelectionTable.H"
diff --git a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C
index e3f26aba88..77b4542387 100644
--- a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C
+++ b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C
@@ -25,7 +25,7 @@ License
#include "badQualityToFace.H"
#include "polyMesh.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "faceSet.H"
#include "addToRunTimeSelectionTable.H"
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
index 9aae02ae9b..084d27b052 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
+++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
@@ -31,7 +31,7 @@ License
#include "pointConstraints.H"
#include "syncTools.H"
#include "meshTools.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C b/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C
index 9281f0f5b1..55ea0c35cf 100644
--- a/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C
+++ b/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C
@@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "attachPolyTopoChanger.H"
-#include "polyMeshCheck.H"
+#include "meshCheck.H"
#include "polyTopoChange.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C
index fe9cc99c71..e854ce2fe7 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C
@@ -31,7 +31,7 @@ License
#include "PointEdgeWave.H"
#include "globalIndex.H"
#include "removePoints.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "OFstream.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
diff --git a/src/functionObjects/utilities/checkMesh/checkMesh.C b/src/functionObjects/utilities/checkMesh/checkMesh.C
index 190ede7d8a..83eed77a8d 100644
--- a/src/functionObjects/utilities/checkMesh/checkMesh.C
+++ b/src/functionObjects/utilities/checkMesh/checkMesh.C
@@ -25,7 +25,7 @@ License
#include "checkMesh.H"
#include "fvMesh.H"
-#include "polyMeshCheck.H"
+#include "meshCheck.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
index a3b46c6e7a..5b909ca7aa 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
@@ -29,7 +29,7 @@ License
#include "removePoints.H"
#include "faceSet.H"
#include "Time.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
index 852b88f25c..2032c588d2 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
@@ -33,7 +33,7 @@ License
#include "indirectPrimitivePatch.H"
#include "cellSet.H"
#include "searchableSurfaces.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "IOmanip.H"
#include "unitConversion.H"
#include "snappySnapDriver.H"
diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C
index db01e10c59..8975c45302 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C
@@ -33,7 +33,7 @@ Description
#include "meshRefinement.H"
#include "removePoints.H"
#include "pointFields.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "unitConversion.H"
#include "pointSet.H"
#include "faceSet.H"
diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C
index e726d2146f..82fa9a3881 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C
@@ -28,7 +28,7 @@ Description
#include "snappySnapDriver.H"
#include "motionSmoother.H"
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
#include "polyTopoChange.H"
#include "syncTools.H"
#include "fvMesh.H"
diff --git a/src/meshCheck/Make/files b/src/meshCheck/Make/files
index cbdb4aec24..b90ad4239c 100644
--- a/src/meshCheck/Make/files
+++ b/src/meshCheck/Make/files
@@ -1,16 +1,13 @@
primitiveMeshCheck/primitiveMeshCheck.C
primitiveMeshCheck/primitiveMeshCheckPointNearness.C
primitiveMeshCheck/primitiveMeshCheckEdgeLength.C
-primitiveMeshCheck/primitiveMeshTools.C
polyMeshCheck/polyMeshCheck.C
-polyMeshCheck/polyMeshTools.C
+polyMeshCheck/polyMeshCheckQuality.C
-dynamicMeshCheck/dynamicMeshCheck.C
-dynamicMeshCheck/motionSmootherAlgoCheck.C
-
-checkTools/checkTools.C
-checkTools/checkTopology.C
-checkTools/checkGeometry.C
+mergeAndWrite/mergeAndWrite.C
+checkTopology.C
+checkGeometry.C
+checkMesh.C
LIB = $(FOAM_LIBBIN)/libmeshCheck
diff --git a/src/meshCheck/checkTools/checkGeometry.C b/src/meshCheck/checkGeometry.C
similarity index 96%
rename from src/meshCheck/checkTools/checkGeometry.C
rename to src/meshCheck/checkGeometry.C
index 7e85e8d819..fd903cee67 100644
--- a/src/meshCheck/checkTools/checkGeometry.C
+++ b/src/meshCheck/checkGeometry.C
@@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/
+#include "meshCheck.H"
#include "PatchTools.H"
-#include "checkGeometry.H"
#include "polyMeshCheck.H"
#include "cellSet.H"
#include "faceSet.H"
@@ -39,7 +39,7 @@ License
#include "writeFile.H"
#include "nonConformalCyclicPolyPatch.H"
-#include "checkTools.H"
+#include "mergeAndWrite.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -608,7 +608,7 @@ Foam::label Foam::meshCheck::checkGeometry
nonAlignedPoints.write();
if (setWriter.valid())
{
- meshTools::mergeAndWrite(setWriter, nonAlignedPoints);
+ meshCheck::mergeAndWrite(setWriter, nonAlignedPoints);
}
}
}
@@ -643,7 +643,7 @@ Foam::label Foam::meshCheck::checkGeometry
cells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), cells);
+ meshCheck::mergeAndWrite(surfWriter(), cells);
}
}
}
@@ -659,7 +659,7 @@ Foam::label Foam::meshCheck::checkGeometry
aspectCells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), aspectCells);
+ meshCheck::mergeAndWrite(surfWriter(), aspectCells);
}
}
}
@@ -680,7 +680,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -702,7 +702,7 @@ Foam::label Foam::meshCheck::checkGeometry
cells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), cells);
+ meshCheck::mergeAndWrite(surfWriter(), cells);
}
}
}
@@ -725,7 +725,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -747,7 +747,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -769,7 +769,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -793,7 +793,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -826,7 +826,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -851,7 +851,7 @@ Foam::label Foam::meshCheck::checkGeometry
points.write();
if (setWriter.valid())
{
- meshTools::mergeAndWrite(setWriter, points);
+ meshCheck::mergeAndWrite(setWriter, points);
}
}
}
@@ -874,7 +874,7 @@ Foam::label Foam::meshCheck::checkGeometry
nearPoints.write();
if (setWriter.valid())
{
- meshTools::mergeAndWrite(setWriter, nearPoints);
+ meshCheck::mergeAndWrite(setWriter, nearPoints);
}
}
}
@@ -898,7 +898,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -921,7 +921,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -942,7 +942,7 @@ Foam::label Foam::meshCheck::checkGeometry
cells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), cells);
+ meshCheck::mergeAndWrite(surfWriter(), cells);
}
}
}
@@ -962,7 +962,7 @@ Foam::label Foam::meshCheck::checkGeometry
cells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), cells);
+ meshCheck::mergeAndWrite(surfWriter(), cells);
}
}
}
@@ -983,7 +983,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -1004,7 +1004,7 @@ Foam::label Foam::meshCheck::checkGeometry
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
diff --git a/src/meshCheck/dynamicMeshCheck/motionSmootherAlgoCheck.C b/src/meshCheck/checkMesh.C
similarity index 99%
rename from src/meshCheck/dynamicMeshCheck/motionSmootherAlgoCheck.C
rename to src/meshCheck/checkMesh.C
index e2bfe372c7..fa7169fffa 100644
--- a/src/meshCheck/dynamicMeshCheck/motionSmootherAlgoCheck.C
+++ b/src/meshCheck/checkMesh.C
@@ -23,7 +23,8 @@ License
\*---------------------------------------------------------------------------*/
-#include "dynamicMeshCheck.H"
+#include "meshCheck.H"
+#include "polyMeshCheck.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@@ -49,6 +50,7 @@ bool Foam::meshCheck::checkMesh
);
}
+
bool Foam::meshCheck::checkMesh
(
const bool report,
diff --git a/src/meshCheck/checkTools/checkTopology.H b/src/meshCheck/checkTools/checkTopology.H
deleted file mode 100644
index e186046a7f..0000000000
--- a/src/meshCheck/checkTools/checkTopology.H
+++ /dev/null
@@ -1,62 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Description
- Tools for checking the mesh
-
-SourceFiles
- checkTopology.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef checkTopology_H
-#define checkTopology_H
-
-#include "label.H"
-#include "autoPtr.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
- class polyMesh;
- class surfaceWriter;
- class setWriter;
-
-namespace meshCheck
-{
- label checkTopology
- (
- const polyMesh& mesh,
- const bool allTopology,
- const autoPtr& surfWriter,
- const autoPtr& setWriter
- );
-}
-}
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/meshCheck/checkTools/checkTopology.C b/src/meshCheck/checkTopology.C
similarity index 96%
rename from src/meshCheck/checkTools/checkTopology.C
rename to src/meshCheck/checkTopology.C
index f4b67c7f4a..95e8781ffa 100644
--- a/src/meshCheck/checkTools/checkTopology.C
+++ b/src/meshCheck/checkTopology.C
@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
-#include "checkTopology.H"
+#include "meshCheck.H"
#include "polyMeshCheck.H"
#include "Time.H"
#include "regionSplit.H"
@@ -34,7 +34,7 @@ License
#include "emptyPolyPatch.H"
#include "processorPolyPatch.H"
#include "surfaceWriter.H"
-#include "checkTools.H"
+#include "mergeAndWrite.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -131,7 +131,7 @@ Foam::label Foam::meshCheck::checkTopology
cells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), cells);
+ meshCheck::mergeAndWrite(surfWriter(), cells);
}
}
@@ -156,7 +156,7 @@ Foam::label Foam::meshCheck::checkTopology
points.write();
if (setWriter.valid())
{
- meshTools::mergeAndWrite(setWriter, points);
+ meshCheck::mergeAndWrite(setWriter, points);
}
}
}
@@ -178,7 +178,7 @@ Foam::label Foam::meshCheck::checkTopology
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -198,7 +198,7 @@ Foam::label Foam::meshCheck::checkTopology
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -219,7 +219,7 @@ Foam::label Foam::meshCheck::checkTopology
cells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), cells);
+ meshCheck::mergeAndWrite(surfWriter(), cells);
}
}
@@ -243,7 +243,7 @@ Foam::label Foam::meshCheck::checkTopology
faces.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), faces);
+ meshCheck::mergeAndWrite(surfWriter(), faces);
}
}
}
@@ -298,7 +298,7 @@ Foam::label Foam::meshCheck::checkTopology
oneCells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), oneCells);
+ meshCheck::mergeAndWrite(surfWriter(), oneCells);
}
}
@@ -314,7 +314,7 @@ Foam::label Foam::meshCheck::checkTopology
twoCells.write();
if (surfWriter.valid())
{
- meshTools::mergeAndWrite(surfWriter(), twoCells);
+ meshCheck::mergeAndWrite(surfWriter(), twoCells);
}
}
}
@@ -459,7 +459,7 @@ Foam::label Foam::meshCheck::checkTopology
points.write();
if (setWriter.valid())
{
- meshTools::mergeAndWrite(setWriter, points);
+ meshCheck::mergeAndWrite(setWriter, points);
}
}
}
diff --git a/src/meshCheck/dynamicMeshCheck/dynamicMeshCheck.H b/src/meshCheck/dynamicMeshCheck/dynamicMeshCheck.H
deleted file mode 100644
index 1ad527b5e1..0000000000
--- a/src/meshCheck/dynamicMeshCheck/dynamicMeshCheck.H
+++ /dev/null
@@ -1,251 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Description
- PolyMesh checking routines. Checks various criteria for a mesh and supplied
- geometry, with the mesh only used for topology. Coupled patch aware (i.e.,
- coupled faces are treated as internal).
-
-SourceFiles
- dynamicMeshCheck.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef dynamicMeshCheck_H
-#define dynamicMeshCheck_H
-
-#include "pointFields.H"
-#include "HashSet.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace meshCheck
-{
-
-//- Check face non-orthogonality
-bool checkFaceDotProduct
-(
- const bool report,
- const scalar orthWarn,
- const polyMesh&,
- const vectorField& cellCentres,
- const vectorField& faceAreas,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet* setPtr
-);
-
-//- Check face pyramid volumes
-bool checkFacePyramids
-(
- const bool report,
- const scalar minPyrVol,
- const polyMesh&,
- const vectorField& cellCentres,
- const pointField& p,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet*
-);
-
-//- Check face tetrahedra volumes
-bool checkFaceTets
-(
- const bool report,
- const scalar minPyrVol,
- const polyMesh&,
- const vectorField& cellCentres,
- const vectorField& faceCentres,
- const pointField& p,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet*
-);
-
-//- Check face skewness
-bool checkFaceSkewness
-(
- const bool report,
- const scalar internalSkew,
- const scalar boundarySkew,
- const polyMesh& mesh,
- const pointField& points,
- const vectorField& cellCentres,
- const vectorField& faceCentres,
- const vectorField& faceAreas,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet* setPtr
-);
-
-//- Check interpolation weights (0.5 for regular mesh)
-bool checkFaceWeights
-(
- const bool report,
- const scalar warnWeight,
- const polyMesh& mesh,
- const vectorField& cellCentres,
- const vectorField& faceCentres,
- const vectorField& faceAreas,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet* setPtr
-);
-
-//- Cell volume ratio of neighbouring cells (1 for regular mesh)
-bool checkVolRatio
-(
- const bool report,
- const scalar warnRatio,
- const polyMesh& mesh,
- const scalarField& cellVolumes,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet* setPtr
-);
-
-//- Check convexity of angles in a face. See primitiveMesh for explanation.
-bool checkFaceAngles
-(
- const bool report,
- const scalar maxDeg,
- const polyMesh& mesh,
- const vectorField& faceAreas,
- const pointField& p,
- const labelList& checkFaces,
- labelHashSet* setPtr
-);
-
-// Check the difference between normals of individual face-triangles (from
-// face-centre decomposition) and the cell-cell centre vector
-bool checkFaceTwist
-(
- const bool report,
- const scalar minTwist,
- const polyMesh&,
- const vectorField& cellCentres,
- const vectorField& faceAreas,
- const vectorField& faceCentres,
- const pointField& p,
- const labelList& checkFaces,
- labelHashSet* setPtr
-);
-
-//- Check consecutive face-triangle (from face-centre decomposition) normals
-bool checkTriangleTwist
-(
- const bool report,
- const scalar minTwist,
- const polyMesh&,
- const vectorField& faceAreas,
- const vectorField& faceCentres,
- const pointField& p,
- const labelList& checkFaces,
- labelHashSet* setPtr
-);
-
-//- Check for face areas v.s. sum of face-triangle (from face-centre
-// decomposition) areas
-bool checkFaceFlatness
-(
- const bool report,
- const scalar minFlatness,
- const polyMesh&,
- const vectorField& faceAreas,
- const vectorField& faceCentres,
- const pointField& p,
- const labelList& checkFaces,
- labelHashSet* setPtr
-);
-
-//- Check for small faces
-bool checkFaceArea
-(
- const bool report,
- const scalar minArea,
- const polyMesh&,
- const vectorField& faceAreas,
- const labelList& checkFaces,
- labelHashSet* setPtr
-);
-
-//- Check the area of internal faces v.s. boundary faces
-bool checkCellDeterminant
-(
- const bool report,
- const scalar minDet,
- const polyMesh&,
- const vectorField& faceAreas,
- const labelList& checkFaces,
- labelHashSet* setPtr
-);
-
-//- Check mesh with mesh settings in dict. Collects incorrect faces
-// in set. Returns true if one or more faces in error.
-// Parallel ok.
-bool checkMesh
-(
- const bool report,
- const polyMesh& mesh,
- const dictionary& dict,
- labelHashSet& wrongFaces
-);
-
-//- Check (subset of mesh) with mesh settings in dict.
-// Collects incorrect faces in set. Returns true if one
-// or more faces in error. Parallel ok.
-bool checkMesh
-(
- const bool report,
- const polyMesh& mesh,
- const dictionary& dict,
- const labelList& checkFaces,
- labelHashSet& wrongFaces
-);
-
-//- Check (subset of mesh including baffles) with mesh settings
-// in dict. Collects incorrect faces in set. Returns true if one
-// or more faces in error. Parallel ok.
-bool checkMesh
-(
- const bool report,
- const polyMesh& mesh,
- const dictionary& dict,
- const labelList& checkFaces,
- const List& baffles,
- labelHashSet& wrongFaces
-);
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace meshCheck
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/meshCheck/checkTools/checkTools.C b/src/meshCheck/mergeAndWrite/mergeAndWrite.C
similarity index 97%
rename from src/meshCheck/checkTools/checkTools.C
rename to src/meshCheck/mergeAndWrite/mergeAndWrite.C
index 628763c64c..8108ba00bf 100644
--- a/src/meshCheck/checkTools/checkTools.C
+++ b/src/meshCheck/mergeAndWrite/mergeAndWrite.C
@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
-#include "checkTools.H"
+#include "mergeAndWrite.H"
#include "polyMesh.H"
#include "globalMeshData.H"
#include "hexMatcher.H"
@@ -46,7 +46,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-void Foam::meshTools::printMeshStats
+void Foam::meshCheck::printMeshStats
(
const polyMesh& mesh,
const bool allTopology
@@ -209,7 +209,7 @@ void Foam::meshTools::printMeshStats
}
-void Foam::meshTools::mergeAndWrite
+void Foam::meshCheck::mergeAndWrite
(
const polyMesh& mesh,
const surfaceWriter& writer,
@@ -261,7 +261,7 @@ void Foam::meshTools::mergeAndWrite
}
-Foam::fileName Foam::meshTools::checkMeshOutputDir(const polyMesh& mesh)
+Foam::fileName Foam::meshCheck::checkMeshOutputDir(const polyMesh& mesh)
{
return
mesh.time().globalPath()
@@ -276,7 +276,7 @@ Foam::fileName Foam::meshTools::checkMeshOutputDir(const polyMesh& mesh)
}
-void Foam::meshTools::mergeAndWrite
+void Foam::meshCheck::mergeAndWrite
(
const surfaceWriter& writer,
const faceSet& set
@@ -294,7 +294,7 @@ void Foam::meshTools::mergeAndWrite
}
-void Foam::meshTools::mergeAndWrite
+void Foam::meshCheck::mergeAndWrite
(
const surfaceWriter& writer,
const cellSet& set
@@ -381,7 +381,7 @@ void Foam::meshTools::mergeAndWrite
}
-void Foam::meshTools::mergeAndWrite
+void Foam::meshCheck::mergeAndWrite
(
const setWriter& writer,
const pointSet& set
diff --git a/src/meshCheck/checkTools/checkTools.H b/src/meshCheck/mergeAndWrite/mergeAndWrite.H
similarity index 96%
rename from src/meshCheck/checkTools/checkTools.H
rename to src/meshCheck/mergeAndWrite/mergeAndWrite.H
index 3a74c1c8d9..2223d207ad 100644
--- a/src/meshCheck/checkTools/checkTools.H
+++ b/src/meshCheck/mergeAndWrite/mergeAndWrite.H
@@ -25,12 +25,12 @@ Description
Tools for checking the mesh
SourceFiles
- checkTools.C
+ mergeAndWrite.C
\*---------------------------------------------------------------------------*/
-#ifndef checkTools_H
-#define checkTools_H
+#ifndef mergeAndWrite_H
+#define mergeAndWrite_H
#include "indirectPrimitivePatch.H"
@@ -45,7 +45,7 @@ namespace Foam
class faceSet;
class cellSet;
-namespace meshTools
+namespace meshCheck
{
//- Output directory for sets and surfaces
fileName checkMeshOutputDir(const polyMesh& mesh);
diff --git a/src/meshCheck/checkTools/checkGeometry.H b/src/meshCheck/meshCheck.H
similarity index 60%
rename from src/meshCheck/checkTools/checkGeometry.H
rename to src/meshCheck/meshCheck.H
index ebda2017d8..566e7c3b32 100644
--- a/src/meshCheck/checkTools/checkGeometry.H
+++ b/src/meshCheck/meshCheck.H
@@ -22,20 +22,24 @@ License
along with OpenFOAM. If not, see .
Description
- Routines for checking mesh geometry
+ Functions for checking mesh topology and geometry
SourceFiles
+ checkTopology.C
checkGeometry.C
\*---------------------------------------------------------------------------*/
-#ifndef checkGeometry_H
-#define checkGeometry_H
+#ifndef meshCheck_H
+#define meshCheck_H
#include "label.H"
#include "HashSet.H"
#include "labelVector.H"
-#include "setWriter.H"
+#include "labelPair.H"
+#include "primitiveMeshCheck.H"
+#include "polyMeshCheck.H"
+#include "mergeAndWrite.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -63,6 +67,15 @@ namespace meshCheck
//- Check 0th vertex on coupled faces
bool checkCoupledPoints(const polyMesh&, const bool report, labelHashSet*);
+ //- Check the topology
+ label checkTopology
+ (
+ const polyMesh& mesh,
+ const bool allTopology,
+ const autoPtr& surfWriter,
+ const autoPtr& setWriter
+ );
+
//- Check the geometry
label checkGeometry
(
@@ -71,6 +84,42 @@ namespace meshCheck
const autoPtr&,
const autoPtr&
);
+
+ //- Check mesh with mesh settings in dict. Collects incorrect faces
+ // in set. Returns true if one or more faces in error.
+ // Parallel ok.
+ bool checkMesh
+ (
+ const bool report,
+ const polyMesh& mesh,
+ const dictionary& dict,
+ labelHashSet& wrongFaces
+ );
+
+ //- Check (subset of mesh) with mesh settings in dict.
+ // Collects incorrect faces in set. Returns true if one
+ // or more faces in error. Parallel ok.
+ bool checkMesh
+ (
+ const bool report,
+ const polyMesh& mesh,
+ const dictionary& dict,
+ const labelList& checkFaces,
+ labelHashSet& wrongFaces
+ );
+
+ //- Check (subset of mesh including baffles) with mesh settings
+ // in dict. Collects incorrect faces in set. Returns true if one
+ // or more faces in error. Parallel ok.
+ bool checkMesh
+ (
+ const bool report,
+ const polyMesh& mesh,
+ const dictionary& dict,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet& wrongFaces
+ );
}
}
diff --git a/src/meshCheck/polyMeshCheck/polyMeshCheck.C b/src/meshCheck/polyMeshCheck/polyMeshCheck.C
index 5ab61b5d1a..f58943fe28 100644
--- a/src/meshCheck/polyMeshCheck/polyMeshCheck.C
+++ b/src/meshCheck/polyMeshCheck/polyMeshCheck.C
@@ -23,13 +23,261 @@ License
\*---------------------------------------------------------------------------*/
+#include "primitiveMeshCheck.H"
#include "polyMeshCheck.H"
-#include "polyMeshTools.H"
#include "unitConversion.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+Foam::tmp Foam::meshCheck::faceOrthogonality
+(
+ const polyMesh& mesh,
+ const vectorField& areas,
+ const vectorField& cc
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+ const polyBoundaryMesh& pbm = mesh.boundaryMesh();
+
+ tmp tortho(new scalarField(mesh.nFaces(), 1.0));
+ scalarField& ortho = tortho.ref();
+
+ // Internal faces
+ forAll(nei, facei)
+ {
+ ortho[facei] = meshCheck::faceOrthogonality
+ (
+ cc[own[facei]],
+ cc[nei[facei]],
+ areas[facei]
+ );
+ }
+
+
+ // Coupled faces
+
+ pointField neighbourCc;
+ syncTools::swapBoundaryCellPositions(mesh, cc, neighbourCc);
+
+ forAll(pbm, patchi)
+ {
+ const polyPatch& pp = pbm[patchi];
+ if (pp.coupled())
+ {
+ forAll(pp, i)
+ {
+ label facei = pp.start() + i;
+ label bFacei = facei - mesh.nInternalFaces();
+
+ ortho[facei] = meshCheck::faceOrthogonality
+ (
+ cc[own[facei]],
+ neighbourCc[bFacei],
+ areas[facei]
+ );
+ }
+ }
+ }
+
+ return tortho;
+}
+
+
+Foam::tmp Foam::meshCheck::faceSkewness
+(
+ const polyMesh& mesh,
+ const pointField& p,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+ const vectorField& cellCtrs
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+ const polyBoundaryMesh& pbm = mesh.boundaryMesh();
+
+ tmp tskew(new scalarField(mesh.nFaces()));
+ scalarField& skew = tskew.ref();
+
+ forAll(nei, facei)
+ {
+ skew[facei] = meshCheck::faceSkewness
+ (
+ mesh,
+ p,
+ fCtrs,
+ fAreas,
+
+ facei,
+ cellCtrs[own[facei]],
+ cellCtrs[nei[facei]]
+ );
+ }
+
+
+ // Boundary faces: consider them to have only skewness error.
+ // (i.e. treat as if mirror cell on other side)
+
+ pointField neighbourCc;
+ syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neighbourCc);
+
+ forAll(pbm, patchi)
+ {
+ const polyPatch& pp = pbm[patchi];
+ if (pp.coupled())
+ {
+ forAll(pp, i)
+ {
+ label facei = pp.start() + i;
+ label bFacei = facei - mesh.nInternalFaces();
+
+ skew[facei] = meshCheck::faceSkewness
+ (
+ mesh,
+ p,
+ fCtrs,
+ fAreas,
+
+ facei,
+ cellCtrs[own[facei]],
+ neighbourCc[bFacei]
+ );
+ }
+ }
+ else
+ {
+ forAll(pp, i)
+ {
+ label facei = pp.start() + i;
+
+ skew[facei] = meshCheck::boundaryFaceSkewness
+ (
+ mesh,
+ p,
+ fCtrs,
+ fAreas,
+
+ facei,
+ cellCtrs[own[facei]]
+ );
+ }
+ }
+ }
+
+ return tskew;
+}
+
+
+Foam::tmp Foam::meshCheck::faceWeights
+(
+ const polyMesh& mesh,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+ const vectorField& cellCtrs
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+ const polyBoundaryMesh& pbm = mesh.boundaryMesh();
+
+ tmp tweight(new scalarField(mesh.nFaces(), 1.0));
+ scalarField& weight = tweight.ref();
+
+ // Internal faces
+ forAll(nei, facei)
+ {
+ const point& fc = fCtrs[facei];
+ const vector& fa = fAreas[facei];
+
+ scalar dOwn = mag(fa & (fc-cellCtrs[own[facei]]));
+ scalar dNei = mag(fa & (cellCtrs[nei[facei]]-fc));
+
+ weight[facei] = min(dNei,dOwn)/(dNei+dOwn+vSmall);
+ }
+
+
+ // Coupled faces
+
+ pointField neiCc;
+ syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neiCc);
+
+ forAll(pbm, patchi)
+ {
+ const polyPatch& pp = pbm[patchi];
+ if (pp.coupled())
+ {
+ forAll(pp, i)
+ {
+ label facei = pp.start() + i;
+ label bFacei = facei - mesh.nInternalFaces();
+
+ const point& fc = fCtrs[facei];
+ const vector& fa = fAreas[facei];
+
+ scalar dOwn = mag(fa & (fc-cellCtrs[own[facei]]));
+ scalar dNei = mag(fa & (neiCc[bFacei]-fc));
+
+ weight[facei] = min(dNei,dOwn)/(dNei+dOwn+vSmall);
+ }
+ }
+ }
+
+ return tweight;
+}
+
+
+Foam::tmp Foam::meshCheck::volRatio
+(
+ const polyMesh& mesh,
+ const scalarField& vol
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+ const polyBoundaryMesh& pbm = mesh.boundaryMesh();
+
+ tmp tratio(new scalarField(mesh.nFaces(), 1.0));
+ scalarField& ratio = tratio.ref();
+
+ // Internal faces
+ forAll(nei, facei)
+ {
+ scalar volOwn = vol[own[facei]];
+ scalar volNei = vol[nei[facei]];
+
+ ratio[facei] = min(volOwn,volNei)/(max(volOwn, volNei)+vSmall);
+ }
+
+
+ // Coupled faces
+
+ scalarField neiVol;
+ syncTools::swapBoundaryCellList(mesh, vol, neiVol);
+
+ forAll(pbm, patchi)
+ {
+ const polyPatch& pp = pbm[patchi];
+ if (pp.coupled())
+ {
+ forAll(pp, i)
+ {
+ label facei = pp.start() + i;
+ label bFacei = facei - mesh.nInternalFaces();
+
+ scalar volOwn = vol[own[facei]];
+ scalar volNei = neiVol[bFacei];
+
+ ratio[facei] = min(volOwn,volNei)/(max(volOwn, volNei)+vSmall);
+ }
+ }
+ }
+
+ return tratio;
+}
+
+
bool Foam::meshCheck::checkFaceOrthogonality
(
const polyMesh& mesh,
@@ -47,7 +295,7 @@ bool Foam::meshCheck::checkFaceOrthogonality
// Calculate orthogonality for all internal and coupled boundary faces
// (1 for uncoupled boundary faces)
- tmp tortho = meshTools::faceOrthogonality
+ tmp tortho = meshCheck::faceOrthogonality
(
mesh,
fAreas,
@@ -173,7 +421,7 @@ bool Foam::meshCheck::checkFaceSkewness
// Warn if the skew correction vector is more than skewWarning times
// larger than the face area vector
- tmp tskew = meshTools::faceSkewness
+ tmp tskew = meshCheck::faceSkewness
(
mesh,
points,
@@ -389,7 +637,7 @@ bool Foam::meshCheck::checkCellDeterminant
InfoInFunction << "Checking for under-determined cells" << endl;
}
- tmp tcellDeterminant = meshTools::cellDeterminant
+ tmp tcellDeterminant = meshCheck::cellDeterminant
(
mesh,
meshD,
@@ -473,7 +721,7 @@ bool Foam::meshCheck::checkFaceWeight
const vectorField& fAreas = mesh.faceAreas();
const vectorField& cellCtrs = mesh.cellCentres();
- tmp tfaceWght = meshTools::faceWeights
+ tmp tfaceWght = meshCheck::faceWeights
(
mesh,
fCtrs,
@@ -568,7 +816,7 @@ bool Foam::meshCheck::checkVolRatio
const scalarField& cellVols = mesh.cellVolumes();
- tmp tvolRatio = meshTools::volRatio(mesh, cellVols);
+ tmp tvolRatio = meshCheck::volRatio(mesh, cellVols);
scalarField& volRatio = tvolRatio.ref();
diff --git a/src/meshCheck/polyMeshCheck/polyMeshCheck.H b/src/meshCheck/polyMeshCheck/polyMeshCheck.H
index 08dfc1a5ec..82a2d60e7a 100644
--- a/src/meshCheck/polyMeshCheck/polyMeshCheck.H
+++ b/src/meshCheck/polyMeshCheck/polyMeshCheck.H
@@ -48,6 +48,41 @@ namespace Foam
namespace meshCheck
{
+ //- Generate orthogonality field. (1 for fully orthogonal, < 1 for
+ // non-orthogonal)
+ tmp faceOrthogonality
+ (
+ const polyMesh& mesh,
+ const vectorField& fAreas,
+ const vectorField& cellCtrs
+ );
+
+ //- Generate skewness field
+ tmp faceSkewness
+ (
+ const polyMesh& mesh,
+ const pointField& points,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+ const vectorField& cellCtrs
+ );
+
+ //- Generate interpolation factors field
+ tmp faceWeights
+ (
+ const polyMesh& mesh,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+ const vectorField& cellCtrs
+ );
+
+ //- Generate volume ratio field
+ tmp volRatio
+ (
+ const polyMesh& mesh,
+ const scalarField& vol
+ );
+
//- Check non-orthogonality
bool checkFaceOrthogonality
(
@@ -98,6 +133,163 @@ namespace meshCheck
labelHashSet* setPtr = nullptr
);
+ //- Check face non-orthogonality
+ bool checkFaceDotProduct
+ (
+ const bool report,
+ const scalar orthWarn,
+ const polyMesh&,
+ const vectorField& cellCentres,
+ const vectorField& faceAreas,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet* setPtr
+ );
+
+ //- Check face pyramid volumes
+ bool checkFacePyramids
+ (
+ const bool report,
+ const scalar minPyrVol,
+ const polyMesh&,
+ const vectorField& cellCentres,
+ const pointField& p,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet*
+ );
+
+ //- Check face tetrahedra volumes
+ bool checkFaceTets
+ (
+ const bool report,
+ const scalar minPyrVol,
+ const polyMesh&,
+ const vectorField& cellCentres,
+ const vectorField& faceCentres,
+ const pointField& p,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet*
+ );
+
+ //- Check face skewness
+ bool checkFaceSkewness
+ (
+ const bool report,
+ const scalar internalSkew,
+ const scalar boundarySkew,
+ const polyMesh& mesh,
+ const pointField& points,
+ const vectorField& cellCentres,
+ const vectorField& faceCentres,
+ const vectorField& faceAreas,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet* setPtr
+ );
+
+ //- Check interpolation weights (0.5 for regular mesh)
+ bool checkFaceWeights
+ (
+ const bool report,
+ const scalar warnWeight,
+ const polyMesh& mesh,
+ const vectorField& cellCentres,
+ const vectorField& faceCentres,
+ const vectorField& faceAreas,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet* setPtr
+ );
+
+ //- Cell volume ratio of neighbouring cells (1 for regular mesh)
+ bool checkVolRatio
+ (
+ const bool report,
+ const scalar warnRatio,
+ const polyMesh& mesh,
+ const scalarField& cellVolumes,
+ const labelList& checkFaces,
+ const List& baffles,
+ labelHashSet* setPtr
+ );
+
+ //- Check convexity of angles in a face. See primitiveMesh for explanation.
+ bool checkFaceAngles
+ (
+ const bool report,
+ const scalar maxDeg,
+ const polyMesh& mesh,
+ const vectorField& faceAreas,
+ const pointField& p,
+ const labelList& checkFaces,
+ labelHashSet* setPtr
+ );
+
+ // Check the difference between normals of individual face-triangles (from
+ // face-centre decomposition) and the cell-cell centre vector
+ bool checkFaceTwist
+ (
+ const bool report,
+ const scalar minTwist,
+ const polyMesh&,
+ const vectorField& cellCentres,
+ const vectorField& faceAreas,
+ const vectorField& faceCentres,
+ const pointField& p,
+ const labelList& checkFaces,
+ labelHashSet* setPtr
+ );
+
+ //- Check consecutive face-triangle (from face-centre decomposition) normals
+ bool checkTriangleTwist
+ (
+ const bool report,
+ const scalar minTwist,
+ const polyMesh&,
+ const vectorField& faceAreas,
+ const vectorField& faceCentres,
+ const pointField& p,
+ const labelList& checkFaces,
+ labelHashSet* setPtr
+ );
+
+ //- Check for face areas v.s. sum of face-triangle (from face-centre
+ // decomposition) areas
+ bool checkFaceFlatness
+ (
+ const bool report,
+ const scalar minFlatness,
+ const polyMesh&,
+ const vectorField& faceAreas,
+ const vectorField& faceCentres,
+ const pointField& p,
+ const labelList& checkFaces,
+ labelHashSet* setPtr
+ );
+
+ //- Check for small faces
+ bool checkFaceArea
+ (
+ const bool report,
+ const scalar minArea,
+ const polyMesh&,
+ const vectorField& faceAreas,
+ const labelList& checkFaces,
+ labelHashSet* setPtr
+ );
+
+ //- Check the area of internal faces v.s. boundary faces
+ bool checkCellDeterminant
+ (
+ const bool report,
+ const scalar minDet,
+ const polyMesh&,
+ const vectorField& faceAreas,
+ const labelList& checkFaces,
+ labelHashSet* setPtr
+ );
//- Check mesh topology for correctness.
// Returns false for no error.
diff --git a/src/meshCheck/dynamicMeshCheck/dynamicMeshCheck.C b/src/meshCheck/polyMeshCheck/polyMeshCheckQuality.C
similarity index 99%
rename from src/meshCheck/dynamicMeshCheck/dynamicMeshCheck.C
rename to src/meshCheck/polyMeshCheck/polyMeshCheckQuality.C
index f5d411424f..3a59f78c34 100644
--- a/src/meshCheck/dynamicMeshCheck/dynamicMeshCheck.C
+++ b/src/meshCheck/polyMeshCheck/polyMeshCheckQuality.C
@@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/
-#include "dynamicMeshCheck.H"
+#include "primitiveMeshCheck.H"
+#include "polyMeshCheck.H"
#include "polyMeshTetDecomposition.H"
#include "pyramidPointFaceRef.H"
#include "tetPointRef.H"
#include "syncTools.H"
#include "unitConversion.H"
-#include "primitiveMeshTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -819,7 +819,7 @@ bool Foam::meshCheck::checkFaceSkewness
if (mesh.isInternalFace(facei))
{
- scalar skewness = meshTools::faceSkewness
+ scalar skewness = meshCheck::faceSkewness
(
mesh,
points,
@@ -854,7 +854,7 @@ bool Foam::meshCheck::checkFaceSkewness
}
else if (patches[patches.whichPatch(facei)].coupled())
{
- scalar skewness = meshTools::faceSkewness
+ scalar skewness = meshCheck::faceSkewness
(
mesh,
points,
@@ -889,7 +889,7 @@ bool Foam::meshCheck::checkFaceSkewness
}
else
{
- scalar skewness = meshTools::boundaryFaceSkewness
+ scalar skewness = meshCheck::boundaryFaceSkewness
(
mesh,
points,
@@ -932,7 +932,7 @@ bool Foam::meshCheck::checkFaceSkewness
const point& ownCc = cellCentres[own[face0]];
const point& neiCc = cellCentres[own[face1]];
- scalar skewness = meshTools::faceSkewness
+ scalar skewness = meshCheck::faceSkewness
(
mesh,
points,
diff --git a/src/meshCheck/polyMeshCheck/polyMeshTools.C b/src/meshCheck/polyMeshCheck/polyMeshTools.C
deleted file mode 100644
index 1f36f44b03..0000000000
--- a/src/meshCheck/polyMeshCheck/polyMeshTools.C
+++ /dev/null
@@ -1,282 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-\*---------------------------------------------------------------------------*/
-
-#include "polyMeshTools.H"
-#include "syncTools.H"
-#include "pyramidPointFaceRef.H"
-#include "primitiveMeshTools.H"
-#include "polyMeshTools.H"
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-Foam::tmp Foam::meshTools::faceOrthogonality
-(
- const polyMesh& mesh,
- const vectorField& areas,
- const vectorField& cc
-)
-{
- const labelList& own = mesh.faceOwner();
- const labelList& nei = mesh.faceNeighbour();
- const polyBoundaryMesh& pbm = mesh.boundaryMesh();
-
- tmp tortho(new scalarField(mesh.nFaces(), 1.0));
- scalarField& ortho = tortho.ref();
-
- // Internal faces
- forAll(nei, facei)
- {
- ortho[facei] = meshTools::faceOrthogonality
- (
- cc[own[facei]],
- cc[nei[facei]],
- areas[facei]
- );
- }
-
-
- // Coupled faces
-
- pointField neighbourCc;
- syncTools::swapBoundaryCellPositions(mesh, cc, neighbourCc);
-
- forAll(pbm, patchi)
- {
- const polyPatch& pp = pbm[patchi];
- if (pp.coupled())
- {
- forAll(pp, i)
- {
- label facei = pp.start() + i;
- label bFacei = facei - mesh.nInternalFaces();
-
- ortho[facei] = meshTools::faceOrthogonality
- (
- cc[own[facei]],
- neighbourCc[bFacei],
- areas[facei]
- );
- }
- }
- }
-
- return tortho;
-}
-
-
-Foam::tmp Foam::meshTools::faceSkewness
-(
- const polyMesh& mesh,
- const pointField& p,
- const vectorField& fCtrs,
- const vectorField& fAreas,
- const vectorField& cellCtrs
-)
-{
- const labelList& own = mesh.faceOwner();
- const labelList& nei = mesh.faceNeighbour();
- const polyBoundaryMesh& pbm = mesh.boundaryMesh();
-
- tmp tskew(new scalarField(mesh.nFaces()));
- scalarField& skew = tskew.ref();
-
- forAll(nei, facei)
- {
- skew[facei] = meshTools::faceSkewness
- (
- mesh,
- p,
- fCtrs,
- fAreas,
-
- facei,
- cellCtrs[own[facei]],
- cellCtrs[nei[facei]]
- );
- }
-
-
- // Boundary faces: consider them to have only skewness error.
- // (i.e. treat as if mirror cell on other side)
-
- pointField neighbourCc;
- syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neighbourCc);
-
- forAll(pbm, patchi)
- {
- const polyPatch& pp = pbm[patchi];
- if (pp.coupled())
- {
- forAll(pp, i)
- {
- label facei = pp.start() + i;
- label bFacei = facei - mesh.nInternalFaces();
-
- skew[facei] = meshTools::faceSkewness
- (
- mesh,
- p,
- fCtrs,
- fAreas,
-
- facei,
- cellCtrs[own[facei]],
- neighbourCc[bFacei]
- );
- }
- }
- else
- {
- forAll(pp, i)
- {
- label facei = pp.start() + i;
-
- skew[facei] = meshTools::boundaryFaceSkewness
- (
- mesh,
- p,
- fCtrs,
- fAreas,
-
- facei,
- cellCtrs[own[facei]]
- );
- }
- }
- }
-
- return tskew;
-}
-
-
-Foam::tmp Foam::meshTools::faceWeights
-(
- const polyMesh& mesh,
- const vectorField& fCtrs,
- const vectorField& fAreas,
- const vectorField& cellCtrs
-)
-{
- const labelList& own = mesh.faceOwner();
- const labelList& nei = mesh.faceNeighbour();
- const polyBoundaryMesh& pbm = mesh.boundaryMesh();
-
- tmp tweight(new scalarField(mesh.nFaces(), 1.0));
- scalarField& weight = tweight.ref();
-
- // Internal faces
- forAll(nei, facei)
- {
- const point& fc = fCtrs[facei];
- const vector& fa = fAreas[facei];
-
- scalar dOwn = mag(fa & (fc-cellCtrs[own[facei]]));
- scalar dNei = mag(fa & (cellCtrs[nei[facei]]-fc));
-
- weight[facei] = min(dNei,dOwn)/(dNei+dOwn+vSmall);
- }
-
-
- // Coupled faces
-
- pointField neiCc;
- syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neiCc);
-
- forAll(pbm, patchi)
- {
- const polyPatch& pp = pbm[patchi];
- if (pp.coupled())
- {
- forAll(pp, i)
- {
- label facei = pp.start() + i;
- label bFacei = facei - mesh.nInternalFaces();
-
- const point& fc = fCtrs[facei];
- const vector& fa = fAreas[facei];
-
- scalar dOwn = mag(fa & (fc-cellCtrs[own[facei]]));
- scalar dNei = mag(fa & (neiCc[bFacei]-fc));
-
- weight[facei] = min(dNei,dOwn)/(dNei+dOwn+vSmall);
- }
- }
- }
-
- return tweight;
-}
-
-
-Foam::tmp Foam::meshTools::volRatio
-(
- const polyMesh& mesh,
- const scalarField& vol
-)
-{
- const labelList& own = mesh.faceOwner();
- const labelList& nei = mesh.faceNeighbour();
- const polyBoundaryMesh& pbm = mesh.boundaryMesh();
-
- tmp tratio(new scalarField(mesh.nFaces(), 1.0));
- scalarField& ratio = tratio.ref();
-
- // Internal faces
- forAll(nei, facei)
- {
- scalar volOwn = vol[own[facei]];
- scalar volNei = vol[nei[facei]];
-
- ratio[facei] = min(volOwn,volNei)/(max(volOwn, volNei)+vSmall);
- }
-
-
- // Coupled faces
-
- scalarField neiVol;
- syncTools::swapBoundaryCellList(mesh, vol, neiVol);
-
- forAll(pbm, patchi)
- {
- const polyPatch& pp = pbm[patchi];
- if (pp.coupled())
- {
- forAll(pp, i)
- {
- label facei = pp.start() + i;
- label bFacei = facei - mesh.nInternalFaces();
-
- scalar volOwn = vol[own[facei]];
- scalar volNei = neiVol[bFacei];
-
- ratio[facei] = min(volOwn,volNei)/(max(volOwn, volNei)+vSmall);
- }
- }
- }
-
- return tratio;
-}
-
-
-// ************************************************************************* //
diff --git a/src/meshCheck/polyMeshCheck/polyMeshTools.H b/src/meshCheck/polyMeshCheck/polyMeshTools.H
deleted file mode 100644
index e9430e2f2c..0000000000
--- a/src/meshCheck/polyMeshCheck/polyMeshTools.H
+++ /dev/null
@@ -1,97 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Namespace
- Foam::meshTools
-
-Description
- Collection of functions operating on polyMesh (mainly checks) so
- that need access to patch information.
-
-SourceFiles
- polyMeshTools.C
-
-\*---------------------------------------------------------------------------*/
-#ifndef polyMeshTools_H
-#define polyMeshTools_H
-
-#include "polyMesh.H"
-#include "primitiveMeshTools.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
- Namespace meshTools Declaration
-\*---------------------------------------------------------------------------*/
-
-namespace meshTools
-{
- //- Generate orthogonality field. (1 for fully orthogonal, < 1 for
- // non-orthogonal)
- tmp faceOrthogonality
- (
- const polyMesh& mesh,
- const vectorField& fAreas,
- const vectorField& cellCtrs
- );
-
- //- Generate skewness field
- tmp faceSkewness
- (
- const polyMesh& mesh,
- const pointField& points,
- const vectorField& fCtrs,
- const vectorField& fAreas,
- const vectorField& cellCtrs
- );
-
- //- Generate interpolation factors field
- tmp faceWeights
- (
- const polyMesh& mesh,
- const vectorField& fCtrs,
- const vectorField& fAreas,
- const vectorField& cellCtrs
- );
-
- //- Generate volume ratio field
- tmp volRatio
- (
- const polyMesh& mesh,
- const scalarField& vol
- );
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/meshCheck/primitiveMeshCheck/primitiveMeshCheck.C b/src/meshCheck/primitiveMeshCheck/primitiveMeshCheck.C
index 1730700b5b..c04e09831b 100644
--- a/src/meshCheck/primitiveMeshCheck/primitiveMeshCheck.C
+++ b/src/meshCheck/primitiveMeshCheck/primitiveMeshCheck.C
@@ -25,11 +25,11 @@ License
#include "primitiveMeshCheck.H"
#include "pyramidPointFaceRef.H"
+#include "PackedBoolList.H"
#include "ListOps.H"
#include "unitConversion.H"
#include "SortableList.H"
#include "EdgeMap.H"
-#include "primitiveMeshTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -42,6 +42,525 @@ Foam::scalar Foam::meshCheck::planarCosAngle = 1.0e-6;
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+Foam::scalar Foam::meshCheck::faceSkewness
+(
+ const primitiveMesh& mesh,
+ const pointField& p,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+
+ const label facei,
+ const point& ownCc,
+ const point& neiCc
+)
+{
+ vector Cpf = fCtrs[facei] - ownCc;
+ vector d = neiCc - ownCc;
+
+ // Skewness vector
+ vector sv =
+ Cpf
+ - ((fAreas[facei] & Cpf)/((fAreas[facei] & d) + rootVSmall))*d;
+ vector svHat = sv/(mag(sv) + rootVSmall);
+
+ // Normalisation distance calculated as the approximate distance
+ // from the face centre to the edge of the face in the direction
+ // of the skewness
+ scalar fd = 0.2*mag(d) + rootVSmall;
+ const face& f = mesh.faces()[facei];
+ forAll(f, pi)
+ {
+ fd = max(fd, mag(svHat & (p[f[pi]] - fCtrs[facei])));
+ }
+
+ // Normalised skewness
+ return mag(sv)/fd;
+}
+
+
+Foam::scalar Foam::meshCheck::boundaryFaceSkewness
+(
+ const primitiveMesh& mesh,
+ const pointField& p,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+
+ const label facei,
+ const point& ownCc
+)
+{
+ vector Cpf = fCtrs[facei] - ownCc;
+
+ vector normal = fAreas[facei];
+ normal /= mag(normal) + rootVSmall;
+ vector d = normal*(normal & Cpf);
+
+
+ // Skewness vector
+ vector sv =
+ Cpf
+ - ((fAreas[facei] & Cpf)/((fAreas[facei] & d) + rootVSmall))*d;
+ vector svHat = sv/(mag(sv) + rootVSmall);
+
+ // Normalisation distance calculated as the approximate distance
+ // from the face centre to the edge of the face in the direction
+ // of the skewness
+ scalar fd = 0.4*mag(d) + rootVSmall;
+ const face& f = mesh.faces()[facei];
+ forAll(f, pi)
+ {
+ fd = max(fd, mag(svHat & (p[f[pi]] - fCtrs[facei])));
+ }
+
+ // Normalised skewness
+ return mag(sv)/fd;
+}
+
+
+Foam::scalar Foam::meshCheck::faceOrthogonality
+(
+ const point& ownCc,
+ const point& neiCc,
+ const vector& s
+)
+{
+ vector d = neiCc - ownCc;
+
+ return (d & s)/(mag(d)*mag(s) + rootVSmall);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+Foam::tmp Foam::meshCheck::faceOrthogonality
+(
+ const primitiveMesh& mesh,
+ const vectorField& areas,
+ const vectorField& cc
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+
+ tmp tortho(new scalarField(mesh.nInternalFaces()));
+ scalarField& ortho = tortho.ref();
+
+ // Internal faces
+ forAll(nei, facei)
+ {
+ ortho[facei] = faceOrthogonality
+ (
+ cc[own[facei]],
+ cc[nei[facei]],
+ areas[facei]
+ );
+ }
+
+ return tortho;
+}
+
+
+Foam::tmp Foam::meshCheck::faceSkewness
+(
+ const primitiveMesh& mesh,
+ const pointField& p,
+ const vectorField& fCtrs,
+ const vectorField& fAreas,
+ const vectorField& cellCtrs
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+
+ tmp tskew(new scalarField(mesh.nFaces()));
+ scalarField& skew = tskew.ref();
+
+ forAll(nei, facei)
+ {
+ skew[facei] = faceSkewness
+ (
+ mesh,
+ p,
+ fCtrs,
+ fAreas,
+
+ facei,
+ cellCtrs[own[facei]],
+ cellCtrs[nei[facei]]
+ );
+ }
+
+
+ // Boundary faces: consider them to have only skewness error.
+ // (i.e. treat as if mirror cell on other side)
+
+ for (label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); facei++)
+ {
+ skew[facei] = boundaryFaceSkewness
+ (
+ mesh,
+ p,
+ fCtrs,
+ fAreas,
+ facei,
+ cellCtrs[own[facei]]
+ );
+ }
+
+ return tskew;
+}
+
+
+void Foam::meshCheck::facePyramidVolume
+(
+ const primitiveMesh& mesh,
+ const pointField& points,
+ const vectorField& ctrs,
+
+ scalarField& ownPyrVol,
+ scalarField& neiPyrVol
+)
+{
+ const labelList& own = mesh.faceOwner();
+ const labelList& nei = mesh.faceNeighbour();
+ const faceList& f = mesh.faces();
+
+ ownPyrVol.setSize(mesh.nFaces());
+ neiPyrVol.setSize(mesh.nInternalFaces());
+
+ forAll(f, facei)
+ {
+ // Create the owner pyramid
+ ownPyrVol[facei] = -pyramidPointFaceRef
+ (
+ f[facei],
+ ctrs[own[facei]]
+ ).mag(points);
+
+ if (mesh.isInternalFace(facei))
+ {
+ // Create the neighbour pyramid - it will have positive volume
+ neiPyrVol[facei] = pyramidPointFaceRef
+ (
+ f[facei],
+ ctrs[nei[facei]]
+ ).mag(points);
+ }
+ }
+}
+
+
+void Foam::meshCheck::cellClosedness
+(
+ const primitiveMesh& mesh,
+ const Vector