diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H index 8b3b05463a..2b430225a8 100644 --- a/src/mesh/blockMesh/blockMesh/blockMesh.H +++ b/src/mesh/blockMesh/blockMesh/blockMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -155,6 +155,38 @@ class blockMesh faceList createPatchFaces(const polyPatch& patchTopologyFaces) const; + Pair xCellSizes + ( + const block& b, + const pointField& blockPoints, + const label j, + const label k + ) const; + + Pair yCellSizes + ( + const block& b, + const pointField& blockPoints, + const label i, + const label k + ) const; + + Pair zCellSizes + ( + const block& b, + const pointField& blockPoints, + const label i, + const label j + ) const; + + void printCellSizeRange(const Pair& cellSizes) const; + + void printCellSizeRanges + ( + const direction d, + const FixedList, 4>& cellSizes + ) const; + void createPoints() const; void createCells() const; void createPatches() const; diff --git a/src/mesh/blockMesh/blockMesh/blockMeshCreate.C b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C index f66a58e595..6e91f0af6d 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshCreate.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,6 +28,137 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +Foam::Pair Foam::blockMesh::xCellSizes +( + const block& b, + const pointField& blockPoints, + const label j, + const label k +) const +{ + return Pair + ( + mag + ( + blockPoints[b.pointLabel(1, j, k)] + - blockPoints[b.pointLabel(0, j, k)] + ), + + mag + ( + blockPoints[b.pointLabel(b.density().x() - 1, j, k)] + - blockPoints[b.pointLabel(b.density().x(), j, k)] + ) + ); +} + + +Foam::Pair Foam::blockMesh::yCellSizes +( + const block& b, + const pointField& blockPoints, + const label i, + const label k +) const +{ + return Pair + ( + mag + ( + blockPoints[b.pointLabel(i, 0, k)] + - blockPoints[b.pointLabel(i, 1, k)] + ), + + mag + ( + blockPoints[b.pointLabel(i, b.density().y() - 1, k)] + - blockPoints[b.pointLabel(i, b.density().y(), k)] + ) + ); +} + + +Foam::Pair Foam::blockMesh::zCellSizes +( + const block& b, + const pointField& blockPoints, + const label i, + const label j +) const +{ + return Pair + ( + mag + ( + blockPoints[b.pointLabel(i, j, 0)] + - blockPoints[b.pointLabel(i, j, 1)] + ), + + mag + ( + blockPoints[b.pointLabel(i, j, b.density().z() - 1)] + - blockPoints[b.pointLabel(i, j, b.density().z())] + ) + ); +} + + +void Foam::blockMesh::printCellSizeRange +( + const Pair& cellSizes +) const +{ + if (cellSizes.first() != cellSizes.second()) + { + Info<< scaleFactor_*cellSizes.first() << " .. " + << scaleFactor_*cellSizes.second(); + } + else + { + Info<< scaleFactor_*cellSizes.first(); + } +} + + +void Foam::blockMesh::printCellSizeRanges +( + const direction d, + const FixedList, 4>& cellSizes +) const +{ + static const char dNames[3] = {'i', 'j', 'k'}; + + const scalar d0 = max + ( + max(cellSizes[0].first(), cellSizes[0].second()), + small + ); + + bool uniform = true; + forAll(cellSizes, i) + { + uniform = uniform + && mag(cellSizes[i].first() - cellSizes[0].first())/d0 < 1e-5 + && mag(cellSizes[i].second() - cellSizes[0].second())/d0 < 1e-5; + } + + Info<< " " << dNames[d] << " : "; + if (uniform) + { + printCellSizeRange(cellSizes[0]); + } + else + { + forAll(cellSizes, i) + { + printCellSizeRange(cellSizes[i]); + Info<< " "; + } + } + Info<< endl; +} + + void Foam::blockMesh::createPoints() const { const blockList& blocks = *this; @@ -45,36 +176,40 @@ void Foam::blockMesh::createPoints() const if (verboseOutput) { - const Vector