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

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