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

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