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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::incompressiblePerfectGas
29
30Group
31 grpSpecieEquationOfState
32
33Description
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
38SourceFiles
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
51namespace Foam
52{
53
54// Forward Declarations
55
56template<class Specie> class incompressiblePerfectGas;
57
58template<class Specie>
60(
63);
64
65template<class Specie>
67(
68 const scalar,
70);
71
72template<class Specie>
74(
77);
78
79template<class Specie>
80Ostream& operator<<
81(
82 Ostream&,
84);
85
86
87/*---------------------------------------------------------------------------*\
88 Class incompressiblePerfectGas Declaration
89\*---------------------------------------------------------------------------*/
90
91template<class Specie>
93:
94 public Specie
95{
96 // Private Data
97
98 //- Reference pressure
99 scalar pRef_;
100
101
102public:
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
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
193 friend incompressiblePerfectGas operator+ <Specie>
194 (
197 );
199 friend incompressiblePerfectGas operator* <Specie>
200 (
201 const scalar s,
203 );
205 friend incompressiblePerfectGas operator== <Specie>
206 (
209 );
210
211
212 // IOstream Operators
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
232#endif
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
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
Incompressible gas equation of state using a constant reference pressure in the perfect gas equation ...
void operator+=(const incompressiblePerfectGas &)
incompressiblePerfectGas(const word &name, const incompressiblePerfectGas &)
Construct as named copy.
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.
autoPtr< incompressiblePerfectGas > clone() const
Construct and return a clone.
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].
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
static autoPtr< incompressiblePerfectGas > New(const dictionary &dict)
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 [].
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