diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C new file mode 100644 index 000000000..e15066faa --- /dev/null +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C @@ -0,0 +1,560 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Description + Cell layer addition/removal mesh modifier + +\*---------------------------------------------------------------------------*/ + +#include "layerAdditionRemoval.H" +#include "polyTopoChanger.H" +#include "polyMesh.H" +#include "foamTime.H" +#include "primitiveMesh.H" +#include "polyTopoChange.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(layerAdditionRemoval, 0); + addToRunTimeSelectionTable + ( + polyMeshModifier, + layerAdditionRemoval, + dictionary + ); +} + + +const Foam::scalar Foam::layerAdditionRemoval::addDelta_ = 0.3; +const Foam::scalar Foam::layerAdditionRemoval::removeDelta_ = 0.1; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::layerAdditionRemoval::checkDefinition() +{ + if (!faceZoneID_.active()) + { + FatalErrorIn + ( + "void Foam::layerAdditionRemoval::checkDefinition()" + ) << "Master face zone named " << faceZoneID_.name() + << " cannot be found." + << abort(FatalError); + } + + const polyMesh& mesh = topoChanger().mesh(); + + if (debug > 1) + { + fileName fvPath(mesh.time().path()/"VTK"); + mkDir(fvPath); + + Info<< "Writing VTK files master face zone" + << "Layer addition/removal " << name() + << ", face zone " << faceZoneID_.name() + << "into " << fvPath + << endl; + + primitiveFacePatch::writeVTK + ( + fvPath/fileName(faceZoneID_.name() + "FaceZone"), + mesh.faceZones()[faceZoneID_.index()]().localFaces(), + mesh.faceZones()[faceZoneID_.index()]().localPoints() + ); + + primitiveFacePatch::writeVTKNormals + ( + fvPath/fileName(faceZoneID_.name() + "FaceZoneNormals"), + mesh.faceZones()[faceZoneID_.index()]().localFaces(), + mesh.faceZones()[faceZoneID_.index()]().localPoints() + ); + } + + if + ( + minLayerThickness_ < VSMALL + || maxLayerThickness_ < minLayerThickness_ + ) + { + FatalErrorIn + ( + "void Foam::layerAdditionRemoval::checkDefinition()" + ) << "Incorrect layer thickness definition." + << abort(FatalError); + } + + // Check size of zones + label globalZoneSize = + returnReduce + ( + mesh.faceZones()[faceZoneID_.index()].size(), + sumOp