1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
28 #include "unitConversion.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace extrudeModels
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(wedge, 0);
41 addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 wedge::wedge(const dictionary& dict)
48 extrudeModel(typeName, dict),
49 axisPt_(coeffDict_.lookup("axisPt")),
50 axis_(coeffDict_.lookup("axis")),
53 degToRad(readScalar(coeffDict_.lookup("angle")))
58 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
64 // * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
66 point wedge::operator()
68 const point& surfacePoint,
69 const vector& surfaceNormal,
74 // For the case of a single layer extrusion assume a
75 // symmetric wedge about the reference plane is required
80 sliceAngle = -angle_/2.0;
84 sliceAngle = angle_/2.0;
89 //sliceAngle = angle_*layer/nLayers_;
90 sliceAngle = angle_*sumThickness(layer);
93 // Find projection onto axis (or rather decompose surfacePoint
94 // into vector along edge (proj), vector normal to edge in plane
95 // of surface point and surface normal.
96 point d = surfacePoint - axisPt_;
98 d -= (axis_ & d)*axis_;
100 scalar dMag = mag(d);
102 point edgePt = surfacePoint - d;
104 // Rotate point around sliceAngle.
105 point rotatedPoint = edgePt;
109 vector n = (d/dMag) ^ axis_;
113 - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 } // End namespace extrudeModels
123 } // End namespace Foam
125 // ************************************************************************* //