diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C index bb590da011..5aadec52c9 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C @@ -138,12 +138,29 @@ label findPatchID(const polyBoundaryMesh& patches, const word& name) } -labelList patchFaces(const polyBoundaryMesh& patches, const word& name) +labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names) { - label patchID = findPatchID(patches, name); - const polyPatch& pp = patches[patchID]; + label n = 0; - return identity(pp.size()) + pp.start(); + forAll(names, i) + { + const polyPatch& pp = patches[findPatchID(patches, names[i])]; + + n += pp.size(); + } + labelList faceLabels(n); + n = 0; + forAll(names, i) + { + const polyPatch& pp = patches[findPatchID(patches, names[i])]; + + forAll(pp, j) + { + faceLabels[n++] = pp.start()+j; + } + } + + return faceLabels; } @@ -242,9 +259,15 @@ int main(int argc, char *argv[]) sourceCasePath.expand(); fileName sourceRootDir = sourceCasePath.path(); fileName sourceCaseDir = sourceCasePath.name(); - dict.lookup("sourcePatch") >> frontPatchName; + wordList sourcePatches; + dict.lookup("sourcePatches") >> sourcePatches; - Info<< "Extruding patch " << frontPatchName + if (sourcePatches.size() == 1) + { + frontPatchName = sourcePatches[0]; + } + + Info<< "Extruding patches " << sourcePatches << " on mesh " << sourceCasePath << nl << endl; @@ -279,7 +302,7 @@ int main(int argc, char *argv[]) IndirectList ( mesh.faces(), - patchFaces(patches, frontPatchName) + patchFaces(patches, sourcePatches) ), mesh.points() ); @@ -478,13 +501,13 @@ int main(int argc, char *argv[]) frontPatchFaces = patchFaces ( meshFromSurface().boundaryMesh(), - frontPatchName + wordList(1, frontPatchName) ); backPatchName = "otherSide"; backPatchFaces = patchFaces ( meshFromSurface().boundaryMesh(), - backPatchName + wordList(1, backPatchName) ); } diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files index c8d0cc571b..91b2eccf28 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files @@ -1,6 +1,7 @@ extrudeModel/extrudeModel.C extrudeModel/newExtrudeModel.C linearNormal/linearNormal.C +linearDirection/linearDirection.C linearRadial/linearRadial.C sigmaRadial/sigmaRadial.C wedge/wedge.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.C new file mode 100644 index 0000000000..9fa8387eec --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "linearDirection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(linearDirection, 0); + +addToRunTimeSelectionTable(extrudeModel, linearDirection, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +linearDirection::linearDirection(const dictionary& dict) +: + extrudeModel(typeName, dict), + direction_(coeffDict_.lookup("direction")), + thickness_(readScalar(coeffDict_.lookup("thickness"))) +{ + direction_ /= mag(direction_); + + if (thickness_ <= 0) + { + FatalErrorIn("linearDirection(const dictionary&)") + << "thickness should be positive : " << thickness_ + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +linearDirection::~linearDirection() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point linearDirection::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + //scalar d = thickness_*layer/nLayers_; + scalar d = thickness_*sumThickness(layer); + return surfacePoint + d*direction_; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.H new file mode 100644 index 0000000000..0982e4e153 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::extrudeModels::linearDirection + +Description + Extrudes by transforming points in a specified direction by a given distance + +\*---------------------------------------------------------------------------*/ + +#ifndef linearDirection_H +#define linearDirection_H + +#include "point.H" +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class linearDirection Declaration +\*---------------------------------------------------------------------------*/ + +class linearDirection +: + public extrudeModel +{ + // Private data + + //- Extrude direction + vector direction_; + + //- layer thickness + scalar thickness_; + + +public: + + //- Runtime type information + TypeName("linearDirection"); + + // Constructors + + //- Construct from dictionary + linearDirection(const dictionary& dict); + + + //- Destructor + ~linearDirection(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties index e1283ab8b5..faf875774d 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties @@ -25,7 +25,7 @@ constructFrom patch; // If construct from patch/mesh: sourceCase "../cavity"; -sourcePatch movingWall; +sourcePatches (movingWall); // If construct from patch: patch to use for back (can be same as sourcePatch) exposedPatchName movingWall; // If construct from surface: @@ -41,6 +41,9 @@ flipNormals false; //- Linear extrusion in point-normal direction //extrudeModel linearNormal; +//- Linear extrusion in specified direction +//extrudeModel linearDirection; + //- Wedge extrusion. If nLayers is 1 assumes symmetry around plane. extrudeModel wedge; @@ -66,6 +69,11 @@ linearNormalCoeffs thickness 0.05; } +linearDirectionCoeffs +{ + direction (0 0 1); +} + linearRadialCoeffs { R 0.1;