FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

polynomialTransportI.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <specie/specie.H>
00027 
00028 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00029 
00030 template<class Thermo, int PolySize>
00031 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
00032 (
00033     const polynomialTransport& pt
00034 )
00035 :
00036     Thermo(pt),
00037     muPolynomial_(pt.muPolynomial_),
00038     kappaPolynomial_(pt.kappaPolynomial_)
00039 {}
00040 
00041 
00042 template<class Thermo, int PolySize>
00043 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
00044 (
00045     const Thermo& t,
00046     const Polynomial<PolySize>& muPoly,
00047     const Polynomial<PolySize>& kappaPoly
00048 )
00049 :
00050     Thermo(t),
00051     muPolynomial_(muPoly),
00052     kappaPolynomial_(kappaPoly)
00053 {}
00054 
00055 
00056 template<class Thermo, int PolySize>
00057 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
00058 (
00059     const word& name,
00060     const polynomialTransport& pt
00061 )
00062 :
00063     Thermo(name, pt),
00064     muPolynomial_(pt.muPolynomial_),
00065     kappaPolynomial_(pt.kappaPolynomial_)
00066 {}
00067 
00068 
00069 template<class Thermo, int PolySize>
00070 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
00071 Foam::polynomialTransport<Thermo, PolySize>::clone() const
00072 {
00073     return autoPtr<polynomialTransport<Thermo, PolySize> >
00074     (
00075         new polynomialTransport<Thermo, PolySize>(*this)
00076     );
00077 }
00078 
00079 
00080 template<class Thermo, int PolySize>
00081 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
00082 Foam::polynomialTransport<Thermo, PolySize>::New(Istream& is)
00083 {
00084     return autoPtr<polynomialTransport<Thermo, PolySize> >
00085     (
00086         new polynomialTransport<Thermo, PolySize>(is)
00087     );
00088 }
00089 
00090 
00091 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00092 
00093 template<class Thermo, int PolySize>
00094 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
00095 (
00096     const scalar T
00097 ) const
00098 {
00099     return muPolynomial_.evaluate(T)/this->W();
00100 }
00101 
00102 
00103 template<class Thermo, int PolySize>
00104 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
00105 (
00106     const scalar T
00107 ) const
00108 {
00109     return kappaPolynomial_.evaluate(T)/this->W();
00110 }
00111 
00112 
00113 template<class Thermo, int PolySize>
00114 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
00115 (
00116     const scalar T
00117 ) const
00118 {
00119     scalar deltaT = T - specie::Tstd;
00120     scalar CpBar =
00121         (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
00122        /(sqr(deltaT) + 1);
00123 
00124     return kappa(T)/CpBar;
00125 }
00126 
00127 
00128 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00129 
00130 template<class Thermo, int PolySize>
00131 inline Foam::polynomialTransport<Thermo, PolySize>&
00132 Foam::polynomialTransport<Thermo, PolySize>::operator=
00133 (
00134     const polynomialTransport<Thermo, PolySize>& pt
00135 )
00136 {
00137     Thermo::operator=(pt);
00138 
00139     muPolynomial_ = pt.muPolynomial_;
00140     kappaPolynomial_ = pt.kappaPolynomial_;
00141 
00142     return *this;
00143 }
00144 
00145 
00146 template<class Thermo, int PolySize>
00147 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
00148 (
00149     const polynomialTransport<Thermo, PolySize>& pt
00150 )
00151 {
00152     scalar molr1 = this->nMoles();
00153 
00154     Thermo::operator+=(pt);
00155 
00156     molr1 /= this->nMoles();
00157     scalar molr2 = pt.nMoles()/this->nMoles();
00158 
00159     muPolynomial_ = molr1*muPolynomial_ + molr2*pt.muPolynomial_;
00160     kappaPolynomial_ = molr1*kappaPolynomial_ + molr2*pt.kappaPolynomial_;
00161 }
00162 
00163 
00164 template<class Thermo, int PolySize>
00165 inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
00166 (
00167     const polynomialTransport<Thermo, PolySize>& pt
00168 )
00169 {
00170     scalar molr1 = this->nMoles();
00171 
00172     Thermo::operator-=(pt);
00173 
00174     molr1 /= this->nMoles();
00175     scalar molr2 = pt.nMoles()/this->nMoles();
00176 
00177     muPolynomial_ = molr1*muPolynomial_ - molr2*pt.muPolynomial_;
00178     kappaPolynomial_ = molr1*kappaPolynomial_ - molr2*pt.kappaPolynomial_;
00179 }
00180 
00181 
00182 template<class Thermo, int PolySize>
00183 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
00184 (
00185     const scalar s
00186 )
00187 {
00188     Thermo::operator*=(s);
00189 }
00190 
00191 
00192 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00193 
00194 template<class Thermo, int PolySize>
00195 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
00196 (
00197     const polynomialTransport<Thermo, PolySize>& pt1,
00198     const polynomialTransport<Thermo, PolySize>& pt2
00199 )
00200 {
00201     Thermo t
00202     (
00203         static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
00204     );
00205 
00206     scalar molr1 = pt1.nMoles()/t.nMoles();
00207     scalar molr2 = pt2.nMoles()/t.nMoles();
00208 
00209     return polynomialTransport<Thermo, PolySize>
00210     (
00211         t,
00212         molr1*pt1.muPolynomial_ + molr2*pt2.muPolynomial_,
00213         molr1*pt1.kappaPolynomial_ + molr2*pt2.kappaPolynomial_
00214     );
00215 }
00216 
00217 
00218 template<class Thermo, int PolySize>
00219 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
00220 (
00221     const polynomialTransport<Thermo, PolySize>& pt1,
00222     const polynomialTransport<Thermo, PolySize>& pt2
00223 )
00224 {
00225     Thermo t
00226     (
00227         static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
00228     );
00229 
00230     scalar molr1 = pt1.nMoles()/t.nMoles();
00231     scalar molr2 = pt2.nMoles()/t.nMoles();
00232 
00233     return polynomialTransport<Thermo, PolySize>
00234     (
00235         t,
00236         molr1*pt1.muPolynomial_ - molr2*pt2.muPolynomial_,
00237         molr1*pt1.kappaPolynomial_ - molr2*pt2.kappaPolynomial_
00238     );
00239 }
00240 
00241 
00242 template<class Thermo, int PolySize>
00243 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
00244 (
00245     const scalar s,
00246     const polynomialTransport<Thermo, PolySize>& pt
00247 )
00248 {
00249     return polynomialTransport<Thermo, PolySize>
00250     (
00251         s*static_cast<const Thermo&>(pt),
00252         pt.muPolynomial_,
00253         pt.kappaPolynomial_
00254     );
00255 }
00256 
00257 
00258 template<class Thermo, int PolySize>
00259 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
00260 (
00261     const polynomialTransport<Thermo, PolySize>& pt1,
00262     const polynomialTransport<Thermo, PolySize>& pt2
00263 )
00264 {
00265     return pt2 - pt1;
00266 }
00267 
00268 
00269 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines