/*---------------------------------------------------------------------------*\ ========= | \\ / 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 "polyMeshCheck.H" #include "polyMeshTools.H" #include "unitConversion.H" #include "syncTools.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::meshCheck::checkFaceOrthogonality ( const polyMesh& mesh, const bool report, labelHashSet* setPtr ) { if (mesh.debug) { InfoInFunction << "Checking mesh non-orthogonality" << endl; } const vectorField& fAreas = mesh.faceAreas(); const vectorField& cellCtrs = mesh.cellCentres(); // Calculate orthogonality for all internal and coupled boundary faces // (1 for uncoupled boundary faces) tmp tortho = meshTools::faceOrthogonality ( mesh, fAreas, cellCtrs ); const scalarField& ortho = tortho.ref(); // Severe nonorthogonality threshold const scalar severeNonorthogonalityThreshold = ::cos(degToRad(meshCheck::nonOrthThreshold)); scalar minDDotS = great; scalar sumDDotS = 0.0; label nSummed = 0; label severeNonOrth = 0; label errorNonOrth = 0; // Statistics only for internal and masters of coupled faces PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(mesh)); forAll(ortho, facei) { if (ortho[facei] < severeNonorthogonalityThreshold) { if (ortho[facei] > small) { if (setPtr) { setPtr->insert(facei); } severeNonOrth++; } else { // Error : non-ortho too large if (setPtr) { setPtr->insert(facei); } errorNonOrth++; } } if (isMasterFace[facei]) { minDDotS = min(minDDotS, ortho[facei]); sumDDotS += ortho[facei]; nSummed++; } } reduce(minDDotS, minOp()); reduce(sumDDotS, sumOp()); reduce(nSummed, sumOp