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