polynomialTransportI.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) 2011-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 
26 #include "specie.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Thermo, int PolySize>
31 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
32 (
33  const polynomialTransport& pt
34 )
35 :
36  Thermo(pt),
37  muCoeffs_(pt.muCoeffs_),
38  kappaCoeffs_(pt.kappaCoeffs_)
39 {}
40 
41 
42 template<class Thermo, int PolySize>
43 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
44 (
45  const Thermo& t,
46  const Polynomial<PolySize>& muCoeffs,
47  const Polynomial<PolySize>& kappaCoeffs
48 )
49 :
50  Thermo(t),
51  muCoeffs_(muCoeffs),
52  kappaCoeffs_(kappaCoeffs)
53 {}
54 
55 
56 template<class Thermo, int PolySize>
57 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
58 (
59  const word& name,
60  const polynomialTransport& pt
61 )
62 :
63  Thermo(name, pt),
64  muCoeffs_(pt.muCoeffs_),
65  kappaCoeffs_(pt.kappaCoeffs_)
66 {}
67 
68 
69 template<class Thermo, int PolySize>
72 {
74  (
76  );
77 }
78 
79 
80 template<class Thermo, int PolySize>
83 {
85  (
87  );
88 }
89 
90 
91 template<class Thermo, int PolySize>
94 {
96  (
98  );
99 }
100 
101 
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 
104 template<class Thermo, int PolySize>
106 (
107  const scalar p,
108  const scalar T
109 ) const
110 {
111  return muCoeffs_.value(T)/this->W();
112 }
113 
114 
115 template<class Thermo, int PolySize>
117 (
118  const scalar p,
119  const scalar T
120 ) const
121 {
122  return kappaCoeffs_.value(T)/this->W();
123 }
124 
125 
126 template<class Thermo, int PolySize>
128 (
129  const scalar p, const scalar T
130 ) const
131 {
132  return kappa(p, T)/this->Cpv(p, T);
133 }
134 
135 
136 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
137 
138 template<class Thermo, int PolySize>
139 inline void Foam::polynomialTransport<Thermo, PolySize>::operator=
140 (
142 )
143 {
144  Thermo::operator=(pt);
145 
146  muCoeffs_ = pt.muCoeffs_;
147  kappaCoeffs_ = pt.kappaCoeffs_;
148 }
149 
150 
151 template<class Thermo, int PolySize>
152 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
153 (
155 )
156 {
157  scalar molr1 = this->nMoles();
158 
159  Thermo::operator+=(pt);
160 
161  molr1 /= this->nMoles();
162  scalar molr2 = pt.nMoles()/this->nMoles();
163 
164  muCoeffs_ = molr1*muCoeffs_ + molr2*pt.muCoeffs_;
165  kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
166 }
167 
168 
169 template<class Thermo, int PolySize>
170 inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
171 (
173 )
174 {
175  scalar molr1 = this->nMoles();
176 
177  Thermo::operator-=(pt);
178 
179  molr1 /= this->nMoles();
180  scalar molr2 = pt.nMoles()/this->nMoles();
181 
182  muCoeffs_ = molr1*muCoeffs_ - molr2*pt.muCoeffs_;
183  kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
184 }
185 
186 
187 template<class Thermo, int PolySize>
188 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
189 (
190  const scalar s
191 )
192 {
193  Thermo::operator*=(s);
194 }
195 
196 
197 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
198 
199 template<class Thermo, int PolySize>
200 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
201 (
204 )
205 {
206  Thermo t
207  (
208  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
209  );
210 
211  scalar molr1 = pt1.nMoles()/t.nMoles();
212  scalar molr2 = pt2.nMoles()/t.nMoles();
213 
215  (
216  t,
217  molr1*pt1.muCoeffs_ + molr2*pt2.muCoeffs_,
218  molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
219  );
220 }
221 
222 
223 template<class Thermo, int PolySize>
224 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
225 (
228 )
229 {
230  Thermo t
231  (
232  static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
233  );
234 
235  scalar molr1 = pt1.nMoles()/t.nMoles();
236  scalar molr2 = pt2.nMoles()/t.nMoles();
237 
239  (
240  t,
241  molr1*pt1.muCoeffs_ - molr2*pt2.muCoeffs_,
242  molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
243  );
244 }
245 
246 
247 template<class Thermo, int PolySize>
248 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
249 (
250  const scalar s,
252 )
253 {
255  (
256  s*static_cast<const Thermo&>(pt),
257  pt.muCoeffs_,
258  pt.kappaCoeffs_
259  );
260 }
261 
262 
263 template<class Thermo, int PolySize>
264 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
265 (
268 )
269 {
270  return pt2 - pt1;
271 }
272 
273 
274 // ************************************************************************* //
dictionary dict
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
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
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
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))
A class for handling words, derived from string.
Definition: word.H:59
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
Polynomial templated on size (order):
Definition: Polynomial.H:63
autoPtr< polynomialTransport > clone() const
Construct and return a clone.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Transport package using polynomial functions for mu and kappa.
static autoPtr< polynomialTransport > New(Istream &is)