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