1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 template<class Thermo, int PolySize>
31 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
33 const polynomialTransport& pt
37 muCoeffs_(pt.muCoeffs_),
38 kappaCoeffs_(pt.kappaCoeffs_)
42 template<class Thermo, int PolySize>
43 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
46 const Polynomial<PolySize>& muCoeffs,
47 const Polynomial<PolySize>& kappaCoeffs
52 kappaCoeffs_(kappaCoeffs)
56 template<class Thermo, int PolySize>
57 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
60 const polynomialTransport& pt
64 muCoeffs_(pt.muCoeffs_),
65 kappaCoeffs_(pt.kappaCoeffs_)
69 template<class Thermo, int PolySize>
70 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
71 Foam::polynomialTransport<Thermo, PolySize>::clone() const
73 return autoPtr<polynomialTransport<Thermo, PolySize> >
75 new polynomialTransport<Thermo, PolySize>(*this)
80 template<class Thermo, int PolySize>
81 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
82 Foam::polynomialTransport<Thermo, PolySize>::New(Istream& is)
84 return autoPtr<polynomialTransport<Thermo, PolySize> >
86 new polynomialTransport<Thermo, PolySize>(is)
91 template<class Thermo, int PolySize>
92 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
93 Foam::polynomialTransport<Thermo, PolySize>::New(const dictionary& dict)
95 return autoPtr<polynomialTransport<Thermo, PolySize> >
97 new polynomialTransport<Thermo, PolySize>(dict)
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 template<class Thermo, int PolySize>
105 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
110 return muCoeffs_.value(T)/this->W();
114 template<class Thermo, int PolySize>
115 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
120 return kappaCoeffs_.value(T)/this->W();
124 template<class Thermo, int PolySize>
125 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
130 scalar deltaT = T - specie::Tstd;
132 (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
135 return kappa(T)/CpBar;
139 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
141 template<class Thermo, int PolySize>
142 inline Foam::polynomialTransport<Thermo, PolySize>&
143 Foam::polynomialTransport<Thermo, PolySize>::operator=
145 const polynomialTransport<Thermo, PolySize>& pt
148 Thermo::operator=(pt);
150 muCoeffs_ = pt.muCoeffs_;
151 kappaCoeffs_ = pt.kappaCoeffs_;
157 template<class Thermo, int PolySize>
158 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
160 const polynomialTransport<Thermo, PolySize>& pt
163 scalar molr1 = this->nMoles();
165 Thermo::operator+=(pt);
167 molr1 /= this->nMoles();
168 scalar molr2 = pt.nMoles()/this->nMoles();
170 muCoeffs_ = molr1*muCoeffs_ + molr2*pt.muCoeffs_;
171 kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
175 template<class Thermo, int PolySize>
176 inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
178 const polynomialTransport<Thermo, PolySize>& pt
181 scalar molr1 = this->nMoles();
183 Thermo::operator-=(pt);
185 molr1 /= this->nMoles();
186 scalar molr2 = pt.nMoles()/this->nMoles();
188 muCoeffs_ = molr1*muCoeffs_ - molr2*pt.muCoeffs_;
189 kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
193 template<class Thermo, int PolySize>
194 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
199 Thermo::operator*=(s);
203 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
205 template<class Thermo, int PolySize>
206 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
208 const polynomialTransport<Thermo, PolySize>& pt1,
209 const polynomialTransport<Thermo, PolySize>& pt2
214 static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
217 scalar molr1 = pt1.nMoles()/t.nMoles();
218 scalar molr2 = pt2.nMoles()/t.nMoles();
220 return polynomialTransport<Thermo, PolySize>
223 molr1*pt1.muCoeffs_ + molr2*pt2.muCoeffs_,
224 molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
229 template<class Thermo, int PolySize>
230 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
232 const polynomialTransport<Thermo, PolySize>& pt1,
233 const polynomialTransport<Thermo, PolySize>& pt2
238 static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
241 scalar molr1 = pt1.nMoles()/t.nMoles();
242 scalar molr2 = pt2.nMoles()/t.nMoles();
244 return polynomialTransport<Thermo, PolySize>
247 molr1*pt1.muCoeffs_ - molr2*pt2.muCoeffs_,
248 molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
253 template<class Thermo, int PolySize>
254 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
257 const polynomialTransport<Thermo, PolySize>& pt
260 return polynomialTransport<Thermo, PolySize>
262 s*static_cast<const Thermo&>(pt),
269 template<class Thermo, int PolySize>
270 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
272 const polynomialTransport<Thermo, PolySize>& pt1,
273 const polynomialTransport<Thermo, PolySize>& pt2
280 // ************************************************************************* //