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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::PengRobinsonGas
28
29Group
30 grpSpecieEquationOfState
31
32Description
33 PengRobinsonGas gas equation of state.
34
35SourceFiles
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
48namespace Foam
49{
50
51// Forward declaration of friend functions and operators
52
53template<class Specie> class PengRobinsonGas;
54
55template<class Specie>
56inline PengRobinsonGas<Specie> operator+
57(
60);
61
62template<class Specie>
63inline PengRobinsonGas<Specie> operator*
64(
65 const scalar,
67);
68
69template<class Specie>
70inline PengRobinsonGas<Specie> operator==
71(
74);
75
76template<class Specie>
77Ostream& operator<<
78(
79 Ostream&,
81);
82
83
84
85/*---------------------------------------------------------------------------*\
86 Class PengRobinsonGas Declaration
87\*---------------------------------------------------------------------------*/
88
89template<class Specie>
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
112public:
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
201 friend PengRobinsonGas operator+ <Specie>
202 (
203 const PengRobinsonGas&,
204 const PengRobinsonGas&
205 );
207 friend PengRobinsonGas operator* <Specie>
208 (
209 const scalar s,
210 const PengRobinsonGas&
211 );
213 friend PengRobinsonGas operator== <Specie>
214 (
215 const PengRobinsonGas&,
216 const PengRobinsonGas&
217 );
218
219
220 // Ostream Operator
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// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
PengRobinsonGas gas equation of state.
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
static word typeName()
Return the instantiated type name.
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
void operator+=(const PengRobinsonGas &)
static autoPtr< PengRobinsonGas > New(const dictionary &dict)
autoPtr< PengRobinsonGas > clone() const
Construct and return a clone.
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
scalar Z(scalar p, scalar T) const
Return compression factor [].
void operator*=(const scalar)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & psi
const volScalarField & T
const volScalarField & Cv
Definition: EEqn.H:8
const volScalarField & Cp
Definition: EEqn.H:7
OBJstream os(runTime.globalPath()/outputName)
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))
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
runTime write()
dictionary dict