BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / specie / thermo / janaf / janafThermo.H
blobb552fad0945956f27de3065b1213753c980f11ec
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::janafThermo
27 Description
28     JANAF tables based thermodynamics package templated
29     into the equation of state.
31 SourceFiles
32     janafThermoI.H
33     janafThermo.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef janafThermo_H
38 #define janafThermo_H
40 #include "scalar.H"
41 #include "FixedList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // Forward declaration of friend functions and operators
50 template<class EquationOfState> class janafThermo;
52 template<class EquationOfState>
53 inline janafThermo<EquationOfState> operator+
55     const janafThermo<EquationOfState>&,
56     const janafThermo<EquationOfState>&
59 template<class EquationOfState>
60 inline janafThermo<EquationOfState> operator-
62     const janafThermo<EquationOfState>&,
63     const janafThermo<EquationOfState>&
66 template<class EquationOfState>
67 inline janafThermo<EquationOfState> operator*
69     const scalar,
70     const janafThermo<EquationOfState>&
73 template<class EquationOfState>
74 inline janafThermo<EquationOfState> operator==
76     const janafThermo<EquationOfState>&,
77     const janafThermo<EquationOfState>&
80 template<class EquationOfState>
81 Ostream& operator<<
83     Ostream&,
84     const janafThermo<EquationOfState>&
88 /*---------------------------------------------------------------------------*\
89                            Class janafThermo Declaration
90 \*---------------------------------------------------------------------------*/
92 template<class EquationOfState>
93 class janafThermo
95     public EquationOfState
98 public:
100     // Public data
102         static const int nCoeffs_ = 7;
103         typedef FixedList<scalar, nCoeffs_> coeffArray;
106 private:
108     // Private data
110         // Temperature limits of applicability of functions
111         scalar Tlow_, Thigh_, Tcommon_;
113         coeffArray highCpCoeffs_;
114         coeffArray lowCpCoeffs_;
117     // Private Member Functions
119         //- Check that input data is valid
120         void checkInputData() const;
122         //- Return the coefficients corresponding to the given temperature
123         inline const coeffArray& coeffs(const scalar T) const;
126 public:
128     // Constructors
130         //- Construct from components
131         inline janafThermo
132         (
133             const EquationOfState& st,
134             const scalar Tlow,
135             const scalar Thigh,
136             const scalar Tcommon,
137             const coeffArray& highCpCoeffs,
138             const coeffArray& lowCpCoeffs
139         );
141         //- Construct from Istream
142         janafThermo(Istream&);
144         //- Construct from dictionary
145         janafThermo(const dictionary& dict);
147         //- Construct as a named copy
148         inline janafThermo(const word&, const janafThermo&);
151     // Member Functions
153         //- Limit the temperature to be in the range Tlow_ to Thigh_
154         inline scalar limit(const scalar T) const;
156         // Fundamental properties
158             //- Heat capacity at constant pressure [J/(kmol K)]
159             inline scalar cp(const scalar T) const;
161             //- Enthalpy [J/kmol]
162             inline scalar h(const scalar T) const;
164             //- Sensible enthalpy [J/kmol]
165             inline scalar hs(const scalar T) const;
167             //- Chemical enthalpy [J/kmol]
168             inline scalar hc() const;
170             //- Entropy [J/(kmol K)]
171             inline scalar s(const scalar T) const;
174         // I-O
176             //- Write to Ostream
177             void write(Ostream& os) const;
180     // Member operators
182         inline void operator+=(const janafThermo&);
183         inline void operator-=(const janafThermo&);
186     // Friend operators
188         friend janafThermo operator+ <EquationOfState>
189         (
190             const janafThermo&,
191             const janafThermo&
192         );
194         friend janafThermo operator- <EquationOfState>
195         (
196             const janafThermo&,
197             const janafThermo&
198         );
200         friend janafThermo operator* <EquationOfState>
201         (
202             const scalar,
203             const janafThermo&
204         );
206         friend janafThermo operator== <EquationOfState>
207         (
208             const janafThermo&,
209             const janafThermo&
210         );
213     // Ostream Operator
215         friend Ostream& operator<< <EquationOfState>
216         (
217             Ostream&,
218             const janafThermo&
219         );
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 } // End namespace Foam
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 #include "janafThermoI.H"
231 #ifdef NoRepository
232 #   include "janafThermo.C"
233 #endif
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 #endif
239 // ************************************************************************* //