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

hPolynomialThermo.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::hPolynomialThermo
00026 
00027 Description
00028     Thermodynamics package templated on the equation of state, using polynomial
00029     functions for cp, h and s
00030 
00031     Polynomials for h and s derived from cp
00032 
00033 SourceFiles
00034     hPolynomialThermoI.H
00035     hPolynomialThermo.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef hPolynomialThermo_H
00040 #define hPolynomialThermo_H
00041 
00042 #include <OpenFOAM/scalar.H>
00043 #include <OpenFOAM/Polynomial.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Forward declaration of friend functions and operators
00051 
00052 template<class EquationOfState, int PolySize>
00053 class hPolynomialThermo;
00054 
00055 template<class EquationOfState, int PolySize>
00056 inline hPolynomialThermo<EquationOfState, PolySize> operator+
00057 (
00058     const hPolynomialThermo<EquationOfState, PolySize>&,
00059     const hPolynomialThermo<EquationOfState, PolySize>&
00060 );
00061 
00062 template<class EquationOfState, int PolySize>
00063 inline hPolynomialThermo<EquationOfState, PolySize> operator-
00064 (
00065     const hPolynomialThermo<EquationOfState, PolySize>&,
00066     const hPolynomialThermo<EquationOfState, PolySize>&
00067 );
00068 
00069 template<class EquationOfState, int PolySize>
00070 inline hPolynomialThermo<EquationOfState, PolySize> operator*
00071 (
00072     const scalar,
00073     const hPolynomialThermo<EquationOfState, PolySize>&
00074 );
00075 
00076 template<class EquationOfState, int PolySize>
00077 inline hPolynomialThermo<EquationOfState, PolySize> operator==
00078 (
00079     const hPolynomialThermo<EquationOfState, PolySize>&,
00080     const hPolynomialThermo<EquationOfState, PolySize>&
00081 );
00082 
00083 template<class EquationOfState, int PolySize>
00084 Ostream& operator<<
00085 (
00086     Ostream&,
00087     const hPolynomialThermo<EquationOfState, PolySize>&
00088 );
00089 
00090 
00091 /*---------------------------------------------------------------------------*\
00092                       Class hPolynomialThermo Declaration
00093 \*---------------------------------------------------------------------------*/
00094 
00095 template<class EquationOfState, int PolySize>
00096 class hPolynomialThermo
00097 :
00098     public EquationOfState
00099 {
00100     // Private data
00101 
00102         //- Heat of formation
00103         //  Note: input in [J/kg], but internally uses [J/kmol]
00104         scalar Hf_;
00105 
00106         //- Standard entropy
00107         //  Note: input in [J/kg/K], but internally uses [J/kmol/K]
00108         scalar Sf_;
00109 
00110         //- Specific heat at constant pressure [J/(kg.K)]
00111         Polynomial<PolySize> CpPolynomial_;
00112 
00113         //- Enthalpy - derived from cp [J/kg] - relative to Tstd
00114         typename Polynomial<PolySize>::intPolyType hPolynomial_;
00115 
00116         //- Entropy - derived from cp [J/(kg.K)] - relative to Tstd
00117         Polynomial<PolySize> sPolynomial_;
00118 
00119 
00120     // Private member functions
00121 
00122         //- Construct from components
00123         inline hPolynomialThermo
00124         (
00125             const EquationOfState& pt,
00126             const scalar Hf,
00127             const scalar Sf,
00128             const Polynomial<PolySize>& cpPoly,
00129             const typename Polynomial<PolySize>::intPolyType& hPoly,
00130             const Polynomial<PolySize>& sPoly
00131         );
00132 
00133 
00134 public:
00135 
00136     // Constructors
00137 
00138         //- Construct from dictionary
00139         hPolynomialThermo(Istream& is);
00140 
00141         //- Construct as copy
00142         inline hPolynomialThermo(const hPolynomialThermo&);
00143 
00144         //- Construct as a named copy
00145         inline hPolynomialThermo(const word&, const hPolynomialThermo&);
00146 
00147 
00148     // Member Functions
00149 
00150         //- Heat capacity at constant pressure [J/(kmol K)]
00151         inline scalar cp(const scalar T) const;
00152 
00153         //- Enthalpy [J/kmol]
00154         inline scalar h(const scalar T) const;
00155 
00156         //- Sensible enthalpy [J/kmol]
00157         inline scalar hs(const scalar T) const;
00158 
00159         //- Chemical enthalpy [J/kmol]
00160         inline scalar hc() const;
00161 
00162         //- Entropy [J/(kmol K)]
00163         inline scalar s(const scalar T) const;
00164 
00165 
00166     // Member operators
00167 
00168         inline hPolynomialThermo& operator=(const hPolynomialThermo&);
00169         inline void operator+=(const hPolynomialThermo&);
00170         inline void operator-=(const hPolynomialThermo&);
00171         inline void operator*=(const scalar);
00172 
00173 
00174     // Friend operators
00175 
00176         friend hPolynomialThermo operator+ <EquationOfState, PolySize>
00177         (
00178             const hPolynomialThermo&,
00179             const hPolynomialThermo&
00180         );
00181 
00182         friend hPolynomialThermo operator- <EquationOfState, PolySize>
00183         (
00184             const hPolynomialThermo&,
00185             const hPolynomialThermo&
00186         );
00187 
00188         friend hPolynomialThermo operator* <EquationOfState, PolySize>
00189         (
00190             const scalar,
00191             const hPolynomialThermo&
00192         );
00193 
00194         friend hPolynomialThermo operator== <EquationOfState, PolySize>
00195         (
00196             const hPolynomialThermo&,
00197             const hPolynomialThermo&
00198         );
00199 
00200 
00201     // Ostream Operator
00202 
00203         friend Ostream& operator<< <EquationOfState, PolySize>
00204         (
00205             Ostream&,
00206             const hPolynomialThermo&
00207         );
00208 };
00209 
00210 
00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00212 
00213 } // End namespace Foam
00214 
00215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00216 
00217 #include "hPolynomialThermoI.H"
00218 
00219 #ifdef NoRepository
00220 #   include "hPolynomialThermo.C"
00221 #endif
00222 
00223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00224 
00225 #endif
00226 
00227 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines