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) 2011-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::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 (
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>
90 class hConstThermo
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 from dictionary
119  hConstThermo(const dictionary& dict);
120 
121  //- Construct as named copy
122  inline hConstThermo(const word&, const hConstThermo&);
123 
124  //- Construct and return a clone
125  inline autoPtr<hConstThermo> clone() const;
126 
127  //- Selector from Istream
128  inline static autoPtr<hConstThermo> New(Istream& is);
129 
130  //- Selector from dictionary
131  inline static autoPtr<hConstThermo> New(const dictionary& dict);
132 
133 
134  // Member Functions
135 
136  //- Return the instantiated type name
137  static word typeName()
138  {
139  return "hConst<" + EquationOfState::typeName() + '>';
140  }
141 
142  //- Limit the temperature to be in the range Tlow_ to Thigh_
143  inline scalar limit(const scalar T) const;
144 
145 
146  // Fundamental properties
147 
148  //- Heat capacity at constant pressure [J/(kmol K)]
149  inline scalar cp(const scalar p, const scalar T) const;
150 
151  //- Absolute Enthalpy [J/kmol]
152  inline scalar ha(const scalar p, const scalar T) const;
153 
154  //- Sensible enthalpy [J/kmol]
155  inline scalar hs(const scalar p, const scalar T) const;
156 
157  //- Chemical enthalpy [J/kmol]
158  inline scalar hc() const;
159 
160  //- Entropy [J/(kmol K)]
161  inline scalar s(const scalar p, const scalar T) const;
162 
163 
164  // I-O
165 
166  //- Write to Ostream
167  void write(Ostream& os) const;
168 
169 
170  // Member operators
171 
172  inline void operator+=(const hConstThermo&);
173  inline void operator-=(const hConstThermo&);
174 
175 
176  // Friend operators
177 
178  friend hConstThermo operator+ <EquationOfState>
179  (
180  const hConstThermo&,
181  const hConstThermo&
182  );
183 
184  friend hConstThermo operator- <EquationOfState>
185  (
186  const hConstThermo&,
187  const hConstThermo&
188  );
189 
190  friend hConstThermo operator* <EquationOfState>
191  (
192  const scalar,
193  const hConstThermo&
194  );
195 
196  friend hConstThermo operator== <EquationOfState>
197  (
198  const hConstThermo&,
199  const hConstThermo&
200  );
201 
202 
203  // IOstream Operators
204 
205  friend Ostream& operator<< <EquationOfState>
206  (
207  Ostream&,
208  const hConstThermo&
209  );
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #include "hConstThermoI.H"
220 
221 #ifdef NoRepository
222  #include "hConstThermo.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
dictionary dict
Constant properties thermodynamics package templated into the EquationOfState.
Definition: hConstThermo.H:46
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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].
static autoPtr< hConstThermo > New(Istream &is)
Selector from Istream.
Definition: hConstThermoI.H:70
static word typeName()
Return the instantiated type name.
Definition: hConstThermo.H:136
void operator+=(const hConstThermo &)
scalar cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kmol K)].
A class for handling words, derived from string.
Definition: word.H:59
void operator-=(const hConstThermo &)
void write(Ostream &os) const
Write to Ostream.
Definition: hConstThermo.C:60
scalar ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kmol].
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
autoPtr< hConstThermo > clone() const
Construct and return a clone.
Definition: hConstThermoI.H:59
scalar hc() const
Chemical enthalpy [J/kmol].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
volScalarField & p
scalar s(const scalar p, const scalar T) const
Entropy [J/(kmol K)].
Namespace for OpenFOAM.
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: hConstThermoI.H:94