polynomialTransportI.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-2020 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 polynomialTransport& 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 muCoeffs_.value(T);
89 }
90 
91 
92 template<class Thermo, int PolySize>
94 (
95  const scalar p,
96  const scalar T
97 ) const
98 {
99  return kappaCoeffs_.value(T);
100 }
101 
102 
103 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
104 
105 template<class Thermo, int PolySize>
106 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
107 (
109 )
110 {
111  scalar Y1 = this->Y();
112 
113  Thermo::operator+=(pt);
114 
115  if (mag(this->Y()) > small)
116  {
117  Y1 /= this->Y();
118  scalar Y2 = pt.Y()/this->Y();
119 
120  muCoeffs_ = Y1*muCoeffs_ + Y2*pt.muCoeffs_;
121  kappaCoeffs_ = Y1*kappaCoeffs_ + Y2*pt.kappaCoeffs_;
122  }
123 }
124 
125 
126 template<class Thermo, int PolySize>
127 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
128 (
129  const scalar s
130 )
131 {
132  Thermo::operator*=(s);
133 }
134 
135 
136 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
137 
138 template<class Thermo, int PolySize>
139 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
140 (
143 )
144 {
145  Thermo t
146  (
147  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
148  );
149 
150  if (mag(t.Y()) < small)
151  {
153  (
154  t,
155  0,
156  pt1.muCoeffs_,
157  pt1.kappaCoeffs_
158  );
159  }
160  else
161  {
162  scalar Y1 = pt1.Y()/t.Y();
163  scalar Y2 = pt2.Y()/t.Y();
164 
166  (
167  t,
168  Y1*pt1.muCoeffs_ + Y2*pt2.muCoeffs_,
169  Y1*pt1.kappaCoeffs_ + Y2*pt2.kappaCoeffs_
170  );
171  }
172 }
173 
174 
175 template<class Thermo, int PolySize>
176 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
177 (
178  const scalar s,
180 )
181 {
183  (
184  s*static_cast<const Thermo&>(pt),
185  pt.muCoeffs_,
186  pt.kappaCoeffs_
187  );
188 }
189 
190 
191 // ************************************************************************* //
dictionary dict
autoPtr< polynomialTransport > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
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
static autoPtr< polynomialTransport > New(const dictionary &dict)
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
PtrList< volScalarField > & Y
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
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
Transport package using polynomial functions for mu and kappa.