diff --git a/etc/caseDicts/meshQualityDict b/etc/caseDicts/meshQualityDict index ada9935597..b1e007fe1c 100644 --- a/etc/caseDicts/meshQualityDict +++ b/etc/caseDicts/meshQualityDict @@ -67,12 +67,14 @@ minVolRatio 0.01; // for Fluent compatibility minTriangleTwist -1; - //- If >0 : preserve cells with all points on the surface if the // resulting volume after snapping (by approximation) is larger than // minVolCollapseRatio times old volume (i.e. not collapsed to flat cell). // If <0 : delete always. //minVolCollapseRatio 0.1; +//- Minimum edge length. Set to <0 to disable +minEdgeLength 0.001; + // ************************************************************************* // diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C index 85c7a72d81..1b3a870102 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2014 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +29,7 @@ License #include "motionSmootherAlgo.H" #include "polyMeshGeometry.H" #include "IOmanip.H" +#include "pointSet.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -127,6 +128,13 @@ bool Foam::motionSmootherAlgo::checkMesh ( get(dict, "minDeterminant", dryRun, keyType::REGEX_RECURSIVE) ); + const scalar minEdgeLength + ( + dict.getOrDefault + ( + "minEdgeLength", -1, keyType::REGEX_RECURSIVE + ) + ); if (dryRun) @@ -452,6 +460,40 @@ bool Foam::motionSmootherAlgo::checkMesh nWrongFaces = nNewWrongFaces; } + if (minEdgeLength >= 0) + { + pointSet edgePoints(mesh, "smallEdgePoints", mesh.nPoints()/1000); + polyMeshGeometry::checkEdgeLength + ( + report, + minEdgeLength, + mesh, + checkFaces, + &edgePoints + ); + + const auto& pointFaces = mesh.pointFaces(); + + label nNewWrongFaces = 0; + for (const label pointi : edgePoints) + { + const auto& pFaces = pointFaces[pointi]; + for (const label facei : pFaces) + { + if (wrongFaces.insert(facei)) + { + nNewWrongFaces++; + } + } + } + + Info<< " faces with edge length < " + << setw(5) << minEdgeLength << " : " + << returnReduce(nNewWrongFaces, sumOp