initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / specie / transport / polynomial / polynomialTransportI.H
blob9e6e00e6e3c603146007caa7866e2e9aaf6751b1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 \*---------------------------------------------------------------------------*/
27 #include "specie.H"
29 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
31 template<class Thermo, int PolySize>
32 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
34     const Thermo& t,
35     const Polynomial<PolySize>& muPoly,
36     const Polynomial<PolySize>& kappaPoly
39     Thermo(t),
40     muPolynomial_(muPoly),
41     kappaPolynomial_(kappaPoly)
45 template<class Thermo, int PolySize>
46 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
48     const word& name,
49     const polynomialTransport& pt
52     Thermo(name, 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> >
63     (
64         new polynomialTransport<Thermo, PolySize>(*this)
65     );
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> >
74     (
75         new polynomialTransport<Thermo, PolySize>(is)
76     );
80 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
82 template<class Thermo, int PolySize>
83 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
85     const scalar T
86 ) const
88     return muPolynomial_.evaluate(T);
92 template<class Thermo, int PolySize>
93 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
95     const scalar T
96 ) const
98     return kappaPolynomial_.evaluate(T);
102 template<class Thermo, int PolySize>
103 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
105     const scalar T
106 ) const
108     scalar deltaT = T - specie::Tstd;
109     scalar CpBar =
110         (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
111        /(sqr(deltaT) + 1);
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_;
131     return *this;
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
144     Thermo t
145     (
146         static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
147     );
150     scalar molr1 = pt1.nMoles()/t.nMoles();
151     scalar molr2 = pt2.nMoles()/t.nMoles();
153     return polynomialTransport<Thermo, PolySize>
154     (
155         t,
156         molr1*pt1.muPolynomial_ + molr2*pt2.muPolynomial_,
157         molr1*pt1.kappaPolynomial_ + molr2*pt2.kappaPolynomial_
158     );
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
169     Thermo t
170     (
171         static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
172     );
174     scalar molr1 = pt1.nMoles()/t.nMoles();
175     scalar molr2 = pt2.nMoles()/t.nMoles();
177     return polynomialTransport<Thermo, PolySize>
178     (
179         t,
180         molr1*pt1.muPolynomial_ - molr2*pt2.muPolynomial_,
181         molr1*pt1.kappaPolynomial_ - molr2*pt2.kappaPolynomial_
182     );
186 template<class Thermo, int PolySize>
187 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
189     const scalar s,
190     const polynomialTransport<Thermo, PolySize>& pt
193     return polynomialTransport<Thermo, PolySize>
194     (
195         s*static_cast<const Thermo&>(pt),
196         pt.muPolynomial_,
197         pt.kappaPolynomial_
198     );
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
209     return pt2 - pt1;
213 // ************************************************************************* //