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