OpenFOAM logo
Open Source CFD Toolkit

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