initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / specie / thermo / janaf / janafThermo.H
blob94cb6cc1d98cb42107ece8e303b28caecfe2c029
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::janafThermo
28 Description
29     JANAF tables based thermodynamics package templated
30     into the equationOfState.
32 SourceFiles
33     janafThermoI.H
34     janafThermo.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef janafThermo_H
39 #define janafThermo_H
41 #include "scalar.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         static const int nCoeffs_ = 7;
101         typedef scalar coeffArray[7];
103 private:
105     // Private data
107         // Temperature limits of applicability of functions
108         scalar Tlow_, Thigh_, Tcommon_;
110         coeffArray highCpCoeffs_;
111         coeffArray lowCpCoeffs_;
114     // Private member functions
116         //- Check given temperature is within the range of the fitted coeffs
117         inline void checkT(const scalar T) const;
119         //- Return the coefficients corresponding to the given temperature
120         inline const coeffArray& coeffs(const scalar T) const;
123 public:
125     // Constructors
127         //- Construct from components
128         inline janafThermo
129         (
130             const equationOfState& st,
131             const scalar Tlow,
132             const scalar Thigh,
133             const scalar Tcommon,
134             const coeffArray& highCpCoeffs,
135             const coeffArray& lowCpCoeffs
136         );
138         //- Construct from Istream
139         janafThermo(Istream&);
141         //- Construct as a named copy
142         inline janafThermo(const word&, const janafThermo&);
145     // Member Functions
147         //- Heat capacity at constant pressure [J/(kmol K)]
148         inline scalar cp(const scalar T) const;
150         //- Enthalpy [J/kmol]
151         inline scalar h(const scalar T) const;
153         //- Sensible enthalpy [J/kmol]
154         inline scalar hs(const scalar T) const;
156         //- Chemical enthalpy [J/kmol]
157         inline scalar hc() const;
159         //- Entropy [J/(kmol K)]
160         inline scalar s(const scalar T) const;
163     // Member operators
165         inline void operator+=(const janafThermo&);
166         inline void operator-=(const janafThermo&);
169     // Friend operators
171         friend janafThermo operator+ <equationOfState>
172         (
173             const janafThermo&,
174             const janafThermo&
175         );
177         friend janafThermo operator- <equationOfState>
178         (
179             const janafThermo&,
180             const janafThermo&
181         );
183         friend janafThermo operator* <equationOfState>
184         (
185             const scalar,
186             const janafThermo&
187         );
189         friend janafThermo operator== <equationOfState>
190         (
191             const janafThermo&,
192             const janafThermo&
193         );
196     // Ostream Operator
198         friend Ostream& operator<< <equationOfState>
199         (
200             Ostream&,
201             const janafThermo&
202         );
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 #include "janafThermoI.H"
214 #ifdef NoRepository
215 #   include "janafThermo.C"
216 #endif
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 #endif
222 // ************************************************************************* //