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