BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / specie / thermo / hPolynomial / hPolynomialThermo.H
blob31954a4a567604d40a35771f7476c4c8cd012b62
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  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 "Polynomial.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 polynomial coeffs [J/(kg.K)]
111         Polynomial<PolySize> CpCoeffs_;
113         //- Enthalpy polynomial coeffs - derived from cp [J/kg]
114         //  NOTE: relative to Tstd
115         typename Polynomial<PolySize>::intPolyType hCoeffs_;
117         //- Entropy - derived from Cp [J/(kg.K)] - relative to Tstd
118         Polynomial<PolySize> sCoeffs_;
121     // Private Member Functions
123         //- Construct from components
124         inline hPolynomialThermo
125         (
126             const EquationOfState& pt,
127             const scalar Hf,
128             const scalar Sf,
129             const Polynomial<PolySize>& CpCoeffs,
130             const typename Polynomial<PolySize>::intPolyType& hCoeffs,
131             const Polynomial<PolySize>& sCoeffs
132         );
135 public:
137     // Constructors
139         //- Construct from Istream
140         hPolynomialThermo(Istream& is);
142         //- Construct from dictionary
143         hPolynomialThermo(const dictionary& dict);
145         //- Construct as copy
146         inline hPolynomialThermo(const hPolynomialThermo&);
148         //- Construct as a named copy
149         inline hPolynomialThermo(const word&, const hPolynomialThermo&);
152     // Member Functions
154         //- Limit the temperature to be in the range Tlow_ to Thigh_
155         inline scalar limit(const scalar T) const;
157         // Fundamental properties
159             //- Heat capacity at constant pressure [J/(kmol K)]
160             inline scalar cp(const scalar T) const;
162             //- Enthalpy [J/kmol]
163             inline scalar h(const scalar T) const;
165             //- Sensible enthalpy [J/kmol]
166             inline scalar hs(const scalar T) const;
168             //- Chemical enthalpy [J/kmol]
169             inline scalar hc() const;
171             //- Entropy [J/(kmol K)]
172             inline scalar s(const scalar T) const;
175         // I-O
177             //- Write to Ostream
178             void write(Ostream& os) const;
181     // Member operators
183         inline hPolynomialThermo& operator=(const hPolynomialThermo&);
184         inline void operator+=(const hPolynomialThermo&);
185         inline void operator-=(const hPolynomialThermo&);
186         inline void operator*=(const scalar);
189     // Friend operators
191         friend hPolynomialThermo operator+ <EquationOfState, PolySize>
192         (
193             const hPolynomialThermo&,
194             const hPolynomialThermo&
195         );
197         friend hPolynomialThermo operator- <EquationOfState, PolySize>
198         (
199             const hPolynomialThermo&,
200             const hPolynomialThermo&
201         );
203         friend hPolynomialThermo operator* <EquationOfState, PolySize>
204         (
205             const scalar,
206             const hPolynomialThermo&
207         );
209         friend hPolynomialThermo operator== <EquationOfState, PolySize>
210         (
211             const hPolynomialThermo&,
212             const hPolynomialThermo&
213         );
216     // Ostream Operator
218         friend Ostream& operator<< <EquationOfState, PolySize>
219         (
220             Ostream&,
221             const hPolynomialThermo&
222         );
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 } // End namespace Foam
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 #include "hPolynomialThermoI.H"
234 #ifdef NoRepository
235 #   include "hPolynomialThermo.C"
236 #endif
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 #endif
242 // ************************************************************************* //