constTransportI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
28 template<class Thermo>
30 (
31  const Thermo& t,
32  const scalar mu,
33  const scalar Pr
34 )
35 :
36  Thermo(t),
37  mu_(mu),
38  rPr_(1.0/Pr)
39 {}
40 
41 
42 template<class Thermo>
44 (
45  const word& name,
46  const constTransport& ct
47 )
48 :
49  Thermo(name, ct),
50  mu_(ct.mu_),
51  rPr_(ct.rPr_)
52 {}
53 
54 
55 template<class Thermo>
58 {
60  (
61  new constTransport<Thermo>(*this)
62  );
63 }
64 
65 
66 template<class Thermo>
69 (
70  const dictionary& dict
71 )
72 {
74  (
76  );
77 }
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
82 template<class Thermo>
83 inline Foam::scalar Foam::constTransport<Thermo>::mu
84 (
85  const scalar p,
86  const scalar T
87 ) const
88 {
89  return mu_;
90 }
91 
92 
93 template<class Thermo>
94 inline Foam::scalar Foam::constTransport<Thermo>::kappa
95 (
96  const scalar p,
97  const scalar T
98 ) const
99 {
100  return this->Cp(p, T)*mu(p, T)*rPr_;
101 }
102 
103 
104 template<class Thermo>
105 inline Foam::scalar Foam::constTransport<Thermo>::alphah
106 (
107  const scalar p,
108  const scalar T
109 ) const
110 {
111  return mu(p, T)*rPr_;
112 }
113 
114 
115 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
116 
117 template<class Thermo>
118 inline void Foam::constTransport<Thermo>::operator+=
119 (
120  const constTransport<Thermo>& st
121 )
122 {
123  scalar Y1 = this->Y();
124 
125  Thermo::operator+=(st);
126 
127  if (mag(this->Y()) > small)
128  {
129  Y1 /= this->Y();
130  scalar Y2 = st.Y()/this->Y();
131 
132  mu_ = Y1*mu_ + Y2*st.mu_;
133  rPr_ = 1.0/(Y1/rPr_ + Y2/st.rPr_);
134  }
135 }
136 
137 
138 template<class Thermo>
139 inline void Foam::constTransport<Thermo>::operator*=
140 (
141  const scalar s
142 )
143 {
144  Thermo::operator*=(s);
145 }
146 
147 
148 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
149 
150 template<class Thermo>
151 inline Foam::constTransport<Thermo> Foam::operator+
152 (
153  const constTransport<Thermo>& ct1,
154  const constTransport<Thermo>& ct2
155 )
156 {
157  Thermo t
158  (
159  static_cast<const Thermo&>(ct1) + static_cast<const Thermo&>(ct2)
160  );
161 
162  if (mag(t.Y()) < small)
163  {
165  (
166  t,
167  0,
168  ct1.rPr_
169  );
170  }
171  else
172  {
173  scalar Y1 = ct1.Y()/t.Y();
174  scalar Y2 = ct2.Y()/t.Y();
175 
177  (
178  t,
179  Y1*ct1.mu_ + Y2*ct2.mu_,
180  1.0/(Y1/ct1.rPr_ + Y2/ct2.rPr_)
181  );
182  }
183 }
184 
185 
186 template<class Thermo>
187 inline Foam::constTransport<Thermo> Foam::operator*
188 (
189  const scalar s,
190  const constTransport<Thermo>& ct
191 )
192 {
194  (
195  s*static_cast<const Thermo&>(ct),
196  ct.mu_,
197  1.0/ct.rPr_
198  );
199 }
200 
201 
202 // ************************************************************************* //
dictionary dict
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
Constant properties Transport package. Templated into a given thermodynamics package (needed for ther...
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/m/s].
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A class for handling words, derived from string.
Definition: word.H:59
autoPtr< constTransport > clone() const
Construct and return a clone.
const dimensionedScalar mu
Atomic mass unit.
PtrList< volScalarField > & Y
scalar Cp(const scalar p, const scalar T) const
Definition: EtoHthermo.H:2
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
static autoPtr< constTransport > New(const dictionary &dict)
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].