ePowerThermo.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) 2021 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::ePowerThermo
26 
27 Description
28  Internal energy based thermodynamics package using a power function of
29  temperature for the constant heat capacity at constant volume which is
30  particularly suitable for solids at low temperatures:
31 
32  \verbatim
33  Cv = c0*pow(T/Tref, n0)
34  \endverbatim
35 
36 Usage
37  \table
38  Property | Description
39  c0 | Reference heat capacity at constant volume [J/kg/K]
40  n0 | Exponent of the power function
41  Tref | Reference temperature [K]
42  Hf | Heat of formation [J/kg]
43  \endtable
44 
45  Example specification of ePowerThermo:
46  \verbatim
47  thermodynamics
48  {
49  c0 230;
50  Tref 470;
51  n0 3;
52  Hf 0;
53  }
54  \endverbatim
55 
56 SourceFiles
57  ePowerThermoI.H
58  ePowerThermo.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef ePowerThermo_H
63 #define ePowerThermo_H
64 
65 #include "scalar.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 // Forward declaration of friend functions and operators
73 
74 template<class EquationOfState> class ePowerThermo;
75 
76 template<class EquationOfState>
77 inline ePowerThermo<EquationOfState> operator+
78 (
79  const ePowerThermo<EquationOfState>&,
80  const ePowerThermo<EquationOfState>&
81 );
82 
83 template<class EquationOfState>
84 inline ePowerThermo<EquationOfState> operator*
85 (
86  const scalar,
87  const ePowerThermo<EquationOfState>&
88 );
89 
90 
91 template<class EquationOfState>
92 inline ePowerThermo<EquationOfState> operator==
93 (
94  const ePowerThermo<EquationOfState>&,
95  const ePowerThermo<EquationOfState>&
96 );
97 
98 
99 template<class EquationOfState>
100 Ostream& operator<<
101 (
102  Ostream&,
103  const ePowerThermo<EquationOfState>&
104 );
105 
106 
107 /*---------------------------------------------------------------------------*\
108  Class ePowerThermo Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 template<class EquationOfState>
112 class ePowerThermo
113 :
114  public EquationOfState
115 {
116  // Private Data
117 
118  scalar c0_;
119  scalar n0_;
120  scalar Tref_;
121  scalar Hf_;
122 
123 
124  // Private Member Functions
125 
126  //- Check given temperature is within the range of the fitted coeffs
127  inline void checkT(const scalar T) const;
128 
129  //- Construct from components
130  inline ePowerThermo
131  (
132  const EquationOfState& st,
133  const scalar c0,
134  const scalar n0,
135  const scalar Tref,
136  const scalar Hf
137  );
138 
139 
140 public:
141 
142  // Constructors
143 
144  //- Construct from dictionary
145  ePowerThermo(const dictionary&);
146 
147  //- Construct as a named copy
148  inline ePowerThermo
149  (
150  const word&,
151  const ePowerThermo&
152  );
153 
154  //- Construct and return a clone
155  inline autoPtr<ePowerThermo> clone() const;
156 
157  //- Selector from dictionary
158  inline static autoPtr<ePowerThermo> New(const dictionary& dict);
159 
160 
161  // Member Functions
162 
163  //- Return the instantiated type name
164  static word typeName()
165  {
166  return "ePower<" + EquationOfState::typeName() + '>';
167  }
168 
169  //- Limit the temperature to be in the range Tlow_ to Thigh_
170  inline scalar limit(const scalar T) const;
171 
172 
173  // Fundamental properties
174 
175  //- Heat capacity at constant volume [J/kg/K]
176  inline scalar Cv(const scalar p, const scalar T) const;
177 
178  //- Sensible internal energy [J/kg]
179  inline scalar Es(const scalar p, const scalar T) const;
180 
181  //- Absolute internal energy [J/kg]
182  inline scalar Ea(const scalar p, const scalar T) const;
183 
184  //- Enthalpy of formation [J/kg]
185  inline scalar Hf() const;
186 
187  //- Entropy [J/kg/K]
188  inline scalar S(const scalar p, const scalar T) const;
189 
190  //- Gibbs free energy of the mixture in the standard state [J/kg]
191  inline scalar Gstd(const scalar T) const;
192 
193  #include "EtoHthermo.H"
194 
195 
196  // Derivative term used for Jacobian
197 
198  //- Temperature derivative of heat capacity at constant pressure
199  inline scalar dCpdT(const scalar p, const scalar T) const;
200 
201 
202  // Member Operators
203 
204  inline void operator+=(const ePowerThermo&);
205 
206 
207  // Friend operators
208 
209  friend ePowerThermo operator+ <EquationOfState>
210  (
211  const ePowerThermo&,
212  const ePowerThermo&
213  );
214 
215  friend ePowerThermo operator* <EquationOfState>
216  (
217  const scalar,
218  const ePowerThermo&
219  );
220 
221 
222  friend ePowerThermo operator== <EquationOfState>
223  (
224  const ePowerThermo&,
225  const ePowerThermo&
226  );
227 
228 
229  // Ostream Operator
230 
231  friend Ostream& operator<< <EquationOfState>
232  (
233  Ostream&,
234  const ePowerThermo&
235  );
236 };
237 
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 } // End namespace Foam
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #ifdef NoRepository
246  #include "ePowerThermoI.H"
247  #include "ePowerThermo.C"
248 #endif
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
dictionary dict
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_.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
scalar S(const scalar p, const scalar T) const
Entropy [J/kg/K].
Internal energy based thermodynamics package using a power function of temperature for the constant h...
Definition: ePowerThermo.H:88
static autoPtr< ePowerThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: ePowerThermoI.H:95
autoPtr< ePowerThermo > clone() const
Construct and return a clone.
Definition: ePowerThermoI.H:84
A class for handling words, derived from string.
Definition: word.H:59
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
scalar Hf() const
Enthalpy of formation [J/kg].
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kg/K].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
void operator+=(const ePowerThermo &)
static word typeName()
Return the instantiated type name.
Definition: ePowerThermo.H:178
Namespace for OpenFOAM.
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].