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:
parent
5f7d4e4502
commit
d7e1d5c24d
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,12 +36,9 @@ Description
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "dimensionedTypes.H"
|
||||
#include "IFstream.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "edgeCollapser.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "perfectInterface.H"
|
||||
#include "addPatchCellLayer.H"
|
||||
#include "fvMesh.H"
|
||||
@ -52,6 +49,11 @@ Description
|
||||
#include "extrudedMesh.H"
|
||||
#include "extrudeModel.H"
|
||||
|
||||
#include "wedge.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "plane.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
|
||||
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[])
|
||||
{
|
||||
#include "addRegionOption.H"
|
||||
@ -583,8 +631,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Layers per face
|
||||
labelList nFaceLayers(extrudePatch.size(), model().nLayers());
|
||||
|
||||
// Layers per point
|
||||
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
|
||||
|
||||
// Displacement for first layer
|
||||
vectorField firstLayerDisp(displacement*model().sumThickness(1));
|
||||
|
||||
@ -791,6 +841,31 @@ int main(int argc, char *argv[])
|
||||
<< 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
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -26,8 +26,10 @@ constructFrom patch;
|
||||
// If construct from patch/mesh:
|
||||
sourceCase "../cavity";
|
||||
sourcePatches (movingWall);
|
||||
|
||||
// If construct from patch: patch to use for back (can be same as sourcePatch)
|
||||
exposedPatchName movingWall;
|
||||
|
||||
// If construct from surface:
|
||||
surface "movingWall.stl";
|
||||
|
||||
@ -38,10 +40,18 @@ flipNormals false;
|
||||
//- Linear extrusion in point-normal direction
|
||||
//extrudeModel linearNormal;
|
||||
|
||||
//- Single layer linear extrusion in point-normal direction
|
||||
// with empty patches on front and back
|
||||
//extrudeModel plane;
|
||||
|
||||
//- Linear extrusion in specified direction
|
||||
//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;
|
||||
|
||||
//- Extrudes into sphere around (0 0 0)
|
||||
@ -55,9 +65,9 @@ extrudeModel wedge;
|
||||
|
||||
nLayers 10;
|
||||
|
||||
expansionRatio 1.0; //0.9;
|
||||
expansionRatio 1.0;
|
||||
|
||||
wedgeCoeffs
|
||||
sectorCoeffs
|
||||
{
|
||||
axisPt (0 0.1 -0.05);
|
||||
axis (-1 0 0);
|
||||
@ -88,7 +98,6 @@ radialCoeffs
|
||||
R table ((0 0.01)(3 0.03)(10 0.1));
|
||||
}
|
||||
|
||||
|
||||
sigmaRadialCoeffs
|
||||
{
|
||||
RTbyg 1;
|
||||
@ -98,7 +107,7 @@ sigmaRadialCoeffs
|
||||
|
||||
// Do front and back need to be merged? Usually only makes sense for 360
|
||||
// degree wedges.
|
||||
mergeFaces false; //true;
|
||||
mergeFaces false;
|
||||
|
||||
// Merge small edges. Fraction of bounding box.
|
||||
mergeTol 0;
|
||||
|
@ -1,10 +1,13 @@
|
||||
extrudeModel/extrudeModel.C
|
||||
extrudeModel/extrudeModelNew.C
|
||||
linearNormal/linearNormal.C
|
||||
plane/plane.C
|
||||
linearDirection/linearDirection.C
|
||||
linearRadial/linearRadial.C
|
||||
radial/radial.C
|
||||
sigmaRadial/sigmaRadial.C
|
||||
sector/sector.C
|
||||
cyclicSector/cyclicSector.C
|
||||
wedge/wedge.C
|
||||
|
||||
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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,7 @@ Foam::extrudeModel::extrudeModel
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nLayers_(readLabel(dict.lookup("nLayers"))),
|
||||
nLayers_(dict.lookupOrDefault<label>("nLayers", 1)),
|
||||
expansionRatio_(readScalar(dict.lookup("expansionRatio"))),
|
||||
dict_(dict),
|
||||
coeffDict_(dict.subDict(modelType + "Coeffs"))
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const label nLayers_;
|
||||
label nLayers_;
|
||||
|
||||
const scalar expansionRatio_;
|
||||
|
||||
|
@ -25,7 +25,7 @@ Class
|
||||
Foam::extrudeModels::linearNormal
|
||||
|
||||
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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "wedge.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -45,14 +44,16 @@ addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
|
||||
|
||||
wedge::wedge(const dictionary& dict)
|
||||
:
|
||||
extrudeModel(typeName, dict),
|
||||
axisPt_(coeffDict_.lookup("axisPt")),
|
||||
axis_(coeffDict_.lookup("axis")),
|
||||
angle_
|
||||
(
|
||||
degToRad(readScalar(coeffDict_.lookup("angle")))
|
||||
)
|
||||
{}
|
||||
sector(dict)
|
||||
{
|
||||
if (nLayers_ != 1)
|
||||
{
|
||||
IOWarningIn("wedge::wedge(const dictionary& dict)", dict)
|
||||
<< "Expected nLayers (if specified) to be 1"
|
||||
<< endl;
|
||||
nLayers_ = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,22 +25,17 @@ Class
|
||||
Foam::extrudeModels::wedge
|
||||
|
||||
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
|
||||
Extrudes by rotating a surface symmetrically around axis by 1 layer.
|
||||
|
||||
SeeAlso
|
||||
Foam::extrudeModels::sector
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedge_H
|
||||
#define wedge_H
|
||||
|
||||
#include "extrudeModel.H"
|
||||
#include "sector.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,19 +50,8 @@ namespace extrudeModels
|
||||
|
||||
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:
|
||||
|
||||
@ -82,16 +66,6 @@ public:
|
||||
|
||||
//- Destructor
|
||||
virtual ~wedge();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user