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 |
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  | Copyright (C) 2012-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::hPowerThermo
28 
29 Group
30  grpSpecieThermo
31 
32 Description
33  Power-function based thermodynamics package templated on EquationOfState.
34 
35  In this thermodynamics package the heat capacity is a simple power of
36  temperature:
37 
38  Cp(T) = c0*(T/Tref)^n0;
39 
40  which is particularly suitable for solids.
41 
42 SourceFiles
43  hPowerThermoI.H
44  hPowerThermo.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef hPowerThermo_H
49 #define hPowerThermo_H
50 
51 #include "scalar.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of friend functions and operators
59 
60 template<class EquationOfState> class hPowerThermo;
61 
62 template<class EquationOfState>
63 inline hPowerThermo<EquationOfState> operator+
64 (
67 );
68 
69 template<class EquationOfState>
70 inline hPowerThermo<EquationOfState> operator*
71 (
72  const scalar,
74 );
75 
76 
77 template<class EquationOfState>
78 inline hPowerThermo<EquationOfState> operator==
79 (
82 );
83 
84 
85 template<class EquationOfState>
86 Ostream& operator<<
87 (
88  Ostream&,
90 );
91 
92 
93 /*---------------------------------------------------------------------------*\
94  Class hPowerThermo Declaration
95 \*---------------------------------------------------------------------------*/
96 
97 template<class EquationOfState>
98 class hPowerThermo
99 :
100  public EquationOfState
101 {
102  // Private data
103 
104  scalar c0_;
105  scalar n0_;
106  scalar Tref_;
107  scalar Hf_;
108 
109 
110  // Private Member Functions
111 
112  //- Check given temperature is within the range of the fitted coeffs
113  inline void checkT(const scalar T) const;
114 
115  //- Construct from components
116  inline hPowerThermo
117  (
118  const EquationOfState& st,
119  const scalar c0,
120  const scalar n0,
121  const scalar Tref,
122  const scalar Hf
123  );
124 
125 
126 public:
127 
128  // Constructors
129 
130  //- Construct from dictionary
131  hPowerThermo(const dictionary&);
132 
133  //- Construct as a named copy
134  inline hPowerThermo
135  (
136  const word&,
137  const hPowerThermo&
138  );
139 
140  //- Construct and return a clone
141  inline autoPtr<hPowerThermo> clone() const;
142 
143  //- Selector from dictionary
144  inline static autoPtr<hPowerThermo> New(const dictionary& dict);
145 
146 
147  // Member Functions
148 
149  //- Return the instantiated type name
150  static word typeName()
151  {
152  return "hPower<" + EquationOfState::typeName() + '>';
153  }
154 
155  //- Limit the temperature to be in the range Tlow_ to Thigh_
156  inline scalar limit(const scalar T) const;
157 
158 
159  // Fundamental properties
160 
161  //- Heat capacity at constant pressure [J/(kg K)]
162  inline scalar Cp(const scalar p, const scalar T) const;
163 
164  //- Absolute Enthalpy [J/kg]
165  inline scalar Ha(const scalar p, const scalar T) const;
166 
167  //- Sensible enthalpy [J/kg]
168  inline scalar Hs(const scalar p, const scalar T) const;
169 
170  //- Chemical enthalpy [J/kg]
171  inline scalar Hc() const;
172 
173  //- Entropy [J/(kg K)]
174  inline scalar S(const scalar p, const scalar T) const;
175 
176 
177  #include "HtoEthermo.H"
178 
179 
180  // Derivative term used for Jacobian
181 
182  //- Derivative of Gibbs free energy w.r.t. temperature
183  inline scalar dGdT(const scalar p, const scalar T) const;
184 
185  //- Temperature derivative of heat capacity at constant pressure
186  inline scalar dCpdT(const scalar p, const scalar T) const;
187 
188 
189 
190  // Member operators
191 
192  inline void operator+=(const hPowerThermo&);
193 
194 
195  // Friend operators
196 
197  friend hPowerThermo operator+ <EquationOfState>
198  (
199  const hPowerThermo&,
200  const hPowerThermo&
201  );
202 
203  friend hPowerThermo operator* <EquationOfState>
204  (
205  const scalar,
206  const hPowerThermo&
207  );
208 
209 
210  friend hPowerThermo operator== <EquationOfState>
211  (
212  const hPowerThermo&,
213  const hPowerThermo&
214  );
215 
216 
217  // Ostream Operator
218 
219  friend Ostream& operator<< <EquationOfState>
220  (
221  Ostream&,
222  const hPowerThermo&
223  );
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #ifdef NoRepository
234  #include "hPowerThermoI.H"
235  #include "hPowerThermo.C"
236 #endif
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
HtoEthermo.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:61
Foam::hPowerThermo
Power-function based thermodynamics package templated on EquationOfState.
Definition: hPowerThermo.H:59
Foam::hPowerThermo::operator+=
void operator+=(const hPowerThermo &)
Definition: hPowerThermoI.H:191
Foam::hPowerThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: hPowerThermoI.H:104
hPowerThermo.C
Foam::hPowerThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: hPowerThermo.H:149
Foam::hPowerThermo::Hs
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: hPowerThermoI.H:134
Foam::hPowerThermo::clone
autoPtr< hPowerThermo > clone() const
Construct and return a clone.
Definition: hPowerThermoI.H:86
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:57
Foam::hPowerThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: hPowerThermoI.H:145
Foam::hPowerThermo::Ha
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: hPowerThermoI.H:124
Foam::hPowerThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: hPowerThermoI.H:153
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:120
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:177
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:32
Foam::hPowerThermo::New
static autoPtr< hPowerThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: hPowerThermoI.H:94
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:52
Foam::hPowerThermo::Cp
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: hPowerThermoI.H:114
Foam::hPowerThermo::dGdT
scalar dGdT(const scalar p, const scalar T) const
Derivative of Gibbs free energy w.r.t. temperature.
Definition: hPowerThermoI.H:165
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:55
hPowerThermoI.H