eRefConstThermo.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) 2018 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::eRefConstThermo
29 
30 Description
31  Constant properties thermodynamics package
32  templated into the EquationOfState.
33 
34 SourceFiles
35  eRefConstThermoI.H
36  eRefConstThermo.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef eRefConstThermo_H
41 #define eRefConstThermo_H
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward Declarations
49 
50 template<class EquationOfState> class eRefConstThermo;
51 
52 template<class EquationOfState>
53 inline eRefConstThermo<EquationOfState> operator+
54 (
57 );
58 
59 template<class EquationOfState>
60 inline eRefConstThermo<EquationOfState> operator*
61 (
62  const scalar,
64 );
65 
66 template<class EquationOfState>
67 inline eRefConstThermo<EquationOfState> operator==
68 (
71 );
72 
73 template<class EquationOfState>
74 Ostream& operator<<
75 (
76  Ostream&,
78 );
79 
80 
81 /*---------------------------------------------------------------------------*\
82  Class eRefConstThermo Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 template<class EquationOfState>
86 class eRefConstThermo
87 :
88  public EquationOfState
89 {
90  // Private Data
91 
92  scalar Cv_;
93  scalar Hf_;
94  scalar Tref_;
95  scalar Eref_;
96 
97 
98  // Private Member Functions
99 
100  //- Read coefficient from "thermodynamics" sub-dictionary
101  inline scalar readCoeff(const word& key, const dictionary& dict)
102  {
103  return dict.subDict("thermodynamics").get<scalar>(key);
104  }
105 
106 
107  //- Construct from components
108  inline eRefConstThermo
109  (
110  const EquationOfState& st,
111  const scalar cv,
112  const scalar hf,
113  const scalar tref,
114  const scalar eref
115  );
116 
117 
118 public:
119 
120  // Constructors
121 
122  //- Construct from dictionary
124 
125  //- Construct as named copy
126  inline eRefConstThermo(const word&, const eRefConstThermo&);
127 
128  //- Construct and return a clone
129  inline autoPtr<eRefConstThermo> clone() const;
130 
131  //- Selector from dictionary
132  inline static autoPtr<eRefConstThermo> New(const dictionary& dict);
133 
134 
135  // Member Functions
136 
137  //- Return the instantiated type name
138  static word typeName()
139  {
140  return "eRefConst<" + EquationOfState::typeName() + '>';
141  }
142 
143  //- Limit the temperature to be in the range Tlow_ to Thigh_
144  inline scalar limit(const scalar T) const;
145 
146 
147  // Fundamental properties
148 
149  //- Heat capacity at constant volume [J/(kg K)]
150  inline scalar Cv(const scalar p, const scalar T) const;
151 
152  //- Sensible internal energy [J/kg]
153  inline scalar Es(const scalar p, const scalar T) const;
154 
155  //- Absolute internal energy [J/kg]
156  inline scalar Ea(const scalar p, const scalar T) const;
157 
158  //- Chemical enthalpy [J/kg]
159  inline scalar Hc() const;
160 
161  //- Entropy [J/(kg K)]
162  inline scalar S(const scalar p, const scalar T) const;
163 
164  #include "EtoHthermo.H"
165 
166 
167  // Derivative term used for Jacobian
168 
169  //- Derivative of Gibbs free energy w.r.t. temperature
170  inline scalar dGdT(const scalar p, const scalar T) const;
171 
172  //- Temperature derivative of heat capacity at constant pressure
173  inline scalar dCpdT(const scalar p, const scalar T) const;
174 
175 
176  // I-O
177 
178  //- Write to Ostream
179  void write(Ostream& os) const;
180 
181 
182  // Member operators
183 
184  inline void operator+=(const eRefConstThermo&);
185 
186 
187  // Friend operators
188 
189  friend eRefConstThermo operator+ <EquationOfState>
190  (
191  const eRefConstThermo&,
192  const eRefConstThermo&
193  );
194 
195  friend eRefConstThermo operator* <EquationOfState>
196  (
197  const scalar,
198  const eRefConstThermo&
199  );
200 
201  friend eRefConstThermo operator== <EquationOfState>
202  (
203  const eRefConstThermo&,
204  const eRefConstThermo&
205  );
206 
207 
208  // IOstream Operators
209 
210  friend Ostream& operator<< <EquationOfState>
211  (
212  Ostream&,
213  const eRefConstThermo&
214  );
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #include "eRefConstThermoI.H"
225 
226 #ifdef NoRepository
227  #include "eRefConstThermo.C"
228 #endif
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::eRefConstThermo::dCpdT
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: eRefConstThermoI.H:159
Foam::eRefConstThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: eRefConstThermo.H:137
eRefConstThermo.C
Foam::eRefConstThermo::write
void write(Ostream &os) const
Write to Ostream.
Definition: eRefConstThermo.C:48
Foam::eRefConstThermo::Cv
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/(kg K)].
Definition: eRefConstThermoI.H:101
Foam::eRefConstThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: eRefConstThermoI.H:91
EtoHthermo.H
Foam::eRefConstThermo::dGdT
scalar dGdT(const scalar p, const scalar T) const
Derivative of Gibbs free energy w.r.t. temperature.
Definition: eRefConstThermoI.H:149
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::eRefConstThermo::operator+=
void operator+=(const eRefConstThermo &)
Definition: eRefConstThermoI.H:171
Foam::eRefConstThermo::Es
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
Definition: eRefConstThermoI.H:112
Foam::eRefConstThermo::clone
autoPtr< eRefConstThermo > clone() const
Construct and return a clone.
Definition: eRefConstThermoI.H:67
Foam::eRefConstThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: eRefConstThermoI.H:121
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::eRefConstThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: eRefConstThermoI.H:139
eRefConstThermoI.H
Foam::eRefConstThermo
Constant properties thermodynamics package templated into the EquationOfState.
Definition: eRefConstThermo.H:49
Foam::eRefConstThermo::Ea
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
Definition: eRefConstThermoI.H:129
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::eRefConstThermo::New
static autoPtr< eRefConstThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: eRefConstThermoI.H:78