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-2020 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  //- Enthalpy of formation [J/kg]
166  inline scalar Hf() const;
167 
168  //- Entropy [J/kg/K]
169  inline scalar S(const scalar p, const scalar T) const;
170 
171  //- Gibbs free energy of the mixture in the standard state [J/kg]
172  inline scalar Gstd(const scalar T) const;
173 
174  #include "HtoEthermo.H"
175 
176 
177  // Derivative term used for Jacobian
178 
179  //- Temperature derivative of heat capacity at constant pressure
180  inline scalar dCpdT(const scalar p, const scalar T) const;
181 
182 
183  // Member Operators
184 
185  inline void operator+=(const hPowerThermo&);
186 
187 
188  // Friend operators
189 
190  friend hPowerThermo operator+ <EquationOfState>
191  (
192  const hPowerThermo&,
193  const hPowerThermo&
194  );
195 
196  friend hPowerThermo operator* <EquationOfState>
197  (
198  const scalar,
199  const hPowerThermo&
200  );
201 
202 
203  friend hPowerThermo operator== <EquationOfState>
204  (
205  const hPowerThermo&,
206  const hPowerThermo&
207  );
208 
209 
210  // Ostream Operator
211 
212  friend Ostream& operator<< <EquationOfState>
213  (
214  Ostream&,
215  const hPowerThermo&
216  );
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #ifdef NoRepository
227  #include "hPowerThermoI.H"
228  #include "hPowerThermo.C"
229 #endif
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
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:144
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].
Power-function based thermodynamics package templated on EquationOfState.
Definition: hPowerThermo.H:54
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.