1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "parabolicCylindricalCS.H"
27 #include "mathematicalConstants.H"
29 #include "addToRunTimeSelectionTable.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(parabolicCylindricalCS, 0);
36 addToRunTimeSelectionTable
39 parabolicCylindricalCS,
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 Foam::parabolicCylindricalCS::parabolicCylindricalCS(const bool inDegrees)
54 Foam::parabolicCylindricalCS::parabolicCylindricalCS
58 const coordinateRotation& cr,
62 coordinateSystem(name, origin, cr),
67 Foam::parabolicCylindricalCS::parabolicCylindricalCS
70 const dictionary& dict
73 coordinateSystem(name, dict),
74 inDegrees_(dict.lookupOrDefault<Switch>("degrees", true))
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 Foam::coordinateSystem::spanInfo
81 Foam::parabolicCylindricalCS::spanLimited() const
83 spanInfo b(Pair<bool>(true, true));
85 // Upper bound or r is unlimited
86 b[0] = Pair<bool>(true, false);
89 b[2] = Pair<bool>(false, false);
95 Foam::boundBox Foam::parabolicCylindricalCS::spanBounds() const
102 ( inDegrees_ ? -180.0 : -mathematicalConstant::pi ),
108 ( inDegrees_ ? 180.0 : mathematicalConstant::pi ),
115 bool Foam::parabolicCylindricalCS::inDegrees() const
121 Foam::Switch& Foam::parabolicCylindricalCS::inDegrees()
127 Foam::vector Foam::parabolicCylindricalCS::localToGlobal
133 // Notation: u = local.x() v = local.y() z = local.z();
138 "parabolicCylindricalCS::localToGlobal(const vector&, bool) const"
140 << "parabolic cylindrical coordinates v < 0"
141 << abort(FatalError);
144 return coordinateSystem::localToGlobal
148 0.5*(sqr(local.x()) - sqr(local.y())),
157 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
159 const vectorField& local,
163 if (min(local.component(vector::Y)) < 0.0)
167 "parabolicCylindricalCS::localToGlobal"
168 "(const vectorField&, bool) const"
169 ) << "parabolic cylindrical coordinates v < 0"
170 << abort(FatalError);
173 vectorField lc(local.size());
179 sqr(local.component(vector::X))
180 - sqr(local.component(vector::Y))
187 local.component(vector::X) * local.component(vector::Y)
193 local.component(vector::Z)
196 return coordinateSystem::localToGlobal(lc, translate);
200 Foam::vector Foam::parabolicCylindricalCS::globalToLocal
202 const vector& global,
208 "parabolicCylindricalCS::globalToLocal(const vector&, bool) const"
214 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal
216 const vectorField& global,
222 "parabolicCylindricalCS::globalToLocal(const vectorField&, bool) const"
225 return tmp<vectorField>(vectorField::null());
229 void Foam::parabolicCylindricalCS::write(Ostream& os) const
231 coordinateSystem::write(os);
232 os << "inDegrees: " << inDegrees() << endl;
236 void Foam::parabolicCylindricalCS::writeDict(Ostream& os, bool subDict) const
241 << indent << token::BEGIN_BLOCK << incrIndent << nl;
244 coordinateSystem::writeDict(os, false);
245 os.writeKeyword("inDegrees") << inDegrees_ << token::END_STATEMENT << nl;
249 os << decrIndent << indent << token::END_BLOCK << endl;
254 // ************************************************************************* //