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 | Copyright (C) 2012-2017 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 \*---------------------------------------------------------------------------*/
25 
27 
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Specie>
33 (
34  const Specie& sp, const scalar pRef
35 )
36 :
37  Specie(sp),
38  pRef_(pRef)
39 {}
40 
41 
42 template<class Specie>
44 (
45  const word& name,
47 )
48 :
49  Specie(name, ipg),
50  pRef_(ipg.pRef_)
51 {}
52 
53 
54 template<class Specie>
57 {
59  (
61  );
62 }
63 
64 
65 template<class Specie>
68 (
69  const dictionary& dict
70 )
71 {
73  (
75  );
76 }
77 
78 
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 
81 template<class Specie>
83 (
84  scalar p,
85  scalar T
86 ) const
87 {
88  return pRef_/(this->R()*T);
89 }
90 
91 
92 template<class Specie>
94 (
95  scalar p,
96  scalar T
97 ) const
98 {
99  return 0;
100 }
101 
102 
103 template<class Specie>
105 (
106  scalar p,
107  scalar T
108 ) const
109 {
110  return 0;
111 }
112 
113 
114 template<class Specie>
116 (
117  scalar p,
118  scalar T
119 ) const
120 {
121  return 0;
122 }
123 
124 
125 template<class Specie>
127 (
128  scalar p,
129  scalar T
130 ) const
131 {
132  return 0;
133 }
134 
135 
136 template<class Specie>
138 (
139  scalar p,
140  scalar T
141 ) const
142 {
143  return 0;
144 }
145 
146 
147 template<class Specie>
149 (
150  scalar p,
151  scalar T
152 ) const
153 {
154  return this->R();
155 }
156 
157 
158 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
159 
160 template<class Specie>
161 inline void Foam::incompressiblePerfectGas<Specie>::operator=
162 (
164 )
165 {
166  Specie::operator=(ipg);
167  pRef_ = ipg.pRef_;
168 }
169 
170 
171 template<class Specie>
172 inline void Foam::incompressiblePerfectGas<Specie>::operator+=
173 (
175 )
176 {
177  scalar Y1 = this->Y();
178  Specie::operator+=(ipg);
179 
180  if (mag(this->Y()) > SMALL)
181  {
182  Y1 /= this->Y();
183  const scalar Y2 = ipg.Y()/this->Y();
184 
185  pRef_ = Y1*pRef_ + Y2*ipg.pRef_;
186  }
187 }
188 
189 
190 template<class Specie>
192 {
193  Specie::operator*=(s);
194 }
195 
196 
197 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
198 
199 template<class Specie>
200 inline Foam::incompressiblePerfectGas<Specie> Foam::operator+
201 (
204 )
205 {
206  Specie sp
207  (
208  static_cast<const Specie&>(ipg1)
209  + static_cast<const Specie&>(ipg2)
210  );
211 
212  if (mag(sp.Y()) < SMALL)
213  {
215  (
216  sp,
217  ipg1.pRef_
218  );
219  }
220  else
221  {
222  const scalar Y1 = ipg1.Y()/sp.Y();
223  const scalar Y2 = ipg2.Y()/sp.Y();
224 
226  (
227  sp,
228  Y1*ipg1.pRef_ + Y2*ipg2.pRef_
229  );
230  }
231 }
232 
233 
234 template<class Specie>
235 inline Foam::incompressiblePerfectGas<Specie> Foam::operator*
236 (
237  const scalar s,
239 )
240 {
242  (
243  s*static_cast<const Specie&>(ipg),
244  ipg.pRef_
245  );
246 }
247 
248 
249 template<class Specie>
250 inline Foam::incompressiblePerfectGas<Specie> Foam::operator==
251 (
254 )
255 {
256  Specie sp
257  (
258  static_cast<const Specie&>(ipg1)
259  == static_cast<const Specie&>(ipg2)
260  );
261 
262  const scalar Y1 = ipg1.Y()/sp.Y();
263  const scalar Y2 = ipg2.Y()/sp.Y();
264 
266  (
267  sp,
268  Y2*ipg2.pRef_ - Y1*ipg1.pRef_
269  );
270 }
271 
272 
273 // ************************************************************************* //
PtrList< volScalarField > & Y1
Definition: YEqns.H:8
dictionary dict
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Incompressible gas equation of state using a constant reference pressure in the perfect gas equation ...
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
PtrList< volScalarField > & Y2
Definition: YEqns.H:9
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
scalar Z(scalar p, scalar T) const
Return compression factor [].
A class for handling words, derived from string.
Definition: word.H:59
incompressiblePerfectGas(const Specie &sp, const scalar pRef)
Construct from components.
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
const volScalarField & T
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
#define R(A, B, C, D, E, F, K, M)
PtrList< volScalarField > & Y
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
autoPtr< incompressiblePerfectGas > clone() const
Construct and return a clone.
static autoPtr< incompressiblePerfectGas > New(const dictionary &dict)