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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::eConstThermo
29
30Group
31 grpSpecieThermo
32
33Description
34 Constant properties thermodynamics package templated on an equation of
35 state
36
37SourceFiles
38 eConstThermoI.H
39 eConstThermo.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef eConstThermo_H
44#define eConstThermo_H
45
46#include "thermo.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// Forward declaration of friend functions and operators
54
55template<class EquationOfState> class eConstThermo;
56
57template<class EquationOfState>
58inline eConstThermo<EquationOfState> operator+
59(
62);
63
64template<class EquationOfState>
65inline eConstThermo<EquationOfState> operator*
66(
67 const scalar,
69);
70
71template<class EquationOfState>
72inline eConstThermo<EquationOfState> operator==
73(
76);
77
78template<class EquationOfState>
79Ostream& operator<<
80(
81 Ostream&,
83);
84
85
86/*---------------------------------------------------------------------------*\
87 Class eConstThermo Declaration
88\*---------------------------------------------------------------------------*/
89
90template<class EquationOfState>
91class eConstThermo
92:
93 public EquationOfState
94{
95 // Private data
96
97 //- Heat capacity at constant volume
98 // Note: input in [J/(kg K)], but internally uses [J/(kmol K)]
99 scalar Cv_;
100
101 //- Heat of formation
102 // Note: input in [J/kg], but internally uses [J/kmol]
103 scalar Hf_;
104
105 //- Reference temperature around which to linearise [K]
106 scalar Tref_;
107
108 //- Reference sensible enthalpy around which to linearise [J/kg]
109 scalar Esref_;
110
111
112 // Private Member Functions
113
114 //- Construct from components
115 inline eConstThermo
116 (
117 const EquationOfState& st,
118 const scalar cv,
119 const scalar hf,
120 const scalar Tref,
121 const scalar Esref
122 );
123
124
125public:
126
127 // Constructors
128
129 //- Construct from dictionary
131
132 //- Construct as named copy
133 inline eConstThermo(const word&, const eConstThermo&);
134
135 //- Construct and return a clone
136 inline autoPtr<eConstThermo> clone() const;
137
138 // Selector from dictionary
139 inline static autoPtr<eConstThermo> New(const dictionary& dict);
140
141
142 // Member Functions
143
144 //- Return the instantiated type name
145 static word typeName()
146 {
147 return "eConst<" + EquationOfState::typeName() + '>';
148 }
149
150 //- Limit temperature to be within the range
151 inline scalar limit(const scalar T) const;
152
153
154 // Fundamental properties
155
156 //- Heat capacity at constant volume [J/(kg K)]
157 inline scalar Cv(const scalar p, const scalar T) const;
158
159 //- Sensible internal energy [J/kg]
160 inline scalar Es(const scalar p, const scalar T) const;
161
162 //- Absolute internal energy [J/kg]
163 inline scalar Ea(const scalar p, const scalar T) const;
164
165 //- Chemical enthalpy [J/kg]
166 inline scalar Hc() const;
167
168 //- Entropy [J/(kg K)]
169 inline scalar S(const scalar p, const scalar T) const;
170
171 //- Gibbs free energy of the mixture in the standard state [J/kg]
172 inline scalar Gstd(const scalar T) const;
173
174 #include "EtoHthermo.H"
175
176
177 // Derivative term used for Jacobian
178
179
180 //- Temperature derivative of heat capacity at constant pressure
181 inline scalar dCpdT(const scalar p, const scalar T) const;
182
183
184 // I-O
185
186 //- Write to Ostream
187 void write(Ostream& os) const;
188
189
190 // Member operators
191
192 inline void operator+=(const eConstThermo&);
193
194
195 // Friend operators
197 friend eConstThermo operator+ <EquationOfState>
198 (
199 const eConstThermo&,
200 const eConstThermo&
201 );
203 friend eConstThermo operator* <EquationOfState>
204 (
205 const scalar,
206 const eConstThermo&
207 );
209 friend eConstThermo operator== <EquationOfState>
210 (
211 const eConstThermo&,
212 const eConstThermo&
213 );
214
215
216 // IOstream Operators
218 friend Ostream& operator<< <EquationOfState>
219 (
220 Ostream&,
221 const eConstThermo&
222 );
223};
224
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228} // End namespace Foam
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#include "eConstThermoI.H"
233
234#ifdef NoRepository
235 #include "eConstThermo.C"
236#endif
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240#endif
241
242// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Constant properties thermodynamics package templated on an equation of state.
Definition: eConstThermo.H:93
scalar limit(const scalar T) const
Limit temperature to be within the range.
Definition: eConstThermoI.H:85
static word typeName()
Return the instantiated type name.
Definition: eConstThermo.H:144
void operator+=(const eConstThermo &)
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
scalar Hc() const
Chemical enthalpy [J/kg].
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
eConstThermo(const word &, const eConstThermo &)
Construct as named copy.
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
static autoPtr< eConstThermo > New(const dictionary &dict)
Definition: eConstThermoI.H:75
autoPtr< eConstThermo > clone() const
Construct and return a clone.
Definition: eConstThermoI.H:67
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & T
const volScalarField & Cv
Definition: EEqn.H:8
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
dictionary dict