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-2023 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,
98 );
99 
100 template<class Thermo, int PolySize>
101 Ostream& operator<<
102 (
103  Ostream&,
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 public:
127 
128  // Constructors
129 
130  //- Construct from components
132  (
133  const Thermo& t,
134  const Polynomial<PolySize>& muPoly,
135  const Polynomial<PolySize>& kappaPoly
136  );
137 
138  //- Construct as named copy
140  (
141  const word&,
143  );
144 
145  //- Construct from name and dictionary
147 
148  //- Construct and return a clone
149  inline autoPtr<logPolynomialTransport> clone() const;
150 
151 
152  // Member Functions
153 
154  //- Return the instantiated type name
155  static word typeName()
156  {
157  return "logPolynomial<" + Thermo::typeName() + '>';
158  }
159 
160  //- Dynamic viscosity [kg/m/s]
161  inline scalar mu(const scalar p, const scalar T) const;
162 
163  //- Thermal conductivity [W/m/K]
164  inline scalar kappa(const scalar p, const scalar T) const;
165 
166  //- Write to Ostream
167  void write(Ostream& os) const;
168 
169 
170  // Member Operators
171 
172  inline void operator+=(const logPolynomialTransport&);
173  inline void operator*=(const scalar);
174 
175 
176  // Friend operators
177 
178  friend logPolynomialTransport operator+ <Thermo, PolySize>
179  (
180  const logPolynomialTransport&,
182  );
183 
184  friend logPolynomialTransport operator* <Thermo, PolySize>
185  (
186  const scalar,
188  );
189 
190 
191  // Ostream Operator
192 
193  friend Ostream& operator<< <Thermo, PolySize>
194  (
195  Ostream&,
197  );
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #include "logPolynomialTransportI.H"
208 
209 #ifdef NoRepository
210  #include "logPolynomialTransport.C"
211 #endif
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Polynomial templated on size (order):
Definition: Polynomial.H:84
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Transport package using polynomial functions of the natural logarithm of temperature for the natural ...
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
static word typeName()
Return the instantiated type name.
void write(Ostream &os) const
Write to Ostream.
logPolynomialTransport(const Thermo &t, const Polynomial< PolySize > &muPoly, const Polynomial< PolySize > &kappaPoly)
Construct from components.
autoPtr< logPolynomialTransport > clone() const
Construct and return a clone.
void operator+=(const logPolynomialTransport &)
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p