polynomialTransportI.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "specie.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Thermo, int PolySize>
34 (
35  const Thermo& t,
36  const Polynomial<PolySize>& muCoeffs,
37  const Polynomial<PolySize>& kappaCoeffs
38 )
39 :
40  Thermo(t),
41  muCoeffs_(muCoeffs),
42  kappaCoeffs_(kappaCoeffs)
43 {}
44 
45 
46 template<class Thermo, int PolySize>
48 (
49  const word& name,
50  const polynomialTransport& pt
51 )
52 :
53  Thermo(name, pt),
54  muCoeffs_(pt.muCoeffs_),
55  kappaCoeffs_(pt.kappaCoeffs_)
56 {}
57 
58 
59 template<class Thermo, int PolySize>
62 {
64 }
65 
66 
67 template<class Thermo, int PolySize>
70 {
72 }
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
77 template<class Thermo, int PolySize>
79 (
80  const scalar p,
81  const scalar T
82 ) const
83 {
84  return muCoeffs_.value(T);
85 }
86 
87 
88 template<class Thermo, int PolySize>
90 (
91  const scalar p,
92  const scalar T
93 ) const
94 {
95  return kappaCoeffs_.value(T);
96 }
97 
98 
99 template<class Thermo, int PolySize>
101 (
102  const scalar p, const scalar T
103 ) const
104 {
105  return kappa(p, T)/this->Cp(p, T);
106 }
107 
108 
109 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
110 
111 template<class Thermo, int PolySize>
113 (
115 )
116 {
117  scalar Y1 = this->Y();
118 
119  Thermo::operator+=(pt);
120 
121  if (mag(this->Y()) > SMALL)
122  {
123  Y1 /= this->Y();
124  scalar Y2 = pt.Y()/this->Y();
125 
126  muCoeffs_ = Y1*muCoeffs_ + Y2*pt.muCoeffs_;
127  kappaCoeffs_ = Y1*kappaCoeffs_ + Y2*pt.kappaCoeffs_;
128  }
129 }
130 
131 
132 template<class Thermo, int PolySize>
134 (
135  const scalar s
136 )
137 {
138  Thermo::operator*=(s);
139 }
140 
141 
142 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
143 
144 template<class Thermo, int PolySize>
145 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
146 (
149 )
150 {
151  Thermo t
152  (
153  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
154  );
155 
156  if (mag(t.Y()) < SMALL)
157  {
159  (
160  t,
161  0,
162  pt1.muCoeffs_,
163  pt1.kappaCoeffs_
164  );
165  }
166  else
167  {
168  scalar Y1 = pt1.Y()/t.Y();
169  scalar Y2 = pt2.Y()/t.Y();
170 
171  return polynomialTransport<Thermo, PolySize>
172  (
173  t,
174  Y1*pt1.muCoeffs_ + Y2*pt2.muCoeffs_,
175  Y1*pt1.kappaCoeffs_ + Y2*pt2.kappaCoeffs_
176  );
177  }
178 }
179 
180 
181 template<class Thermo, int PolySize>
182 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
183 (
184  const scalar s,
185  const polynomialTransport<Thermo, PolySize>& pt
186 )
187 {
188  return polynomialTransport<Thermo, PolySize>
189  (
190  s*static_cast<const Thermo&>(pt),
191  pt.muCoeffs_,
192  pt.kappaCoeffs_
193  );
194 }
195 
196 
197 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Definition: gmvOutputSpray.H:25
specie.H
Foam::polynomialTransport::New
static autoPtr< polynomialTransport > New(const dictionary &dict)
Definition: polynomialTransportI.H:69
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Foam::polynomialTransport::kappa
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
Definition: polynomialTransportI.H:90
Foam::polynomialTransport::mu
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
Definition: polynomialTransportI.H:79
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::polynomialTransport::alphah
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
Definition: polynomialTransportI.H:101
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::polynomialTransport
Transport package using polynomial functions for mu and kappa.
Definition: polynomialTransport.H:98
Cp
const volScalarField & Cp
Definition: EEqn.H:7
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::polynomialTransport::clone
autoPtr< polynomialTransport > clone() const
Construct and return a clone.
Definition: polynomialTransportI.H:61