incompressiblePerfectGasI.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 -------------------------------------------------------------------------------
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 
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Specie>
34 (
35  const Specie& sp,
36  const scalar pRef
37 )
38 :
39  Specie(sp),
40  pRef_(pRef)
41 {}
42 
43 
44 template<class Specie>
46 (
47  const word& name,
49 )
50 :
51  Specie(name, ipg),
52  pRef_(ipg.pRef_)
53 {}
54 
55 
56 template<class Specie>
59 {
61 }
62 
63 
64 template<class Specie>
67 (
68  const dictionary& dict
69 )
70 {
72 }
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
77 template<class Specie>
79 (
80  scalar p,
81  scalar T
82 ) const
83 {
84  return pRef_/(this->R()*T);
85 }
86 
87 
88 template<class Specie>
90 (
91  scalar p,
92  scalar T
93 ) const
94 {
95  return 0;
96 }
97 
98 
99 template<class Specie>
101 (
102  scalar p,
103  scalar T
104 ) const
105 {
106  return 0;
107 }
108 
109 
110 template<class Specie>
112 (
113  scalar p,
114  scalar T
115 ) const
116 {
117  return 0;
118 }
119 
120 
121 template<class Specie>
123 (
124  scalar p,
125  scalar T
126 ) const
127 {
128  return 0;
129 }
130 
131 
132 template<class Specie>
134 (
135  scalar p,
136  scalar T
137 ) const
138 {
139  return 0;
140 }
141 
142 
143 template<class Specie>
145 (
146  scalar p,
147  scalar T
148 ) const
149 {
150  return 0;
151 }
152 
153 
154 template<class Specie>
156 (
157  scalar p,
158  scalar T
159 ) const
160 {
161  return 0;
162 }
163 
164 
165 template<class Specie>
167 (
168  scalar p,
169  scalar T
170 ) const
171 {
172  return 0;
173 }
174 
175 
176 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
177 
178 template<class Specie>
180 (
182 )
183 {
184  scalar Y1 = this->Y();
185  Specie::operator+=(ipg);
186 
187  if (mag(this->Y()) > SMALL)
188  {
189  Y1 /= this->Y();
190  const scalar Y2 = ipg.Y()/this->Y();
191 
192  pRef_ = Y1*pRef_ + Y2*ipg.pRef_;
193  }
194 }
195 
196 
197 template<class Specie>
199 {
200  Specie::operator*=(s);
201 }
202 
203 
204 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
205 
206 template<class Specie>
207 inline Foam::incompressiblePerfectGas<Specie> Foam::operator+
208 (
211 )
212 {
213  Specie sp
214  (
215  static_cast<const Specie&>(ipg1)
216  + static_cast<const Specie&>(ipg2)
217  );
218 
219  if (mag(sp.Y()) < SMALL)
220  {
222  (
223  sp,
224  ipg1.pRef_
225  );
226  }
227  else
228  {
229  const scalar Y1 = ipg1.Y()/sp.Y();
230  const scalar Y2 = ipg2.Y()/sp.Y();
231 
232  return incompressiblePerfectGas<Specie>
233  (
234  sp,
235  Y1*ipg1.pRef_ + Y2*ipg2.pRef_
236  );
237  }
238 }
239 
240 
241 template<class Specie>
242 inline Foam::incompressiblePerfectGas<Specie> Foam::operator*
243 (
244  const scalar s,
245  const incompressiblePerfectGas<Specie>& ipg
246 )
247 {
248  return incompressiblePerfectGas<Specie>
249  (
250  s*static_cast<const Specie&>(ipg),
251  ipg.pRef_
252  );
253 }
254 
255 
256 template<class Specie>
257 inline Foam::incompressiblePerfectGas<Specie> Foam::operator==
258 (
259  const incompressiblePerfectGas<Specie>& ipg1,
260  const incompressiblePerfectGas<Specie>& ipg2
261 )
262 {
263  Specie sp
264  (
265  static_cast<const Specie&>(ipg1)
266  == static_cast<const Specie&>(ipg2)
267  );
268 
269  const scalar Y1 = ipg1.Y()/sp.Y();
270  const scalar Y2 = ipg2.Y()/sp.Y();
271 
272  return incompressiblePerfectGas<Specie>
273  (
274  sp,
275  Y2*ipg2.pRef_ - Y1*ipg1.pRef_
276  );
277 }
278 
279 
280 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::incompressiblePerfectGas::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: incompressiblePerfectGasI.H:101
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::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
incompressiblePerfectGas.H
R
#define R(A, B, C, D, E, F, K, M)
Foam::incompressiblePerfectGas::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: incompressiblePerfectGasI.H:156
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
Foam::incompressiblePerfectGas::incompressiblePerfectGas
incompressiblePerfectGas(const Specie &sp, const scalar pRef)
Construct from components.
Definition: incompressiblePerfectGasI.H:34
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::incompressiblePerfectGas::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: incompressiblePerfectGasI.H:112
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
Foam::incompressiblePerfectGas::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: incompressiblePerfectGasI.H:90
Foam::incompressiblePerfectGas::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: incompressiblePerfectGasI.H:145
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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::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