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 \*---------------------------------------------------------------------------*/
26 #include "wedgePolyPatch.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "transform.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(wedgePolyPatch, 0);
37 addToRunTimeSelectionTable(polyPatch, wedgePolyPatch, word);
38 addToRunTimeSelectionTable(polyPatch, wedgePolyPatch, dictionary);
41 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
43 void Foam::wedgePolyPatch::initTransforms()
47 const pointField& points = this->points();
49 patchNormal_ = operator[](0).normal(points);
50 patchNormal_ /= mag(patchNormal_);
55 sign(patchNormal_.x())*(max(mag(patchNormal_.x()), 0.5) - 0.5),
56 sign(patchNormal_.y())*(max(mag(patchNormal_.y()), 0.5) - 0.5),
57 sign(patchNormal_.z())*(max(mag(patchNormal_.z()), 0.5) - 0.5)
59 centreNormal_ /= mag(centreNormal_);
63 mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
69 "wedgePolyPatch::wedgePolyPatch(const polyPatch&, "
70 "const fvBoundaryMesh&)"
71 ) << "wedge " << name()
72 << " centre plane does not align with a coordinate plane by "
74 - mag(centreNormal_.x()+centreNormal_.y()+centreNormal_.z())
78 axis_ = centreNormal_ ^ patchNormal_;
79 scalar magAxis = mag(axis_);
86 "wedgePolyPatch::initTransforms()"
87 ) << "wedge " << name()
88 << " plane aligns with a coordinate plane." << nl
89 << " The wedge plane should make a small angle (~2.5deg)"
90 " with the coordinate plane" << nl
91 << " and the the pair of wedge planes should be symmetric"
92 << " about the coordinate plane." << nl
93 << " Normal of face " << 0 << " is " << patchNormal_
94 << " , implied coordinate plane direction is " << centreNormal_
98 faceT_ = rotationTensor(centreNormal_, patchNormal_);
99 cellT_ = faceT_ & faceT_;
104 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
106 Foam::wedgePolyPatch::wedgePolyPatch
112 const polyBoundaryMesh& bm
115 polyPatch(name, size, start, index, bm)
121 Foam::wedgePolyPatch::wedgePolyPatch
124 const dictionary& dict,
126 const polyBoundaryMesh& bm
129 polyPatch(name, dict, index, bm)
135 Foam::wedgePolyPatch::wedgePolyPatch
137 const wedgePolyPatch& pp,
138 const polyBoundaryMesh& bm
147 Foam::wedgePolyPatch::wedgePolyPatch
149 const wedgePolyPatch& pp,
150 const polyBoundaryMesh& bm,
156 polyPatch(pp, bm, index, newSize, newStart)
162 Foam::wedgePolyPatch::wedgePolyPatch
164 const wedgePolyPatch& pp,
165 const polyBoundaryMesh& bm,
167 const labelUList& mapAddressing,
171 polyPatch(pp, bm, index, mapAddressing, newStart)
177 // ************************************************************************* //