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  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::hConstThermo
29 
30 Group
31  grpSpecieThermo
32 
33 Description
34  Constant properties thermodynamics package
35  templated into the EquationOfState.
36 
37 SourceFiles
38  hConstThermoI.H
39  hConstThermo.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef hConstThermo_H
44 #define hConstThermo_H
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of friend functions and operators
52 
53 template<class EquationOfState> class hConstThermo;
54 
55 template<class EquationOfState>
56 inline hConstThermo<EquationOfState> operator+
57 (
60 );
61 
62 template<class EquationOfState>
63 inline hConstThermo<EquationOfState> operator*
64 (
65  const scalar,
67 );
68 
69 template<class EquationOfState>
70 inline hConstThermo<EquationOfState> operator==
71 (
74 );
75 
76 template<class EquationOfState>
77 Ostream& operator<<
78 (
79  Ostream&,
81 );
82 
83 
84 /*---------------------------------------------------------------------------*\
85  Class hConstThermo Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 template<class EquationOfState>
89 class hConstThermo
90 :
91  public EquationOfState
92 {
93  // Private data
94 
95  scalar Cp_;
96  scalar Hf_;
97 
98  //- Reference temperature
99  scalar Tref_;
100 
101  //- Reference sensible enthalpy
102  scalar Hsref_;
103 
104 
105  // Private Member Functions
106 
107  //- Construct from components
108  inline hConstThermo
109  (
110  const EquationOfState& st,
111  const scalar cp,
112  const scalar hf,
113  const scalar Tref,
114  const scalar Href
115  );
116 
117 
118 public:
119 
120  // Constructors
121 
122  //- Construct from dictionary
123  hConstThermo(const dictionary& dict);
124 
125  //- Construct as named copy
126  inline hConstThermo(const word&, const hConstThermo&);
127 
128  //- Construct and return a clone
129  inline autoPtr<hConstThermo> clone() const;
130 
131  //- Selector from dictionary
132  inline static autoPtr<hConstThermo> New(const dictionary& dict);
133 
134 
135  // Member Functions
136 
137  //- Return the instantiated type name
138  static word typeName()
139  {
140  return "hConst<" + EquationOfState::typeName() + '>';
141  }
142 
143  //- Limit temperature to be within the range
144  inline scalar limit(const scalar T) const;
145 
146 
147  // Fundamental properties
148 
149  //- Heat capacity at constant pressure [J/(kg K)]
150  inline scalar Cp(const scalar p, const scalar T) const;
151 
152  //- Absolute Enthalpy [J/kg]
153  inline scalar Ha(const scalar p, const scalar T) const;
154 
155  //- Sensible enthalpy [J/kg]
156  inline scalar Hs(const scalar p, const scalar T) const;
157 
158  //- Chemical enthalpy [J/kg]
159  inline scalar Hc() const;
160 
161  //- Entropy [J/(kg K)]
162  inline scalar S(const scalar p, const scalar T) const;
163 
164  //- Gibbs free energy of the mixture in the standard state [J/kg]
165  inline scalar Gstd(const scalar T) const;
166 
167  #include "HtoEthermo.H"
168 
169 
170  // Derivative term used for Jacobian
171 
172 
173  //- Temperature derivative of heat capacity at constant pressure
174  inline scalar dCpdT(const scalar p, const scalar T) const;
175 
176 
177 
178  // I-O
179 
180  //- Write to Ostream
181  void write(Ostream& os) const;
182 
183 
184  // Member operators
185 
186  inline void operator+=(const hConstThermo&);
187 
188 
189  // Friend operators
190 
191  friend hConstThermo operator+ <EquationOfState>
192  (
193  const hConstThermo&,
194  const hConstThermo&
195  );
196 
197  friend hConstThermo operator* <EquationOfState>
198  (
199  const scalar,
200  const hConstThermo&
201  );
202 
203  friend hConstThermo operator== <EquationOfState>
204  (
205  const hConstThermo&,
206  const hConstThermo&
207  );
208 
209 
210  // IOstream Operators
211 
212  friend Ostream& operator<< <EquationOfState>
213  (
214  Ostream&,
215  const hConstThermo&
216  );
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #include "hConstThermoI.H"
227 
228 #ifdef NoRepository
229  #include "hConstThermo.C"
230 #endif
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
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:116
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::hConstThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: hConstThermoI.H:125
Foam::hConstThermo::limit
scalar limit(const scalar T) const
Limit temperature to be within the range.
Definition: hConstThermoI.H:85
Foam::hConstThermo::write
void write(Ostream &os) const
Write to Ostream.
Definition: hConstThermo.C:48
Foam::hConstThermo::operator+=
void operator+=(const hConstThermo &)
Definition: hConstThermoI.H:164
hConstThermoI.H
Foam::hConstThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: hConstThermo.H:137
Foam::hConstThermo::New
static autoPtr< hConstThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: hConstThermoI.H:75
Foam::hConstThermo::clone
autoPtr< hConstThermo > clone() const
Construct and return a clone.
Definition: hConstThermoI.H:67
hConstThermo.C
Foam::hConstThermo::Ha
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: hConstThermoI.H:106
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:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::hConstThermo::Gstd
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
Definition: hConstThermoI.H:143
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:153
Foam::hConstThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: hConstThermoI.H:133
Foam::hConstThermo::Cp
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: hConstThermoI.H:95
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:52