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