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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::eConstThermo
29 
30 Group
31  grpSpecieThermo
32 
33 Description
34  Constant properties thermodynamics package templated on an equation of
35  state
36 
37 SourceFiles
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 
50 namespace Foam
51 {
52 
53 // Forward declaration of friend functions and operators
54 
55 template<class EquationOfState> class eConstThermo;
56 
57 template<class EquationOfState>
58 inline eConstThermo<EquationOfState> operator+
59 (
62 );
63 
64 template<class EquationOfState>
65 inline eConstThermo<EquationOfState> operator*
66 (
67  const scalar,
69 );
70 
71 template<class EquationOfState>
72 inline eConstThermo<EquationOfState> operator==
73 (
76 );
77 
78 template<class EquationOfState>
79 Ostream& operator<<
80 (
81  Ostream&,
83 );
84 
85 
86 /*---------------------------------------------------------------------------*\
87  Class eConstThermo Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 template<class EquationOfState>
91 class 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 
125 public:
126 
127  // Constructors
128 
129  //- Construct from dictionary
130  eConstThermo(const dictionary& dict);
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
196 
197  friend eConstThermo operator+ <EquationOfState>
198  (
199  const eConstThermo&,
200  const eConstThermo&
201  );
202 
203  friend eConstThermo operator* <EquationOfState>
204  (
205  const scalar,
206  const eConstThermo&
207  );
208 
209  friend eConstThermo operator== <EquationOfState>
210  (
211  const eConstThermo&,
212  const eConstThermo&
213  );
214 
215 
216  // IOstream Operators
217 
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 // ************************************************************************* //
Foam::eConstThermo::Cv
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/(kg K)].
Definition: eConstThermoI.H:95
Foam::eConstThermo::clone
autoPtr< eConstThermo > clone() const
Construct and return a clone.
Definition: eConstThermoI.H:67
Foam::eConstThermo::New
static autoPtr< eConstThermo > New(const dictionary &dict)
Definition: eConstThermoI.H:75
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::eConstThermo
Constant properties thermodynamics package templated on an equation of state.
Definition: eConstThermo.H:54
Foam::eConstThermo::limit
scalar limit(const scalar T) const
Limit temperature to be within the range.
Definition: eConstThermoI.H:85
Foam::eConstThermo::write
void write(Ostream &os) const
Write to Ostream.
Definition: eConstThermo.C:48
Foam::eConstThermo::operator+=
void operator+=(const eConstThermo &)
Definition: eConstThermoI.H:171
Foam::eConstThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: eConstThermo.H:144
EtoHthermo.H
eConstThermoI.H
Foam::eConstThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: eConstThermoI.H:127
Foam::eConstThermo::Ea
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
Definition: eConstThermoI.H:117
eConstThermo.C
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::eConstThermo::Es
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
Definition: eConstThermoI.H:106
Foam::eConstThermo::Gstd
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
Definition: eConstThermoI.H:146
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::eConstThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: eConstThermoI.H:135
Foam::eConstThermo::dCpdT
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: eConstThermoI.H:158
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56