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