From 32e7b52c8189dd621af2efde10725d1a742f7b74 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 24 Feb 2022 16:44:34 +0000 Subject: [PATCH] motionSmootherAlgoCheck::checkMesh: improved minVol test and removed unused tests motionSmootherAlgoCheck::checkMesh is used by snappyHexMesh to check the mesh after snapping and morphing. The minVol test which checks for collapsed cells is now relative to the cube of the minimum bounding box length so that it is less dependent on the size of the geometry and less likely to need changing for very small geometries. The default value is set in etc/caseDicts/mesh/generation/meshQualityDict etc/caseDicts/mesh/generation/meshQualityDict.cfg //- Minimum cell pyramid volume relative to min bounding box length^3 // Set to a fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1e30) to disable. minVol 1e-10; The unused minArea and minTriangleTwist tests have been removed --- etc/caseDicts/annotated/foamyHexMeshDict | 10 +-- etc/caseDicts/mesh/generation/meshQualityDict | 20 +---- .../mesh/generation/meshQualityDict.cfg | 13 +--- .../motionSmoother/motionSmootherAlgoCheck.C | 62 +--------------- .../system/snappyHexMeshDict | 2 - .../RAS/propeller/system/snappyHexMeshDict | 14 +--- .../system/snappyHexMeshDict | 14 +--- .../motorBike/system/snappyHexMeshDict | 15 +--- .../turbineSiting/system/snappyHexMeshDict | 22 +----- .../foamyHexMesh/blob/system/meshQualityDict | 12 +-- .../flange/system/meshQualityDict | 12 +-- .../simpleShapes/system/meshQualityDict | 12 +-- .../RAS/DTCHull/system/meshQualityDict | 19 +---- .../RAS/DTCHullMoving/system/meshQualityDict | 21 +----- .../RAS/DTCHullWave/system/meshQualityDict | 19 +---- .../mixerVesselAMI/system/snappyHexMeshDict | 21 ++---- .../RAS/planingHullW3/system/meshQualityDict | 22 +----- .../RAS/propeller/system/snappyHexMeshDict | 14 +--- .../RAS/weirOverflow/system/blockMeshDict | 74 ++++++++++++------- .../cavitatingBullet/system/snappyHexMeshDict | 13 +--- 20 files changed, 110 insertions(+), 301 deletions(-) diff --git a/etc/caseDicts/annotated/foamyHexMeshDict b/etc/caseDicts/annotated/foamyHexMeshDict index 975fd099d7..64a6f989cf 100644 --- a/etc/caseDicts/annotated/foamyHexMeshDict +++ b/etc/caseDicts/annotated/foamyHexMeshDict @@ -433,8 +433,8 @@ meshQualityControls // Set to 180 to disable. maxConcave 80; - //- Minimum pyramid volume. Is absolute volume of cell pyramid. - // Set to a sensible fraction of the smallest cell volume expected. + //- Minimum cell pyramid volume relative to min bounding box length^3 + // Set to a fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1e30) to disable. minVol -1e30; @@ -449,9 +449,6 @@ meshQualityControls // 1 = regular tet minTetQuality 1e-30; - //- Minimum absolute face area. Set to <0 to disable. - minArea -1; - //- Minimum face twist. Set to <-1 to disable. dot product of face normal // and face centre triangles normal minTwist 0.02; @@ -465,9 +462,6 @@ meshQualityControls //- minVolRatio (0 -> 1) minVolRatio 0.01; - - // must be >0 for Fluent compatibility - minTriangleTwist -1; } diff --git a/etc/caseDicts/mesh/generation/meshQualityDict b/etc/caseDicts/mesh/generation/meshQualityDict index 3d2b18a6e9..cfe837b340 100644 --- a/etc/caseDicts/mesh/generation/meshQualityDict +++ b/etc/caseDicts/mesh/generation/meshQualityDict @@ -25,10 +25,10 @@ maxInternalSkewness 4; // Set to 180 to disable. maxConcave 80; -//- Minimum pyramid volume. Is absolute volume of cell pyramid. -// Set to a sensible fraction of the smallest cell volume expected. +//- Minimum cell pyramid volume relative to min bounding box length^3 +// Set to a fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1e30) to disable. -minVol 1e-13; +minVol 1e-10; //- Minimum quality of the tet formed by the face-centre // and variable base point minimum decomposition triangles and @@ -39,9 +39,6 @@ minVol 1e-13; // 1 = regular tet minTetQuality 1e-15; -//- Minimum face area. Set to <0 to disable. -minArea -1; - //- Minimum face twist. Set to <-1 to disable. dot product of face normal // and face centre triangles normal minTwist 0.02; @@ -61,20 +58,9 @@ minFaceWeight 0.05; //- Volume ratio of neighbouring cells (0 -> 1) minVolRatio 0.01; -//- Per triangle normal compared to average normal. Like face twist -// but now per (face-centre decomposition) triangle. Must be >0 for Fluent -// compatibility -minTriangleTwist -1; - nSmoothScale 4; errorReduction 0.75; -//- 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; - // ************************************************************************* // diff --git a/etc/caseDicts/mesh/generation/meshQualityDict.cfg b/etc/caseDicts/mesh/generation/meshQualityDict.cfg index b8a1f8f6a7..df7b2610b5 100644 --- a/etc/caseDicts/mesh/generation/meshQualityDict.cfg +++ b/etc/caseDicts/mesh/generation/meshQualityDict.cfg @@ -14,19 +14,10 @@ maxInternalSkewness 4; maxConcave 80; -// Minimum cell pyramid volume; case dependent -minVol 1e-13; +minVol 1e-10; minTetQuality -1e30; -// if >0 : preserve single 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.5; - -minArea -1; - minTwist 0.02; minDeterminant 0.001; @@ -35,8 +26,6 @@ minFaceWeight 0.05; minVolRatio 0.01; -minTriangleTwist -1; - nSmoothScale 4; errorReduction 0.75; diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C index d002c35953..b8386e5112 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,10 +76,6 @@ bool Foam::motionSmootherAlgo::checkMesh ( dict.lookup("maxConcave", true) ); - const scalar minArea - ( - dict.lookup("minArea", true) - ); const scalar maxIntSkew ( dict.lookup("maxInternalSkewness", true) @@ -100,10 +96,6 @@ bool Foam::motionSmootherAlgo::checkMesh ( dict.lookup("minTwist", true) ); - const scalar minTriangleTwist - ( - dict.lookup("minTriangleTwist", true) - ); scalar minFaceFlatness = -1.0; dict.readIfPresent("minFaceFlatness", minFaceFlatness, true); const scalar minDet @@ -141,10 +133,12 @@ bool Foam::motionSmootherAlgo::checkMesh if (minVol > -great) { + const scalar refVol = pow3(mesh.bounds().minDim()); + polyMeshCheck::checkFacePyramids ( report, - minVol, + minVol*refVol, mesh, mesh.cellCentres(), mesh.points(), @@ -209,28 +203,6 @@ bool Foam::motionSmootherAlgo::checkMesh nWrongFaces = nNewWrongFaces; } - if (minArea > -small) - { - polyMeshCheck::checkFaceArea - ( - report, - minArea, - mesh, - mesh.faceAreas(), - checkFaces, - &wrongFaces - ); - - label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp