FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::janafThermo
00026 
00027 Description
00028     JANAF tables based thermodynamics package templated
00029     into the equationOfState.
00030 
00031 SourceFiles
00032     janafThermoI.H
00033     janafThermo.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef janafThermo_H
00038 #define janafThermo_H
00039 
00040 #include <OpenFOAM/scalar.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // Forward declaration of friend functions and operators
00048 
00049 template<class equationOfState> class janafThermo;
00050 
00051 template<class equationOfState>
00052 inline janafThermo<equationOfState> operator+
00053 (
00054     const janafThermo<equationOfState>&,
00055     const janafThermo<equationOfState>&
00056 );
00057 
00058 template<class equationOfState>
00059 inline janafThermo<equationOfState> operator-
00060 (
00061     const janafThermo<equationOfState>&,
00062     const janafThermo<equationOfState>&
00063 );
00064 
00065 template<class equationOfState>
00066 inline janafThermo<equationOfState> operator*
00067 (
00068     const scalar,
00069     const janafThermo<equationOfState>&
00070 );
00071 
00072 template<class equationOfState>
00073 inline janafThermo<equationOfState> operator==
00074 (
00075     const janafThermo<equationOfState>&,
00076     const janafThermo<equationOfState>&
00077 );
00078 
00079 template<class equationOfState>
00080 Ostream& operator<<
00081 (
00082     Ostream&,
00083     const janafThermo<equationOfState>&
00084 );
00085 
00086 
00087 /*---------------------------------------------------------------------------*\
00088                            Class janafThermo Declaration
00089 \*---------------------------------------------------------------------------*/
00090 
00091 template<class equationOfState>
00092 class janafThermo
00093 :
00094     public equationOfState
00095 {
00096 
00097 public:
00098 
00099         static const int nCoeffs_ = 7;
00100         typedef scalar coeffArray[7];
00101 
00102 private:
00103 
00104     // Private data
00105 
00106         // Temperature limits of applicability of functions
00107         scalar Tlow_, Thigh_, Tcommon_;
00108 
00109         coeffArray highCpCoeffs_;
00110         coeffArray lowCpCoeffs_;
00111 
00112 
00113     // Private member functions
00114 
00115         //- Check given temperature is within the range of the fitted coeffs
00116         inline void checkT(const scalar T) const;
00117 
00118         //- Return the coefficients corresponding to the given temperature
00119         inline const coeffArray& coeffs(const scalar T) const;
00120 
00121 
00122 public:
00123 
00124     // Constructors
00125 
00126         //- Construct from components
00127         inline janafThermo
00128         (
00129             const equationOfState& st,
00130             const scalar Tlow,
00131             const scalar Thigh,
00132             const scalar Tcommon,
00133             const coeffArray& highCpCoeffs,
00134             const coeffArray& lowCpCoeffs
00135         );
00136 
00137         //- Construct from Istream
00138         janafThermo(Istream&);
00139 
00140         //- Construct as a named copy
00141         inline janafThermo(const word&, const janafThermo&);
00142 
00143 
00144     // Member Functions
00145 
00146         //- Heat capacity at constant pressure [J/(kmol K)]
00147         inline scalar cp(const scalar T) const;
00148 
00149         //- Enthalpy [J/kmol]
00150         inline scalar h(const scalar T) const;
00151 
00152         //- Sensible enthalpy [J/kmol]
00153         inline scalar hs(const scalar T) const;
00154 
00155         //- Chemical enthalpy [J/kmol]
00156         inline scalar hc() const;
00157 
00158         //- Entropy [J/(kmol K)]
00159         inline scalar s(const scalar T) const;
00160 
00161 
00162     // Member operators
00163 
00164         inline void operator+=(const janafThermo&);
00165         inline void operator-=(const janafThermo&);
00166 
00167 
00168     // Friend operators
00169 
00170         friend janafThermo operator+ <equationOfState>
00171         (
00172             const janafThermo&,
00173             const janafThermo&
00174         );
00175 
00176         friend janafThermo operator- <equationOfState>
00177         (
00178             const janafThermo&,
00179             const janafThermo&
00180         );
00181 
00182         friend janafThermo operator* <equationOfState>
00183         (
00184             const scalar,
00185             const janafThermo&
00186         );
00187 
00188         friend janafThermo operator== <equationOfState>
00189         (
00190             const janafThermo&,
00191             const janafThermo&
00192         );
00193 
00194 
00195     // Ostream Operator
00196 
00197         friend Ostream& operator<< <equationOfState>
00198         (
00199             Ostream&,
00200             const janafThermo&
00201         );
00202 };
00203 
00204 
00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00206 
00207 } // End namespace Foam
00208 
00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00210 
00211 #include <specie/janafThermoI.H>
00212 
00213 #ifdef NoRepository
00214 #   include <specie/janafThermo.C>
00215 #endif
00216 
00217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00218 
00219 #endif
00220 
00221 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines