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

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