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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::hPowerThermo
29
30Group
31 grpSpecieThermo
32
33Description
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
43SourceFiles
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
56namespace Foam
57{
58
59// Forward declaration of friend functions and operators
60
61template<class EquationOfState> class hPowerThermo;
62
63template<class EquationOfState>
64inline hPowerThermo<EquationOfState> operator+
65(
68);
69
70template<class EquationOfState>
71inline hPowerThermo<EquationOfState> operator*
72(
73 const scalar,
75);
76
77
78template<class EquationOfState>
79inline hPowerThermo<EquationOfState> operator==
80(
83);
84
85
86template<class EquationOfState>
87Ostream& operator<<
88(
89 Ostream&,
91);
92
93
94/*---------------------------------------------------------------------------*\
95 Class hPowerThermo Declaration
96\*---------------------------------------------------------------------------*/
97
98template<class EquationOfState>
99class 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
127public:
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
199 friend hPowerThermo operator+ <EquationOfState>
200 (
201 const hPowerThermo&,
202 const hPowerThermo&
203 );
205 friend hPowerThermo operator* <EquationOfState>
206 (
207 const scalar,
208 const hPowerThermo&
209 );
210
212 friend hPowerThermo operator== <EquationOfState>
213 (
214 const hPowerThermo&,
215 const hPowerThermo&
216 );
217
218
219 // Ostream Operator
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// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Power-function based thermodynamics package templated on EquationOfState.
Definition: hPowerThermo.H:101
scalar limit(const scalar T) const
Limit temperature to be within the range.
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
autoPtr< hPowerThermo > clone() const
Construct and return a clone.
Definition: hPowerThermoI.H:87
static word typeName()
Return the instantiated type name.
Definition: hPowerThermo.H:150
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
static autoPtr< hPowerThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: hPowerThermoI.H:95
scalar Hc() const
Chemical enthalpy [J/kg].
void operator+=(const hPowerThermo &)
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & T
const volScalarField & Cp
Definition: EEqn.H:7
Namespace for OpenFOAM.
dictionary dict