FreeFOAM The Cross-Platform CFD Toolkit
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) 2008-2010 OpenCFD Ltd.
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/specie.H>
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Thermo, int PolySize>
32 (
33  const polynomialTransport& pt
34 )
35 :
36  Thermo(pt),
37  muPolynomial_(pt.muPolynomial_),
38  kappaPolynomial_(pt.kappaPolynomial_)
39 {}
40 
41 
42 template<class Thermo, int PolySize>
44 (
45  const Thermo& t,
46  const Polynomial<PolySize>& muPoly,
47  const Polynomial<PolySize>& kappaPoly
48 )
49 :
50  Thermo(t),
51  muPolynomial_(muPoly),
52  kappaPolynomial_(kappaPoly)
53 {}
54 
55 
56 template<class Thermo, int PolySize>
58 (
59  const word& name,
60  const polynomialTransport& pt
61 )
62 :
63  Thermo(name, pt),
64  muPolynomial_(pt.muPolynomial_),
65  kappaPolynomial_(pt.kappaPolynomial_)
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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
93 template<class Thermo, int PolySize>
95 (
96  const scalar T
97 ) const
98 {
99  return muPolynomial_.evaluate(T)/this->W();
100 }
101 
102 
103 template<class Thermo, int PolySize>
105 (
106  const scalar T
107 ) const
108 {
109  return kappaPolynomial_.evaluate(T)/this->W();
110 }
111 
112 
113 template<class Thermo, int PolySize>
115 (
116  const scalar T
117 ) const
118 {
119  scalar deltaT = T - specie::Tstd;
120  scalar CpBar =
121  (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
122  /(sqr(deltaT) + 1);
123 
124  return kappa(T)/CpBar;
125 }
126 
127 
128 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
129 
130 template<class Thermo, int PolySize>
133 (
135 )
136 {
137  Thermo::operator=(pt);
138 
139  muPolynomial_ = pt.muPolynomial_;
140  kappaPolynomial_ = pt.kappaPolynomial_;
141 
142  return *this;
143 }
144 
145 
146 template<class Thermo, int PolySize>
147 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
148 (
150 )
151 {
152  scalar molr1 = this->nMoles();
153 
154  Thermo::operator+=(pt);
155 
156  molr1 /= this->nMoles();
157  scalar molr2 = pt.nMoles()/this->nMoles();
158 
159  muPolynomial_ = molr1*muPolynomial_ + molr2*pt.muPolynomial_;
160  kappaPolynomial_ = molr1*kappaPolynomial_ + molr2*pt.kappaPolynomial_;
161 }
162 
163 
164 template<class Thermo, int PolySize>
165 inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
166 (
168 )
169 {
170  scalar molr1 = this->nMoles();
171 
172  Thermo::operator-=(pt);
173 
174  molr1 /= this->nMoles();
175  scalar molr2 = pt.nMoles()/this->nMoles();
176 
177  muPolynomial_ = molr1*muPolynomial_ - molr2*pt.muPolynomial_;
178  kappaPolynomial_ = molr1*kappaPolynomial_ - molr2*pt.kappaPolynomial_;
179 }
180 
181 
182 template<class Thermo, int PolySize>
183 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
184 (
185  const scalar s
186 )
187 {
188  Thermo::operator*=(s);
189 }
190 
191 
192 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
193 
194 template<class Thermo, int PolySize>
195 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
196 (
199 )
200 {
201  Thermo t
202  (
203  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
204  );
205 
206  scalar molr1 = pt1.nMoles()/t.nMoles();
207  scalar molr2 = pt2.nMoles()/t.nMoles();
208 
210  (
211  t,
212  molr1*pt1.muPolynomial_ + molr2*pt2.muPolynomial_,
213  molr1*pt1.kappaPolynomial_ + molr2*pt2.kappaPolynomial_
214  );
215 }
216 
217 
218 template<class Thermo, int PolySize>
219 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
220 (
223 )
224 {
225  Thermo t
226  (
227  static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
228  );
229 
230  scalar molr1 = pt1.nMoles()/t.nMoles();
231  scalar molr2 = pt2.nMoles()/t.nMoles();
232 
234  (
235  t,
236  molr1*pt1.muPolynomial_ - molr2*pt2.muPolynomial_,
237  molr1*pt1.kappaPolynomial_ - molr2*pt2.kappaPolynomial_
238  );
239 }
240 
241 
242 template<class Thermo, int PolySize>
243 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
244 (
245  const scalar s,
247 )
248 {
250  (
251  s*static_cast<const Thermo&>(pt),
252  pt.muPolynomial_,
253  pt.kappaPolynomial_
254  );
255 }
256 
257 
258 template<class Thermo, int PolySize>
259 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
260 (
263 )
264 {
265  return pt2 - pt1;
266 }
267 
268 
269 // ************************ vim: set sw=4 sts=4 et: ************************ //