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-2013 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>
140 Foam::polynomialTransport<Thermo, PolySize>::operator=
141 (
143 )
144 {
145  Thermo::operator=(pt);
146 
147  muCoeffs_ = pt.muCoeffs_;
148  kappaCoeffs_ = pt.kappaCoeffs_;
149 
150  return *this;
151 }
152 
153 
154 template<class Thermo, int PolySize>
155 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
156 (
158 )
159 {
160  scalar molr1 = this->nMoles();
161 
162  Thermo::operator+=(pt);
163 
164  molr1 /= this->nMoles();
165  scalar molr2 = pt.nMoles()/this->nMoles();
166 
167  muCoeffs_ = molr1*muCoeffs_ + molr2*pt.muCoeffs_;
168  kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
169 }
170 
171 
172 template<class Thermo, int PolySize>
173 inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
174 (
176 )
177 {
178  scalar molr1 = this->nMoles();
179 
180  Thermo::operator-=(pt);
181 
182  molr1 /= this->nMoles();
183  scalar molr2 = pt.nMoles()/this->nMoles();
184 
185  muCoeffs_ = molr1*muCoeffs_ - molr2*pt.muCoeffs_;
186  kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
187 }
188 
189 
190 template<class Thermo, int PolySize>
191 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
192 (
193  const scalar s
194 )
195 {
196  Thermo::operator*=(s);
197 }
198 
199 
200 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
201 
202 template<class Thermo, int PolySize>
203 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
204 (
207 )
208 {
209  Thermo t
210  (
211  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
212  );
213 
214  scalar molr1 = pt1.nMoles()/t.nMoles();
215  scalar molr2 = pt2.nMoles()/t.nMoles();
216 
218  (
219  t,
220  molr1*pt1.muCoeffs_ + molr2*pt2.muCoeffs_,
221  molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
222  );
223 }
224 
225 
226 template<class Thermo, int PolySize>
227 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
228 (
231 )
232 {
233  Thermo t
234  (
235  static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
236  );
237 
238  scalar molr1 = pt1.nMoles()/t.nMoles();
239  scalar molr2 = pt2.nMoles()/t.nMoles();
240 
242  (
243  t,
244  molr1*pt1.muCoeffs_ - molr2*pt2.muCoeffs_,
245  molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
246  );
247 }
248 
249 
250 template<class Thermo, int PolySize>
251 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
252 (
253  const scalar s,
255 )
256 {
258  (
259  s*static_cast<const Thermo&>(pt),
260  pt.muCoeffs_,
261  pt.kappaCoeffs_
262  );
263 }
264 
265 
266 template<class Thermo, int PolySize>
267 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
268 (
271 )
272 {
273  return pt2 - pt1;
274 }
275 
276 
277 // ************************************************************************* //
Polynomial templated on size (order):
Definition: Polynomial.H:63
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 mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A class for handling words, derived from string.
Definition: word.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
autoPtr< polynomialTransport > clone() const
Construct and return a clone.
dictionary dict
static autoPtr< polynomialTransport > New(Istream &is)
Transport package using polynomial functions for mu and kappa.
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117