Forward compatibility: flex
[foam-extend-3.2.git] / src / thermophysicalModels / specie / thermo / hPolynomial / hPolynomialThermo.H
blobfe79a959f8109ac6abb105c5bdbdca5070076b32
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     Foam::hPolynomialThermo
27 Description
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
33 SourceFiles
34     hPolynomialThermoI.H
35     hPolynomialThermo.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef hPolynomialThermo_H
40 #define hPolynomialThermo_H
42 #include "scalar.H"
43 #include "PolynomialTemplate.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
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*
72     const scalar,
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>
84 Ostream& operator<<
86     Ostream&,
87     const hPolynomialThermo<EquationOfState, PolySize>&
91 /*---------------------------------------------------------------------------*\
92                       Class hPolynomialThermo Declaration
93 \*---------------------------------------------------------------------------*/
95 template<class EquationOfState, int PolySize>
96 class hPolynomialThermo
98     public EquationOfState
100     // Private data
102         //- Heat of formation
103         //  Note: input in [J/kg], but internally uses [J/kmol]
104         scalar Hf_;
106         //- Standard entropy
107         //  Note: input in [J/kg/K], but internally uses [J/kmol/K]
108         scalar Sf_;
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
124         (
125             const EquationOfState& pt,
126             const scalar Hf,
127             const scalar Sf,
128             const Polynomial<PolySize>& cpPoly,
129             const typename Polynomial<PolySize>::intPolyType& hPoly,
130             const Polynomial<PolySize>& sPoly
131         );
134 public:
136     // Constructors
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&);
148     // Member Functions
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;
166     // Member operators
168         inline hPolynomialThermo& operator=(const hPolynomialThermo&);
169         inline void operator+=(const hPolynomialThermo&);
170         inline void operator-=(const hPolynomialThermo&);
171         inline void operator*=(const scalar);
174     // Friend operators
176         friend hPolynomialThermo operator+ <EquationOfState, PolySize>
177         (
178             const hPolynomialThermo&,
179             const hPolynomialThermo&
180         );
182         friend hPolynomialThermo operator- <EquationOfState, PolySize>
183         (
184             const hPolynomialThermo&,
185             const hPolynomialThermo&
186         );
188         friend hPolynomialThermo operator* <EquationOfState, PolySize>
189         (
190             const scalar,
191             const hPolynomialThermo&
192         );
194         friend hPolynomialThermo operator== <EquationOfState, PolySize>
195         (
196             const hPolynomialThermo&,
197             const hPolynomialThermo&
198         );
201     // Ostream Operator
203         friend Ostream& operator<< <EquationOfState, PolySize>
204         (
205             Ostream&,
206             const hPolynomialThermo&
207         );
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #include "hPolynomialThermoI.H"
219 #ifdef NoRepository
220 #   include "hPolynomialThermo.C"
221 #endif
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 #endif
227 // ************************************************************************* //