logPolynomialTransport.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) 2016-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::logPolynomialTransport
29 
30 Group
31  grpSpecieTransport
32 
33 Description
34  Transport package using polynomial functions of \c ln(T) for \c mu and
35  \c kappa:
36 
37  \f[
38  ln(mu) = \sum_{i=1}^N \left( a[i] * ln(T)^{i-1} \right)
39  \f]
40 
41  \f[
42  ln(kappa) = \sum_{i=1}^N \left( b[i] * ln(T)^{i-1} \right)
43  \f]
44 
45 Usage
46 
47  \table
48  Property | Description
49  muCoeffs<8> | Dynamic viscosity polynomial coefficients
50  kappaCoeffs<8> | Thermal conductivity polynomial coefficients
51  \endtable
52 
53  Example of the specification of the transport properties:
54  \verbatim
55  transport
56  {
57  muCoeffs<8> ( 1000 -0.05 0.003 0 0 0 0 0 );
58  kappaCoeffs<8> ( 2000 -0.15 0.023 0 0 0 0 0 );
59  }
60  \endverbatim
61 
62  The polynomial expressions are evaluated as so:
63 
64  \f[
65  \mu = 1000 - 0.05 ln(T) + 0.003 ln(T)^2
66  \f]
67 
68  \f[
69  \kappa = 2000 - 0.15 ln(T) + 0.023 ln(T)^2
70  \f]
71 
72 Note
73  - Dynamic viscosity polynomial coefficients evaluate to an expression in
74  [Pa.s], but internally uses [Pa.s/kmol].
75  - Thermal conductivity polynomial coefficients evaluate to an expression in
76  [W/m/K], but internally uses [W/m/K/kmol].
77 
78 SourceFiles
79  logPolynomialTransportI.H
80  logPolynomialTransport.C
81 
82 See also
83  Foam::Polynomial
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef logPolynomialTransport_H
88 #define logPolynomialTransport_H
89 
90 #include "Polynomial.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 
97 // Forward Declarations
98 
99 template<class Thermo, int PolySize> class logPolynomialTransport;
100 
101 template<class Thermo, int PolySize>
102 inline logPolynomialTransport<Thermo, PolySize> operator+
103 (
104  const logPolynomialTransport<Thermo, PolySize>&,
105  const logPolynomialTransport<Thermo, PolySize>&
106 );
107 
108 template<class Thermo, int PolySize>
110 (
111  const scalar,
113 );
114 
115 template<class Thermo, int PolySize>
116 Ostream& operator<<
117 (
118  Ostream&,
120 );
121 
122 
123 /*---------------------------------------------------------------------------*\
124  Class logPolynomialTransport Declaration
125 \*---------------------------------------------------------------------------*/
126 
127 template<class Thermo, int PolySize=8>
129 :
130  public Thermo
131 {
132  // Private Data
133 
134  //- Dynamic viscosity polynomial coefficients
135  // Note: input in [Pa.s], but internally uses [Pa.s/kmol]
136  Polynomial<PolySize> muCoeffs_;
137 
138  //- Thermal conductivity polynomial coefficients
139  // Note: input in [W/m/K], but internally uses [W/m/K/kmol]
140  Polynomial<PolySize> kappaCoeffs_;
141 
142 
143  // Private Member Functions
144 
145  //- Coeffs name. Eg, "muLogCoeffs<10>"
146  inline static word coeffsName(const char* name)
147  {
148  return word(name + ("LogCoeffs<" + std::to_string(PolySize) + '>'));
149  }
150 
151  //- Construct from components
153  (
154  const Thermo& t,
155  const Polynomial<PolySize>& muPoly,
156  const Polynomial<PolySize>& kappaPoly
157  );
158 
159 
160 public:
161 
162  // Generated Methods: copy construct, copy assignment
163 
164 
165  // Constructors
166 
167  //- Construct as named copy
169  (
170  const word&,
172  );
173 
174  //- Construct from dictionary
175  explicit logPolynomialTransport(const dictionary& dict);
176 
177  //- Construct and return a clone
178  inline autoPtr<logPolynomialTransport> clone() const;
179 
180  // Selector from dictionary
182  (
183  const dictionary& dict
184  );
185 
186 
187  // Member Functions
188 
189  //- Return the instantiated type name
190  static word typeName()
191  {
192  return "logPolynomial<" + Thermo::typeName() + '>';
193  }
194 
195  //- Dynamic viscosity [kg/ms]
196  inline scalar mu(const scalar p, const scalar T) const;
197 
198  //- Thermal conductivity [W/mK]
199  inline scalar kappa(const scalar p, const scalar T) const;
200 
201  //- Thermal diffusivity of enthalpy [kg/ms]
202  inline scalar alphah(const scalar p, const scalar T) const;
203 
204  // Species diffusivity
205  //inline scalar D(const scalar p, const scalar T) const;
206 
207  //- Write to Ostream
208  void write(Ostream& os) const;
209 
210 
211  // Member Operators
212 
213  inline void operator+=(const logPolynomialTransport&);
214 
215  inline void operator*=(const scalar);
216 
217 
218  // Friend Operators
219 
220  friend logPolynomialTransport operator+ <Thermo, PolySize>
221  (
222  const logPolynomialTransport&,
224  );
225 
226  friend logPolynomialTransport operator* <Thermo, PolySize>
227  (
228  const scalar,
230  );
231 
232 
233  // IOstream Operators
234 
235  friend Ostream& operator<< <Thermo, PolySize>
236  (
237  Ostream&,
239  );
240 };
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #include "logPolynomialTransportI.H"
250 
251 #ifdef NoRepository
252  #include "logPolynomialTransport.C"
253 #endif
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #endif
258 
259 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::logPolynomialTransport::alphah
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
Definition: logPolynomialTransportI.H:101
Foam::logPolynomialTransport::operator+=
void operator+=(const logPolynomialTransport &)
Definition: logPolynomialTransportI.H:113
logPolynomialTransportI.H
logPolynomialTransport.C
Foam::logPolynomialTransport::operator*=
void operator*=(const scalar)
Definition: logPolynomialTransportI.H:134
Foam::logPolynomialTransport::write
void write(Ostream &os) const
Write to Ostream.
Definition: logPolynomialTransport.C:48
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::logPolynomialTransport::clone
autoPtr< logPolynomialTransport > clone() const
Construct and return a clone.
Definition: logPolynomialTransportI.H:61
Polynomial.H
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
os
OBJstream os(runTime.globalPath()/outputName)
Foam::logPolynomialTransport::mu
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
Definition: logPolynomialTransportI.H:79
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::logPolynomialTransport::typeName
static word typeName()
Return the instantiated type name.
Definition: logPolynomialTransport.H:198
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Polynomial
Polynomial templated on size (order):
Definition: Polynomial.H:68
Foam::logPolynomialTransport
Transport package using polynomial functions of ln(T) for mu and kappa:
Definition: logPolynomialTransport.H:107
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::logPolynomialTransport::kappa
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
Definition: logPolynomialTransportI.H:90
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::logPolynomialTransport::New
static autoPtr< logPolynomialTransport > New(const dictionary &dict)
Definition: logPolynomialTransportI.H:69