PengRobinsonGas.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) 2014 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::PengRobinsonGas
26 
27 Description
28  PengRobinsonGas gas equation of state.
29 
30 SourceFiles
31  PengRobinsonGasI.H
32  PengRobinsonGas.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef PengRobinsonGas_H
37 #define PengRobinsonGas_H
38 
39 #include "autoPtr.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of friend functions and operators
47 
48 template<class Specie> class PengRobinsonGas;
49 
50 template<class Specie>
51 inline PengRobinsonGas<Specie> operator+
52 (
55 );
56 
57 template<class Specie>
58 inline PengRobinsonGas<Specie> operator-
59 (
62 );
63 
64 template<class Specie>
65 inline PengRobinsonGas<Specie> operator*
66 (
67  const scalar,
69 );
70 
71 template<class Specie>
72 inline PengRobinsonGas<Specie> operator==
73 (
76 );
77 
78 template<class Specie>
79 Ostream& operator<<
80 (
81  Ostream&,
83 );
84 
85 
86 
87 /*---------------------------------------------------------------------------*\
88  Class PengRobinsonGas Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 template<class Specie>
92 class PengRobinsonGas
93 :
94  public Specie
95 {
96  // Private data
97 
98  //- Critical Temperature [K]
99  scalar Tc_;
100 
101  //- Critical volume [m^3/kmol]
102  scalar Vc_;
103 
104  //- Critical compression factor [-]
105  scalar Zc_;
106 
107  //- Critical Pressure [Pa]
108  scalar Pc_;
109 
110  //- Acentric factor [-]
111  scalar omega_;
112 
113 
114 public:
115 
116  // Constructors
117 
118  //- Construct from components
119  inline PengRobinsonGas
120  (
121  const Specie& sp,
122  const scalar& Tc,
123  const scalar& Vc,
124  const scalar& Zc,
125  const scalar& Pc,
126  const scalar& omega
127  );
128 
129  //- Construct from Istream
131 
132  //- Construct from dictionary
134 
135  //- Construct as named copy
136  inline PengRobinsonGas(const word& name, const PengRobinsonGas&);
137 
138  //- Construct and return a clone
139  inline autoPtr<PengRobinsonGas> clone() const;
140 
141  // Selector from Istream
142  inline static autoPtr<PengRobinsonGas> New(Istream& is);
143 
144  // Selector from dictionary
145  inline static autoPtr<PengRobinsonGas> New
146  (
147  const dictionary& dict
148  );
149 
150 
151  // Member functions
152 
153  //- Return the instantiated type name
154  static word typeName()
155  {
156  return "PengRobinsonGas<" + word(Specie::typeName_()) + '>';
157  }
158 
159  // Fundamental properties
160 
161 
162  //- Is the equation of state is incompressible i.e. rho != f(p)
163  static const bool incompressible = false;
164 
165  //- Is the equation of state is isochoric i.e. rho = const
166  static const bool isochoric = false;
167 
168  //- Return density [kg/m^3]
169  inline scalar rho(scalar p, scalar T) const;
170 
171  //- Return entropy [J/(kmol K)]
172  inline scalar s(const scalar p, const scalar T) const;
173 
174  //- Return compressibility rho/p [s^2/m^2]
175  inline scalar psi(scalar p, scalar T) const;
176 
177  //- Return compression factor [-]
178  inline scalar Z(scalar p, scalar T) const;
179 
180  //- Return (cp - cv) [J/(kmol K]
181  inline scalar cpMcv(scalar p, scalar T) const;
182 
183 
184  // IO
185 
186  //- Write to Ostream
187  void write(Ostream& os) const;
188 
189  // Member operators
190 
191  inline void operator+=(const PengRobinsonGas&);
192  inline void operator-=(const PengRobinsonGas&);
193 
194  inline void operator*=(const scalar);
195 
196 
197  // Friend operators
198 
199  friend PengRobinsonGas operator+ <Specie>
200  (
201  const PengRobinsonGas&,
202  const PengRobinsonGas&
203  );
204 
205  friend PengRobinsonGas operator- <Specie>
206  (
207  const PengRobinsonGas&,
208  const PengRobinsonGas&
209  );
210 
211  friend PengRobinsonGas operator* <Specie>
212  (
213  const scalar s,
214  const PengRobinsonGas&
215  );
216 
217  friend PengRobinsonGas operator== <Specie>
218  (
219  const PengRobinsonGas&,
220  const PengRobinsonGas&
221  );
222 
223 
224  // Ostream Operator
225 
226  friend Ostream& operator<< <Specie>
227  (
228  Ostream&,
229  const PengRobinsonGas&
230  );
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #include "PengRobinsonGasI.H"
241 
242 #ifdef NoRepository
243 # include "PengRobinsonGas.C"
244 #endif
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
Foam::PengRobinsonGas::s
scalar s(const scalar p, const scalar T) const
Return entropy [J/(kmol K)].
Definition: PengRobinsonGasI.H:121
Foam::PengRobinsonGas::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: PengRobinsonGasI.H:134
Foam::PengRobinsonGas::Pc_
scalar Pc_
Critical Pressure [Pa].
Definition: PengRobinsonGas.H:107
Foam::PengRobinsonGas::Vc_
scalar Vc_
Critical volume [m^3/kmol].
Definition: PengRobinsonGas.H:101
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::PengRobinsonGas::cpMcv
scalar cpMcv(scalar p, scalar T) const
Return (cp - cv) [J/(kmol K].
Definition: PengRobinsonGasI.H:212
Foam::PengRobinsonGas::Z
scalar Z(scalar p, scalar T) const
Return compression factor [-].
Definition: PengRobinsonGasI.H:146
Foam::PengRobinsonGas::operator*=
void operator*=(const scalar)
Definition: PengRobinsonGasI.H:265
Foam::PengRobinsonGas::New
static autoPtr< PengRobinsonGas > New(Istream &is)
Definition: PengRobinsonGasI.H:83
Foam::PengRobinsonGas::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: PengRobinsonGasI.H:109
PengRobinsonGas.C
Foam::PengRobinsonGas::Tc_
scalar Tc_
Critical Temperature [K].
Definition: PengRobinsonGas.H:98
Foam::PengRobinsonGas::clone
autoPtr< PengRobinsonGas > clone() const
Construct and return a clone.
Definition: PengRobinsonGasI.H:71
Foam::PengRobinsonGas::typeName
static word typeName()
Return the instantiated type name.
Definition: PengRobinsonGas.H:153
Foam::PengRobinsonGas::omega_
scalar omega_
Acentric factor [-].
Definition: PengRobinsonGas.H:110
Foam::PengRobinsonGas::operator+=
void operator+=(const PengRobinsonGas &)
Definition: PengRobinsonGasI.H:225
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::PengRobinsonGas::operator-=
void operator-=(const PengRobinsonGas &)
Definition: PengRobinsonGasI.H:245
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::PengRobinsonGas
PengRobinsonGas gas equation of state.
Definition: PengRobinsonGas.H:47
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::PengRobinsonGas::PengRobinsonGas
PengRobinsonGas(const Specie &sp, const scalar &Tc, const scalar &Vc, const scalar &Zc, const scalar &Pc, const scalar &omega)
Construct from components.
Definition: PengRobinsonGasI.H:33
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::PengRobinsonGas::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: PengRobinsonGas.H:165
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::PengRobinsonGas::Zc_
scalar Zc_
Critical compression factor [-].
Definition: PengRobinsonGas.H:104
PengRobinsonGasI.H
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::PengRobinsonGas::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: PengRobinsonGas.H:162
Foam::PengRobinsonGas::write
void write(Ostream &os) const
Write to Ostream.
Definition: PengRobinsonGas.C:66
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
autoPtr.H