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