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

sutherlandTransportI.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) 1991-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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00029 
00030 namespace Foam
00031 {
00032 
00033 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00034 
00035 template<class thermo>
00036 inline void sutherlandTransport<thermo>::calcCoeffs
00037 (
00038     const scalar mu1, const scalar T1,
00039     const scalar mu2, const scalar T2
00040 )
00041 {
00042     scalar rootT1 = sqrt(T1);
00043     scalar mu1rootT2 = mu1*sqrt(T2);
00044     scalar mu2rootT1 = mu2*rootT1;
00045 
00046     Ts = (mu2rootT1 - mu1rootT2)/(mu1rootT2/T1 - mu2rootT1/T2);
00047 
00048     As = mu1*(1.0 + Ts/T1)/rootT1;
00049 }
00050 
00051 
00052 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00053 
00054 // Construct from components
00055 template<class thermo>
00056 inline sutherlandTransport<thermo>::sutherlandTransport
00057 (
00058     const thermo& t,
00059     const scalar as,
00060     const scalar ts
00061 )
00062 :
00063     thermo(t),
00064     As(as),
00065     Ts(ts)
00066 {}
00067 
00068 
00069 // Construct from components
00070 template<class thermo>
00071 inline sutherlandTransport<thermo>::sutherlandTransport
00072 (
00073     const thermo& t,
00074     const scalar mu1, const scalar T1,
00075     const scalar mu2, const scalar T2
00076 )
00077 :
00078     thermo(t)
00079 {
00080     calcCoeffs(mu1, T1, mu2, T2);
00081 }
00082 
00083 
00084 //- Construct as named copy
00085 template<class thermo>
00086 inline sutherlandTransport<thermo>::sutherlandTransport
00087 (
00088     const word& name,
00089     const sutherlandTransport& st
00090 )
00091 :
00092     thermo(name, st),
00093     As(st.As),
00094     Ts(st.Ts)
00095 {}
00096 
00097 
00098 // Construct and return a clone
00099 template<class thermo>
00100 inline autoPtr<sutherlandTransport<thermo> > sutherlandTransport<thermo>::clone
00101 () const
00102 {
00103     return autoPtr<sutherlandTransport<thermo> >
00104     (
00105         new sutherlandTransport<thermo>(*this)
00106     );
00107 }
00108 
00109 
00110 // Selector from Istream
00111 template<class thermo>
00112 inline autoPtr<sutherlandTransport<thermo> > sutherlandTransport<thermo>::New
00113 (
00114     Istream& is
00115 )
00116 {
00117     return autoPtr<sutherlandTransport<thermo> >
00118     (
00119         new sutherlandTransport<thermo>(is)
00120     );
00121 }
00122 
00123 
00124 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00125 
00126 // Dynamic viscosity [kg/ms]
00127 template<class thermo>
00128 inline scalar sutherlandTransport<thermo>::mu(const scalar T) const
00129 {
00130     return As*::sqrt(T)/(1.0 + Ts/T);
00131 }
00132 
00133 
00134 // Thermal conductivity [W/mK]
00135 template<class thermo>
00136 inline scalar sutherlandTransport<thermo>::kappa(const scalar T) const
00137 {
00138     scalar Cv_ = this->Cv(T);
00139     return mu(T)*Cv_*(1.32 + 1.77*this->R()/Cv_);
00140 }
00141 
00142 
00143 // Thermal diffusivity for enthalpy [kg/ms]
00144 template<class thermo>
00145 inline scalar sutherlandTransport<thermo>::alpha(const scalar T) const
00146 {
00147     scalar Cv_ = this->Cv(T);
00148     scalar R_ = this->R();
00149     scalar Cp_ = Cv_ + R_;
00150 
00151     scalar deltaT = T - specie::Tstd;
00152     scalar CpBar =
00153         (deltaT*(this->H(T) - this->H(specie::Tstd)) + Cp_)/(sqr(deltaT) + 1);
00154 
00155     return mu(T)*Cv_*(1.32 + 1.77*this->R()/Cv_)/CpBar;
00156 }
00157 
00158 
00159 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00160 
00161 template<class thermo>
00162 inline sutherlandTransport<thermo>& sutherlandTransport<thermo>::operator=
00163 (
00164     const sutherlandTransport<thermo>& st
00165 )
00166 {
00167     thermo::operator=(st);
00168 
00169     As = st.As;
00170     Ts = st.Ts;
00171 
00172     return *this;
00173 }
00174 
00175 
00176 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00177 
00178 template<class thermo>
00179 inline sutherlandTransport<thermo> operator+
00180 (
00181     const sutherlandTransport<thermo>& st1,
00182     const sutherlandTransport<thermo>& st2
00183 )
00184 {
00185     thermo t
00186     (
00187         static_cast<const thermo&>(st1) + static_cast<const thermo&>(st2)
00188     );
00189 
00190     scalar molr1 = st1.nMoles()/t.nMoles();
00191     scalar molr2 = st2.nMoles()/t.nMoles();
00192 
00193     return sutherlandTransport<thermo>
00194     (
00195         t,
00196         molr1*st1.As + molr2*st2.As,
00197         molr1*st1.Ts + molr2*st2.Ts
00198     );
00199 }
00200 
00201 
00202 template<class thermo>
00203 inline sutherlandTransport<thermo> operator-
00204 (
00205     const sutherlandTransport<thermo>& st1,
00206     const sutherlandTransport<thermo>& st2
00207 )
00208 {
00209     thermo t
00210     (
00211         static_cast<const thermo&>(st1) - static_cast<const thermo&>(st2)
00212     );
00213 
00214     scalar molr1 = st1.nMoles()/t.nMoles();
00215     scalar molr2 = st2.nMoles()/t.nMoles();
00216 
00217     return sutherlandTransport<thermo>
00218     (
00219         t,
00220         molr1*st1.As - molr2*st2.As,
00221         molr1*st1.Ts - molr2*st2.Ts
00222     );
00223 }
00224 
00225 
00226 template<class thermo>
00227 inline sutherlandTransport<thermo> operator*
00228 (
00229     const scalar s,
00230     const sutherlandTransport<thermo>& st
00231 )
00232 {
00233     return sutherlandTransport<thermo>
00234     (
00235         s*static_cast<const thermo&>(st),
00236         st.As,
00237         st.Ts
00238     );
00239 }
00240 
00241 
00242 template<class thermo>
00243 inline sutherlandTransport<thermo> operator==
00244 (
00245     const sutherlandTransport<thermo>& st1,
00246     const sutherlandTransport<thermo>& st2
00247 )
00248 {
00249     return st2 - st1;
00250 }
00251 
00252 
00253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00254 
00255 } // End namespace Foam
00256 
00257 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines