icoPolynomialI.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) 2011-2018 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 
26 #include "icoPolynomial.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class Specie, int PolySize>
32 (
33  const Specie& sp,
34  const Polynomial<PolySize>& rhoCoeffs
35 )
36 :
37  Specie(sp),
38  rhoCoeffs_(rhoCoeffs)
39 {}
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
44 template<class Specie, int PolySize>
46 (
47  const word& name,
49 )
50 :
51  Specie(name, ip),
52  rhoCoeffs_(ip.rhoCoeffs_)
53 {}
54 
55 
56 template<class Specie, int PolySize>
59 {
61  (
63  );
64 }
65 
66 
67 template<class Specie, int PolySize>
70 {
72  (
74  );
75 }
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
80 template<class Specie, int PolySize>
82 (
83  scalar p,
84  scalar T
85 ) const
86 {
87  return rhoCoeffs_.value(T);
88 }
89 
90 
91 template<class Specie, int PolySize>
93 (
94  scalar p,
95  scalar T
96 ) const
97 {
98  return 0;
99 }
100 
101 
102 template<class Specie, int PolySize>
104 (
105  scalar p,
106  scalar T
107 ) const
108 {
109  return 0;
110 }
111 
112 
113 template<class Specie, int PolySize>
115 (
116  scalar p,
117  scalar T
118 ) const
119 {
120  return 0;
121 }
122 
123 
124 template<class Specie, int PolySize>
126 (
127  scalar p,
128  scalar T
129 ) const
130 {
131  return 0;
132 }
133 
134 
135 template<class Specie, int PolySize>
137 (
138  scalar p,
139  scalar T
140 ) const
141 {
142  return 0;
143 }
144 
145 
146 template<class Specie, int PolySize>
148 (
149  scalar p,
150  scalar T
151 ) const
152 {
153  return -(p/sqr(rhoCoeffs_.value(T)))*rhoCoeffs_.derivative(T);
154 }
155 
156 
157 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
158 
159 template<class Specie, int PolySize>
160 inline void Foam::icoPolynomial<Specie, PolySize>::operator=
161 (
163 )
164 {
165  Specie::operator=(ip);
166 
167  rhoCoeffs_ = ip.rhoCoeffs_;
168 }
169 
170 
171 template<class Specie, int PolySize>
172 inline void Foam::icoPolynomial<Specie, PolySize>::operator+=
173 (
175 )
176 {
177  scalar Y1 = this->Y();
178  Specie::operator+=(ip);
179 
180  if (mag(this->Y()) > small)
181  {
182  Y1 /= this->Y();
183  const scalar Y2 = ip.Y()/this->Y();
184 
185  rhoCoeffs_ = Y1*rhoCoeffs_ + Y2*ip.rhoCoeffs_;
186  }
187 }
188 
189 
190 template<class Specie, int PolySize>
192 {
193  Specie::operator*=(s);
194 }
195 
196 
197 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
198 
199 template<class Specie, int PolySize>
201 (
204 )
205 {
206  Specie sp
207  (
208  static_cast<const Specie&>(ip1)
209  + static_cast<const Specie&>(ip2)
210  );
211 
212  if (mag(sp.Y()) < small)
213  {
215  (
216  sp,
217  ip1.rhoCoeffs_
218  );
219  }
220  else
221  {
222  const scalar Y1 = ip1.Y()/sp.Y();
223  const scalar Y2 = ip2.Y()/sp.Y();
224 
226  (
227  sp,
228  Y1*ip1.rhoCoeffs_ + Y2*ip2.rhoCoeffs_
229  );
230  }
231 }
232 
233 
234 template<class Specie, int PolySize>
236 (
237  const scalar s,
239 )
240 {
242  (
243  s*static_cast<const Specie&>(ip),
244  ip.rhoCoeffs_
245  );
246 }
247 
248 
249 template<class Specie, int PolySize>
251 (
254 )
255 {
256  Specie sp
257  (
258  static_cast<const Specie&>(ip1)
259  == static_cast<const Specie&>(ip2)
260  );
261 
262  const scalar Y1 = ip1.Y()/sp.Y();
263  const scalar Y2 = ip2.Y()/sp.Y();
264 
266  (
267  sp,
268  Y2*ip2.rhoCoeffs_ - Y1*ip1.rhoCoeffs_
269  );
270 }
271 
272 
273 // ************************************************************************* //
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
dictionary dict
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
autoPtr< icoPolynomial > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Incompressible, polynomial form of equation of state, using a polynomial function for density...
Definition: icoPolynomial.H:82
dimensionedSymmTensor sqr(const dimensionedVector &dv)
scalar Z(scalar p, scalar T) const
Return compression factor [].
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
static autoPtr< icoPolynomial > New(const dictionary &dict)
void operator*=(const scalar)
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))
icoPolynomial(const Specie &sp, const Polynomial< PolySize > &rhoPoly)
Construct from components.
A class for handling words, derived from string.
Definition: word.H:59
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Polynomial templated on size (order):
Definition: Polynomial.H:65
PtrList< volScalarField > & Y
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
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].