constTransport.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::constTransport
26 
27 Description
28  Transport package with constant properties
29 
30 Usage
31  \table
32  Property | Description
33  mu | Constant dynamic viscosity [Pa.s]
34  Pr | Constant Prandtl number []
35  \endtable
36 
37  Example specification of constTransport for air:
38  \verbatim
39  transport
40  {
41  mu 1.82e-05;
42  Pr 0.71;
43  }
44  \endverbatim
45 
46 SourceFiles
47  constTransportI.H
48  constTransport.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef constTransport_H
53 #define constTransport_H
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 // Forward declaration of friend functions and operators
61 
62 template<class Thermo> class constTransport;
63 
64 template<class Thermo>
65 inline constTransport<Thermo> operator+
66 (
67  const constTransport<Thermo>&,
68  const constTransport<Thermo>&
69 );
70 
71 template<class Thermo>
72 inline constTransport<Thermo> operator*
73 (
74  const scalar,
75  const constTransport<Thermo>&
76 );
77 
78 template<class Thermo>
79 Ostream& operator<<
80 (
81  Ostream&,
82  const constTransport<Thermo>&
83 );
84 
85 
86 /*---------------------------------------------------------------------------*\
87  Class constTransport Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 template<class Thermo>
91 class constTransport
92 :
93  public Thermo
94 {
95  // Private Data
96 
97  //- Constant dynamic viscosity [Pa.s]
98  scalar mu_;
99 
100  //- Is the Prandtl Number constant?
101  bool constPr_;
102 
103  //- Reciprocal constant Prandtl Number []
104  scalar rPr_;
105 
106  //- Constant thermal conductivity [W/m/K]
107  scalar kappa_;
108 
109 
110  // Private Member Functions
111 
112  //- Construct from components
113  inline constTransport
114  (
115  const Thermo& t,
116  const scalar mu,
117  const bool constPr,
118  const scalar rPr,
119  const scalar kappa
120  );
121 
122 
123 public:
124 
125  // Constructors
126 
127  //- Construct as named copy
128  inline constTransport(const word&, const constTransport&);
129 
130  //- Construct from dictionary
132 
133  //- Construct and return a clone
134  inline autoPtr<constTransport> clone() const;
135 
136  // Selector from dictionary
137  inline static autoPtr<constTransport> New(const dictionary& dict);
138 
139 
140  // Member Functions
141 
142  //- Return the instantiated type name
143  static word typeName()
144  {
145  return "const<" + Thermo::typeName() + '>';
146  }
147 
148  //- Dynamic viscosity [kg/m/s]
149  inline scalar mu(const scalar p, const scalar T) const;
150 
151  //- Thermal conductivity [W/m/K]
152  inline scalar kappa(const scalar p, const scalar T) const;
153 
154  //- Write to Ostream
155  void write(Ostream& os) const;
156 
157 
158  // Member Operators
159 
160  inline void operator+=(const constTransport&);
161  inline void operator*=(const scalar);
162 
163 
164  // Friend operators
165 
166  friend constTransport operator+ <Thermo>
167  (
168  const constTransport&,
169  const constTransport&
170  );
171 
172  friend constTransport operator* <Thermo>
173  (
174  const scalar,
175  const constTransport&
176  );
177 
178 
179  // Ostream Operator
180 
181  friend Ostream& operator<< <Thermo>
182  (
183  Ostream&,
184  const constTransport&
185  );
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #include "constTransportI.H"
196 
197 #ifdef NoRepository
198  #include "constTransport.C"
199 #endif
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
dictionary dict
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Transport package with constant properties.
static word typeName()
Return the instantiated type name.
void write(Ostream &os) const
Write to Ostream.
A class for handling words, derived from string.
Definition: word.H:59
autoPtr< constTransport > clone() const
Construct and return a clone.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void operator*=(const scalar)
void operator+=(const constTransport &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
static autoPtr< constTransport > New(const dictionary &dict)
volScalarField & p
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
Namespace for OpenFOAM.