eRefConstThermo.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) 2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::eRefConstThermo
28 
29 Description
30  Constant properties thermodynamics package
31  templated into the EquationOfState.
32 
33 SourceFiles
34  eRefConstThermoI.H
35  eRefConstThermo.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef eRefConstThermo_H
40 #define eRefConstThermo_H
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 
49 template<class EquationOfState> class eRefConstThermo;
50 
51 template<class EquationOfState>
52 inline eRefConstThermo<EquationOfState> operator+
53 (
56 );
57 
58 template<class EquationOfState>
59 inline eRefConstThermo<EquationOfState> operator*
60 (
61  const scalar,
63 );
64 
65 template<class EquationOfState>
66 inline eRefConstThermo<EquationOfState> operator==
67 (
70 );
71 
72 template<class EquationOfState>
73 Ostream& operator<<
74 (
75  Ostream&,
77 );
78 
79 
80 /*---------------------------------------------------------------------------*\
81  Class eRefConstThermo Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 template<class EquationOfState>
85 class eRefConstThermo
86 :
87  public EquationOfState
88 {
89  // Private data
90 
91  scalar Cv_;
92  scalar Hf_;
93  scalar Tref_;
94  scalar Eref_;
95 
96 
97  // Private Member Functions
98 
99  //- Construct from components
100  inline eRefConstThermo
101  (
102  const EquationOfState& st,
103  const scalar cv,
104  const scalar hf,
105  const scalar tref,
106  const scalar eref
107  );
108 
109 
110 public:
111 
112  // Constructors
113 
114  //- Construct from dictionary
116 
117  //- Construct as named copy
118  inline eRefConstThermo(const word&, const eRefConstThermo&);
119 
120  //- Construct and return a clone
121  inline autoPtr<eRefConstThermo> clone() const;
122 
123  //- Selector from dictionary
124  inline static autoPtr<eRefConstThermo> New(const dictionary& dict);
125 
126 
127  // Member Functions
128 
129  //- Return the instantiated type name
130  static word typeName()
131  {
132  return "eRefConst<" + EquationOfState::typeName() + '>';
133  }
134 
135  //- Limit the temperature to be in the range Tlow_ to Thigh_
136  inline scalar limit(const scalar T) const;
137 
138 
139  // Fundamental properties
140 
141  //- Heat capacity at constant volume [J/(kg K)]
142  inline scalar Cv(const scalar p, const scalar T) const;
143 
144  //- Sensible internal energy [J/kg]
145  inline scalar Es(const scalar p, const scalar T) const;
146 
147  //- Absolute internal energy [J/kg]
148  inline scalar Ea(const scalar p, const scalar T) const;
149 
150  //- Chemical enthalpy [J/kg]
151  inline scalar Hc() const;
152 
153  //- Entropy [J/(kg K)]
154  inline scalar S(const scalar p, const scalar T) const;
155 
156  #include "EtoHthermo.H"
157 
158 
159  // Derivative term used for Jacobian
160 
161  //- Derivative of Gibbs free energy w.r.t. temperature
162  inline scalar dGdT(const scalar p, const scalar T) const;
163 
164  //- Temperature derivative of heat capacity at constant pressure
165  inline scalar dCpdT(const scalar p, const scalar T) const;
166 
167 
168  // I-O
169 
170  //- Write to Ostream
171  void write(Ostream& os) const;
172 
173 
174  // Member operators
175 
176  inline void operator+=(const eRefConstThermo&);
177 
178 
179  // Friend operators
180 
181  friend eRefConstThermo operator+ <EquationOfState>
182  (
183  const eRefConstThermo&,
184  const eRefConstThermo&
185  );
186 
187  friend eRefConstThermo operator* <EquationOfState>
188  (
189  const scalar,
190  const eRefConstThermo&
191  );
192 
193  friend eRefConstThermo operator== <EquationOfState>
194  (
195  const eRefConstThermo&,
196  const eRefConstThermo&
197  );
198 
199 
200  // IOstream Operators
201 
202  friend Ostream& operator<< <EquationOfState>
203  (
204  Ostream&,
205  const eRefConstThermo&
206  );
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #include "eRefConstThermoI.H"
217 
218 #ifdef NoRepository
219  #include "eRefConstThermo.C"
220 #endif
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::eRefConstThermo::dCpdT
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: eRefConstThermoI.H:159
Foam::eRefConstThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: eRefConstThermo.H:129
eRefConstThermo.C
Foam::eRefConstThermo::write
void write(Ostream &os) const
Write to Ostream.
Definition: eRefConstThermo.C:47
Foam::eRefConstThermo::Cv
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/(kg K)].
Definition: eRefConstThermoI.H:101
Foam::eRefConstThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: eRefConstThermoI.H:91
EtoHthermo.H
Foam::eRefConstThermo::dGdT
scalar dGdT(const scalar p, const scalar T) const
Derivative of Gibbs free energy w.r.t. temperature.
Definition: eRefConstThermoI.H:149
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::eRefConstThermo::operator+=
void operator+=(const eRefConstThermo &)
Definition: eRefConstThermoI.H:171
Foam::eRefConstThermo::Es
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
Definition: eRefConstThermoI.H:112
Foam::eRefConstThermo::clone
autoPtr< eRefConstThermo > clone() const
Construct and return a clone.
Definition: eRefConstThermoI.H:67
Foam::eRefConstThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: eRefConstThermoI.H:121
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:121
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::eRefConstThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: eRefConstThermoI.H:139
eRefConstThermoI.H
Foam::eRefConstThermo
Constant properties thermodynamics package templated into the EquationOfState.
Definition: eRefConstThermo.H:48
Foam::eRefConstThermo::Ea
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
Definition: eRefConstThermoI.H:129
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::eRefConstThermo::New
static autoPtr< eRefConstThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: eRefConstThermoI.H:78