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