FreeFOAM The Cross-Platform CFD Toolkit
sutherlandTransportI.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 #include <specie/specie.H>
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 template<class thermo>
36 inline void sutherlandTransport<thermo>::calcCoeffs
37 (
38  const scalar mu1, const scalar T1,
39  const scalar mu2, const scalar T2
40 )
41 {
42  scalar rootT1 = sqrt(T1);
43  scalar mu1rootT2 = mu1*sqrt(T2);
44  scalar mu2rootT1 = mu2*rootT1;
45 
46  Ts = (mu2rootT1 - mu1rootT2)/(mu1rootT2/T1 - mu2rootT1/T2);
47 
48  As = mu1*(1.0 + Ts/T1)/rootT1;
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
54 // Construct from components
55 template<class thermo>
57 (
58  const thermo& t,
59  const scalar as,
60  const scalar ts
61 )
62 :
63  thermo(t),
64  As(as),
65  Ts(ts)
66 {}
67 
68 
69 // Construct from components
70 template<class thermo>
72 (
73  const thermo& t,
74  const scalar mu1, const scalar T1,
75  const scalar mu2, const scalar T2
76 )
77 :
78  thermo(t)
79 {
80  calcCoeffs(mu1, T1, mu2, T2);
81 }
82 
83 
84 //- Construct as named copy
85 template<class thermo>
87 (
88  const word& name,
89  const sutherlandTransport& st
90 )
91 :
92  thermo(name, st),
93  As(st.As),
94  Ts(st.Ts)
95 {}
96 
97 
98 // Construct and return a clone
99 template<class thermo>
101 () const
102 {
104  (
105  new sutherlandTransport<thermo>(*this)
106  );
107 }
108 
109 
110 // Selector from Istream
111 template<class thermo>
113 (
114  Istream& is
115 )
116 {
118  (
120  );
121 }
122 
123 
124 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
125 
126 // Dynamic viscosity [kg/ms]
127 template<class thermo>
128 inline scalar sutherlandTransport<thermo>::mu(const scalar T) const
129 {
130  return As*::sqrt(T)/(1.0 + Ts/T);
131 }
132 
133 
134 // Thermal conductivity [W/mK]
135 template<class thermo>
136 inline scalar sutherlandTransport<thermo>::kappa(const scalar T) const
137 {
138  scalar Cv_ = this->Cv(T);
139  return mu(T)*Cv_*(1.32 + 1.77*this->R()/Cv_);
140 }
141 
142 
143 // Thermal diffusivity for enthalpy [kg/ms]
144 template<class thermo>
145 inline scalar sutherlandTransport<thermo>::alpha(const scalar T) const
146 {
147  scalar Cv_ = this->Cv(T);
148  scalar R_ = this->R();
149  scalar Cp_ = Cv_ + R_;
150 
151  scalar deltaT = T - specie::Tstd;
152  scalar CpBar =
153  (deltaT*(this->H(T) - this->H(specie::Tstd)) + Cp_)/(sqr(deltaT) + 1);
154 
155  return mu(T)*Cv_*(1.32 + 1.77*this->R()/Cv_)/CpBar;
156 }
157 
158 
159 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
160 
161 template<class thermo>
163 (
165 )
166 {
167  thermo::operator=(st);
168 
169  As = st.As;
170  Ts = st.Ts;
171 
172  return *this;
173 }
174 
175 
176 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
177 
178 template<class thermo>
179 inline sutherlandTransport<thermo> operator+
180 (
181  const sutherlandTransport<thermo>& st1,
182  const sutherlandTransport<thermo>& st2
183 )
184 {
185  thermo t
186  (
187  static_cast<const thermo&>(st1) + static_cast<const thermo&>(st2)
188  );
189 
190  scalar molr1 = st1.nMoles()/t.nMoles();
191  scalar molr2 = st2.nMoles()/t.nMoles();
192 
194  (
195  t,
196  molr1*st1.As + molr2*st2.As,
197  molr1*st1.Ts + molr2*st2.Ts
198  );
199 }
200 
201 
202 template<class thermo>
203 inline sutherlandTransport<thermo> operator-
204 (
205  const sutherlandTransport<thermo>& st1,
206  const sutherlandTransport<thermo>& st2
207 )
208 {
209  thermo t
210  (
211  static_cast<const thermo&>(st1) - static_cast<const thermo&>(st2)
212  );
213 
214  scalar molr1 = st1.nMoles()/t.nMoles();
215  scalar molr2 = st2.nMoles()/t.nMoles();
216 
218  (
219  t,
220  molr1*st1.As - molr2*st2.As,
221  molr1*st1.Ts - molr2*st2.Ts
222  );
223 }
224 
225 
226 template<class thermo>
227 inline sutherlandTransport<thermo> operator*
228 (
229  const scalar s,
231 )
232 {
234  (
235  s*static_cast<const thermo&>(st),
236  st.As,
237  st.Ts
238  );
239 }
240 
241 
242 template<class thermo>
243 inline sutherlandTransport<thermo> operator==
244 (
245  const sutherlandTransport<thermo>& st1,
246  const sutherlandTransport<thermo>& st2
247 )
248 {
249  return st2 - st1;
250 }
251 
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 } // End namespace Foam
256 
257 // ************************ vim: set sw=4 sts=4 et: ************************ //