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