OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "specie.H"
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 template<class Thermo, int PolySize>
00032 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
00033 (
00034     const Thermo& t,
00035     const Polynomial<PolySize>& muPoly,
00036     const Polynomial<PolySize>& kappaPoly
00037 )
00038 :
00039     Thermo(t),
00040     muPolynomial_(muPoly),
00041     kappaPolynomial_(kappaPoly)
00042 {}
00043 
00044 
00045 template<class Thermo, int PolySize>
00046 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
00047 (
00048     const word& name,
00049     const polynomialTransport& pt
00050 )
00051 :
00052     Thermo(name, pt),
00053     muPolynomial_(pt.muPolynomial_),
00054     kappaPolynomial_(pt.kappaPolynomial_)
00055 {}
00056 
00057 
00058 template<class Thermo, int PolySize>
00059 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
00060 Foam::polynomialTransport<Thermo, PolySize>::clone() const
00061 {
00062     return autoPtr<polynomialTransport<Thermo, PolySize> >
00063     (
00064         new polynomialTransport<Thermo, PolySize>(*this)
00065     );
00066 }
00067 
00068 
00069 template<class Thermo, int PolySize>
00070 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
00071 Foam::polynomialTransport<Thermo, PolySize>::New(Istream& is)
00072 {
00073     return autoPtr<polynomialTransport<Thermo, PolySize> >
00074     (
00075         new polynomialTransport<Thermo, PolySize>(is)
00076     );
00077 }
00078 
00079 
00080 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00081 
00082 template<class Thermo, int PolySize>
00083 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
00084 (
00085     const scalar T
00086 ) const
00087 {
00088     return muPolynomial_.evaluate(T);
00089 }
00090 
00091 
00092 template<class Thermo, int PolySize>
00093 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
00094 (
00095     const scalar T
00096 ) const
00097 {
00098     return kappaPolynomial_.evaluate(T);
00099 }
00100 
00101 
00102 template<class Thermo, int PolySize>
00103 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
00104 (
00105     const scalar T
00106 ) const
00107 {
00108     scalar deltaT = T - specie::Tstd;
00109     scalar CpBar =
00110         (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
00111        /(sqr(deltaT) + 1);
00112 
00113     return kappa(T)/CpBar;
00114 }
00115 
00116 
00117 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00118 
00119 template<class Thermo, int PolySize>
00120 inline Foam::polynomialTransport<Thermo, PolySize>&
00121 Foam::polynomialTransport<Thermo, PolySize>::operator=
00122 (
00123     const polynomialTransport<Thermo, PolySize>& pt
00124 )
00125 {
00126     Thermo::operator=(pt);
00127 
00128     muPolynomial_ = pt.muPolynomial_;
00129     kappaPolynomial_ = pt.kappaPolynomial_;
00130 
00131     return *this;
00132 }
00133 
00134 
00135 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00136 
00137 template<class Thermo, int PolySize>
00138 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
00139 (
00140     const polynomialTransport<Thermo, PolySize>& pt1,
00141     const polynomialTransport<Thermo, PolySize>& pt2
00142 )
00143 {
00144     Thermo t
00145     (
00146         static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
00147     );
00148 
00149 
00150     scalar molr1 = pt1.nMoles()/t.nMoles();
00151     scalar molr2 = pt2.nMoles()/t.nMoles();
00152 
00153     return polynomialTransport<Thermo, PolySize>
00154     (
00155         t,
00156         molr1*pt1.muPolynomial_ + molr2*pt2.muPolynomial_,
00157         molr1*pt1.kappaPolynomial_ + molr2*pt2.kappaPolynomial_
00158     );
00159 }
00160 
00161 
00162 template<class Thermo, int PolySize>
00163 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
00164 (
00165     const polynomialTransport<Thermo, PolySize>& pt1,
00166     const polynomialTransport<Thermo, PolySize>& pt2
00167 )
00168 {
00169     Thermo t
00170     (
00171         static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
00172     );
00173 
00174     scalar molr1 = pt1.nMoles()/t.nMoles();
00175     scalar molr2 = pt2.nMoles()/t.nMoles();
00176 
00177     return polynomialTransport<Thermo, PolySize>
00178     (
00179         t,
00180         molr1*pt1.muPolynomial_ - molr2*pt2.muPolynomial_,
00181         molr1*pt1.kappaPolynomial_ - molr2*pt2.kappaPolynomial_
00182     );
00183 }
00184 
00185 
00186 template<class Thermo, int PolySize>
00187 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
00188 (
00189     const scalar s,
00190     const polynomialTransport<Thermo, PolySize>& pt
00191 )
00192 {
00193     return polynomialTransport<Thermo, PolySize>
00194     (
00195         s*static_cast<const Thermo&>(pt),
00196         pt.muPolynomial_,
00197         pt.kappaPolynomial_
00198     );
00199 }
00200 
00201 
00202 template<class Thermo, int PolySize>
00203 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
00204 (
00205     const polynomialTransport<Thermo, PolySize>& pt1,
00206     const polynomialTransport<Thermo, PolySize>& pt2
00207 )
00208 {
00209     return pt2 - pt1;
00210 }
00211 
00212 
00213 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd