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