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-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::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,
76 );
77 
78 template<class Thermo>
79 Ostream& operator<<
80 (
81  Ostream&,
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 public:
111 
112  // Constructors
113 
114  //- Construct from components
115  inline constTransport
116  (
117  const Thermo& t,
118  const scalar mu,
119  const bool constPr,
120  const scalar rPr,
121  const scalar kappa
122  );
123 
124  //- Construct as named copy
125  inline constTransport(const word&, const constTransport&);
126 
127  //- Construct from name and dictionary
128  constTransport(const word& name, const dictionary& dict);
129 
130  //- Construct and return a clone
131  inline autoPtr<constTransport> clone() const;
132 
133 
134  // Member Functions
135 
136  //- Return the instantiated type name
137  static word typeName()
138  {
139  return "const<" + Thermo::typeName() + '>';
140  }
141 
142  //- Dynamic viscosity [kg/m/s]
143  inline scalar mu(const scalar p, const scalar T) const;
144 
145  //- Thermal conductivity [W/m/K]
146  inline scalar kappa(const scalar p, const scalar T) const;
147 
148  //- Write to Ostream
149  void write(Ostream& os) const;
150 
151 
152  // Member Operators
153 
154  inline void operator+=(const constTransport&);
155  inline void operator*=(const scalar);
156 
157 
158  // Friend operators
159 
160  friend constTransport operator+ <Thermo>
161  (
162  const constTransport&,
163  const constTransport&
164  );
165 
166  friend constTransport operator* <Thermo>
167  (
168  const scalar,
169  const constTransport&
170  );
171 
172 
173  // Ostream Operator
174 
175  friend Ostream& operator<< <Thermo>
176  (
177  Ostream&,
178  const constTransport&
179  );
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #include "constTransportI.H"
190 
191 #ifdef NoRepository
192  #include "constTransport.C"
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Transport package with constant properties.
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/m/s].
void operator+=(const constTransport &)
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/m/K].
static word typeName()
Return the instantiated type name.
autoPtr< constTransport > clone() const
Construct and return a clone.
void write(Ostream &os) const
Write to Ostream.
constTransport(const Thermo &t, const scalar mu, const bool constPr, const scalar rPr, const scalar kappa)
Construct from components.
void operator*=(const scalar)
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
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