logPolynomialTransport.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-2021 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 Class
25  Foam::logPolynomialTransport
26 
27 Description
28  Transport package using polynomial functions of \c ln(T) for \c mu and
29  \c kappa:
30 
31  \f[
32  ln(mu) = \sum_{i=1}^N \left( a[i] * ln(T)^{i-1} \right)
33  \f]
34 
35  \f[
36  ln(kappa) = \sum_{i=1}^N \left( b[i] * ln(T)^{i-1} \right)
37  \f]
38 
39 Usage
40 
41  \table
42  Property | Description
43  muCoeffs<8> | Dynamic viscosity polynomial coefficients
44  kappaCoeffs<8> | Thermal conductivity polynomial coefficients
45  \endtable
46 
47  Example of the specification of the transport properties:
48  \verbatim
49  transport
50  {
51  muCoeffs<8> ( 1000 -0.05 0.003 0 0 0 0 0 );
52  kappaCoeffs<8> ( 2000 -0.15 0.023 0 0 0 0 0 );
53  }
54  \endverbatim
55 
56  The polynomial expressions are evaluated as so:
57 
58  \f[
59  \mu = 1000 - 0.05 ln(T) + 0.003 ln(T)^2
60  \f]
61 
62  \f[
63  \kappa = 2000 - 0.15 ln(T) + 0.023 ln(T)^2
64  \f]
65 
66 SourceFiles
67  logPolynomialTransportI.H
68  logPolynomialTransport.C
69 
70 See also
71  Foam::Polynomial
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef logPolynomialTransport_H
76 #define logPolynomialTransport_H
77 
78 #include "Polynomial.H"
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 // Forward declaration of friend functions and operators
86 
87 template<class Thermo, int PolySize> class logPolynomialTransport;
88 
89 template<class Thermo, int PolySize>
90 inline logPolynomialTransport<Thermo, PolySize> operator+
91 (
92  const logPolynomialTransport<Thermo, PolySize>&,
93  const logPolynomialTransport<Thermo, PolySize>&
94 );
95 
96 template<class Thermo, int PolySize>
97 inline logPolynomialTransport<Thermo, PolySize> operator*
98 (
99  const scalar,
100  const logPolynomialTransport<Thermo, PolySize>&
101 );
102 
103 template<class Thermo, int PolySize>
104 Ostream& operator<<
105 (
106  Ostream&,
107  const logPolynomialTransport<Thermo, PolySize>&
108 );
109 
110 
111 /*---------------------------------------------------------------------------*\
112  Class logPolynomialTransport Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 template<class Thermo, int PolySize=8>
117 :
118  public Thermo
119 {
120  // Private Data
121 
122  //- Dynamic viscosity polynomial coefficients [Pa.s/K^i]
123  Polynomial<PolySize> muCoeffs_;
124 
125  //- Thermal conductivity polynomial coefficients [W/m/K/K^i]
126  Polynomial<PolySize> kappaCoeffs_;
127 
128 
129  // Private Member Functions
130 
131  //- Construct from components
133  (
134  const Thermo& t,
135  const Polynomial<PolySize>& muPoly,
136  const Polynomial<PolySize>& kappaPoly
137  );
138 
139 
140 public:
141 
142  // Constructors
143 
144  //- Construct as named copy
146  (
147  const word&,
149  );
150 
151  //- Construct from dictionary
153 
154  //- Construct and return a clone
155  inline autoPtr<logPolynomialTransport> clone() const;
156 
157  // Selector from dictionary
159  (
160  const dictionary& dict
161  );
162 
163 
164  // Member Functions
165 
166  //- Return the instantiated type name
167  static word typeName()
168  {
169  return "logPolynomial<" + Thermo::typeName() + '>';
170  }
171 
172  //- Dynamic viscosity [kg/m/s]
173  inline scalar mu(const scalar p, const scalar T) const;
174 
175  //- Thermal conductivity [W/m/K]
176  inline scalar kappa(const scalar p, const scalar T) const;
177 
178  //- Write to Ostream
179  void write(Ostream& os) const;
180 
181 
182  // Member Operators
183 
184  inline void operator+=(const logPolynomialTransport&);
185  inline void operator*=(const scalar);
186 
187 
188  // Friend operators
189 
190  friend logPolynomialTransport operator+ <Thermo, PolySize>
191  (
192  const logPolynomialTransport&,
193  const logPolynomialTransport&
194  );
195 
196  friend logPolynomialTransport operator* <Thermo, PolySize>
197  (
198  const scalar,
199  const logPolynomialTransport&
200  );
201 
202 
203  // Ostream Operator
204 
205  friend Ostream& operator<< <Thermo, PolySize>
206  (
207  Ostream&,
208  const logPolynomialTransport&
209  );
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #include "logPolynomialTransportI.H"
220 
221 #ifdef NoRepository
222  #include "logPolynomialTransport.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
autoPtr< logPolynomialTransport > clone() const
Construct and return a clone.
static autoPtr< logPolynomialTransport > New(const dictionary &dict)
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
void operator+=(const logPolynomialTransport &)
A class for handling words, derived from string.
Definition: word.H:59
static word typeName()
Return the instantiated type name.
void write(Ostream &os) const
Write to Ostream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
Polynomial templated on size (order):
Definition: Polynomial.H:65
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:
volScalarField & p
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
Namespace for OpenFOAM.