1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class Thermo, int PolySize>
32 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
35 const Polynomial<PolySize>& muPoly,
36 const Polynomial<PolySize>& kappaPoly
40 muPolynomial_(muPoly),
41 kappaPolynomial_(kappaPoly)
45 template<class Thermo, int PolySize>
46 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
49 const polynomialTransport& pt
53 muPolynomial_(pt.muPolynomial_),
54 kappaPolynomial_(pt.kappaPolynomial_)
58 template<class Thermo, int PolySize>
59 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
60 Foam::polynomialTransport<Thermo, PolySize>::clone() const
62 return autoPtr<polynomialTransport<Thermo, PolySize> >
64 new polynomialTransport<Thermo, PolySize>(*this)
69 template<class Thermo, int PolySize>
70 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
71 Foam::polynomialTransport<Thermo, PolySize>::New(Istream& is)
73 return autoPtr<polynomialTransport<Thermo, PolySize> >
75 new polynomialTransport<Thermo, PolySize>(is)
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 template<class Thermo, int PolySize>
83 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
88 return muPolynomial_.evaluate(T);
92 template<class Thermo, int PolySize>
93 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
98 return kappaPolynomial_.evaluate(T);
102 template<class Thermo, int PolySize>
103 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
108 scalar deltaT = T - specie::Tstd;
110 (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
113 return kappa(T)/CpBar;
117 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
119 template<class Thermo, int PolySize>
120 inline Foam::polynomialTransport<Thermo, PolySize>&
121 Foam::polynomialTransport<Thermo, PolySize>::operator=
123 const polynomialTransport<Thermo, PolySize>& pt
126 Thermo::operator=(pt);
128 muPolynomial_ = pt.muPolynomial_;
129 kappaPolynomial_ = pt.kappaPolynomial_;
135 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
137 template<class Thermo, int PolySize>
138 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
140 const polynomialTransport<Thermo, PolySize>& pt1,
141 const polynomialTransport<Thermo, PolySize>& pt2
146 static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
150 scalar molr1 = pt1.nMoles()/t.nMoles();
151 scalar molr2 = pt2.nMoles()/t.nMoles();
153 return polynomialTransport<Thermo, PolySize>
156 molr1*pt1.muPolynomial_ + molr2*pt2.muPolynomial_,
157 molr1*pt1.kappaPolynomial_ + molr2*pt2.kappaPolynomial_
162 template<class Thermo, int PolySize>
163 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
165 const polynomialTransport<Thermo, PolySize>& pt1,
166 const polynomialTransport<Thermo, PolySize>& pt2
171 static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
174 scalar molr1 = pt1.nMoles()/t.nMoles();
175 scalar molr2 = pt2.nMoles()/t.nMoles();
177 return polynomialTransport<Thermo, PolySize>
180 molr1*pt1.muPolynomial_ - molr2*pt2.muPolynomial_,
181 molr1*pt1.kappaPolynomial_ - molr2*pt2.kappaPolynomial_
186 template<class Thermo, int PolySize>
187 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
190 const polynomialTransport<Thermo, PolySize>& pt
193 return polynomialTransport<Thermo, PolySize>
195 s*static_cast<const Thermo&>(pt),
202 template<class Thermo, int PolySize>
203 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
205 const polynomialTransport<Thermo, PolySize>& pt1,
206 const polynomialTransport<Thermo, PolySize>& pt2
213 // ************************************************************************* //