sutherlandTransport.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-2018 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::sutherlandTransport
26 
27 Description
28  Transport package using Sutherland's formula.
29 
30  Templated into a given thermodynamics package (needed for thermal
31  conductivity).
32 
33  Dynamic viscosity [kg/m.s]
34  \f[
35  \mu = A_s \frac{\sqrt{T}}{1 + T_s / T}
36  \f]
37 
38 SourceFiles
39  sutherlandTransportI.H
40  sutherlandTransport.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef sutherlandTransport_H
45 #define sutherlandTransport_H
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of friend functions and operators
53 
54 template<class Thermo> class sutherlandTransport;
55 
56 template<class Thermo>
57 inline sutherlandTransport<Thermo> operator+
58 (
60  const sutherlandTransport<Thermo>&
61 );
62 
63 template<class Thermo>
64 inline sutherlandTransport<Thermo> operator*
65 (
66  const scalar,
67  const sutherlandTransport<Thermo>&
68 );
69 
70 template<class Thermo>
71 Ostream& operator<<
72 (
73  Ostream&,
74  const sutherlandTransport<Thermo>&
75 );
76 
77 
78 /*---------------------------------------------------------------------------*\
79  Class sutherlandTransport Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 template<class Thermo>
84 :
85  public Thermo
86 {
87  // Private data
88 
89  // Sutherland's coefficients
90  scalar As_, Ts_;
91 
92 
93  // Private Member Functions
94 
95  //- Calculate the Sutherland coefficients
96  // given two viscosities and temperatures
97  inline void calcCoeffs
98  (
99  const scalar mu1, const scalar T1,
100  const scalar mu2, const scalar T2
101  );
102 
103  //- Read coefficient from dictionary
104  scalar readCoeff(const word& coeffName, const dictionary& dict);
105 
106 
107 public:
108 
109  // Constructors
110 
111  //- Construct from components
112  inline sutherlandTransport
113  (
114  const Thermo& t,
115  const scalar As,
116  const scalar Ts
117  );
118 
119  //- Construct from two viscosities
120  inline sutherlandTransport
121  (
122  const Thermo& t,
123  const scalar mu1, const scalar T1,
124  const scalar mu2, const scalar T2
125  );
126 
127  //- Construct as named copy
128  inline sutherlandTransport(const word&, const sutherlandTransport&);
129 
130  //- Construct from dictionary
132 
133  //- Construct from base thermo and dictionary
134  sutherlandTransport(const Thermo& t,const dictionary& dict);
135 
136  //- Construct and return a clone
137  inline autoPtr<sutherlandTransport> clone() const;
138 
139  // Selector from dictionary
140  inline static autoPtr<sutherlandTransport> New(const dictionary& dict);
141 
142 
143  // Member functions
144 
145  //- Return the instantiated type name
146  static word typeName()
147  {
148  return "sutherland<" + Thermo::typeName() + '>';
149  }
150 
151  //- Dynamic viscosity [kg/ms]
152  inline scalar mu(const scalar p, const scalar T) const;
153 
154  //- Thermal conductivity [W/mK]
155  inline scalar kappa(const scalar p, const scalar T) const;
156 
157  //- Thermal diffusivity of enthalpy [kg/ms]
158  inline scalar alphah(const scalar p, const scalar T) const;
159 
160  // Species diffusivity
161  // inline scalar D(const scalar p, const scalar T) const;
162 
163  //- Write to Ostream
164  void write(Ostream& os) const;
165 
166 
167  // Member operators
168 
169  inline void operator=(const sutherlandTransport&);
170 
171  inline void operator+=(const sutherlandTransport&);
172 
173  inline void operator*=(const scalar);
174 
175 
176  // Friend operators
177 
178  friend sutherlandTransport operator+ <Thermo>
179  (
180  const sutherlandTransport&,
181  const sutherlandTransport&
182  );
183 
184  friend sutherlandTransport operator* <Thermo>
185  (
186  const scalar,
187  const sutherlandTransport&
188  );
189 
190 
191  // Ostream Operator
192 
193  friend Ostream& operator<< <Thermo>
194  (
195  Ostream&,
196  const sutherlandTransport&
197  );
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #include "sutherlandTransportI.H"
208 
209 #ifdef NoRepository
210  #include "sutherlandTransport.C"
211 #endif
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
void operator+=(const sutherlandTransport &)
static word typeName()
Return the instantiated type name.
A class for handling words, derived from string.
Definition: word.H:59
sutherlandTransport(const Thermo &t, const scalar As, const scalar Ts)
Construct from components.
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
autoPtr< sutherlandTransport > clone() const
Construct and return a clone.
static autoPtr< sutherlandTransport > New(const dictionary &dict)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void operator=(const sutherlandTransport &)
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
void write(Ostream &os) const
Write to Ostream.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Transport package using Sutherland&#39;s formula.
volScalarField & p
Namespace for OpenFOAM.