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