FreeFOAM The Cross-Platform CFD Toolkit
parabolicCylindricalCS.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "parabolicCylindricalCS.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(parabolicCylindricalCS, 0);
35  (
36  coordinateSystem,
37  parabolicCylindricalCS,
38  dictionary
39  );
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 :
48 {}
49 
50 
52 (
53  const word& name,
54  const point& origin,
55  const coordinateRotation& cr
56 )
57 :
58  coordinateSystem(name, origin, cr)
59 {}
60 
61 
63 (
64  const word& name,
65  const dictionary& dict
66 )
67 :
68  coordinateSystem(name, dict)
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
75 (
76  const vector& local,
77  bool translate
78 ) const
79 {
80  // Notation: u = local.x() v = local.y() z = local.z();
81  if (local.y() < 0.0)
82  {
84  (
85  "parabolicCylindricalCS::localToGlobal(const vector&, bool) const"
86  )
87  << "parabolic cylindrical coordinates v < 0"
88  << abort(FatalError);
89  }
90 
92  (
93  vector
94  (
95  0.5*(sqr(local.x()) - sqr(local.y())),
96  local.x()*local.y(),
97  local.z()
98  ),
99  translate
100  );
101 }
102 
103 
105 (
106  const vectorField& local,
107  bool translate
108 ) const
109 {
110  if (min(local.component(vector::Y)) < 0.0)
111  {
113  (
114  "parabolicCylindricalCS::localToGlobal"
115  "(const vectorField&, bool) const"
116  ) << "parabolic cylindrical coordinates v < 0"
117  << abort(FatalError);
118  }
119 
120  vectorField lc(local.size());
121  lc.replace
122  (
123  vector::X,
124  0.5*
125  (
126  sqr(local.component(vector::X))
127  - sqr(local.component(vector::Y))
128  )
129  );
130 
131  lc.replace
132  (
133  vector::Y,
134  local.component(vector::X) * local.component(vector::Y)
135  );
136 
137  lc.replace
138  (
139  vector::Z,
140  local.component(vector::Z)
141  );
142 
143  return coordinateSystem::localToGlobal(lc, translate);
144 }
145 
146 
148 (
149  const vector& global,
150  bool translate
151 ) const
152 {
154  (
155  "parabolicCylindricalCS::globalToLocal(const vector&, bool) const"
156  );
157 
158  return vector::zero;
159 }
160 
162 (
163  const vectorField& global,
164  bool translate
165 ) const
166 {
168  (
169  "parabolicCylindricalCS::globalToLocal(const vectorField&, bool) const"
170  );
171 
173 }
174 
175 
176 // ************************ vim: set sw=4 sts=4 et: ************************ //