FreeFOAM The Cross-Platform CFD Toolkit
constTransportI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 namespace Foam
29 {
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 // Construct from components
34 template<class thermo>
35 inline constTransport<thermo>::constTransport
36 (
37  const thermo& t,
38  const scalar mu,
39  const scalar Pr
40 )
41 :
42  thermo(t),
43  Mu(mu),
44  rPr(1.0/Pr)
45 {}
46 
47 
48 // Construct as named copy
49 template<class thermo>
50 inline constTransport<thermo>::constTransport
51 (
52  const word& name,
53  const constTransport& ct
54 )
55 :
56  thermo(name, ct),
57  Mu(ct.Mu),
58  rPr(ct.rPr)
59 {}
60 
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
64 // Dynamic viscosity [kg/ms]
65 template<class thermo>
66 inline scalar constTransport<thermo>::mu(const scalar) const
67 {
68  return Mu;
69 }
70 
71 
72 // Thermal conductivity [W/mK]
73 template<class thermo>
74 inline scalar constTransport<thermo>::kappa(const scalar T) const
75 {
76  return this->Cp(T)*mu(T)*rPr;
77 }
78 
79 
80 // Thermal diffusivity for enthalpy [kg/ms]
81 template<class thermo>
82 inline scalar constTransport<thermo>::alpha(const scalar T) const
83 {
84  scalar Cp_ = this->Cp(T);
85 
86  scalar deltaT = T - specie::Tstd;
87  scalar CpBar =
88  (deltaT*(this->H(T) - this->H(specie::Tstd)) + Cp_)/(sqr(deltaT) + 1);
89 
90  return Cp_*mu(T)*rPr/CpBar;
91 }
92 
93 
94 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
95 
96 template<class thermo>
98 (
99  const constTransport<thermo>& ct
100 )
101 {
102  thermo::operator=(ct);
103 
104  Mu = ct.Mu;
105  rPr = ct.rPr;
106 
107  return *this;
108 }
109 
110 
111 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
112 
113 template<class thermo>
114 inline constTransport<thermo> operator+
115 (
116  const constTransport<thermo>& ct1,
117  const constTransport<thermo>& ct2
118 )
119 {
120  thermo t
121  (
122  static_cast<const thermo&>(ct1) + static_cast<const thermo&>(ct2)
123  );
124 
125  scalar molr1 = ct1.nMoles()/t.nMoles();
126  scalar molr2 = ct2.nMoles()/t.nMoles();
127 
129  (
130  t,
131  molr1*ct1.Mu + molr2*ct2.Mu,
132  molr1*ct1.rPr + molr2*ct2.rPr
133  );
134 }
135 
136 
137 template<class thermo>
138 inline constTransport<thermo> operator-
139 (
140  const constTransport<thermo>& ct1,
141  const constTransport<thermo>& ct2
142 )
143 {
144  thermo t
145  (
146  static_cast<const thermo&>(ct1) - static_cast<const thermo&>(ct2)
147  );
148 
149  scalar molr1 = ct1.nMoles()/t.nMoles();
150  scalar molr2 = ct2.nMoles()/t.nMoles();
151 
153  (
154  t,
155  molr1*ct1.Mu - molr2*ct2.Mu,
156  molr1*ct1.rPr - molr2*ct2.rPr
157  );
158 }
159 
160 
161 template<class thermo>
162 inline constTransport<thermo> operator*
163 (
164  const scalar s,
165  const constTransport<thermo>& ct
166 )
167 {
169  (
170  s*static_cast<const thermo&>(ct),
171  ct.Mu,
172  ct.rPr
173  );
174 }
175 
176 
177 template<class thermo>
178 inline constTransport<thermo> operator==
179 (
180  const constTransport<thermo>& ct1,
181  const constTransport<thermo>& ct2
182 )
183 {
184  return ct2 - ct1;
185 }
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // ************************ vim: set sw=4 sts=4 et: ************************ //