hRefConstThermo.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) 2015-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::hRefConstThermo
28 
29 Group
30  grpSpecieThermo
31 
32 Description
33  Constant properties thermodynamics package
34  templated into the EquationOfState.
35 
36 SourceFiles
37  hRefConstThermoI.H
38  hRefConstThermo.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef hRefConstThermo_H
43 #define hRefConstThermo_H
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of friend functions and operators
51 
52 template<class EquationOfState> class hRefConstThermo;
53 
54 template<class EquationOfState>
55 inline hRefConstThermo<EquationOfState> operator+
56 (
59 );
60 
61 template<class EquationOfState>
62 inline hRefConstThermo<EquationOfState> operator*
63 (
64  const scalar,
66 );
67 
68 template<class EquationOfState>
69 inline hRefConstThermo<EquationOfState> operator==
70 (
73 );
74 
75 template<class EquationOfState>
76 Ostream& operator<<
77 (
78  Ostream&,
80 );
81 
82 
83 /*---------------------------------------------------------------------------*\
84  Class hRefConstThermo Declaration
85 \*---------------------------------------------------------------------------*/
86 
87 template<class EquationOfState>
88 class hRefConstThermo
89 :
90  public EquationOfState
91 {
92  // Private data
93 
94  scalar Cp_;
95  scalar Hf_;
96  scalar Tref_;
97  scalar Href_;
98 
99 
100  // Private Member Functions
101 
102  //- Construct from components
103  inline hRefConstThermo
104  (
105  const EquationOfState& st,
106  const scalar cp,
107  const scalar hf,
108  const scalar tref,
109  const scalar href
110  );
111 
112 
113 public:
114 
115  // Constructors
116 
117  //- Construct from dictionary
119 
120  //- Construct as named copy
121  inline hRefConstThermo(const word&, const hRefConstThermo&);
122 
123  //- Construct and return a clone
124  inline autoPtr<hRefConstThermo> clone() const;
125 
126  //- Selector from dictionary
127  inline static autoPtr<hRefConstThermo> New(const dictionary& dict);
128 
129 
130  // Member Functions
131 
132  //- Return the instantiated type name
133  static word typeName()
134  {
135  return "hRefConst<" + EquationOfState::typeName() + '>';
136  }
137 
138  //- Limit the temperature to be in the range Tlow_ to Thigh_
139  inline scalar limit(const scalar T) const;
140 
141 
142  // Fundamental properties
143 
144  //- Heat capacity at constant pressure [J/(kg K)]
145  inline scalar Cp(const scalar p, const scalar T) const;
146 
147  //- Absolute Enthalpy [J/kg]
148  inline scalar Ha(const scalar p, const scalar T) const;
149 
150  //- Sensible enthalpy [J/kg]
151  inline scalar Hs(const scalar p, const scalar T) const;
152 
153  //- Chemical enthalpy [J/kg]
154  inline scalar Hc() const;
155 
156  //- Entropy [J/(kg K)]
157  inline scalar S(const scalar p, const scalar T) const;
158 
159  #include "HtoEthermo.H"
160 
161 
162  // Derivative term used for Jacobian
163 
164  //- Derivative of Gibbs free energy w.r.t. temperature
165  inline scalar dGdT(const scalar p, const scalar T) const;
166 
167  //- Temperature derivative of heat capacity at constant pressure
168  inline scalar dCpdT(const scalar p, const scalar T) const;
169 
170 
171  // I-O
172 
173  //- Write to Ostream
174  void write(Ostream& os) const;
175 
176 
177  // Member operators
178 
179  inline void operator+=(const hRefConstThermo&);
180 
181 
182  // Friend operators
183 
184  friend hRefConstThermo operator+ <EquationOfState>
185  (
186  const hRefConstThermo&,
187  const hRefConstThermo&
188  );
189 
190  friend hRefConstThermo operator* <EquationOfState>
191  (
192  const scalar,
193  const hRefConstThermo&
194  );
195 
196  friend hRefConstThermo operator== <EquationOfState>
197  (
198  const hRefConstThermo&,
199  const hRefConstThermo&
200  );
201 
202 
203  // IOstream Operators
204 
205  friend Ostream& operator<< <EquationOfState>
206  (
207  Ostream&,
208  const hRefConstThermo&
209  );
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #include "hRefConstThermoI.H"
220 
221 #ifdef NoRepository
222  #include "hRefConstThermo.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
HtoEthermo.H
Foam::hRefConstThermo::Ha
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: hRefConstThermoI.H:106
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::hRefConstThermo::dCpdT
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: hRefConstThermoI.H:153
Foam::hRefConstThermo::clone
autoPtr< hRefConstThermo > clone() const
Construct and return a clone.
Definition: hRefConstThermoI.H:67
Foam::hRefConstThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: hRefConstThermoI.H:133
hRefConstThermo.C
Foam::hRefConstThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: hRefConstThermo.H:132
hRefConstThermoI.H
Foam::hRefConstThermo::Cp
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: hRefConstThermoI.H:95
Foam::hRefConstThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: hRefConstThermoI.H:125
Foam::hRefConstThermo::Hs
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: hRefConstThermoI.H:116
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::hRefConstThermo::operator+=
void operator+=(const hRefConstThermo &)
Definition: hRefConstThermoI.H:165
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::hRefConstThermo::dGdT
scalar dGdT(const scalar p, const scalar T) const
Derivative of Gibbs free energy w.r.t. temperature.
Definition: hRefConstThermoI.H:143
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::hRefConstThermo::write
void write(Ostream &os) const
Write to Ostream.
Definition: hRefConstThermo.C:47
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::hRefConstThermo::New
static autoPtr< hRefConstThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: hRefConstThermoI.H:75
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cp
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: MSwindows.C:802
Foam::hRefConstThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: hRefConstThermoI.H:85
Foam::hRefConstThermo
Constant properties thermodynamics package templated into the EquationOfState.
Definition: hRefConstThermo.H:51
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56