mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
extrudeMesh: Add sector extrusion type and specialize wedge and plane
to create single layer extrusions with wedge and empty front and back patches respectively.
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,12 +36,9 @@ Description
|
|||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "dimensionedTypes.H"
|
|
||||||
#include "IFstream.H"
|
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
#include "polyTopoChanger.H"
|
#include "polyTopoChanger.H"
|
||||||
#include "edgeCollapser.H"
|
#include "edgeCollapser.H"
|
||||||
#include "globalMeshData.H"
|
|
||||||
#include "perfectInterface.H"
|
#include "perfectInterface.H"
|
||||||
#include "addPatchCellLayer.H"
|
#include "addPatchCellLayer.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
@ -52,6 +49,11 @@ Description
|
|||||||
#include "extrudedMesh.H"
|
#include "extrudedMesh.H"
|
||||||
#include "extrudeModel.H"
|
#include "extrudeModel.H"
|
||||||
|
|
||||||
|
#include "wedge.H"
|
||||||
|
#include "wedgePolyPatch.H"
|
||||||
|
#include "plane.H"
|
||||||
|
#include "emptyPolyPatch.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -212,6 +214,52 @@ void updateCellSet(const mapPolyMesh& map, labelHashSet& cellLabels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PatchType>
|
||||||
|
void changeFrontBackPatches
|
||||||
|
(
|
||||||
|
polyMesh& mesh,
|
||||||
|
const word& frontPatchName,
|
||||||
|
const word& backPatchName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
label frontPatchI = findPatchID(patches, frontPatchName);
|
||||||
|
label backPatchI = findPatchID(patches, backPatchName);
|
||||||
|
|
||||||
|
DynamicList<polyPatch*> newPatches(patches.size());
|
||||||
|
|
||||||
|
forAll(patches, patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& pp(patches[patchI]);
|
||||||
|
|
||||||
|
if (patchI == frontPatchI || patchI == backPatchI)
|
||||||
|
{
|
||||||
|
newPatches.append
|
||||||
|
(
|
||||||
|
new PatchType
|
||||||
|
(
|
||||||
|
pp.name(),
|
||||||
|
pp.size(),
|
||||||
|
pp.start(),
|
||||||
|
pp.index(),
|
||||||
|
mesh.boundaryMesh(),
|
||||||
|
PatchType::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPatches.append(pp.clone(mesh.boundaryMesh()).ptr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit patches
|
||||||
|
mesh.removeBoundary();
|
||||||
|
mesh.addPatches(newPatches, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
@ -583,8 +631,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Layers per face
|
// Layers per face
|
||||||
labelList nFaceLayers(extrudePatch.size(), model().nLayers());
|
labelList nFaceLayers(extrudePatch.size(), model().nLayers());
|
||||||
|
|
||||||
// Layers per point
|
// Layers per point
|
||||||
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
|
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
|
||||||
|
|
||||||
// Displacement for first layer
|
// Displacement for first layer
|
||||||
vectorField firstLayerDisp(displacement*model().sumThickness(1));
|
vectorField firstLayerDisp(displacement*model().sumThickness(1));
|
||||||
|
|
||||||
@ -791,6 +841,31 @@ int main(int argc, char *argv[])
|
|||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Change the front and back patch types as required
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
word frontBackType(word::null);
|
||||||
|
|
||||||
|
if (isType<extrudeModels::wedge>(model()))
|
||||||
|
{
|
||||||
|
changeFrontBackPatches<wedgePolyPatch>
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
frontPatchName,
|
||||||
|
backPatchName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (isType<extrudeModels::plane>(model()))
|
||||||
|
{
|
||||||
|
changeFrontBackPatches<emptyPolyPatch>
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
frontPatchName,
|
||||||
|
backPatchName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Collapse edges
|
// Collapse edges
|
||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,10 @@ constructFrom patch;
|
|||||||
// If construct from patch/mesh:
|
// If construct from patch/mesh:
|
||||||
sourceCase "../cavity";
|
sourceCase "../cavity";
|
||||||
sourcePatches (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:
|
||||||
surface "movingWall.stl";
|
surface "movingWall.stl";
|
||||||
|
|
||||||
@ -38,10 +40,18 @@ flipNormals false;
|
|||||||
//- Linear extrusion in point-normal direction
|
//- Linear extrusion in point-normal direction
|
||||||
//extrudeModel linearNormal;
|
//extrudeModel linearNormal;
|
||||||
|
|
||||||
|
//- Single layer linear extrusion in point-normal direction
|
||||||
|
// with empty patches on front and back
|
||||||
|
//extrudeModel plane;
|
||||||
|
|
||||||
//- Linear extrusion in specified direction
|
//- Linear extrusion in specified direction
|
||||||
//extrudeModel linearDirection;
|
//extrudeModel linearDirection;
|
||||||
|
|
||||||
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
//- Sector extrusion
|
||||||
|
//extrudeModel sector;
|
||||||
|
|
||||||
|
//- Wedge extrusion of a single layer
|
||||||
|
// with wedge patches on front and back
|
||||||
extrudeModel wedge;
|
extrudeModel wedge;
|
||||||
|
|
||||||
//- Extrudes into sphere around (0 0 0)
|
//- Extrudes into sphere around (0 0 0)
|
||||||
@ -55,9 +65,9 @@ extrudeModel wedge;
|
|||||||
|
|
||||||
nLayers 10;
|
nLayers 10;
|
||||||
|
|
||||||
expansionRatio 1.0; //0.9;
|
expansionRatio 1.0;
|
||||||
|
|
||||||
wedgeCoeffs
|
sectorCoeffs
|
||||||
{
|
{
|
||||||
axisPt (0 0.1 -0.05);
|
axisPt (0 0.1 -0.05);
|
||||||
axis (-1 0 0);
|
axis (-1 0 0);
|
||||||
@ -88,7 +98,6 @@ radialCoeffs
|
|||||||
R table ((0 0.01)(3 0.03)(10 0.1));
|
R table ((0 0.01)(3 0.03)(10 0.1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sigmaRadialCoeffs
|
sigmaRadialCoeffs
|
||||||
{
|
{
|
||||||
RTbyg 1;
|
RTbyg 1;
|
||||||
@ -98,7 +107,7 @@ sigmaRadialCoeffs
|
|||||||
|
|
||||||
// Do front and back need to be merged? Usually only makes sense for 360
|
// Do front and back need to be merged? Usually only makes sense for 360
|
||||||
// degree wedges.
|
// degree wedges.
|
||||||
mergeFaces false; //true;
|
mergeFaces false;
|
||||||
|
|
||||||
// Merge small edges. Fraction of bounding box.
|
// Merge small edges. Fraction of bounding box.
|
||||||
mergeTol 0;
|
mergeTol 0;
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
extrudeModel/extrudeModel.C
|
extrudeModel/extrudeModel.C
|
||||||
extrudeModel/extrudeModelNew.C
|
extrudeModel/extrudeModelNew.C
|
||||||
linearNormal/linearNormal.C
|
linearNormal/linearNormal.C
|
||||||
|
plane/plane.C
|
||||||
linearDirection/linearDirection.C
|
linearDirection/linearDirection.C
|
||||||
linearRadial/linearRadial.C
|
linearRadial/linearRadial.C
|
||||||
radial/radial.C
|
radial/radial.C
|
||||||
sigmaRadial/sigmaRadial.C
|
sigmaRadial/sigmaRadial.C
|
||||||
|
sector/sector.C
|
||||||
|
cyclicSector/cyclicSector.C
|
||||||
wedge/wedge.C
|
wedge/wedge.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
||||||
|
|||||||
62
src/mesh/extrudeModel/cyclicSector/cyclicSector.C
Normal file
62
src/mesh/extrudeModel/cyclicSector/cyclicSector.C
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cyclicSector.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(cyclicSector, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(extrudeModel, cyclicSector, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
cyclicSector::cyclicSector(const dictionary& dict)
|
||||||
|
:
|
||||||
|
sector(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
cyclicSector::~cyclicSector()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
81
src/mesh/extrudeModel/cyclicSector/cyclicSector.H
Normal file
81
src/mesh/extrudeModel/cyclicSector/cyclicSector.H
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::extrudeModels::cyclicSector
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extrudes a sector.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::extrudeModels::sector
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicSector_H
|
||||||
|
#define cyclicSector_H
|
||||||
|
|
||||||
|
#include "sector.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicSector Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cyclicSector
|
||||||
|
:
|
||||||
|
public sector
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cyclicSector");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
cyclicSector(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cyclicSector();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,7 +41,7 @@ Foam::extrudeModel::extrudeModel
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
nLayers_(readLabel(dict.lookup("nLayers"))),
|
nLayers_(dict.lookupOrDefault<label>("nLayers", 1)),
|
||||||
expansionRatio_(readScalar(dict.lookup("expansionRatio"))),
|
expansionRatio_(readScalar(dict.lookup("expansionRatio"))),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
coeffDict_(dict.subDict(modelType + "Coeffs"))
|
coeffDict_(dict.subDict(modelType + "Coeffs"))
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -55,7 +55,7 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
const label nLayers_;
|
label nLayers_;
|
||||||
|
|
||||||
const scalar expansionRatio_;
|
const scalar expansionRatio_;
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::extrudeModels::linearNormal
|
Foam::extrudeModels::linearNormal
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Extrudes by transforming points normal to the surface by a given distance
|
Extrudes by transforming points normal to the surface by a given distance.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
70
src/mesh/extrudeModel/plane/plane.C
Normal file
70
src/mesh/extrudeModel/plane/plane.C
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "plane.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(plane, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(extrudeModel, plane, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
plane::plane(const dictionary& dict)
|
||||||
|
:
|
||||||
|
linearNormal(dict)
|
||||||
|
{
|
||||||
|
if (nLayers_ != 1)
|
||||||
|
{
|
||||||
|
IOWarningIn("plane::plane(const dictionary& dict)", dict)
|
||||||
|
<< "Expected nLayers (if specified) to be 1"
|
||||||
|
<< endl;
|
||||||
|
nLayers_ = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
plane::~plane()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
82
src/mesh/extrudeModel/plane/plane.H
Normal file
82
src/mesh/extrudeModel/plane/plane.H
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::extrudeModels::plane
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extrudes by transforming points normal to the surface by 1 layer over
|
||||||
|
a given distance.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::extrudeModels::linearNormal
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef plane_H
|
||||||
|
#define plane_H
|
||||||
|
|
||||||
|
#include "linearNormal.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class plane Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class plane
|
||||||
|
:
|
||||||
|
public linearNormal
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("plane");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
plane(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~plane();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
125
src/mesh/extrudeModel/sector/sector.C
Normal file
125
src/mesh/extrudeModel/sector/sector.C
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "sector.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "unitConversion.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(sector, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(extrudeModel, sector, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
sector::sector(const dictionary& dict)
|
||||||
|
:
|
||||||
|
extrudeModel(typeName, dict),
|
||||||
|
axisPt_(coeffDict_.lookup("axisPt")),
|
||||||
|
axis_(coeffDict_.lookup("axis")),
|
||||||
|
angle_
|
||||||
|
(
|
||||||
|
degToRad(readScalar(coeffDict_.lookup("angle")))
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
sector::~sector()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
point sector::operator()
|
||||||
|
(
|
||||||
|
const point& surfacePoint,
|
||||||
|
const vector& surfaceNormal,
|
||||||
|
const label layer
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
scalar sliceAngle;
|
||||||
|
|
||||||
|
// For the case of a single layer extrusion assume a
|
||||||
|
// symmetric sector about the reference plane is required
|
||||||
|
if (nLayers_ == 1)
|
||||||
|
{
|
||||||
|
if (layer == 0)
|
||||||
|
{
|
||||||
|
sliceAngle = -angle_/2.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sliceAngle = angle_/2.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sliceAngle = angle_*sumThickness(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find projection onto axis (or rather decompose surfacePoint
|
||||||
|
// into vector along edge (proj), vector normal to edge in plane
|
||||||
|
// of surface point and surface normal.
|
||||||
|
point d = surfacePoint - axisPt_;
|
||||||
|
|
||||||
|
d -= (axis_ & d)*axis_;
|
||||||
|
|
||||||
|
scalar dMag = mag(d);
|
||||||
|
|
||||||
|
point edgePt = surfacePoint - d;
|
||||||
|
|
||||||
|
// Rotate point around sliceAngle.
|
||||||
|
point rotatedPoint = edgePt;
|
||||||
|
|
||||||
|
if (dMag > VSMALL)
|
||||||
|
{
|
||||||
|
vector n = (d/dMag) ^ axis_;
|
||||||
|
|
||||||
|
rotatedPoint +=
|
||||||
|
+ cos(sliceAngle)*d
|
||||||
|
- sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
|
||||||
|
}
|
||||||
|
|
||||||
|
return rotatedPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
107
src/mesh/extrudeModel/sector/sector.H
Normal file
107
src/mesh/extrudeModel/sector/sector.H
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::extrudeModels::sector
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extrudes by rotating a surface around an axis
|
||||||
|
- extrusion is opposite the surface/patch normal so inwards the source
|
||||||
|
mesh
|
||||||
|
- axis direction has to be consistent with this.
|
||||||
|
- use -mergeFaces option if doing full 360 and want to merge front and back
|
||||||
|
- note direction of axis. This should be consistent with rotating against
|
||||||
|
the patch normal direction. If you get it wrong you'll see all cells
|
||||||
|
with extreme aspect ratio and internal faces wrong way around in
|
||||||
|
checkMesh
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef sector_H
|
||||||
|
#define sector_H
|
||||||
|
|
||||||
|
#include "extrudeModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class sector Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class sector
|
||||||
|
:
|
||||||
|
public extrudeModel
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Point on axis
|
||||||
|
const point axisPt_;
|
||||||
|
|
||||||
|
//- Normalized direction of axis
|
||||||
|
const vector axis_;
|
||||||
|
|
||||||
|
//- Overall angle (radians)
|
||||||
|
const scalar angle_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("sector");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
sector(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~sector();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
point operator()
|
||||||
|
(
|
||||||
|
const point& surfacePoint,
|
||||||
|
const vector& surfaceNormal,
|
||||||
|
const label layer
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,7 +25,6 @@ License
|
|||||||
|
|
||||||
#include "wedge.H"
|
#include "wedge.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "unitConversion.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -45,14 +44,16 @@ addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
|
|||||||
|
|
||||||
wedge::wedge(const dictionary& dict)
|
wedge::wedge(const dictionary& dict)
|
||||||
:
|
:
|
||||||
extrudeModel(typeName, dict),
|
sector(dict)
|
||||||
axisPt_(coeffDict_.lookup("axisPt")),
|
{
|
||||||
axis_(coeffDict_.lookup("axis")),
|
if (nLayers_ != 1)
|
||||||
angle_
|
{
|
||||||
(
|
IOWarningIn("wedge::wedge(const dictionary& dict)", dict)
|
||||||
degToRad(readScalar(coeffDict_.lookup("angle")))
|
<< "Expected nLayers (if specified) to be 1"
|
||||||
)
|
<< endl;
|
||||||
{}
|
nLayers_ = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -61,62 +62,6 @@ wedge::~wedge()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
point wedge::operator()
|
|
||||||
(
|
|
||||||
const point& surfacePoint,
|
|
||||||
const vector& surfaceNormal,
|
|
||||||
const label layer
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
scalar sliceAngle;
|
|
||||||
// For the case of a single layer extrusion assume a
|
|
||||||
// symmetric wedge about the reference plane is required
|
|
||||||
if (nLayers_ == 1)
|
|
||||||
{
|
|
||||||
if (layer == 0)
|
|
||||||
{
|
|
||||||
sliceAngle = -angle_/2.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sliceAngle = angle_/2.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//sliceAngle = angle_*layer/nLayers_;
|
|
||||||
sliceAngle = angle_*sumThickness(layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find projection onto axis (or rather decompose surfacePoint
|
|
||||||
// into vector along edge (proj), vector normal to edge in plane
|
|
||||||
// of surface point and surface normal.
|
|
||||||
point d = surfacePoint - axisPt_;
|
|
||||||
|
|
||||||
d -= (axis_ & d)*axis_;
|
|
||||||
|
|
||||||
scalar dMag = mag(d);
|
|
||||||
|
|
||||||
point edgePt = surfacePoint - d;
|
|
||||||
|
|
||||||
// Rotate point around sliceAngle.
|
|
||||||
point rotatedPoint = edgePt;
|
|
||||||
|
|
||||||
if (dMag > VSMALL)
|
|
||||||
{
|
|
||||||
vector n = (d/dMag) ^ axis_;
|
|
||||||
|
|
||||||
rotatedPoint +=
|
|
||||||
+ cos(sliceAngle)*d
|
|
||||||
- sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
|
|
||||||
}
|
|
||||||
|
|
||||||
return rotatedPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace extrudeModels
|
} // End namespace extrudeModels
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,22 +25,17 @@ Class
|
|||||||
Foam::extrudeModels::wedge
|
Foam::extrudeModels::wedge
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Extrudes by rotating a surface around an axis
|
Extrudes by rotating a surface symmetrically around axis by 1 layer.
|
||||||
- extrusion is opposite the surface/patch normal so inwards the source
|
|
||||||
mesh
|
SeeAlso
|
||||||
- axis direction has to be consistent with this.
|
Foam::extrudeModels::sector
|
||||||
- use -mergeFaces option if doing full 360 and want to merge front and back
|
|
||||||
- note direction of axis. This should be consistent with rotating against
|
|
||||||
the patch normal direction. If you get it wrong you'll see all cells
|
|
||||||
with extreme aspect ratio and internal faces wrong way around in
|
|
||||||
checkMesh
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef wedge_H
|
#ifndef wedge_H
|
||||||
#define wedge_H
|
#define wedge_H
|
||||||
|
|
||||||
#include "extrudeModel.H"
|
#include "sector.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -55,19 +50,8 @@ namespace extrudeModels
|
|||||||
|
|
||||||
class wedge
|
class wedge
|
||||||
:
|
:
|
||||||
public extrudeModel
|
public sector
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Point on axis
|
|
||||||
const point axisPt_;
|
|
||||||
|
|
||||||
//- Normalized direction of axis
|
|
||||||
const vector axis_;
|
|
||||||
|
|
||||||
//- Overall angle (radians)
|
|
||||||
const scalar angle_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -82,16 +66,6 @@ public:
|
|||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~wedge();
|
virtual ~wedge();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
point operator()
|
|
||||||
(
|
|
||||||
const point& surfacePoint,
|
|
||||||
const vector& surfaceNormal,
|
|
||||||
const label layer
|
|
||||||
) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user