incompressiblePerfectGasI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2020 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 p/this->rho(p, T);
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 0;
155 }
156 
157 
158 template<class Specie>
160 (
161  scalar p,
162  scalar T
163 ) const
164 {
165  return 0;
166 }
167 
168 
169 template<class Specie>
171 (
172  scalar p,
173  scalar T
174 ) const
175 {
176  return p/(rho(p, T)*this->R()*T);
177 }
178 
179 
180 template<class Specie>
182 (
183  scalar p,
184  scalar T
185 ) const
186 {
187  return 0;
188 }
189 
190 
191 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
192 
193 template<class Specie>
194 inline void Foam::incompressiblePerfectGas<Specie>::operator+=
195 (
197 )
198 {
199  if (notEqual(pRef_, ipg.pRef_))
200  {
202  << "pRef " << pRef_ << " for "
203  << (this->name().size() ? this->name() : "others")
204  << " != " << ipg.pRef_ << " for "
205  << (ipg.name().size() ? ipg.name() : "others")
206  << exit(FatalError);
207  }
208 
209  Specie::operator+=(ipg);
210 }
211 
212 
213 template<class Specie>
215 {
216  Specie::operator*=(s);
217 }
218 
219 
220 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
221 
222 template<class Specie>
223 inline Foam::incompressiblePerfectGas<Specie> Foam::operator+
224 (
227 )
228 {
229  if (notEqual(ipg1.pRef_, ipg2.pRef_))
230  {
232  << "pRef " << ipg1.pRef_ << " for "
233  << (ipg1.name().size() ? ipg1.name() : "others")
234  << " != " << ipg2.pRef_ << " for "
235  << (ipg2.name().size() ? ipg2.name() : "others")
236  << exit(FatalError);
237  }
238 
240  (
241  static_cast<const Specie&>(ipg1) + static_cast<const Specie&>(ipg2),
242  ipg1.pRef_
243  );
244 }
245 
246 
247 template<class Specie>
248 inline Foam::incompressiblePerfectGas<Specie> Foam::operator*
249 (
250  const scalar s,
252 )
253 {
255  (
256  s*static_cast<const Specie&>(ipg),
257  ipg.pRef_
258  );
259 }
260 
261 
262 template<class Specie>
263 inline Foam::incompressiblePerfectGas<Specie> Foam::operator==
264 (
267 )
268 {
270  (
271  static_cast<const Specie&>(ipg1) == static_cast<const Specie&>(ipg2),
272  NaN
273  );
274 }
275 
276 
277 // ************************************************************************* //
dictionary dict
scalar Cp(scalar p, scalar T) const
Return Cp contribution [J/(kg K].
bool notEqual(const Scalar s1, const Scalar s2)
Definition: Scalar.H:215
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
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].
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 E(const scalar p, const scalar T) const
Return internal energy contribution [J/kg].
scalar Sp(const scalar p, const scalar T) const
Return entropy contribution to the integral of Cp/T [J/kg/K].
scalar Cv(scalar p, scalar T) const
Return Cv contribution [J/(kg K].
const volScalarField & T
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
scalar H(const scalar p, const scalar T) const
Return enthalpy contribution [J/kg].
#define R(A, B, C, D, E, F, K, M)
scalar psi(scalar p, scalar T) const
Return compressibility [s^2/m^2].
scalar Sv(const scalar p, const scalar T) const
Return entropy contribution to the integral of Cv/T [J/kg/K].
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)