polynomialTransport.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::polynomialTransport
29 
30 Group
31  grpSpecieTransport
32 
33 Description
34  Transport package using polynomial functions for \c mu and \c kappa.
35 
36 Usage
37 
38  \table
39  Property | Description
40  muCoeffs<8> | Dynamic viscosity polynomial coefficients
41  kappaCoeffs<8> | Thermal conductivity polynomial coefficients
42  \endtable
43 
44  Example of the specification of the transport properties:
45  \verbatim
46  transport
47  {
48  muCoeffs<8> ( 1000 -0.05 0.003 0 0 0 0 0 );
49  kappaCoeffs<8> ( 2000 -0.15 0.023 0 0 0 0 0 );
50  }
51  \endverbatim
52 
53  The polynomial expressions are evaluated as so:
54 
55  \f[
56  \mu = 1000 - 0.05 T + 0.003 T^2
57  \f]
58 
59  \f[
60  \kappa = 2000 - 0.15 T + 0.023 T^2
61  \f]
62 
63 Note
64  - Dynamic viscosity polynomial coefficients evaluate to an expression in
65  [Pa.s], but internally uses [Pa.s/kmol].
66  - Thermal conductivity polynomial coefficients evaluate to an expression in
67  [W/m/K], but internally uses [W/m/K/kmol].
68 
69 SourceFiles
70  polynomialTransportI.H
71  polynomialTransport.C
72 
73 See also
74  Foam::Polynomial
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef polynomialTransport_H
79 #define polynomialTransport_H
80 
81 #include "Polynomial.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 // Forward Declarations
89 
90 template<class Thermo, int PolySize> class polynomialTransport;
91 
92 template<class Thermo, int PolySize>
93 inline polynomialTransport<Thermo, PolySize> operator+
94 (
95  const polynomialTransport<Thermo, PolySize>&,
96  const polynomialTransport<Thermo, PolySize>&
97 );
98 
99 template<class Thermo, int PolySize>
101 (
102  const scalar,
104 );
105 
106 template<class Thermo, int PolySize>
107 Ostream& operator<<
108 (
109  Ostream&,
111 );
112 
113 
114 /*---------------------------------------------------------------------------*\
115  Class polynomialTransport Declaration
116 \*---------------------------------------------------------------------------*/
117 
118 template<class Thermo, int PolySize=8>
120 :
121  public Thermo
122 {
123  // Private Data
124 
125  //- Dynamic viscosity polynomial coefficients
126  Polynomial<PolySize> muCoeffs_;
127 
128  //- Thermal conductivity polynomial coefficients
129  Polynomial<PolySize> kappaCoeffs_;
130 
131 
132  // Private Member Functions
133 
134  //- Coeffs name. Eg, "muCoeffs<10>"
135  inline static word coeffsName(const char* name)
136  {
137  return word(name + ("Coeffs<" + std::to_string(PolySize) + '>'));
138  }
139 
140  //- Construct from components
141  inline polynomialTransport
142  (
143  const Thermo& t,
144  const Polynomial<PolySize>& muPoly,
145  const Polynomial<PolySize>& kappaPoly
146  );
147 
148 
149 public:
150 
151  // Generated Methods: copy construct, copy assignment
152 
153 
154  // Constructors
155 
156  //- Construct as named copy
157  inline polynomialTransport(const word&, const polynomialTransport&);
158 
159  //- Construct from dictionary
160  explicit polynomialTransport(const dictionary& dict);
161 
162  //- Construct and return a clone
163  inline autoPtr<polynomialTransport> clone() const;
164 
165  // Selector from dictionary
166  inline static autoPtr<polynomialTransport> New(const dictionary& dict);
167 
168 
169  // Member Functions
170 
171  //- Return the instantiated type name
172  static word typeName()
173  {
174  return "polynomial<" + Thermo::typeName() + '>';
175  }
176 
177  //- Dynamic viscosity [kg/ms]
178  inline scalar mu(const scalar p, const scalar T) const;
179 
180  //- Thermal conductivity [W/mK]
181  inline scalar kappa(const scalar p, const scalar T) const;
182 
183  //- Thermal diffusivity of enthalpy [kg/ms]
184  inline scalar alphah(const scalar p, const scalar T) const;
185 
186  // Species diffusivity
187  //inline scalar D(const scalar p, const scalar T) const;
188 
189  //- Write to Ostream
190  void write(Ostream& os) const;
191 
192 
193  // Member Operators
194 
195  inline void operator+=(const polynomialTransport&);
196 
197  inline void operator*=(const scalar);
198 
199 
200  // Friend Operators
201 
202  friend polynomialTransport operator+ <Thermo, PolySize>
203  (
204  const polynomialTransport&,
205  const polynomialTransport&
206  );
207 
208  friend polynomialTransport operator* <Thermo, PolySize>
209  (
210  const scalar,
211  const polynomialTransport&
212  );
213 
214 
215  // IOstream Operators
216 
217  friend Ostream& operator<< <Thermo, PolySize>
218  (
219  Ostream&,
220  const polynomialTransport&
221  );
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #include "polynomialTransportI.H"
232 
233 #ifdef NoRepository
234  #include "polynomialTransport.C"
235 #endif
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
polynomialTransport.C
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polynomialTransport::write
void write(Ostream &os) const
Write to Ostream.
Definition: polynomialTransport.C:48
Foam::polynomialTransport::typeName
static word typeName()
Return the instantiated type name.
Definition: polynomialTransport.H:180
Foam::polynomialTransport::operator*=
void operator*=(const scalar)
Definition: polynomialTransportI.H:134
Foam::polynomialTransport::New
static autoPtr< polynomialTransport > New(const dictionary &dict)
Definition: polynomialTransportI.H:69
polynomialTransportI.H
Foam::polynomialTransport::kappa
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
Definition: polynomialTransportI.H:90
Foam::polynomialTransport::mu
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
Definition: polynomialTransportI.H:79
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Polynomial.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::polynomialTransport::operator+=
void operator+=(const polynomialTransport &)
Definition: polynomialTransportI.H:113
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::polynomialTransport::alphah
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
Definition: polynomialTransportI.H:101
Foam::Polynomial
Polynomial templated on size (order):
Definition: Polynomial.H:68
Foam::polynomialTransport
Transport package using polynomial functions for mu and kappa.
Definition: polynomialTransport.H:98
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::polynomialTransport::clone
autoPtr< polynomialTransport > clone() const
Construct and return a clone.
Definition: polynomialTransportI.H:61