OpenFOAM logo
Open Source CFD Toolkit

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