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 | Copyright (C) 2015-2017 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 
155  // I-O
156 
157  //- Write to Ostream
158  void write(Ostream& os) const;
159 
160 
161  // Member operators
162 
163  inline void operator+=(const hRefConstThermo&);
164 
165 
166  // Friend operators
167 
168  friend hRefConstThermo operator+ <EquationOfState>
169  (
170  const hRefConstThermo&,
171  const hRefConstThermo&
172  );
173 
174  friend hRefConstThermo operator* <EquationOfState>
175  (
176  const scalar,
177  const hRefConstThermo&
178  );
179 
180  friend hRefConstThermo operator== <EquationOfState>
181  (
182  const hRefConstThermo&,
183  const hRefConstThermo&
184  );
185 
186 
187  // IOstream Operators
188 
189  friend Ostream& operator<< <EquationOfState>
190  (
191  Ostream&,
192  const hRefConstThermo&
193  );
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #include "hRefConstThermoI.H"
204 
205 #ifdef NoRepository
206  #include "hRefConstThermo.C"
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
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:137
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy, recursively if necessary, the source to the destination.
Definition: POSIX.C:739
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 &)
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.