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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2017 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::incompressiblePerfectGas
29 
30 Group
31  grpSpecieEquationOfState
32 
33 Description
34  Incompressible gas equation of state using a constant reference pressure in
35  the perfect gas equation of state rather than the local pressure so that the
36  density only varies with temperature and composition.
37 
38 SourceFiles
39  incompressiblePerfectGasI.H
40  incompressiblePerfectGas.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef incompressiblePerfectGas_H
45 #define incompressiblePerfectGas_H
46 
47 #include "autoPtr.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 
56 template<class Specie> class incompressiblePerfectGas;
57 
58 template<class Specie>
59 inline incompressiblePerfectGas<Specie> operator+
60 (
63 );
64 
65 template<class Specie>
66 inline incompressiblePerfectGas<Specie> operator*
67 (
68  const scalar,
70 );
71 
72 template<class Specie>
73 inline incompressiblePerfectGas<Specie> operator==
74 (
77 );
78 
79 template<class Specie>
80 Ostream& operator<<
81 (
82  Ostream&,
84 );
85 
86 
87 /*---------------------------------------------------------------------------*\
88  Class incompressiblePerfectGas Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 template<class Specie>
93 :
94  public Specie
95 {
96  // Private Data
97 
98  //- Reference pressure
99  scalar pRef_;
100 
101 
102 public:
103 
104  // Generated Methods: copy construct, copy assignment
105 
106 
107  // Constructors
108 
109  //- Construct from components
110  inline incompressiblePerfectGas(const Specie& sp, const scalar pRef);
111 
112  //- Construct from dictionary
113  explicit incompressiblePerfectGas(const dictionary& dict);
114 
115  //- Construct as named copy
117  (
118  const word& name,
120  );
121 
122  //- Construct and return a clone
124 
125  // Selector from dictionary
127  (
128  const dictionary& dict
129  );
130 
131 
132  // Member Functions
133 
134  //- Return the instantiated type name
135  static word typeName()
136  {
137  return
138  "incompressiblePerfectGas<"
139  + word(Specie::typeName_()) + '>';
140  }
141 
142 
143  // Fundamental properties
144 
145  //- Is the equation of state is incompressible i.e. rho != f(p)
146  static const bool incompressible = true;
147 
148  //- Is the equation of state is isochoric i.e. rho = const
149  static const bool isochoric = false;
150 
151  //- Return density [kg/m^3]
152  inline scalar rho(scalar p, scalar T) const;
153 
154  //- Return enthalpy departure [J/kg]
155  inline scalar H(const scalar p, const scalar T) const;
156 
157  //- Return Cp departure [J/(kg K]
158  inline scalar Cp(scalar p, scalar T) const;
159 
160  //- Return internal energy departure [J/kg]
161  inline scalar E(const scalar p, const scalar T) const;
162 
163  //- Return Cv departure [J/(kg K]
164  inline scalar Cv(scalar p, scalar T) const;
165 
166  //- Return entropy [J/(kg K)]
167  inline scalar S(const scalar p, const scalar T) const;
168 
169  //- Return compressibility rho/p [s^2/m^2]
170  inline scalar psi(scalar p, scalar T) const;
171 
172  //- Return compression factor []
173  inline scalar Z(scalar p, scalar T) const;
174 
175  //- Return (Cp - Cv) [J/(kg K]
176  inline scalar CpMCv(scalar p, scalar T) const;
177 
178 
179  // IO
180 
181  //- Write to Ostream
182  void write(Ostream& os) const;
183 
184 
185  // Member Operators
186 
187  inline void operator+=(const incompressiblePerfectGas&);
188  inline void operator*=(const scalar);
189 
190 
191  // Friend Operators
192 
193  friend incompressiblePerfectGas operator+ <Specie>
194  (
197  );
198 
199  friend incompressiblePerfectGas operator* <Specie>
200  (
201  const scalar s,
203  );
204 
205  friend incompressiblePerfectGas operator== <Specie>
206  (
209  );
210 
211 
212  // IOstream Operators
213 
214  friend Ostream& operator<< <Specie>
215  (
216  Ostream&,
218  );
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
229 
230 #ifdef NoRepository
231  #include "incompressiblePerfectGas.C"
232 #endif
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::incompressiblePerfectGas::write
void write(Ostream &os) const
Write to Ostream.
Definition: incompressiblePerfectGas.C:47
Foam::incompressiblePerfectGas::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: incompressiblePerfectGasI.H:101
Foam::incompressiblePerfectGas::typeName
static word typeName()
Return the instantiated type name.
Definition: incompressiblePerfectGas.H:134
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::incompressiblePerfectGas::operator+=
void operator+=(const incompressiblePerfectGas &)
Definition: incompressiblePerfectGasI.H:180
Foam::incompressiblePerfectGas::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: incompressiblePerfectGasI.H:79
Foam::incompressiblePerfectGas::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: incompressiblePerfectGasI.H:167
incompressiblePerfectGasI.H
Foam::incompressiblePerfectGas::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: incompressiblePerfectGas.H:145
Foam::incompressiblePerfectGas::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: incompressiblePerfectGasI.H:156
Foam::incompressiblePerfectGas::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: incompressiblePerfectGas.H:148
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::incompressiblePerfectGas::Cv
scalar Cv(scalar p, scalar T) const
Return Cv departure [J/(kg K].
Definition: incompressiblePerfectGasI.H:123
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::incompressiblePerfectGas::S
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: incompressiblePerfectGasI.H:134
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::incompressiblePerfectGas::incompressiblePerfectGas
incompressiblePerfectGas(const Specie &sp, const scalar pRef)
Construct from components.
Definition: incompressiblePerfectGasI.H:34
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressiblePerfectGas::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: incompressiblePerfectGasI.H:112
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::incompressiblePerfectGas::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: incompressiblePerfectGasI.H:90
incompressiblePerfectGas.C
Foam::incompressiblePerfectGas::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: incompressiblePerfectGasI.H:145
Foam::incompressiblePerfectGas::New
static autoPtr< incompressiblePerfectGas > New(const dictionary &dict)
Definition: incompressiblePerfectGasI.H:67
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::incompressiblePerfectGas
Incompressible gas equation of state using a constant reference pressure in the perfect gas equation ...
Definition: incompressiblePerfectGas.H:55
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::incompressiblePerfectGas::clone
autoPtr< incompressiblePerfectGas > clone() const
Construct and return a clone.
Definition: incompressiblePerfectGasI.H:58
Foam::incompressiblePerfectGas::operator*=
void operator*=(const scalar)
Definition: incompressiblePerfectGasI.H:198
autoPtr.H