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