perfectGasI.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) 2011-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 \*---------------------------------------------------------------------------*/
27 
28 #include "perfectGas.H"
29 #include "thermodynamicConstants.H"
30 
31 using namespace Foam::constant::thermodynamic;
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 template<class Specie>
36 inline Foam::perfectGas<Specie>::perfectGas(const Specie& sp)
37 :
38  Specie(sp)
39 {}
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
44 template<class Specie>
46 (
47  const word& name,
48  const perfectGas<Specie>& pg
49 )
50 :
51  Specie(name, pg)
52 {}
53 
54 
55 template<class Specie>
58 {
59  return autoPtr<perfectGas<Specie>>::New(*this);
60 }
61 
62 
63 template<class Specie>
65 (
66  const dictionary& dict
67 )
68 {
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
75 template<class Specie>
76 inline Foam::scalar Foam::perfectGas<Specie>::rho(scalar p, scalar T) const
77 {
78  return p/(this->R()*T);
79 }
80 
81 
82 template<class Specie>
83 inline Foam::scalar Foam::perfectGas<Specie>::H(scalar p, scalar T) const
84 {
85  return 0;
86 }
87 
88 
89 template<class Specie>
90 inline Foam::scalar Foam::perfectGas<Specie>::Cp(scalar p, scalar T) const
91 {
92  return 0;
93 }
94 
95 
96 template<class Specie>
97 inline Foam::scalar Foam::perfectGas<Specie>::E(scalar p, scalar T) const
98 {
99  return 0;
100 }
101 
102 
103 template<class Specie>
104 inline Foam::scalar Foam::perfectGas<Specie>::Cv(scalar p, scalar T) const
105 {
106  return 0;
107 }
108 
109 
110 template<class Specie>
111 inline Foam::scalar Foam::perfectGas<Specie>::S(scalar p, scalar T) const
112 {
113  return -this->R()*log(p/Pstd);
114 }
115 
116 
117 template<class Specie>
118 inline Foam::scalar Foam::perfectGas<Specie>::psi(scalar p, scalar T) const
119 {
120  return 1.0/(this->R()*T);
121 }
122 
123 
124 template<class Specie>
125 inline Foam::scalar Foam::perfectGas<Specie>::Z(scalar p, scalar T) const
126 {
127  return 1;
128 }
129 
130 
131 template<class Specie>
132 inline Foam::scalar Foam::perfectGas<Specie>::CpMCv(scalar p, scalar T) const
133 {
134  return this->R();
135 }
136 
137 
138 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
139 
140 template<class Specie>
142 {
143  Specie::operator+=(pg);
144 }
145 
146 
147 template<class Specie>
148 inline void Foam::perfectGas<Specie>::operator*=(const scalar s)
149 {
150  Specie::operator*=(s);
151 }
152 
153 
154 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
155 
156 template<class Specie>
157 inline Foam::perfectGas<Specie> Foam::operator+
158 (
159  const perfectGas<Specie>& pg1,
160  const perfectGas<Specie>& pg2
161 )
162 {
163  return perfectGas<Specie>
164  (
165  static_cast<const Specie&>(pg1) + static_cast<const Specie&>(pg2)
166  );
167 }
168 
169 
170 template<class Specie>
171 inline Foam::perfectGas<Specie> Foam::operator*
172 (
173  const scalar s,
174  const perfectGas<Specie>& pg
175 )
176 {
177  return perfectGas<Specie>(s*static_cast<const Specie&>(pg));
178 }
179 
180 
181 template<class Specie>
182 inline Foam::perfectGas<Specie> Foam::operator==
183 (
184  const perfectGas<Specie>& pg1,
185  const perfectGas<Specie>& pg2
186 )
187 {
188  return perfectGas<Specie>
189  (
190  static_cast<const Specie&>(pg1) == static_cast<const Specie&>(pg2)
191  );
192 }
193 
194 
195 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::perfectGas::New
static autoPtr< perfectGas > New(const dictionary &dict)
Definition: perfectGasI.H:65
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::constant::standard::Pstd
const dimensionedScalar Pstd
Standard pressure.
Definition: thermodynamicConstants.C:48
Foam::perfectGas::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: perfectGasI.H:125
Foam::perfectGas::perfectGas
perfectGas(const Specie &sp)
Construct from components.
Definition: perfectGasI.H:36
Foam::perfectGas::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: perfectGasI.H:97
R
#define R(A, B, C, D, E, F, K, M)
Foam::constant::thermodynamic
Thermodynamic scalar constants.
Definition: thermodynamicConstants.C:37
Foam::perfectGas
Perfect gas equation of state.
Definition: perfectGas.H:52
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::perfectGas::clone
autoPtr< perfectGas > clone() const
Construct and return a clone.
Definition: perfectGasI.H:57
Foam::perfectGas::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: perfectGasI.H:132
dict
dictionary dict
Definition: searchingEngine.H:14
perfectGas.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::log
dimensionedScalar log(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:262
Foam::perfectGas::S
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: perfectGasI.H:111
Foam::perfectGas::operator+=
void operator+=(const perfectGas &)
Definition: perfectGasI.H:141
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
thermodynamicConstants.H
Foam::perfectGas::Cv
scalar Cv(scalar p, scalar T) const
Return Cv departure [J/(kg K].
Definition: perfectGasI.H:104
Foam::perfectGas::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: perfectGasI.H:118
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::perfectGas::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: perfectGasI.H:76
Foam::perfectGas::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: perfectGasI.H:90
Foam::perfectGas::operator*=
void operator*=(const scalar)
Definition: perfectGasI.H:148
Foam::perfectGas::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: perfectGasI.H:83