diff --git a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C index 77ce89ca71e2a7d238d973b5af6c13a766a59b37..3efb62a995ae9f66cb46e096950f17a0869c9957 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -239,6 +239,7 @@ bool Foam::motionSmoother::checkMesh maxIntSkew, maxBounSkew, mesh, + mesh.points(), mesh.cellCentres(), mesh.faceCentres(), mesh.faceAreas(), @@ -481,14 +482,14 @@ bool Foam::motionSmoother::checkMesh ( readScalar(dict.lookup("minArea", true)) ); - const scalar maxIntSkew - ( - readScalar(dict.lookup("maxInternalSkewness", true)) - ); - const scalar maxBounSkew - ( - readScalar(dict.lookup("maxBoundarySkewness", true)) - ); + //const scalar maxIntSkew + //( + // readScalar(dict.lookup("maxInternalSkewness", true)) + //); + //const scalar maxBounSkew + //( + // readScalar(dict.lookup("maxBoundarySkewness", true)) + //); const scalar minWeight ( readScalar(dict.lookup("minFaceWeight", true)) @@ -615,27 +616,30 @@ bool Foam::motionSmoother::checkMesh nWrongFaces = nNewWrongFaces; } - if (maxIntSkew > 0 || maxBounSkew > 0) - { - meshGeom.checkFaceSkewness - ( - report, - maxIntSkew, - maxBounSkew, - checkFaces, - baffles, - &wrongFaces - ); - - label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>()); - - Info<< " faces with skewness > " - << setw(3) << maxIntSkew - << " (internal) or " << setw(3) << maxBounSkew - << " (boundary) : " << nNewWrongFaces-nWrongFaces << endl; - nWrongFaces = nNewWrongFaces; - } + //- Note: cannot check the skewness without the points and don't want + // to store them on polyMeshGeometry. + //if (maxIntSkew > 0 || maxBounSkew > 0) + //{ + // meshGeom.checkFaceSkewness + // ( + // report, + // maxIntSkew, + // maxBounSkew, + // checkFaces, + // baffles, + // &wrongFaces + // ); + // + // label nNewWrongFaces = returnReduce(wrongFaces.size(),sumOp<label>()); + // + // Info<< " faces with skewness > " + // << setw(3) << maxIntSkew + // << " (internal) or " << setw(3) << maxBounSkew + // << " (boundary) : " << nNewWrongFaces-nWrongFaces << endl; + // + // nWrongFaces = nNewWrongFaces; + //} if (minWeight >= 0 && minWeight < 1) { diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C index d3b69d392f391a8d554d3557d677b006a3d8902e..57725dc57c95aaf24cabc25133b7a70b9b110afb 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C @@ -29,6 +29,7 @@ License #include "tetrahedron.H" #include "syncTools.H" #include "unitConversion.H" +#include "primitiveMeshTools.H" namespace Foam { @@ -286,29 +287,6 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho } -Foam::scalar Foam::polyMeshGeometry::calcSkewness -( - const point& ownCc, - const point& neiCc, - const point& fc -) -{ - scalar dOwn = mag(fc - ownCc); - scalar dNei = mag(fc - neiCc); - - point faceIntersection = - ownCc*dNei/(dOwn+dNei+VSMALL) - + neiCc*dOwn/(dOwn+dNei+VSMALL); - - return - mag(fc - faceIntersection) - / ( - mag(neiCc-ownCc) - + VSMALL - ); -} - - // Create the neighbour pyramid - it will have positive volume bool Foam::polyMeshGeometry::checkFaceTet ( @@ -1008,6 +986,7 @@ bool Foam::polyMeshGeometry::checkFaceSkewness const scalar internalSkew, const scalar boundarySkew, const polyMesh& mesh, + const pointField& points, const vectorField& cellCentres, const vectorField& faceCentres, const vectorField& faceAreas, @@ -1024,14 +1003,8 @@ bool Foam::polyMeshGeometry::checkFaceSkewness const polyBoundaryMesh& patches = mesh.boundaryMesh(); // Calculate coupled cell centre - pointField neiCc(mesh.nFaces()-mesh.nInternalFaces()); - - for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) - { - neiCc[faceI-mesh.nInternalFaces()] = cellCentres[own[faceI]]; - } - syncTools::swapBoundaryFacePositions(mesh, neiCc); - + pointField neiCc; + syncTools::swapBoundaryCellPositions(mesh, cellCentres, neiCc); scalar maxSkew = 0; @@ -1043,11 +1016,16 @@ bool Foam::polyMeshGeometry::checkFaceSkewness if (mesh.isInternalFace(faceI)) { - scalar skewness = calcSkewness + scalar skewness = primitiveMeshTools::faceSkewness ( + mesh, + points, + faceCentres, + faceAreas, + + faceI, cellCentres[own[faceI]], - cellCentres[nei[faceI]], - faceCentres[faceI] + cellCentres[nei[faceI]] ); // Check if the skewness vector is greater than the PN vector. @@ -1073,11 +1051,16 @@ bool Foam::polyMeshGeometry::checkFaceSkewness } else if (patches[patches.whichPatch(faceI)].coupled()) { - scalar skewness = calcSkewness + scalar skewness = primitiveMeshTools::faceSkewness ( + mesh, + points, + faceCentres, + faceAreas, + + faceI, cellCentres[own[faceI]], - neiCc[faceI-mesh.nInternalFaces()], - faceCentres[faceI] + neiCc[faceI-mesh.nInternalFaces()] ); // Check if the skewness vector is greater than the PN vector. @@ -1103,21 +1086,17 @@ bool Foam::polyMeshGeometry::checkFaceSkewness } else { - // Boundary faces: consider them to have only skewness error. - // (i.e. treat as if mirror cell on other side) - - vector faceNormal = faceAreas[faceI]; - faceNormal /= mag(faceNormal) + ROOTVSMALL; - - vector dOwn = faceCentres[faceI] - cellCentres[own[faceI]]; - - vector dWall = faceNormal*(faceNormal & dOwn); + scalar skewness = primitiveMeshTools::boundaryFaceSkewness + ( + mesh, + points, + faceCentres, + faceAreas, - point faceIntersection = cellCentres[own[faceI]] + dWall; + faceI, + cellCentres[own[faceI]] + ); - scalar skewness = - mag(faceCentres[faceI] - faceIntersection) - /(2*mag(dWall) + ROOTVSMALL); // Check if the skewness vector is greater than the PN vector. // This does not cause trouble but is a good indication of a poor @@ -1148,12 +1127,18 @@ bool Foam::polyMeshGeometry::checkFaceSkewness label face1 = baffles[i].second(); const point& ownCc = cellCentres[own[face0]]; + const point& neiCc = cellCentres[own[face1]]; - scalar skewness = calcSkewness + scalar skewness = primitiveMeshTools::faceSkewness ( + mesh, + points, + faceCentres, + faceAreas, + + face0, ownCc, - cellCentres[own[face1]], - faceCentres[face0] + neiCc ); // Check if the skewness vector is greater than the PN vector. @@ -2361,30 +2346,30 @@ bool Foam::polyMeshGeometry::checkFaceTets } -bool Foam::polyMeshGeometry::checkFaceSkewness -( - const bool report, - const scalar internalSkew, - const scalar boundarySkew, - const labelList& checkFaces, - const List<labelPair>& baffles, - labelHashSet* setPtr -) const -{ - return checkFaceSkewness - ( - report, - internalSkew, - boundarySkew, - mesh_, - cellCentres_, - faceCentres_, - faceAreas_, - checkFaces, - baffles, - setPtr - ); -} +//bool Foam::polyMeshGeometry::checkFaceSkewness +//( +// const bool report, +// const scalar internalSkew, +// const scalar boundarySkew, +// const labelList& checkFaces, +// const List<labelPair>& baffles, +// labelHashSet* setPtr +//) const +//{ +// return checkFaceSkewness +// ( +// report, +// internalSkew, +// boundarySkew, +// mesh_, +// cellCentres_, +// faceCentres_, +// faceAreas_, +// checkFaces, +// baffles, +// setPtr +// ); +//} bool Foam::polyMeshGeometry::checkFaceWeights diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H index 2ef8604cac8714a45711323d82f2cbc4f475d574..405564a175273efd8d273725ef121558bc816f60 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -229,6 +229,7 @@ public: const scalar internalSkew, const scalar boundarySkew, const polyMesh& mesh, + const pointField& points, const vectorField& cellCentres, const vectorField& faceCentres, const vectorField& faceAreas, @@ -372,16 +373,6 @@ public: labelHashSet* setPtr ) const; - bool checkFaceSkewness - ( - const bool report, - const scalar internalSkew, - const scalar boundarySkew, - const labelList& checkFaces, - const List<labelPair>& baffles, - labelHashSet* setPtr - ) const; - bool checkFaceWeights ( const bool report,