FreeFOAM The Cross-Platform CFD Toolkit
hConstThermo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::hConstThermo
26 
27 Description
28  Constant properties thermodynamics package
29  templated into the equationOfState.
30 
31 SourceFiles
32  hConstThermoI.H
33  hConstThermo.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef hConstThermo_H
38 #define hConstThermo_H
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of friend functions and operators
46 
47 template<class equationOfState> class hConstThermo;
48 
49 template<class equationOfState>
50 inline hConstThermo<equationOfState> operator+
51 (
52  const hConstThermo<equationOfState>&,
53  const hConstThermo<equationOfState>&
54 );
55 
56 template<class equationOfState>
57 inline hConstThermo<equationOfState> operator-
58 (
59  const hConstThermo<equationOfState>&,
60  const hConstThermo<equationOfState>&
61 );
62 
63 template<class equationOfState>
64 inline hConstThermo<equationOfState> operator*
65 (
66  const scalar,
67  const hConstThermo<equationOfState>&
68 );
69 
70 template<class equationOfState>
71 inline hConstThermo<equationOfState> operator==
72 (
73  const hConstThermo<equationOfState>&,
74  const hConstThermo<equationOfState>&
75 );
76 
77 template<class equationOfState>
78 Ostream& operator<<
79 (
80  Ostream&,
81  const hConstThermo<equationOfState>&
82 );
83 
84 
85 /*---------------------------------------------------------------------------*\
86  Class hConstThermo Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class equationOfState>
91 :
92  public equationOfState
93 {
94  // Private data
95 
96  scalar Cp_;
97  scalar Hf_;
98 
99 
100  // Private member functions
101 
102  //- Construct from components
103  inline hConstThermo
104  (
105  const equationOfState& st,
106  const scalar cp,
107  const scalar hf
108  );
109 
110 
111 public:
112 
113  // Constructors
114 
115  //- Construct from Istream
117 
118  //- Construct as named copy
119  inline hConstThermo(const word&, const hConstThermo&);
120 
121  //- Construct and return a clone
122  inline autoPtr<hConstThermo> clone() const;
123 
124  //- Selector from Istream
125  inline static autoPtr<hConstThermo> New(Istream& is);
126 
127 
128  // Member Functions
129 
130  // Fundamaental properties
131 
132  //- Heat capacity at constant pressure [J/(kmol K)]
133  inline scalar cp(const scalar T) const;
134 
135  //- Enthalpy [J/kmol]
136  inline scalar h(const scalar T) const;
137 
138  //- Sensible enthalpy [J/kmol]
139  inline scalar hs(const scalar T) const;
140 
141  //- Chemical enthalpy [J/kmol]
142  inline scalar hc() const;
143 
144  //- Entropy [J/(kmol K)]
145  inline scalar s(const scalar T) const;
146 
147 
148  // Member operators
149 
150  inline void operator+=(const hConstThermo&);
151  inline void operator-=(const hConstThermo&);
152 
153 
154  // Friend operators
155 
156  friend hConstThermo operator+ <equationOfState>
157  (
158  const hConstThermo&,
159  const hConstThermo&
160  );
161 
162  friend hConstThermo operator- <equationOfState>
163  (
164  const hConstThermo&,
165  const hConstThermo&
166  );
167 
168  friend hConstThermo operator* <equationOfState>
169  (
170  const scalar,
171  const hConstThermo&
172  );
173 
174  friend hConstThermo operator== <equationOfState>
175  (
176  const hConstThermo&,
177  const hConstThermo&
178  );
179 
180 
181  // IOstream Operators
182 
183  friend Ostream& operator<< <equationOfState>
184  (
185  Ostream&,
186  const hConstThermo&
187  );
188 };
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 } // End namespace Foam
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #include <specie/hConstThermoI.H>
198 
199 #ifdef NoRepository
200 # include <specie/hConstThermo.C>
201 #endif
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************ vim: set sw=4 sts=4 et: ************************ //