/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 "polyMesh.H" #include "polyMeshTools.H" #include "unitConversion.H" #include "syncTools.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::polyMesh::checkFaceOrthogonality ( const vectorField& fAreas, const vectorField& cellCtrs, const bool report, const bool detailedReport, labelHashSet* setPtr ) const { DebugInFunction << "Checking mesh non-orthogonality" << endl; const labelList& own = faceOwner(); const labelList& nei = faceNeighbour(); // Calculate orthogonality for all internal and coupled boundary faces // (1 for uncoupled boundary faces) tmp tortho = polyMeshTools::faceOrthogonality ( *this, fAreas, cellCtrs ); const scalarField& ortho = tortho.ref(); // Severe nonorthogonality threshold const scalar severeNonorthogonalityThreshold = ::cos(degToRad(primitiveMesh::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 bitSet isMasterFace(syncTools::getInternalOrMasterFaces(*this)); 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); } if (detailedReport && errorNonOrth == 0) { // Non-orthogonality greater than 90 deg WarningInFunction << "Severe non-orthogonality for face " << facei << " between cells " << own[facei] << " and " << nei[facei] << ": Angle = " << radToDeg(::acos(clamp(ortho[facei], -1, 1))) << " deg." << endl; } errorNonOrth++; } } if (isMasterFace.test(facei)) { minDDotS = min(minDDotS, ortho[facei]); sumDDotS += ortho[facei]; nSummed++; } } reduce(minDDotS, minOp()); reduce(sumDDotS, sumOp()); reduce(nSummed, sumOp