1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include "addToRunTimeSelectionTable.H"
29 #include "mathematicalConstants.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace extrudeModels
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(wedge, 0);
42 addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 wedge::wedge(const dictionary& dict)
49 extrudeModel(typeName, dict),
50 axisPt_(coeffDict_.lookup("axisPt")),
51 axisNormal_(coeffDict_.lookup("axisNormal")),
54 readScalar(coeffDict_.lookup("angle"))
55 *mathematicalConstant::pi/180.0
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 // * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
68 point wedge::operator()
70 const point& surfacePoint,
71 const vector& surfaceNormal,
76 // For the case of a single layer extrusion assume a
77 // symmetric wedge about the reference plane is required
82 sliceAngle = -angle_/2.0;
86 sliceAngle = angle_/2.0;
91 //sliceAngle = angle_*(layer + 1)/nLayers_;
92 sliceAngle = angle_*layer/nLayers_;
95 // Find projection onto axis (or rather decompose surfacePoint
96 // into vector along edge (proj), vector normal to edge in plane
97 // of surface point and surface normal.
98 point d = surfacePoint - axisPt_;
100 d -= (axisNormal_ & d)*axisNormal_;
102 scalar dMag = mag(d);
104 point edgePt = surfacePoint - d;
106 // Rotate point around sliceAngle.
107 point rotatedPoint = edgePt;
111 vector n = (d/dMag) ^ axisNormal_;
115 - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 } // End namespace extrudeModels
125 } // End namespace Foam
127 // ************************************************************************* //