incompressiblePerfectGas.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) 2012-2015 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::incompressiblePerfectGas
26 
27 Description
28  Incompressible gas equation of state using a constant reference pressure in
29  the perfect gas equation of state rather than the local pressure so that the
30  density only varies with temperature and composition.
31 
32 SourceFiles
33  incompressiblePerfectGasI.H
34  incompressiblePerfectGas.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef incompressiblePerfectGas_H
39 #define incompressiblePerfectGas_H
40 
41 #include "autoPtr.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of friend functions and operators
49 
50 template<class Specie> class incompressiblePerfectGas;
51 
52 template<class Specie>
53 inline incompressiblePerfectGas<Specie> operator+
54 (
57 );
58 
59 template<class Specie>
60 inline incompressiblePerfectGas<Specie> operator-
61 (
64 );
65 
66 template<class Specie>
67 inline incompressiblePerfectGas<Specie> operator*
68 (
69  const scalar,
71 );
72 
73 template<class Specie>
74 inline incompressiblePerfectGas<Specie> operator==
75 (
78 );
79 
80 template<class Specie>
81 Ostream& operator<<
82 (
83  Ostream&,
85 );
86 
87 
88 /*---------------------------------------------------------------------------*\
89  Class incompressiblePerfectGas Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 template<class Specie>
94 :
95  public Specie
96 {
97  // Private data
98 
99  //- Reference pressure
100  scalar pRef_;
101 
102 
103 public:
104 
105  // Constructors
106 
107  //- Construct from components
108  inline incompressiblePerfectGas(const Specie& sp, const scalar pRef);
109 
110  //- Construct from incompressiblePerfectGas
112 
113  //- Construct from Istream
115 
116  //- Construct from dictionary
118 
119  //- Construct as named copy
121  (
122  const word& name,
124  );
125 
126  //- Construct and return a clone
128 
129  // Selector from Istream
130  inline static autoPtr<incompressiblePerfectGas> New(Istream& is);
131 
132  // Selector from dictionary
134  (
135  const dictionary& dict
136  );
137 
138 
139  // Member functions
140 
141  //- Return the instantiated type name
142  static word typeName()
143  {
144  return
145  "incompressiblePerfectGas<"
146  + word(Specie::typeName_()) + '>';
147  }
148 
149 
150  // Fundamental properties
151 
152  //- Is the equation of state is incompressible i.e. rho != f(p)
153  static const bool incompressible = true;
154 
155  //- Is the equation of state is isochoric i.e. rho = const
156  static const bool isochoric = false;
157 
158  //- Return density [kg/m^3]
159  inline scalar rho(scalar p, scalar T) const;
160 
161  //- Return entropy [J/(kmol K)]
162  inline scalar s(const scalar p, const scalar T) const;
163 
164  //- Return compressibility rho/p [s^2/m^2]
165  inline scalar psi(scalar p, scalar T) const;
166 
167  //- Return compression factor []
168  inline scalar Z(scalar p, scalar T) const;
169 
170  //- Return (cp - cv) [J/(kmol K]
171  inline scalar cpMcv(scalar p, scalar T) const;
172 
173 
174  // IO
175 
176  //- Write to Ostream
177  void write(Ostream& os) const;
178 
179 
180  // Member operators
181 
182  inline incompressiblePerfectGas& operator=
183  (
185  );
186  inline void operator+=(const incompressiblePerfectGas&);
187  inline void operator-=(const incompressiblePerfectGas&);
188 
189  inline void operator*=(const scalar);
190 
191 
192  // Friend operators
193 
194  friend incompressiblePerfectGas operator+ <Specie>
195  (
198  );
199 
200  friend incompressiblePerfectGas operator- <Specie>
201  (
204  );
205 
206  friend incompressiblePerfectGas operator* <Specie>
207  (
208  const scalar s,
210  );
211 
212  friend incompressiblePerfectGas operator== <Specie>
213  (
216  );
217 
218 
219  // Ostream Operator
220 
221  friend Ostream& operator<< <Specie>
222  (
223  Ostream&,
225  );
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
236 
237 #ifdef NoRepository
238 # include "incompressiblePerfectGas.C"
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
Foam::incompressiblePerfectGas::operator-=
void operator-=(const incompressiblePerfectGas &)
Definition: incompressiblePerfectGasI.H:194
Foam::incompressiblePerfectGas::write
void write(Ostream &os) const
Write to Ostream.
Definition: incompressiblePerfectGas.C:59
Foam::incompressiblePerfectGas::typeName
static word typeName()
Return the instantiated type name.
Definition: incompressiblePerfectGas.H:141
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::incompressiblePerfectGas::operator+=
void operator+=(const incompressiblePerfectGas &)
Definition: incompressiblePerfectGasI.H:179
Foam::incompressiblePerfectGas::cpMcv
scalar cpMcv(scalar p, scalar T) const
Return (cp - cv) [J/(kmol K].
Definition: incompressiblePerfectGasI.H:152
Foam::incompressiblePerfectGas::pRef_
scalar pRef_
Reference pressure.
Definition: incompressiblePerfectGas.H:99
Foam::incompressiblePerfectGas::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: incompressiblePerfectGasI.H:108
incompressiblePerfectGasI.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::incompressiblePerfectGas::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: incompressiblePerfectGas.H:152
Foam::incompressiblePerfectGas::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: incompressiblePerfectGasI.H:141
Foam::incompressiblePerfectGas::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: incompressiblePerfectGas.H:155
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
pRef
scalar pRef
Definition: createFields.H:19
Foam::incompressiblePerfectGas::incompressiblePerfectGas
incompressiblePerfectGas(const Specie &sp, const scalar pRef)
Construct from components.
Definition: incompressiblePerfectGasI.H:33
Foam::incompressiblePerfectGas::s
scalar s(const scalar p, const scalar T) const
Return entropy [J/(kmol K)].
Definition: incompressiblePerfectGasI.H:119
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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
incompressiblePerfectGas.C
Foam::incompressiblePerfectGas::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: incompressiblePerfectGasI.H:130
Foam::incompressiblePerfectGas
Incompressible gas equation of state using a constant reference pressure in the perfect gas equation ...
Definition: incompressiblePerfectGas.H:49
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::incompressiblePerfectGas::New
static autoPtr< incompressiblePerfectGas > New(Istream &is)
Definition: incompressiblePerfectGasI.H:79
Foam::incompressiblePerfectGas::clone
autoPtr< incompressiblePerfectGas > clone() const
Construct and return a clone.
Definition: incompressiblePerfectGasI.H:67
Foam::incompressiblePerfectGas::operator*=
void operator*=(const scalar)
Definition: incompressiblePerfectGasI.H:204
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
autoPtr.H