eRefConstThermo.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) 2018-2019 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::eRefConstThermo
26 
27 Description
28  Constant properties thermodynamics package
29  templated into the EquationOfState.
30 
31 SourceFiles
32  eRefConstThermoI.H
33  eRefConstThermo.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef eRefConstThermo_H
38 #define eRefConstThermo_H
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of friend functions and operators
46 
47 template<class EquationOfState> class eRefConstThermo;
48 
49 template<class EquationOfState>
50 inline eRefConstThermo<EquationOfState> operator+
51 (
53  const eRefConstThermo<EquationOfState>&
54 );
55 
56 template<class EquationOfState>
57 inline eRefConstThermo<EquationOfState> operator*
58 (
59  const scalar,
60  const eRefConstThermo<EquationOfState>&
61 );
62 
63 template<class EquationOfState>
64 inline eRefConstThermo<EquationOfState> operator==
65 (
66  const eRefConstThermo<EquationOfState>&,
67  const eRefConstThermo<EquationOfState>&
68 );
69 
70 template<class EquationOfState>
71 Ostream& operator<<
72 (
73  Ostream&,
74  const eRefConstThermo<EquationOfState>&
75 );
76 
77 
78 /*---------------------------------------------------------------------------*\
79  Class eRefConstThermo Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 template<class EquationOfState>
83 class eRefConstThermo
84 :
85  public EquationOfState
86 {
87  // Private Data
88 
89  scalar Cv_;
90  scalar Hf_;
91  scalar Tref_;
92  scalar Eref_;
93 
94 
95  // Private Member Functions
96 
97  //- Construct from components
98  inline eRefConstThermo
99  (
100  const EquationOfState& st,
101  const scalar cv,
102  const scalar hf,
103  const scalar tref,
104  const scalar eref
105  );
106 
107 
108 public:
109 
110  // Constructors
111 
112  //- Construct from dictionary
114 
115  //- Construct as named copy
116  inline eRefConstThermo(const word&, const eRefConstThermo&);
117 
118  //- Construct and return a clone
119  inline autoPtr<eRefConstThermo> clone() const;
120 
121  //- Selector from dictionary
122  inline static autoPtr<eRefConstThermo> New(const dictionary& dict);
123 
124 
125  // Member Functions
126 
127  //- Return the instantiated type name
128  static word typeName()
129  {
130  return "eRefConst<" + EquationOfState::typeName() + '>';
131  }
132 
133  //- Limit the temperature to be in the range Tlow_ to Thigh_
134  inline scalar limit(const scalar T) const;
135 
136 
137  // Fundamental properties
138 
139  //- Heat capacity at constant volume [J/kg/K]
140  inline scalar Cv(const scalar p, const scalar T) const;
141 
142  //- Sensible internal energy [J/kg]
143  inline scalar Es(const scalar p, const scalar T) const;
144 
145  //- Absolute internal energy [J/kg]
146  inline scalar Ea(const scalar p, const scalar T) const;
147 
148  //- Chemical enthalpy [J/kg]
149  inline scalar Hc() const;
150 
151  //- Entropy [J/kg/K]
152  inline scalar S(const scalar p, const scalar T) const;
153 
154  #include "EtoHthermo.H"
155 
156 
157  // Derivative term used for Jacobian
158 
159  //- Derivative of Gibbs free energy w.r.t. temperature
160  inline scalar dGdT(const scalar p, const scalar T) const;
161 
162  //- Temperature derivative of heat capacity at constant pressure
163  inline scalar dCpdT(const scalar p, const scalar T) const;
164 
165 
166  // I-O
167 
168  //- Write to Ostream
169  void write(Ostream& os) const;
170 
171 
172  // Member Operators
173 
174  inline void operator+=(const eRefConstThermo&);
175 
176 
177  // Friend operators
178 
179  friend eRefConstThermo operator+ <EquationOfState>
180  (
181  const eRefConstThermo&,
182  const eRefConstThermo&
183  );
184 
185  friend eRefConstThermo operator* <EquationOfState>
186  (
187  const scalar,
188  const eRefConstThermo&
189  );
190 
191  friend eRefConstThermo operator== <EquationOfState>
192  (
193  const eRefConstThermo&,
194  const eRefConstThermo&
195  );
196 
197 
198  // IOstream Operators
199 
200  friend Ostream& operator<< <EquationOfState>
201  (
202  Ostream&,
203  const eRefConstThermo&
204  );
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #include "eRefConstThermoI.H"
215 
216 #ifdef NoRepository
217  #include "eRefConstThermo.C"
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kg/K].
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
dictionary dict
scalar dGdT(const scalar p, const scalar T) const
Derivative of Gibbs free energy w.r.t. temperature.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
void operator+=(const eRefConstThermo &)
static word typeName()
Return the instantiated type name.
void write(Ostream &os) const
Write to Ostream.
A class for handling words, derived from string.
Definition: word.H:59
scalar S(const scalar p, const scalar T) const
Entropy [J/kg/K].
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
scalar Hc() const
Chemical enthalpy [J/kg].
static autoPtr< eRefConstThermo > New(const dictionary &dict)
Selector from dictionary.
autoPtr< eRefConstThermo > clone() const
Construct and return a clone.
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Constant properties thermodynamics package templated into the EquationOfState.
volScalarField & p
Namespace for OpenFOAM.