1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Foam::hPolynomialThermo
28 Thermodynamics package templated on the equation of state, using polynomial
29 functions for cp, h and s
31 Polynomials for h and s derived from cp
37 \*---------------------------------------------------------------------------*/
39 #ifndef hPolynomialThermo_H
40 #define hPolynomialThermo_H
43 #include "PolynomialTemplate.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of friend functions and operators
52 template<class EquationOfState, int PolySize>
53 class hPolynomialThermo;
55 template<class EquationOfState, int PolySize>
56 inline hPolynomialThermo<EquationOfState, PolySize> operator+
58 const hPolynomialThermo<EquationOfState, PolySize>&,
59 const hPolynomialThermo<EquationOfState, PolySize>&
62 template<class EquationOfState, int PolySize>
63 inline hPolynomialThermo<EquationOfState, PolySize> operator-
65 const hPolynomialThermo<EquationOfState, PolySize>&,
66 const hPolynomialThermo<EquationOfState, PolySize>&
69 template<class EquationOfState, int PolySize>
70 inline hPolynomialThermo<EquationOfState, PolySize> operator*
73 const hPolynomialThermo<EquationOfState, PolySize>&
76 template<class EquationOfState, int PolySize>
77 inline hPolynomialThermo<EquationOfState, PolySize> operator==
79 const hPolynomialThermo<EquationOfState, PolySize>&,
80 const hPolynomialThermo<EquationOfState, PolySize>&
83 template<class EquationOfState, int PolySize>
87 const hPolynomialThermo<EquationOfState, PolySize>&
91 /*---------------------------------------------------------------------------*\
92 Class hPolynomialThermo Declaration
93 \*---------------------------------------------------------------------------*/
95 template<class EquationOfState, int PolySize>
96 class hPolynomialThermo
98 public EquationOfState
102 //- Heat of formation
103 // Note: input in [J/kg], but internally uses [J/kmol]
107 // Note: input in [J/kg/K], but internally uses [J/kmol/K]
110 //- Specific heat at constant pressure [J/(kg.K)]
111 Polynomial<PolySize> cpPolynomial_;
113 //- Enthalpy - derived from cp [J/kg] - relative to Tstd
114 typename Polynomial<PolySize>::intPolyType hPolynomial_;
116 //- Entropy - derived from cp [J/(kg.K)] - relative to Tstd
117 Polynomial<PolySize> sPolynomial_;
120 // Private member functions
122 //- Construct from components
123 inline hPolynomialThermo
125 const EquationOfState& pt,
128 const Polynomial<PolySize>& cpPoly,
129 const typename Polynomial<PolySize>::intPolyType& hPoly,
130 const Polynomial<PolySize>& sPoly
138 //- Construct from dictionary
139 hPolynomialThermo(Istream& is);
141 //- Construct as copy
142 inline hPolynomialThermo(const hPolynomialThermo&);
144 //- Construct as a named copy
145 inline hPolynomialThermo(const word&, const hPolynomialThermo&);
150 //- Heat capacity at constant pressure [J/(kmol K)]
151 inline scalar cp(const scalar T) const;
153 //- Enthalpy [J/kmol]
154 inline scalar h(const scalar T) const;
156 //- Sensible enthalpy [J/kmol]
157 inline scalar hs(const scalar T) const;
159 //- Chemical enthalpy [J/kmol]
160 inline scalar hc() const;
162 //- Entropy [J/(kmol K)]
163 inline scalar s(const scalar T) const;
168 inline hPolynomialThermo& operator=(const hPolynomialThermo&);
169 inline void operator+=(const hPolynomialThermo&);
170 inline void operator-=(const hPolynomialThermo&);
171 inline void operator*=(const scalar);
176 friend hPolynomialThermo operator+ <EquationOfState, PolySize>
178 const hPolynomialThermo&,
179 const hPolynomialThermo&
182 friend hPolynomialThermo operator- <EquationOfState, PolySize>
184 const hPolynomialThermo&,
185 const hPolynomialThermo&
188 friend hPolynomialThermo operator* <EquationOfState, PolySize>
191 const hPolynomialThermo&
194 friend hPolynomialThermo operator== <EquationOfState, PolySize>
196 const hPolynomialThermo&,
197 const hPolynomialThermo&
203 friend Ostream& operator<< <EquationOfState, PolySize>
206 const hPolynomialThermo&
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #include "hPolynomialThermoI.H"
220 # include "hPolynomialThermo.C"
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 // ************************************************************************* //