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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-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::PengRobinsonGas
28 
29 Group
30  grpSpecieEquationOfState
31 
32 Description
33  PengRobinsonGas gas equation of state.
34 
35 SourceFiles
36  PengRobinsonGasI.H
37  PengRobinsonGas.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef PengRobinsonGas_H
42 #define PengRobinsonGas_H
43 
44 #include "autoPtr.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of friend functions and operators
52 
53 template<class Specie> class PengRobinsonGas;
54 
55 template<class Specie>
56 inline PengRobinsonGas<Specie> operator+
57 (
60 );
61 
62 template<class Specie>
63 inline PengRobinsonGas<Specie> operator*
64 (
65  const scalar,
67 );
68 
69 template<class Specie>
70 inline PengRobinsonGas<Specie> operator==
71 (
74 );
75 
76 template<class Specie>
77 Ostream& operator<<
78 (
79  Ostream&,
81 );
82 
83 
84 
85 /*---------------------------------------------------------------------------*\
86  Class PengRobinsonGas Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class Specie>
90 class PengRobinsonGas
91 :
92  public Specie
93 {
94  // Private data
95 
96  //- Critical Temperature [K]
97  scalar Tc_;
98 
99  //- Critical volume [m^3/kmol]
100  scalar Vc_;
101 
102  //- Critical compression factor [-]
103  scalar Zc_;
104 
105  //- Critical Pressure [Pa]
106  scalar Pc_;
107 
108  //- Acentric factor [-]
109  scalar omega_;
110 
111 
112 public:
113 
114  // Constructors
115 
116  //- Construct from components
117  inline PengRobinsonGas
118  (
119  const Specie& sp,
120  const scalar& Tc,
121  const scalar& Vc,
122  const scalar& Zc,
123  const scalar& Pc,
124  const scalar& omega
125  );
126 
127  //- Construct from dictionary
129 
130  //- Construct as named copy
131  inline PengRobinsonGas(const word& name, const PengRobinsonGas&);
132 
133  //- Construct and return a clone
134  inline autoPtr<PengRobinsonGas> clone() const;
135 
136  // Selector from dictionary
137  inline static autoPtr<PengRobinsonGas> New
138  (
139  const dictionary& dict
140  );
141 
142 
143  // Member functions
144 
145  //- Return the instantiated type name
146  static word typeName()
147  {
148  return "PengRobinsonGas<" + word(Specie::typeName_()) + '>';
149  }
150 
151  // Fundamental properties
152 
153 
154  //- Is the equation of state is incompressible i.e. rho != f(p)
155  static const bool incompressible = false;
156 
157  //- Is the equation of state is isochoric i.e. rho = const
158  static const bool isochoric = false;
159 
160  //- Return density [kg/m^3]
161  inline scalar rho(scalar p, scalar T) const;
162 
163  //- Return enthalpy departure [J/kg]
164  inline scalar H(const scalar p, const scalar T) const;
165 
166  //- Return Cp departure [J/(kg K]
167  inline scalar Cp(scalar p, scalar T) const;
168 
169  //- Return internal energy departure [J/kg]
170  inline scalar E(const scalar p, const scalar T) const;
171 
172  //- Return Cv departure [J/(kg K]
173  inline scalar Cv(scalar p, scalar T) const;
174 
175  //- Return entropy [J/(kg K)]
176  inline scalar S(const scalar p, const scalar T) const;
177 
178  //- Return compressibility rho/p [s^2/m^2]
179  inline scalar psi(scalar p, scalar T) const;
180 
181  //- Return compression factor []
182  inline scalar Z(scalar p, scalar T) const;
183 
184  //- Return (Cp - Cv) [J/(kg K]
185  inline scalar CpMCv(scalar p, scalar T) const;
186 
187 
188  // IO
189 
190  //- Write to Ostream
191  void write(Ostream& os) const;
192 
193  // Member operators
194 
195  inline void operator+=(const PengRobinsonGas&);
196  inline void operator*=(const scalar);
197 
198 
199  // Friend operators
200 
201  friend PengRobinsonGas operator+ <Specie>
202  (
203  const PengRobinsonGas&,
204  const PengRobinsonGas&
205  );
206 
207  friend PengRobinsonGas operator* <Specie>
208  (
209  const scalar s,
210  const PengRobinsonGas&
211  );
212 
213  friend PengRobinsonGas operator== <Specie>
214  (
215  const PengRobinsonGas&,
216  const PengRobinsonGas&
217  );
218 
219 
220  // Ostream Operator
221 
222  friend Ostream& operator<< <Specie>
223  (
224  Ostream&,
225  const PengRobinsonGas&
226  );
227 };
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 } // End namespace Foam
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #include "PengRobinsonGasI.H"
237 
238 #ifdef NoRepository
239  #include "PengRobinsonGas.C"
240 #endif
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
Foam::PengRobinsonGas::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: PengRobinsonGasI.H:230
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::PengRobinsonGas::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: PengRobinsonGasI.H:243
Foam::PengRobinsonGas::operator*=
void operator*=(const scalar)
Definition: PengRobinsonGasI.H:355
Foam::PengRobinsonGas::Cv
scalar Cv(scalar p, scalar T) const
Return Cv departure [J/(kg K].
Definition: PengRobinsonGasI.H:179
Foam::PengRobinsonGas::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: PengRobinsonGasI.H:94
PengRobinsonGas.C
Foam::PengRobinsonGas::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: PengRobinsonGasI.H:305
Foam::PengRobinsonGas::clone
autoPtr< PengRobinsonGas > clone() const
Construct and return a clone.
Definition: PengRobinsonGasI.H:73
Foam::PengRobinsonGas::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: PengRobinsonGasI.H:105
Foam::PengRobinsonGas::typeName
static word typeName()
Return the instantiated type name.
Definition: PengRobinsonGas.H:145
Foam::PengRobinsonGas::operator+=
void operator+=(const PengRobinsonGas &)
Definition: PengRobinsonGasI.H:333
Foam::PengRobinsonGas::New
static autoPtr< PengRobinsonGas > New(const dictionary &dict)
Definition: PengRobinsonGasI.H:82
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::PengRobinsonGas
PengRobinsonGas gas equation of state.
Definition: PengRobinsonGas.H:52
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:35
Foam::PengRobinsonGas::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: PengRobinsonGasI.H:127
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::PengRobinsonGas::S
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: PengRobinsonGasI.H:203
Foam::PengRobinsonGas::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: PengRobinsonGas.H:157
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
PengRobinsonGasI.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PengRobinsonGas::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: PengRobinsonGas.H:154
Foam::PengRobinsonGas::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: PengRobinsonGasI.H:158
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::PengRobinsonGas::write
void write(Ostream &os) const
Write to Ostream.
Definition: PengRobinsonGas.C:54
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
autoPtr.H