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 Note
58  - Dynamic viscosity polynomial coefficients evaluate to an expression in
59  [Pa.s], but internally uses [Pa.s/kmol].
60  - Thermal conductivity polynomial coefficients evaluate to an expression in
61  [W/m/K], but internally uses [W/m/K/kmol].
62 
63 SourceFiles
64  polynomialTransportI.H
65  polynomialTransport.C
66 
67 See also
68  Foam::Polynomial
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef polynomialTransport_H
73 #define polynomialTransport_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 polynomialTransport;
85 
86 template<class Thermo, int PolySize>
87 inline polynomialTransport<Thermo, PolySize> operator+
88 (
89  const polynomialTransport<Thermo, PolySize>&,
90  const polynomialTransport<Thermo, PolySize>&
91 );
92 
93 template<class Thermo, int PolySize>
94 inline polynomialTransport<Thermo, PolySize> operator*
95 (
96  const scalar,
97  const polynomialTransport<Thermo, PolySize>&
98 );
99 
100 template<class Thermo, int PolySize>
101 Ostream& operator<<
102 (
103  Ostream&,
104  const polynomialTransport<Thermo, PolySize>&
105 );
106 
107 
108 /*---------------------------------------------------------------------------*\
109  Class polynomialTransport Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 template<class Thermo, int PolySize=8>
114 :
115  public Thermo
116 {
117  // Private Data
118 
119  //- Dynamic viscosity polynomial coefficients
120  Polynomial<PolySize> muCoeffs_;
121 
122  //- Thermal conductivity polynomial coefficients
123  Polynomial<PolySize> kappaCoeffs_;
124 
125 
126  // Private Member Functions
127 
128  //- Construct from components
129  inline polynomialTransport
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
142  inline polynomialTransport(const word&, const polynomialTransport&);
143 
144  //- Construct from dictionary
146 
147  //- Construct and return a clone
148  inline autoPtr<polynomialTransport> clone() const;
149 
150  // Selector from dictionary
151  inline static autoPtr<polynomialTransport> New(const dictionary& dict);
152 
153 
154  // Member Functions
155 
156  //- Return the instantiated type name
157  static word typeName()
158  {
159  return "polynomial<" + Thermo::typeName() + '>';
160  }
161 
162  //- Dynamic viscosity [kg/m/s]
163  inline scalar mu(const scalar p, const scalar T) const;
164 
165  //- Thermal conductivity [W/m/K]
166  inline scalar kappa(const scalar p, const scalar T) const;
167 
168  //- Thermal diffusivity of enthalpy [kg/m/s]
169  inline scalar alphah(const scalar p, const scalar T) const;
170 
171  // Species diffusivity
172  // inline scalar D(const scalar p, const scalar T) const;
173 
174  //- Write to Ostream
175  void write(Ostream& os) const;
176 
177 
178  // Member Operators
179 
180  inline void operator+=(const polynomialTransport&);
181  inline void operator*=(const scalar);
182 
183 
184  // Friend operators
185 
186  friend polynomialTransport operator+ <Thermo, PolySize>
187  (
188  const polynomialTransport&,
189  const polynomialTransport&
190  );
191 
192  friend polynomialTransport operator* <Thermo, PolySize>
193  (
194  const scalar,
195  const polynomialTransport&
196  );
197 
198 
199  // Ostream Operator
200 
201  friend Ostream& operator<< <Thermo, PolySize>
202  (
203  Ostream&,
204  const polynomialTransport&
205  );
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #include "polynomialTransportI.H"
216 
217 #ifdef NoRepository
218  #include "polynomialTransport.C"
219 #endif
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
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:53
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.