OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

parabolicCylindricalCS.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "parabolicCylindricalCS.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034     defineTypeNameAndDebug(parabolicCylindricalCS, 0);
00035     addToRunTimeSelectionTable
00036     (
00037         coordinateSystem,
00038         parabolicCylindricalCS,
00039         dictionary
00040     );
00041 }
00042 
00043 
00044 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00045 
00046 Foam::parabolicCylindricalCS::parabolicCylindricalCS()
00047 :
00048     coordinateSystem()
00049 {}
00050 
00051 
00052 Foam::parabolicCylindricalCS::parabolicCylindricalCS
00053 (
00054     const word& name,
00055     const point& origin,
00056     const coordinateRotation& cr
00057 )
00058 :
00059     coordinateSystem(name, origin, cr)
00060 {}
00061 
00062 
00063 Foam::parabolicCylindricalCS::parabolicCylindricalCS
00064 (
00065     const word& name,
00066     const dictionary& dict
00067 )
00068 :
00069     coordinateSystem(name, dict)
00070 {}
00071 
00072 
00073 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00074 
00075 Foam::vector Foam::parabolicCylindricalCS::localToGlobal
00076 (
00077     const vector& local,
00078     bool translate
00079 ) const
00080 {
00081     // Notation: u = local.x() v = local.y() z = local.z();
00082     if (local.y() < 0.0)
00083     {
00084         FatalErrorIn
00085         (
00086             "parabolicCylindricalCS::localToGlobal(const vector&, bool) const"
00087         )
00088             << "parabolic cylindrical coordinates v < 0"
00089             << abort(FatalError);
00090     }
00091 
00092     return coordinateSystem::localToGlobal
00093     (
00094         vector
00095         (
00096             0.5*(sqr(local.x()) - sqr(local.y())),
00097             local.x()*local.y(),
00098             local.z()
00099         ),
00100         translate
00101     );
00102 }
00103 
00104 
00105 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
00106 (
00107     const vectorField& local,
00108     bool translate
00109 ) const
00110 {
00111     if (min(local.component(vector::Y)) < 0.0)
00112     {
00113         FatalErrorIn
00114         (
00115             "parabolicCylindricalCS::localToGlobal"
00116             "(const vectorField&, bool) const"
00117         )   << "parabolic cylindrical coordinates v < 0"
00118             << abort(FatalError);
00119     }
00120 
00121     vectorField lc(local.size());
00122     lc.replace
00123     (
00124         vector::X,
00125         0.5*
00126         (
00127             sqr(local.component(vector::X))
00128           - sqr(local.component(vector::Y))
00129         )
00130     );
00131 
00132     lc.replace
00133     (
00134         vector::Y,
00135         local.component(vector::X) * local.component(vector::Y)
00136     );
00137 
00138     lc.replace
00139     (
00140         vector::Z,
00141         local.component(vector::Z)
00142     );
00143 
00144     return coordinateSystem::localToGlobal(lc, translate);
00145 }
00146 
00147 
00148 Foam::vector Foam::parabolicCylindricalCS::globalToLocal
00149 (
00150     const vector& global,
00151     bool translate
00152 ) const
00153 {
00154     notImplemented
00155     (
00156         "parabolicCylindricalCS::globalToLocal(const vector&, bool) const"
00157     );
00158 
00159     return vector::zero;
00160 }
00161 
00162 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal
00163 (
00164     const vectorField& global,
00165     bool translate
00166 ) const
00167 {
00168     notImplemented
00169     (
00170         "parabolicCylindricalCS::globalToLocal(const vectorField&, bool) const"
00171     );
00172 
00173     return tmp<vectorField>(vectorField::null());
00174 }
00175 
00176 
00177 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd