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-2016 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 incompressiblePerfectGas& ipg
46 )
47 :
48  Specie(ipg),
49  pRef_(ipg.pRef_)
50 {}
51 
52 
53 template<class Specie>
55 (
56  const word& name,
58 )
59 :
60  Specie(name, ipg),
61  pRef_(ipg.pRef_)
62 {}
63 
64 
65 template<class Specie>
68 {
70  (
72  );
73 }
74 
75 
76 template<class Specie>
79 (
80  Istream& is
81 )
82 {
84  (
86  );
87 }
88 
89 
90 template<class Specie>
93 (
94  const dictionary& dict
95 )
96 {
98  (
100  );
101 }
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
106 template<class Specie>
108 (
109  scalar p,
110  scalar T
111 ) const
112 {
113  return pRef_/(this->R()*T);
114 }
115 
116 
117 template<class Specie>
119 (
120  scalar p,
121  scalar T
122 ) const
123 {
124  return 0;
125 }
126 
127 
128 template<class Specie>
130 (
131  scalar p,
132  scalar T
133 ) const
134 {
135  return 0;
136 }
137 
138 
139 template<class Specie>
141 (
142  scalar p,
143  scalar T
144 ) const
145 {
146  return 0;
147 }
148 
149 
150 template<class Specie>
152 (
153  scalar p,
154  scalar T
155 ) const
156 {
157  return 0;
158 }
159 
160 
161 template<class Specie>
163 (
164  scalar p,
165  scalar T
166 ) const
167 {
168  return 0;
169 }
170 
171 
172 template<class Specie>
174 (
175  scalar p,
176  scalar T
177 ) const
178 {
179  return RR;
180 }
181 
182 
183 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
184 
185 template<class Specie>
186 inline void Foam::incompressiblePerfectGas<Specie>::operator=
187 (
189 )
190 {
191  Specie::operator=(ipg);
192  pRef_ = ipg.pRef_;
193 }
194 
195 
196 template<class Specie>
197 inline void Foam::incompressiblePerfectGas<Specie>::operator+=
198 (
200 )
201 {
202  scalar molr1 = this->nMoles();
203  Specie::operator+=(ipg);
204  molr1 /= this->nMoles();
205  scalar molr2 = ipg.nMoles()/this->nMoles();
206 
207  pRef_ = molr1*pRef_ + molr2*ipg.pRef_;
208 }
209 
210 
211 template<class Specie>
212 inline void Foam::incompressiblePerfectGas<Specie>::operator-=
213 (
215 )
216 {
217  Specie::operator-=(ipg);
218  pRef_ = ipg.pRef_;
219 }
220 
221 
222 template<class Specie>
224 {
225  Specie::operator*=(s);
226 }
227 
228 
229 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
230 
231 template<class Specie>
232 inline Foam::incompressiblePerfectGas<Specie> Foam::operator+
233 (
236 )
237 {
238  scalar nMoles = ipg1.nMoles() + ipg2.nMoles();
239  scalar molr1 = ipg1.nMoles()/nMoles;
240  scalar molr2 = ipg2.nMoles()/nMoles;
241 
243  (
244  static_cast<const Specie&>(ipg1)
245  + static_cast<const Specie&>(ipg2),
246  molr1*ipg1.pRef_ + molr2*ipg2.pRef_
247  );
248 }
249 
250 
251 template<class Specie>
252 inline Foam::incompressiblePerfectGas<Specie> Foam::operator-
253 (
256 )
257 {
259  (
260  static_cast<const Specie&>(ipg1)
261  - static_cast<const Specie&>(ipg2),
262  ipg1.pRef_
263  );
264 }
265 
266 
267 template<class Specie>
268 inline Foam::incompressiblePerfectGas<Specie> Foam::operator*
269 (
270  const scalar s,
272 )
273 {
275  (
276  s*static_cast<const Specie&>(ipg),
277  ipg.pRef_
278  );
279 }
280 
281 
282 template<class Specie>
283 inline Foam::incompressiblePerfectGas<Specie> Foam::operator==
284 (
287 )
288 {
289  return pg2 - pg1;
290 }
291 
292 
293 // ************************************************************************* //
scalar cpMcv(scalar p, scalar T) const
Return (cp - cv) [J/(kmol K].
scalar cp(scalar p, scalar T) const
Return cp departure [J/(kmol K].
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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].
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 s(const scalar p, const scalar T) const
Return entropy [J/(kmol K)].
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
A class for handling words, derived from string.
Definition: word.H:59
incompressiblePerfectGas(const Specie &sp, const scalar pRef)
Construct from components.
scalar h(const scalar p, const scalar T) const
Return enthalpy departure [J/kmol].
const volScalarField & T
#define R(A, B, C, D, E, F, K, M)
const scalar RR
Universal gas constant (default in [J/(kmol K)])
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
static autoPtr< incompressiblePerfectGas > New(Istream &is)
scalar Z(scalar p, scalar T) const
Return compression factor [].
autoPtr< incompressiblePerfectGas > clone() const
Construct and return a clone.