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 | Copyright (C) 2012-2015 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 (
62 );
63 
64 template<class EquationOfState>
65 inline hPowerThermo<EquationOfState> operator-
66 (
69 );
70 
71 template<class EquationOfState>
72 inline hPowerThermo<EquationOfState> operator*
73 (
74  const scalar,
76 );
77 
78 
79 template<class EquationOfState>
80 inline hPowerThermo<EquationOfState> operator==
81 (
84 );
85 
86 
87 template<class EquationOfState>
88 Ostream& operator<<
89 (
90  Ostream&,
92 );
93 
94 
95 /*---------------------------------------------------------------------------*\
96  Class hPowerThermo Declaration
97 \*---------------------------------------------------------------------------*/
98 
99 template<class EquationOfState>
100 class hPowerThermo
101 :
102  public EquationOfState
103 {
104  // Private data
105 
106  scalar c0_;
107  scalar n0_;
108  scalar Tref_;
109  scalar Hf_;
110 
111 
112  // Private Member Functions
113 
114  //- Check given temperature is within the range of the fitted coeffs
115  inline void checkT(const scalar T) const;
116 
117  //- Construct from components
118  inline hPowerThermo
119  (
120  const EquationOfState& st,
121  const scalar c0,
122  const scalar n0,
123  const scalar Tref,
124  const scalar Hf
125  );
126 
127 
128 public:
129 
130  // Constructors
131 
132  //- Construct from Istream
134 
135  //- Construct from dictionary
136  hPowerThermo(const dictionary&);
137 
138  //- Construct as a named copy
139  inline hPowerThermo
140  (
141  const word&,
142  const hPowerThermo&
143  );
144 
145  //- Construct and return a clone
146  inline autoPtr<hPowerThermo> clone() const;
147 
148  //- Selector from Istream
149  inline static autoPtr<hPowerThermo> New(Istream& is);
150 
151  //- Selector from dictionary
152  inline static autoPtr<hPowerThermo> New(const dictionary& dict);
153 
154 
155  // Member Functions
156 
157  //- Return the instantiated type name
158  static word typeName()
159  {
160  return "hPower<" + EquationOfState::typeName() + '>';
161  }
162 
163  //- Limit the temperature to be in the range Tlow_ to Thigh_
164  inline scalar limit(const scalar T) const;
165 
166 
167  // Fundamental properties
168 
169  //- Heat capacity at constant pressure [J/(kg K)]
170  inline scalar cp(const scalar p, const scalar T) const;
171 
172  //- Absolute enthalpy [J/kmol]
173  inline scalar ha(const scalar p, const scalar T) const;
174 
175  //- Sensible enthalpy [J/kg]
176  inline scalar hs(const scalar p, const scalar T) const;
177 
178  //- Chemical enthalpy [J/kg]
179  inline scalar hc() const;
180 
181  //- Entropy [J/(kmol K)]
182  inline scalar s(const scalar p, const scalar T) const;
183 
184 
185  // Member operators
186 
187  inline void operator+=(const hPowerThermo&);
188  inline void operator-=(const hPowerThermo&);
189 
190 
191  // Friend operators
192 
193  friend hPowerThermo operator+ <EquationOfState>
194  (
195  const hPowerThermo&,
196  const hPowerThermo&
197  );
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 // ************************************************************************* //
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::hPowerThermo
Power-function based thermodynamics package templated on EquationOfState.
Definition: hPowerThermo.H:54
Foam::hPowerThermo::operator+=
void operator+=(const hPowerThermo &)
Definition: hPowerThermoI.H:181
Foam::hPowerThermo::hPowerThermo
hPowerThermo(const EquationOfState &st, const scalar c0, const scalar n0, const scalar Tref, const scalar Hf)
Construct from components.
Definition: hPowerThermoI.H:66
Foam::hPowerThermo::n0_
scalar n0_
Definition: hPowerThermo.H:106
Foam::hPowerThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: hPowerThermoI.H:119
hPowerThermo.C
Foam::hPowerThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: hPowerThermo.H:157
Foam::hPowerThermo::New
static autoPtr< hPowerThermo > New(Istream &is)
Selector from Istream.
Definition: hPowerThermoI.H:95
Foam::hPowerThermo::ha
scalar ha(const scalar p, const scalar T) const
Absolute enthalpy [J/kmol].
Definition: hPowerThermoI.H:139
Foam::hPowerThermo::checkT
void checkT(const scalar T) const
Check given temperature is within the range of the fitted coeffs.
Definition: hPowerThermoI.H:33
Foam::hPowerThermo::cp
scalar cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: hPowerThermoI.H:129
Foam::hPowerThermo::hs
scalar hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: hPowerThermoI.H:149
Foam::hPowerThermo::clone
autoPtr< hPowerThermo > clone() const
Construct and return a clone.
Definition: hPowerThermoI.H:84
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::hPowerThermo::c0_
scalar c0_
Definition: hPowerThermo.H:105
Foam::hPowerThermo::Hf_
scalar Hf_
Definition: hPowerThermo.H:108
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::hPowerThermo::hc
scalar hc() const
Chemical enthalpy [J/kg].
Definition: hPowerThermoI.H:159
Foam::hPowerThermo::operator-=
void operator-=(const hPowerThermo &)
Definition: hPowerThermoI.H:200
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
scalar.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::hPowerThermo::s
scalar s(const scalar p, const scalar T) const
Entropy [J/(kmol K)].
Definition: hPowerThermoI.H:167
Foam::hPowerThermo::Tref_
scalar Tref_
Definition: hPowerThermo.H:107
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
hPowerThermoI.H