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-2017 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 scalar,
62  const eConstThermo<EquationOfState>&
63 );
64 
65 template<class EquationOfState>
66 inline eConstThermo<EquationOfState> operator==
67 (
68  const eConstThermo<EquationOfState>&,
69  const eConstThermo<EquationOfState>&
70 );
71 
72 template<class EquationOfState>
73 Ostream& operator<<
74 (
75  Ostream&,
76  const eConstThermo<EquationOfState>&
77 );
78 
79 
80 /*---------------------------------------------------------------------------*\
81  Class eConstThermo Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 template<class EquationOfState>
85 class eConstThermo
86 :
87  public EquationOfState
88 {
89  // Private data
90 
91  //- Heat capacity at constant volume
92  // Note: input in [J/(kg K)], but internally uses [J/(kmol K)]
93  scalar Cv_;
94 
95  //- Heat of formation
96  // Note: input in [J/kg], but internally uses [J/kmol]
97  scalar Hf_;
98 
99 
100  // Private Member Functions
101 
102  //- Construct from components
103  inline eConstThermo
104  (
105  const EquationOfState& st,
106  const scalar cv,
107  const scalar hf
108  );
109 
110 
111 public:
112 
113  // Constructors
114 
115  //- Construct from dictionary
116  eConstThermo(const dictionary& dict);
117 
118  //- Construct as named copy
119  inline eConstThermo(const word&, const eConstThermo&);
120 
121  //- Construct and return a clone
122  inline autoPtr<eConstThermo> clone() const;
123 
124  // Selector from dictionary
125  inline static autoPtr<eConstThermo> New(const dictionary& dict);
126 
127 
128  // Member Functions
129 
130  //- Return the instantiated type name
131  static word typeName()
132  {
133  return "eConst<" + EquationOfState::typeName() + '>';
134  }
135 
136  //- Limit the temperature to be in the range Tlow_ to Thigh_
137  inline scalar limit(const scalar T) const;
138 
139 
140  // Fundamental properties
141 
142  //- Heat capacity at constant pressure [J/(kg K)]
143  inline scalar Cp(const scalar p, const scalar T) const;
144 
145  //- Absolute Enthalpy [J/kg]
146  inline scalar Ha(const scalar p, const scalar T) const;
147 
148  //- Sensible enthalpy [J/kg]
149  inline scalar Hs(const scalar p, const scalar T) const;
150 
151  //- Chemical enthalpy [J/kg]
152  inline scalar Hc() const;
153 
154  //- Entropy [J/(kg K)]
155  inline scalar S(const scalar p, const scalar T) const;
156 
157 
158  // I-O
159 
160  //- Write to Ostream
161  void write(Ostream& os) const;
162 
163 
164  // Member operators
165 
166  inline void operator+=(const eConstThermo&);
167 
168 
169  // Friend operators
170 
171  friend eConstThermo operator+ <EquationOfState>
172  (
173  const eConstThermo&,
174  const eConstThermo&
175  );
176 
177  friend eConstThermo operator* <EquationOfState>
178  (
179  const scalar,
180  const eConstThermo&
181  );
182 
183  friend eConstThermo operator== <EquationOfState>
184  (
185  const eConstThermo&,
186  const eConstThermo&
187  );
188 
189 
190  // IOstream Operators
191 
192  friend Ostream& operator<< <EquationOfState>
193  (
194  Ostream&,
195  const eConstThermo&
196  );
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #include "eConstThermoI.H"
207 
208 #ifdef NoRepository
209  #include "eConstThermo.C"
210 #endif
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: eConstThermoI.H:83
dictionary dict
scalar Hc() const
Chemical enthalpy [J/kg].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
void operator+=(const eConstThermo &)
static word typeName()
Return the instantiated type name.
Definition: eConstThermo.H:130
Constant properties thermodynamics package templated on an equation of state.
Definition: eConstThermo.H:48
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: eConstThermoI.H:93
A class for handling words, derived from string.
Definition: word.H:59
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
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< eConstThermo > clone() const
Construct and return a clone.
Definition: eConstThermoI.H:59
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
void write(Ostream &os) const
Write to Ostream.
Definition: eConstThermo.C:43
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
static autoPtr< eConstThermo > New(const dictionary &dict)
Definition: eConstThermoI.H:70
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Namespace for OpenFOAM.