1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 \*---------------------------------------------------------------------------*/
27 #include "wedgePolyPatch.H"
28 #include "addToRunTimeSelectionTable.H"
30 #include "transform.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(wedgePolyPatch, 0);
38 addToRunTimeSelectionTable(polyPatch, wedgePolyPatch, word);
39 addToRunTimeSelectionTable(polyPatch, wedgePolyPatch, dictionary);
42 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
44 void Foam::wedgePolyPatch::initTransforms()
46 const pointField& points = this->points();
48 patchNormal_ = operator[](0).normal(points);
49 patchNormal_ /= mag(patchNormal_);
54 sign(patchNormal_.x())*(max(mag(patchNormal_.x()), 0.5) - 0.5),
55 sign(patchNormal_.y())*(max(mag(patchNormal_.y()), 0.5) - 0.5),
56 sign(patchNormal_.z())*(max(mag(patchNormal_.z()), 0.5) - 0.5)
58 centreNormal_ /= mag(centreNormal_);
62 mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
68 "wedgePolyPatch::wedgePolyPatch(const polyPatch&, "
69 "const fvBoundaryMesh&)"
70 ) << "wedge " << name()
71 << " centre plane does not align with a coordinate plane by "
73 - mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
77 axis_ = centreNormal_ ^ patchNormal_;
78 scalar magAxis = mag(axis_);
85 "wedgePolyPatch::initTransforms()"
86 ) << "wedge " << name()
87 << " plane aligns with a coordinate plane." << nl
88 << " The wedge plane should make a small angle (~2.5deg)"
89 " with the coordinate plane" << nl
90 << " and the the pair of wedge planes should be symmetric"
91 << " about the coordinate plane." << nl
92 << " Normal of face " << 0 << " is " << patchNormal_
93 << " , implied coordinate plane direction is " << centreNormal_
97 faceT_ = rotationTensor(centreNormal_, patchNormal_);
98 cellT_ = faceT_ & faceT_;
102 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
104 Foam::wedgePolyPatch::wedgePolyPatch
110 const polyBoundaryMesh& bm
113 polyPatch(name, size, start, index, bm)
119 Foam::wedgePolyPatch::wedgePolyPatch
122 const dictionary& dict,
124 const polyBoundaryMesh& bm
127 polyPatch(name, dict, index, bm)
133 Foam::wedgePolyPatch::wedgePolyPatch
135 const wedgePolyPatch& pp,
136 const polyBoundaryMesh& bm
145 Foam::wedgePolyPatch::wedgePolyPatch
147 const wedgePolyPatch& pp,
148 const polyBoundaryMesh& bm,
154 polyPatch(pp, bm, index, newSize, newStart)
160 // ************************************************************************* //