initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / coordinateSystems / parabolicCylindricalCS.C
blobf2e83108ace812d8c7c137bcd9931d8aa5ec26ed
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 "parabolicCylindricalCS.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 namespace Foam
34     defineTypeNameAndDebug(parabolicCylindricalCS, 0);
35     addToRunTimeSelectionTable
36     (
37         coordinateSystem,
38         parabolicCylindricalCS,
39         dictionary
40     );
44 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
46 Foam::parabolicCylindricalCS::parabolicCylindricalCS()
48     coordinateSystem()
52 Foam::parabolicCylindricalCS::parabolicCylindricalCS
54     const word& name,
55     const point& origin,
56     const coordinateRotation& cr
59     coordinateSystem(name, origin, cr)
63 Foam::parabolicCylindricalCS::parabolicCylindricalCS
65     const word& name,
66     const dictionary& dict
69     coordinateSystem(name, dict)
73 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
75 Foam::vector Foam::parabolicCylindricalCS::localToGlobal
77     const vector& local,
78     bool translate
79 ) const
81     // Notation: u = local.x() v = local.y() z = local.z();
82     if (local.y() < 0.0)
83     {
84         FatalErrorIn
85         (
86             "parabolicCylindricalCS::localToGlobal(const vector&, bool) const"
87         )
88             << "parabolic cylindrical coordinates v < 0"
89             << abort(FatalError);
90     }
92     return coordinateSystem::localToGlobal
93     (
94         vector
95         (
96             0.5*(sqr(local.x()) - sqr(local.y())),
97             local.x()*local.y(),
98             local.z()
99         ),
100         translate
101     );
105 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
107     const vectorField& local,
108     bool translate
109 ) const
111     if (min(local.component(vector::Y)) < 0.0)
112     {
113         FatalErrorIn
114         (
115             "parabolicCylindricalCS::localToGlobal"
116             "(const vectorField&, bool) const"
117         )   << "parabolic cylindrical coordinates v < 0"
118             << abort(FatalError);
119     }
121     vectorField lc(local.size());
122     lc.replace
123     (
124         vector::X,
125         0.5*
126         (
127             sqr(local.component(vector::X))
128           - sqr(local.component(vector::Y))
129         )
130     );
132     lc.replace
133     (
134         vector::Y,
135         local.component(vector::X) * local.component(vector::Y)
136     );
138     lc.replace
139     (
140         vector::Z,
141         local.component(vector::Z)
142     );
144     return coordinateSystem::localToGlobal(lc, translate);
148 Foam::vector Foam::parabolicCylindricalCS::globalToLocal
150     const vector& global,
151     bool translate
152 ) const
154     notImplemented
155     (
156         "parabolicCylindricalCS::globalToLocal(const vector&, bool) const"
157     );
159     return vector::zero;
162 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal
164     const vectorField& global,
165     bool translate
166 ) const
168     notImplemented
169     (
170         "parabolicCylindricalCS::globalToLocal(const vectorField&, bool) const"
171     );
173     return tmp<vectorField>(vectorField::null());
177 // ************************************************************************* //