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