mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
specified direction extrusion mode
This commit is contained in:
@ -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);
|
label n = 0;
|
||||||
const polyPatch& pp = patches[patchID];
|
|
||||||
|
|
||||||
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();
|
sourceCasePath.expand();
|
||||||
fileName sourceRootDir = sourceCasePath.path();
|
fileName sourceRootDir = sourceCasePath.path();
|
||||||
fileName sourceCaseDir = sourceCasePath.name();
|
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
|
<< " on mesh " << sourceCasePath << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
@ -279,7 +302,7 @@ int main(int argc, char *argv[])
|
|||||||
IndirectList<face>
|
IndirectList<face>
|
||||||
(
|
(
|
||||||
mesh.faces(),
|
mesh.faces(),
|
||||||
patchFaces(patches, frontPatchName)
|
patchFaces(patches, sourcePatches)
|
||||||
),
|
),
|
||||||
mesh.points()
|
mesh.points()
|
||||||
);
|
);
|
||||||
@ -478,13 +501,13 @@ int main(int argc, char *argv[])
|
|||||||
frontPatchFaces = patchFaces
|
frontPatchFaces = patchFaces
|
||||||
(
|
(
|
||||||
meshFromSurface().boundaryMesh(),
|
meshFromSurface().boundaryMesh(),
|
||||||
frontPatchName
|
wordList(1, frontPatchName)
|
||||||
);
|
);
|
||||||
backPatchName = "otherSide";
|
backPatchName = "otherSide";
|
||||||
backPatchFaces = patchFaces
|
backPatchFaces = patchFaces
|
||||||
(
|
(
|
||||||
meshFromSurface().boundaryMesh(),
|
meshFromSurface().boundaryMesh(),
|
||||||
backPatchName
|
wordList(1, backPatchName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
extrudeModel/extrudeModel.C
|
extrudeModel/extrudeModel.C
|
||||||
extrudeModel/newExtrudeModel.C
|
extrudeModel/newExtrudeModel.C
|
||||||
linearNormal/linearNormal.C
|
linearNormal/linearNormal.C
|
||||||
|
linearDirection/linearDirection.C
|
||||||
linearRadial/linearRadial.C
|
linearRadial/linearRadial.C
|
||||||
sigmaRadial/sigmaRadial.C
|
sigmaRadial/sigmaRadial.C
|
||||||
wedge/wedge.C
|
wedge/wedge.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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ constructFrom patch;
|
|||||||
|
|
||||||
// If construct from patch/mesh:
|
// If construct from patch/mesh:
|
||||||
sourceCase "../cavity";
|
sourceCase "../cavity";
|
||||||
sourcePatch movingWall;
|
sourcePatches (movingWall);
|
||||||
// If construct from patch: patch to use for back (can be same as sourcePatch)
|
// If construct from patch: patch to use for back (can be same as sourcePatch)
|
||||||
exposedPatchName movingWall;
|
exposedPatchName movingWall;
|
||||||
// If construct from surface:
|
// If construct from surface:
|
||||||
@ -41,6 +41,9 @@ flipNormals false;
|
|||||||
//- Linear extrusion in point-normal direction
|
//- Linear extrusion in point-normal direction
|
||||||
//extrudeModel linearNormal;
|
//extrudeModel linearNormal;
|
||||||
|
|
||||||
|
//- Linear extrusion in specified direction
|
||||||
|
//extrudeModel linearDirection;
|
||||||
|
|
||||||
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
||||||
extrudeModel wedge;
|
extrudeModel wedge;
|
||||||
|
|
||||||
@ -66,6 +69,11 @@ linearNormalCoeffs
|
|||||||
thickness 0.05;
|
thickness 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
linearDirectionCoeffs
|
||||||
|
{
|
||||||
|
direction (0 0 1);
|
||||||
|
}
|
||||||
|
|
||||||
linearRadialCoeffs
|
linearRadialCoeffs
|
||||||
{
|
{
|
||||||
R 0.1;
|
R 0.1;
|
||||||
|
|||||||
Reference in New Issue
Block a user