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

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