FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "parabolicCylindricalCS.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 
00029 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033     defineTypeNameAndDebug(parabolicCylindricalCS, 0);
00034     addToRunTimeSelectionTable
00035     (
00036         coordinateSystem,
00037         parabolicCylindricalCS,
00038         dictionary
00039     );
00040 }
00041 
00042 
00043 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00044 
00045 Foam::parabolicCylindricalCS::parabolicCylindricalCS()
00046 :
00047     coordinateSystem()
00048 {}
00049 
00050 
00051 Foam::parabolicCylindricalCS::parabolicCylindricalCS
00052 (
00053     const word& name,
00054     const point& origin,
00055     const coordinateRotation& cr
00056 )
00057 :
00058     coordinateSystem(name, origin, cr)
00059 {}
00060 
00061 
00062 Foam::parabolicCylindricalCS::parabolicCylindricalCS
00063 (
00064     const word& name,
00065     const dictionary& dict
00066 )
00067 :
00068     coordinateSystem(name, dict)
00069 {}
00070 
00071 
00072 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00073 
00074 Foam::vector Foam::parabolicCylindricalCS::localToGlobal
00075 (
00076     const vector& local,
00077     bool translate
00078 ) const
00079 {
00080     // Notation: u = local.x() v = local.y() z = local.z();
00081     if (local.y() < 0.0)
00082     {
00083         FatalErrorIn
00084         (
00085             "parabolicCylindricalCS::localToGlobal(const vector&, bool) const"
00086         )
00087             << "parabolic cylindrical coordinates v < 0"
00088             << abort(FatalError);
00089     }
00090 
00091     return coordinateSystem::localToGlobal
00092     (
00093         vector
00094         (
00095             0.5*(sqr(local.x()) - sqr(local.y())),
00096             local.x()*local.y(),
00097             local.z()
00098         ),
00099         translate
00100     );
00101 }
00102 
00103 
00104 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
00105 (
00106     const vectorField& local,
00107     bool translate
00108 ) const
00109 {
00110     if (min(local.component(vector::Y)) < 0.0)
00111     {
00112         FatalErrorIn
00113         (
00114             "parabolicCylindricalCS::localToGlobal"
00115             "(const vectorField&, bool) const"
00116         )   << "parabolic cylindrical coordinates v < 0"
00117             << abort(FatalError);
00118     }
00119 
00120     vectorField lc(local.size());
00121     lc.replace
00122     (
00123         vector::X,
00124         0.5*
00125         (
00126             sqr(local.component(vector::X))
00127           - sqr(local.component(vector::Y))
00128         )
00129     );
00130 
00131     lc.replace
00132     (
00133         vector::Y,
00134         local.component(vector::X) * local.component(vector::Y)
00135     );
00136 
00137     lc.replace
00138     (
00139         vector::Z,
00140         local.component(vector::Z)
00141     );
00142 
00143     return coordinateSystem::localToGlobal(lc, translate);
00144 }
00145 
00146 
00147 Foam::vector Foam::parabolicCylindricalCS::globalToLocal
00148 (
00149     const vector& global,
00150     bool translate
00151 ) const
00152 {
00153     notImplemented
00154     (
00155         "parabolicCylindricalCS::globalToLocal(const vector&, bool) const"
00156     );
00157 
00158     return vector::zero;
00159 }
00160 
00161 Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal
00162 (
00163     const vectorField& global,
00164     bool translate
00165 ) const
00166 {
00167     notImplemented
00168     (
00169         "parabolicCylindricalCS::globalToLocal(const vectorField&, bool) const"
00170     );
00171 
00172     return tmp<vectorField>(vectorField::null());
00173 }
00174 
00175 
00176 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines