hRefConstThermo.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) 2015-2016 OpenFOAM Foundation
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::hRefConstThermo
26 
27 Description
28  Constant properties thermodynamics package
29  templated into the EquationOfState.
30 
31 SourceFiles
32  hRefConstThermoI.H
33  hRefConstThermo.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef hRefConstThermo_H
38 #define hRefConstThermo_H
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of friend functions and operators
46 
47 template<class EquationOfState> class hRefConstThermo;
48 
49 template<class EquationOfState>
50 inline hRefConstThermo<EquationOfState> operator+
51 (
53  const hRefConstThermo<EquationOfState>&
54 );
55 
56 template<class EquationOfState>
57 inline hRefConstThermo<EquationOfState> operator-
58 (
59  const hRefConstThermo<EquationOfState>&,
60  const hRefConstThermo<EquationOfState>&
61 );
62 
63 template<class EquationOfState>
64 inline hRefConstThermo<EquationOfState> operator*
65 (
66  const scalar,
67  const hRefConstThermo<EquationOfState>&
68 );
69 
70 template<class EquationOfState>
71 inline hRefConstThermo<EquationOfState> operator==
72 (
73  const hRefConstThermo<EquationOfState>&,
74  const hRefConstThermo<EquationOfState>&
75 );
76 
77 template<class EquationOfState>
78 Ostream& operator<<
79 (
80  Ostream&,
81  const hRefConstThermo<EquationOfState>&
82 );
83 
84 
85 /*---------------------------------------------------------------------------*\
86  Class hRefConstThermo Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class EquationOfState>
90 class hRefConstThermo
91 :
92  public EquationOfState
93 {
94  // Private data
95 
96  scalar Cp_;
97  scalar Hf_;
98  scalar Tref_;
99  scalar Href_;
100 
101 
102  // Private Member Functions
103 
104  //- Construct from components
105  inline hRefConstThermo
106  (
107  const EquationOfState& st,
108  const scalar cp,
109  const scalar hf,
110  const scalar tref,
111  const scalar href
112  );
113 
114 
115 public:
116 
117  // Constructors
118 
119  //- Construct from Istream
121 
122  //- Construct from dictionary
124 
125  //- Construct as named copy
126  inline hRefConstThermo(const word&, const hRefConstThermo&);
127 
128  //- Construct and return a clone
129  inline autoPtr<hRefConstThermo> clone() const;
130 
131  //- Selector from Istream
132  inline static autoPtr<hRefConstThermo> New(Istream& is);
133 
134  //- Selector from dictionary
135  inline static autoPtr<hRefConstThermo> New(const dictionary& dict);
136 
137 
138  // Member Functions
139 
140  //- Return the instantiated type name
141  static word typeName()
142  {
143  return "hRefConst<" + EquationOfState::typeName() + '>';
144  }
145 
146  //- Limit the temperature to be in the range Tlow_ to Thigh_
147  inline scalar limit(const scalar T) const;
148 
149 
150  // Fundamental properties
151 
152  //- Heat capacity at constant pressure [J/(kmol K)]
153  inline scalar cp(const scalar p, const scalar T) const;
154 
155  //- Absolute Enthalpy [J/kmol]
156  inline scalar ha(const scalar p, const scalar T) const;
157 
158  //- Sensible enthalpy [J/kmol]
159  inline scalar hs(const scalar p, const scalar T) const;
160 
161  //- Chemical enthalpy [J/kmol]
162  inline scalar hc() const;
163 
164  //- Entropy [J/(kmol K)]
165  inline scalar s(const scalar p, const scalar T) const;
166 
167 
168  // I-O
169 
170  //- Write to Ostream
171  void write(Ostream& os) const;
172 
173 
174  // Member operators
175 
176  inline void operator+=(const hRefConstThermo&);
177  inline void operator-=(const hRefConstThermo&);
178 
179 
180  // Friend operators
181 
182  friend hRefConstThermo operator+ <EquationOfState>
183  (
184  const hRefConstThermo&,
185  const hRefConstThermo&
186  );
187 
188  friend hRefConstThermo operator- <EquationOfState>
189  (
190  const hRefConstThermo&,
191  const hRefConstThermo&
192  );
193 
194  friend hRefConstThermo operator* <EquationOfState>
195  (
196  const scalar,
197  const hRefConstThermo&
198  );
199 
200  friend hRefConstThermo operator== <EquationOfState>
201  (
202  const hRefConstThermo&,
203  const hRefConstThermo&
204  );
205 
206 
207  // IOstream Operators
208 
209  friend Ostream& operator<< <EquationOfState>
210  (
211  Ostream&,
212  const hRefConstThermo&
213  );
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #include "hRefConstThermoI.H"
224 
225 #ifdef NoRepository
226  #include "hRefConstThermo.C"
227 #endif
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
dictionary dict
scalar s(const scalar p, const scalar T) const
Entropy [J/(kmol K)].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
static autoPtr< hRefConstThermo > New(Istream &is)
Selector from Istream.
void operator-=(const hRefConstThermo &)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
scalar hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kmol].
scalar hc() const
Chemical enthalpy [J/kmol].
void operator+=(const hRefConstThermo &)
scalar ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kmol].
static word typeName()
Return the instantiated type name.
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
autoPtr< hRefConstThermo > clone() const
Construct and return a clone.
scalar cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kmol K)].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Constant properties thermodynamics package templated into the EquationOfState.
volScalarField & p
void write(Ostream &os) const
Write to Ostream.
Namespace for OpenFOAM.