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-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::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,
97 );
98 
99 template<class Thermo, int PolySize>
100 Ostream& operator<<
101 (
102  Ostream&,
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 public:
126 
127  // Constructors
128 
129  //- Construct from components
130  inline polynomialTransport
131  (
132  const Thermo& t,
133  const Polynomial<PolySize>& muPoly,
134  const Polynomial<PolySize>& kappaPoly
135  );
136 
137  //- Construct as named copy
138  inline polynomialTransport(const word&, const polynomialTransport&);
139 
140  //- Construct from name and dictionary
141  polynomialTransport(const word& name, const dictionary& dict);
142 
143  //- Construct and return a clone
144  inline autoPtr<polynomialTransport> clone() const;
145 
146 
147  // Member Functions
148 
149  //- Return the instantiated type name
150  static word typeName()
151  {
152  return "polynomial<" + Thermo::typeName() + '>';
153  }
154 
155  //- Dynamic viscosity [kg/m/s]
156  inline scalar mu(const scalar p, const scalar T) const;
157 
158  //- Thermal conductivity [W/m/K]
159  inline scalar kappa(const scalar p, const scalar T) const;
160 
161  //- Write to Ostream
162  void write(Ostream& os) const;
163 
164 
165  // Member Operators
166 
167  inline void operator+=(const polynomialTransport&);
168  inline void operator*=(const scalar);
169 
170 
171  // Friend operators
172 
173  friend polynomialTransport operator+ <Thermo, PolySize>
174  (
175  const polynomialTransport&,
176  const polynomialTransport&
177  );
178 
179  friend polynomialTransport operator* <Thermo, PolySize>
180  (
181  const scalar,
182  const polynomialTransport&
183  );
184 
185 
186  // Ostream Operator
187 
188  friend Ostream& operator<< <Thermo, PolySize>
189  (
190  Ostream&,
191  const polynomialTransport&
192  );
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #include "polynomialTransportI.H"
203 
204 #ifdef NoRepository
205  #include "polynomialTransport.C"
206 #endif
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
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 temperature for the dynamic viscosity and thermal con...
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
polynomialTransport(const Thermo &t, const Polynomial< PolySize > &muPoly, const Polynomial< PolySize > &kappaPoly)
Construct from components.
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.
autoPtr< polynomialTransport > clone() const
Construct and return a clone.
void operator+=(const polynomialTransport &)
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p