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

icoPolynomial.H

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) 2008-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 Class
00025     Foam::icoPolynomial
00026 
00027 Description
00028     Incompressible, polynomial form of equation of state, using a polynomial
00029     function for density.
00030 
00031 SourceFiles
00032     icoPolynomialI.H
00033     icoPolynomial.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef icoPolynomial_H
00038 #define icoPolynomial_H
00039 
00040 #include <specie/specie.H>
00041 #include <OpenFOAM/autoPtr.H>
00042 #include <OpenFOAM/Polynomial.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 // Forward declaration of friend functions and operators
00050 
00051 template<int PolySize>
00052 class icoPolynomial;
00053 
00054 template<int PolySize>
00055 icoPolynomial<PolySize> operator+
00056 (
00057     const icoPolynomial<PolySize>&,
00058     const icoPolynomial<PolySize>&
00059 );
00060 
00061 template<int PolySize>
00062 icoPolynomial<PolySize> operator-
00063 (
00064     const icoPolynomial<PolySize>&,
00065     const icoPolynomial<PolySize>&
00066 );
00067 
00068 template<int PolySize>
00069 icoPolynomial<PolySize> operator*
00070 (
00071     const scalar,
00072     const icoPolynomial<PolySize>&
00073 );
00074 
00075 template<int PolySize>
00076 icoPolynomial<PolySize> operator==
00077 (
00078     const icoPolynomial<PolySize>&,
00079     const icoPolynomial<PolySize>&
00080 );
00081 
00082 template<int PolySize>
00083 Ostream& operator<<
00084 (
00085     Ostream&,
00086     const icoPolynomial<PolySize>&
00087 );
00088 
00089 
00090 /*---------------------------------------------------------------------------*\
00091                         Class icoPolynomial Declaration
00092 \*---------------------------------------------------------------------------*/
00093 
00094 template<int PolySize>
00095 class icoPolynomial
00096 :
00097     public specie
00098 {
00099     // Private data
00100 
00101         //- Density
00102         //  Note: input in [kg/m3], but internally uses [kg/m3/kmol]
00103         Polynomial<PolySize> rhoPolynomial_;
00104 
00105 
00106 public:
00107 
00108     // Constructors
00109 
00110         //- Construct from components
00111         inline icoPolynomial
00112         (
00113             const specie& sp,
00114             const Polynomial<PolySize>& rhoPoly
00115         );
00116 
00117         //- Construct from Istream
00118         icoPolynomial(Istream&);
00119 
00120         //- Construct as copy
00121         inline icoPolynomial(const icoPolynomial&);
00122 
00123         //- Construct as named copy
00124         inline icoPolynomial(const word& name, const icoPolynomial&);
00125 
00126         //- Construct and return a clone
00127         inline autoPtr<icoPolynomial> clone() const;
00128 
00129         // Selector from Istream
00130         inline static autoPtr<icoPolynomial> New(Istream& is);
00131 
00132 
00133     // Member functions
00134 
00135         //- Return density [kg/m^3]
00136         inline scalar rho(scalar p, scalar T) const;
00137 
00138         //- Return compressibility rho/p [s^2/m^2]
00139         inline scalar psi(scalar p, scalar T) const;
00140 
00141         //- Return compression factor []
00142         inline scalar Z(scalar p, scalar T) const;
00143 
00144 
00145     // Member operators
00146 
00147         inline icoPolynomial& operator=(const icoPolynomial&);
00148         inline void operator+=(const icoPolynomial&);
00149         inline void operator-=(const icoPolynomial&);
00150 
00151         inline void operator*=(const scalar);
00152 
00153 
00154     // Friend operators
00155 
00156         friend icoPolynomial operator+ <PolySize>
00157         (
00158             const icoPolynomial&,
00159             const icoPolynomial&
00160         );
00161 
00162         friend icoPolynomial operator- <PolySize>
00163         (
00164             const icoPolynomial&,
00165             const icoPolynomial&
00166         );
00167 
00168         friend icoPolynomial operator* <PolySize>
00169         (
00170             const scalar s,
00171             const icoPolynomial&
00172         );
00173 
00174         friend icoPolynomial operator== <PolySize>
00175         (
00176             const icoPolynomial&,
00177             const icoPolynomial&
00178         );
00179 
00180 
00181     // Ostream Operator
00182 
00183         friend Ostream& operator<< <PolySize>(Ostream&, const icoPolynomial&);
00184 };
00185 
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 } // End namespace Foam
00190 
00191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00192 
00193 #define makeIcoPolynomial(PolySize)                                          \
00194                                                                              \
00195 defineTemplateTypeNameAndDebugWithName                                       \
00196 (                                                                            \
00197     icoPolynomial<PolySize>,                                                 \
00198     "icoPolynomial<"#PolySize">",                                            \
00199     0                                                                        \
00200 );
00201 
00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00203 
00204 #include "icoPolynomialI.H"
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 #ifdef NoRepository
00209 #   include "icoPolynomial.C"
00210 #endif
00211 
00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00213 
00214 #endif
00215 
00216 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines