eConstThermo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 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  Internal energy based thermodynamics package using a constant heat capacity
29  at constant volume.
30 
31  The sensible internal energy is evaluated as:
32  \verbatim
33  es = Cv*(T - Tref) + esRef
34  \endverbatim
35 
36 Usage
37  \table
38  Property | Description
39  Cv | Constant Heat capacity at constant volume [J/kg/K]
40  Tref | Reference temperature [K] (defaults to Tstd)
41  esRef | Reference sensible internal energy [J/kg] (defaults to 0)
42  hf | Heat of formation [J/kg]
43  \endtable
44 
45  Example specification of eConstThermo for air:
46  \verbatim
47  thermodynamics
48  {
49  Cv 724;
50  hf 0;
51  }
52  \endverbatim
53 
54 SourceFiles
55  eConstThermoI.H
56  eConstThermo.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef eConstThermo_H
61 #define eConstThermo_H
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 // Forward declaration of friend functions and operators
69 
70 template<class EquationOfState> class eConstThermo;
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 inline eConstThermo<EquationOfState> operator*
81 (
82  const scalar,
83  const eConstThermo<EquationOfState>&
84 );
85 
86 template<class EquationOfState>
88 (
91 );
92 
93 template<class EquationOfState>
94 Ostream& operator<<
95 (
96  Ostream&,
98 );
99 
100 
101 /*---------------------------------------------------------------------------*\
102  Class eConstThermo Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 template<class EquationOfState>
106 class eConstThermo
107 :
108  public EquationOfState
109 {
110  // Private Data
111 
112  //- Heat capacity at constant volume [J/kg/K]
113  scalar Cv_;
114 
115  //- Heat of formation [J/kg]
116  scalar hf_;
117 
118  //- Reference temperature around which to linearise [K]
119  scalar Tref_;
120 
121  //- Reference sensible enthalpy around which to linearise [J/kg]
122  scalar esRef_;
123 
124 
125 public:
126 
127  // Constructors
128 
129  //- Construct from components
130  inline eConstThermo
131  (
132  const EquationOfState& st,
133  const scalar Cv,
134  const scalar hf,
135  const scalar Tref,
136  const scalar esRef
137  );
138 
139  //- Construct from name and dictionary
140  eConstThermo(const word& name, const dictionary& dict);
141 
142  //- Construct as named copy
143  inline eConstThermo(const word&, const eConstThermo&);
144 
145  //- Construct and return a clone
146  inline autoPtr<eConstThermo> clone() const;
147 
148 
149  // Member Functions
150 
151  //- Return the instantiated type name
152  static word typeName()
153  {
154  return "eConst<" + EquationOfState::typeName() + '>';
155  }
156 
157  //- Limit the temperature to be in the range Tlow_ to Thigh_
158  inline scalar limit(const scalar T) const;
159 
160 
161  // Fundamental properties
162 
163  //- Heat capacity at constant volume [J/kg/K]
164  inline scalar Cv(const scalar p, const scalar T) const;
165 
166  //- Sensible internal energy [J/kg]
167  inline scalar es(const scalar p, const scalar T) const;
168 
169  //- Absolute internal energy [J/kg]
170  inline scalar ea(const scalar p, const scalar T) const;
171 
172  //- Enthalpy of formation [J/kg]
173  inline scalar hf() const;
174 
175  //- Entropy [J/kg/K]
176  inline scalar s(const scalar p, const scalar T) const;
177 
178  //- Gibbs free energy of the mixture in the standard state [J/kg]
179  inline scalar gStd(const scalar T) const;
180 
181  #include "EtoHthermo.H"
182 
183 
184  // Derivative term used for Jacobian
185 
186  //- Temperature derivative of heat capacity at constant pressure
187  inline scalar dCpdT(const scalar p, const scalar T) const;
188 
189 
190  // I-O
191 
192  //- Write to Ostream
193  void write(Ostream& os) const;
194 
195 
196  // Member Operators
197 
198  inline void operator+=(const eConstThermo&);
199 
200 
201  // Friend operators
202 
203  friend eConstThermo operator+ <EquationOfState>
204  (
205  const eConstThermo&,
206  const eConstThermo&
207  );
208 
209  friend eConstThermo operator* <EquationOfState>
210  (
211  const scalar,
212  const eConstThermo&
213  );
214 
215  friend eConstThermo operator== <EquationOfState>
216  (
217  const eConstThermo&,
218  const eConstThermo&
219  );
220 
221 
222  // IOstream Operators
223 
224  friend Ostream& operator<< <EquationOfState>
225  (
226  Ostream&,
227  const eConstThermo&
228  );
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #include "eConstThermoI.H"
239 
240 #ifdef NoRepository
241  #include "eConstThermo.C"
242 #endif
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #endif
247 
248 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Internal energy based thermodynamics package using a constant heat capacity at constant volume.
Definition: eConstThermo.H:123
scalar gStd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: eConstThermoI.H:76
scalar s(const scalar p, const scalar T) const
Entropy [J/kg/K].
static word typeName()
Return the instantiated type name.
Definition: eConstThermo.H:166
void operator+=(const eConstThermo &)
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
scalar ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
void write(Ostream &os) const
Write to Ostream.
Definition: eConstThermo.C:59
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kg/K].
Definition: eConstThermoI.H:86
scalar hf() const
Enthalpy of formation [J/kg].
scalar es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
Definition: eConstThermoI.H:97
autoPtr< eConstThermo > clone() const
Construct and return a clone.
Definition: eConstThermoI.H:63
eConstThermo(const EquationOfState &st, const scalar Cv, const scalar hf, const scalar Tref, const scalar esRef)
Construct from components.
Definition: eConstThermoI.H:30
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p