Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / coordinateSystems / ellipticCylindricalCS.C
blobd5a6681849b25b995abc7b93d1d068c690cefbb1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "ellipticCylindricalCS.H"
29 #include "Switch.H"
30 #include "mathematicalConstants.H"
31 #include "addToRunTimeSelectionTable.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 namespace Foam
37     defineTypeNameAndDebug(ellipticCylindricalCS, 0);
38     addToRunTimeSelectionTable
39     (
40         coordinateSystem,
41         ellipticCylindricalCS,
42         dictionary
43     );
47 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
49 Foam::ellipticCylindricalCS::ellipticCylindricalCS(const bool inDegrees)
51     coordinateSystem(),
52     a_(0),
53     inDegrees_(inDegrees)
57 Foam::ellipticCylindricalCS::ellipticCylindricalCS
59     const coordinateSystem& cs,
60     const bool inDegrees
63     coordinateSystem(cs),
64     a_(0),
65     inDegrees_(inDegrees)
69 Foam::ellipticCylindricalCS::ellipticCylindricalCS
71     const word& name,
72     const coordinateSystem& cs,
73     const bool inDegrees
76     coordinateSystem(name, cs),
77     a_(0),
78     inDegrees_(inDegrees)
82 Foam::ellipticCylindricalCS::ellipticCylindricalCS
84     const word& name,
85     const point& origin,
86     const coordinateRotation& cr,
87     const scalar a,
88     const bool inDegrees
91     coordinateSystem(name, origin, cr),
92     a_(a),
93     inDegrees_(inDegrees)
97 Foam::ellipticCylindricalCS::ellipticCylindricalCS
99     const word& name,
100     const point& origin,
101     const vector& axis,
102     const vector& direction,
103     const scalar a,
104     const bool inDegrees
107     coordinateSystem(name, origin, axis, direction),
108     a_(a),
109     inDegrees_(inDegrees)
113 Foam::ellipticCylindricalCS::ellipticCylindricalCS
115     const word& name,
116     const dictionary& dict
119     coordinateSystem(name, dict),
120     a_(readScalar(dict.lookup("a"))),
121     inDegrees_(dict.lookupOrDefault<Switch>("degrees", true))
125 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
127 Foam::vector Foam::ellipticCylindricalCS::localToGlobal
129     const vector& local,
130     bool translate
131 ) const
133     // Notation: u = local.x() v = local.y() z = local.z();
134     scalar theta =
135         local.y()*( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 );
137     return coordinateSystem::localToGlobal
138     (
139         vector
140         (
141             a_*cosh(local.x())*cos(theta),
142             a_*sinh(local.x())*sin(theta),
143             local.z()
144         ),
145         translate
146     );
149 Foam::tmp<Foam::vectorField> Foam::ellipticCylindricalCS::localToGlobal
151     const vectorField& local,
152     bool translate
153 ) const
155     scalarField theta =
156         local.component(vector::Y)*
157         ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 );
159     vectorField lc(local.size());
160     lc.replace
161     (
162         vector::X,
163         a_*cosh(local.component(vector::X))*cos(theta)
164     );
166     lc.replace
167     (
168         vector::Y,
169         a_*sinh(local.component(vector::X))*sin(theta)
170     );
172     lc.replace
173     (
174         vector::Z,
175         local.component(vector::Z)
176     );
178     return coordinateSystem::localToGlobal(lc, translate);
182 Foam::vector Foam::ellipticCylindricalCS::globalToLocal
184     const vector& global,
185     bool translate
186 ) const
188     notImplemented
189     (
190         "ellipticCylindricalCS::globalToLocal(const vector&, bool) const"
191     );
193     return vector::zero;
196 Foam::tmp<Foam::vectorField> Foam::ellipticCylindricalCS::globalToLocal
198     const vectorField& global,
199     bool translate
200 ) const
202     notImplemented
203     (
204         "ellipticCylindricalCS::globalToLocal(const vectorField&, bool) const"
205     );
207     return tmp<vectorField>(vectorField::null());
211 // ************************************************************************* //