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

constTransportI.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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00028 
00029 namespace Foam
00030 {
00031 
00032 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00033 
00034 // Construct from components
00035 template<class thermo>
00036 inline constTransport<thermo>::constTransport
00037 (
00038     const thermo& t,
00039     const scalar mu,
00040     const scalar Pr
00041 )
00042 :
00043     thermo(t),
00044     Mu(mu),
00045     rPr(1.0/Pr)
00046 {}
00047 
00048 
00049 // Construct as named copy
00050 template<class thermo>
00051 inline constTransport<thermo>::constTransport
00052 (
00053     const word& name,
00054     const constTransport& ct
00055 )
00056 :
00057     thermo(name, ct),
00058     Mu(ct.Mu),
00059     rPr(ct.rPr)
00060 {}
00061 
00062 
00063 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00064 
00065 // Dynamic viscosity [kg/ms]
00066 template<class thermo>
00067 inline scalar constTransport<thermo>::mu(const scalar) const
00068 {
00069     return Mu;
00070 }
00071 
00072 
00073 // Thermal conductivity [W/mK]
00074 template<class thermo>
00075 inline scalar constTransport<thermo>::kappa(const scalar T) const
00076 {
00077     return this->Cp(T)*mu(T)*rPr;
00078 }
00079 
00080 
00081 // Thermal diffusivity for enthalpy [kg/ms]
00082 template<class thermo>
00083 inline scalar constTransport<thermo>::alpha(const scalar T) const
00084 {
00085     scalar Cp_ = this->Cp(T);
00086 
00087     scalar deltaT = T - specie::Tstd;
00088     scalar CpBar =
00089         (deltaT*(this->H(T) - this->H(specie::Tstd)) + Cp_)/(sqr(deltaT) + 1);
00090 
00091     return Cp_*mu(T)*rPr/CpBar;
00092 }
00093 
00094 
00095 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00096 
00097 template<class thermo>
00098 inline constTransport<thermo>& constTransport<thermo>::operator=
00099 (
00100     const constTransport<thermo>& ct
00101 )
00102 {
00103     thermo::operator=(ct);
00104 
00105     Mu = ct.Mu;
00106     rPr = ct.rPr;
00107 
00108     return *this;
00109 }
00110 
00111 
00112 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00113 
00114 template<class thermo>
00115 inline constTransport<thermo> operator+
00116 (
00117     const constTransport<thermo>& ct1,
00118     const constTransport<thermo>& ct2
00119 )
00120 {
00121     thermo t
00122     (
00123         static_cast<const thermo&>(ct1) + static_cast<const thermo&>(ct2)
00124     );
00125 
00126     scalar molr1 = ct1.nMoles()/t.nMoles();
00127     scalar molr2 = ct2.nMoles()/t.nMoles();
00128 
00129     return constTransport<thermo>
00130     (
00131         t,
00132         molr1*ct1.Mu + molr2*ct2.Mu,
00133         molr1*ct1.rPr + molr2*ct2.rPr
00134     );
00135 }
00136 
00137 
00138 template<class thermo>
00139 inline constTransport<thermo> operator-
00140 (
00141     const constTransport<thermo>& ct1,
00142     const constTransport<thermo>& ct2
00143 )
00144 {
00145     thermo t
00146     (
00147         static_cast<const thermo&>(ct1) - static_cast<const thermo&>(ct2)
00148     );
00149 
00150     scalar molr1 = ct1.nMoles()/t.nMoles();
00151     scalar molr2 = ct2.nMoles()/t.nMoles();
00152 
00153     return constTransport<thermo>
00154     (
00155         t,
00156         molr1*ct1.Mu - molr2*ct2.Mu,
00157         molr1*ct1.rPr - molr2*ct2.rPr
00158     );
00159 }
00160 
00161 
00162 template<class thermo>
00163 inline constTransport<thermo> operator*
00164 (
00165     const scalar s,
00166     const constTransport<thermo>& ct
00167 )
00168 {
00169     return constTransport<thermo>
00170     (
00171         s*static_cast<const thermo&>(ct),
00172         ct.Mu,
00173         ct.rPr
00174     );
00175 }
00176 
00177 
00178 template<class thermo>
00179 inline constTransport<thermo> operator==
00180 (
00181     const constTransport<thermo>& ct1,
00182     const constTransport<thermo>& ct2
00183 )
00184 {
00185     return ct2 - ct1;
00186 }
00187 
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 } // End namespace Foam
00192 
00193 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd