OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

janafThermo.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::janafThermo
00027 
00028 Description
00029     JANAF tables based thermodynamics package templated
00030     into the equationOfState.
00031 
00032 SourceFiles
00033     janafThermoI.H
00034     janafThermo.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef janafThermo_H
00039 #define janafThermo_H
00040 
00041 #include "scalar.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // Forward declaration of friend functions and operators
00049 
00050 template<class equationOfState> class janafThermo;
00051 
00052 template<class equationOfState>
00053 inline janafThermo<equationOfState> operator+
00054 (
00055     const janafThermo<equationOfState>&,
00056     const janafThermo<equationOfState>&
00057 );
00058 
00059 template<class equationOfState>
00060 inline janafThermo<equationOfState> operator-
00061 (
00062     const janafThermo<equationOfState>&,
00063     const janafThermo<equationOfState>&
00064 );
00065 
00066 template<class equationOfState>
00067 inline janafThermo<equationOfState> operator*
00068 (
00069     const scalar,
00070     const janafThermo<equationOfState>&
00071 );
00072 
00073 template<class equationOfState>
00074 inline janafThermo<equationOfState> operator==
00075 (
00076     const janafThermo<equationOfState>&,
00077     const janafThermo<equationOfState>&
00078 );
00079 
00080 template<class equationOfState>
00081 Ostream& operator<<
00082 (
00083     Ostream&,
00084     const janafThermo<equationOfState>&
00085 );
00086 
00087 
00088 /*---------------------------------------------------------------------------*\
00089                            Class janafThermo Declaration
00090 \*---------------------------------------------------------------------------*/
00091 
00092 template<class equationOfState>
00093 class janafThermo
00094 :
00095     public equationOfState
00096 {
00097 
00098 public:
00099 
00100         static const int nCoeffs_ = 7;
00101         typedef scalar coeffArray[7];
00102 
00103 private:
00104 
00105     // Private data
00106 
00107         // Temperature limits of applicability of functions
00108         scalar Tlow_, Thigh_, Tcommon_;
00109 
00110         coeffArray highCpCoeffs_;
00111         coeffArray lowCpCoeffs_;
00112 
00113 
00114     // Private member functions
00115 
00116         //- Check given temperature is within the range of the fitted coeffs
00117         inline void checkT(const scalar T) const;
00118 
00119         //- Return the coefficients corresponding to the given temperature
00120         inline const coeffArray& coeffs(const scalar T) const;
00121 
00122 
00123 public:
00124 
00125     // Constructors
00126 
00127         //- Construct from components
00128         inline janafThermo
00129         (
00130             const equationOfState& st,
00131             const scalar Tlow,
00132             const scalar Thigh,
00133             const scalar Tcommon,
00134             const coeffArray& highCpCoeffs,
00135             const coeffArray& lowCpCoeffs
00136         );
00137 
00138         //- Construct from Istream
00139         janafThermo(Istream&);
00140 
00141         //- Construct as a named copy
00142         inline janafThermo(const word&, const janafThermo&);
00143 
00144 
00145     // Member Functions
00146 
00147         //- Heat capacity at constant pressure [J/(kmol K)]
00148         inline scalar cp(const scalar T) const;
00149 
00150         //- Enthalpy [J/kmol]
00151         inline scalar h(const scalar T) const;
00152 
00153         //- Sensible enthalpy [J/kmol]
00154         inline scalar hs(const scalar T) const;
00155 
00156         //- Chemical enthalpy [J/kmol]
00157         inline scalar hc() const;
00158 
00159         //- Entropy [J/(kmol K)]
00160         inline scalar s(const scalar T) const;
00161 
00162 
00163     // Member operators
00164 
00165         inline void operator+=(const janafThermo&);
00166         inline void operator-=(const janafThermo&);
00167 
00168 
00169     // Friend operators
00170 
00171         friend janafThermo operator+ <equationOfState>
00172         (
00173             const janafThermo&,
00174             const janafThermo&
00175         );
00176 
00177         friend janafThermo operator- <equationOfState>
00178         (
00179             const janafThermo&,
00180             const janafThermo&
00181         );
00182 
00183         friend janafThermo operator* <equationOfState>
00184         (
00185             const scalar,
00186             const janafThermo&
00187         );
00188 
00189         friend janafThermo operator== <equationOfState>
00190         (
00191             const janafThermo&,
00192             const janafThermo&
00193         );
00194 
00195 
00196     // Ostream Operator
00197 
00198         friend Ostream& operator<< <equationOfState>
00199         (
00200             Ostream&,
00201             const janafThermo&
00202         );
00203 };
00204 
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 } // End namespace Foam
00209 
00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00211 
00212 #include "janafThermoI.H"
00213 
00214 #ifdef NoRepository
00215 #   include "janafThermo.C"
00216 #endif
00217 
00218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00219 
00220 #endif
00221 
00222 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd