logPolynomialTransportI.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) 2016-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 #include "specie.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Thermo, int PolySize>
32 (
33  const Thermo& t,
34  const Polynomial<PolySize>& muCoeffs,
35  const Polynomial<PolySize>& kappaCoeffs
36 )
37 :
38  Thermo(t),
39  muCoeffs_(muCoeffs),
40  kappaCoeffs_(kappaCoeffs)
41 {}
42 
43 
44 template<class Thermo, int PolySize>
46 (
47  const word& name,
48  const logPolynomialTransport& pt
49 )
50 :
51  Thermo(name, pt),
52  muCoeffs_(pt.muCoeffs_),
53  kappaCoeffs_(pt.kappaCoeffs_)
54 {}
55 
56 
57 template<class Thermo, int PolySize>
60 {
62  (
64  );
65 }
66 
67 
68 template<class Thermo, int PolySize>
71 {
73  (
75  );
76 }
77 
78 
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 
81 template<class Thermo, int PolySize>
83 (
84  const scalar p,
85  const scalar T
86 ) const
87 {
88  return exp(muCoeffs_.value(log(T)));
89 }
90 
91 
92 template<class Thermo, int PolySize>
94 (
95  const scalar p,
96  const scalar T
97 ) const
98 {
99  return exp(kappaCoeffs_.value(log(T)));
100 }
101 
102 
103 template<class Thermo, int PolySize>
105 (
106  const scalar p, const scalar T
107 ) const
108 {
109  return kappa(p, T)/this->Cp(p, T);
110 }
111 
112 
113 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
114 
115 template<class Thermo, int PolySize>
116 inline void Foam::logPolynomialTransport<Thermo, PolySize>::operator+=
117 (
119 )
120 {
121  scalar Y1 = this->Y();
122 
123  Thermo::operator+=(pt);
124 
125  if (mag(this->Y()) > small)
126  {
127  Y1 /= this->Y();
128  scalar Y2 = pt.Y()/this->Y();
129 
130  muCoeffs_ = Y1*muCoeffs_ + Y2*pt.muCoeffs_;
131  kappaCoeffs_ = Y1*kappaCoeffs_ + Y2*pt.kappaCoeffs_;
132  }
133 }
134 
135 
136 template<class Thermo, int PolySize>
137 inline void Foam::logPolynomialTransport<Thermo, PolySize>::operator*=
138 (
139  const scalar s
140 )
141 {
142  Thermo::operator*=(s);
143 }
144 
145 
146 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
147 
148 template<class Thermo, int PolySize>
150 (
153 )
154 {
155  Thermo t
156  (
157  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
158  );
159 
160  if (mag(t.Y()) < small)
161  {
163  (
164  t,
165  0,
166  pt1.muCoeffs_,
167  pt1.kappaCoeffs_
168  );
169  }
170  else
171  {
172  scalar Y1 = pt1.Y()/t.Y();
173  scalar Y2 = pt2.Y()/t.Y();
174 
176  (
177  t,
178  Y1*pt1.muCoeffs_ + Y2*pt2.muCoeffs_,
179  Y1*pt1.kappaCoeffs_ + Y2*pt2.kappaCoeffs_
180  );
181  }
182 }
183 
184 
185 template<class Thermo, int PolySize>
187 (
188  const scalar s,
190 )
191 {
193  (
194  s*static_cast<const Thermo&>(pt),
195  pt.muCoeffs_,
196  pt.kappaCoeffs_
197  );
198 }
199 
200 
201 // ************************************************************************* //
autoPtr< logPolynomialTransport > clone() const
Construct and return a clone.
static autoPtr< logPolynomialTransport > New(const dictionary &dict)
dictionary dict
dimensionedScalar log(const dimensionedScalar &ds)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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))
dimensionedScalar exp(const dimensionedScalar &ds)
A class for handling words, derived from string.
Definition: word.H:59
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/m/s].
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
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
Transport package using polynomial functions of ln(T) for mu and kappa:
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].