viscosityModel.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 OpenFOAM Foundation
9  Copyright (C) 2019 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 Namespace
28  Foam::viscosityModels
29 
30 Description
31  A namespace for various incompressible viscosityModel implementations.
32 
33 Class
34  Foam::viscosityModel
35 
36 Description
37  An abstract base class for incompressible viscosityModels.
38 
39  The strain rate is defined by:
40 
41  mag(symm(grad(U)))
42 
43 
44 SourceFiles
45  viscosityModel.C
46  viscosityModelNew.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef viscosityModel_H
51 #define viscosityModel_H
52 
53 #include "dictionary.H"
54 #include "volFieldsFwd.H"
55 #include "surfaceFieldsFwd.H"
56 #include "dimensionedScalar.H"
57 #include "runTimeSelectionTables.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class viscosityModel Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class viscosityModel
69 {
70 
71 protected:
72 
73  // Protected data
74 
77 
79  const surfaceScalarField& phi_;
80 
81 
82  // Private Member Functions
83 
84  //- No copy construct
85  viscosityModel(const viscosityModel&) = delete;
86 
87  //- No copy assignment
88  void operator=(const viscosityModel&) = delete;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("viscosityModel");
95 
96 
97  // Declare run-time constructor selection table
98 
100  (
101  autoPtr,
103  dictionary,
104  (
105  const word& name,
107  const volVectorField& U,
108  const surfaceScalarField& phi
109  ),
111  );
112 
113 
114  // Selectors
115 
116  //- Return a reference to the selected viscosity model
118  (
119  const word& name,
121  const volVectorField& U,
122  const surfaceScalarField& phi
123  );
124 
125 
126  // Constructors
127 
128  //- Construct from components
130  (
131  const word& name,
133  const volVectorField& U,
134  const surfaceScalarField& phi
135  );
136 
137 
138  //- Destructor
139  virtual ~viscosityModel() = default;
140 
141 
142  // Member Functions
143 
144  //- Return the phase transport properties dictionary
145  const dictionary& viscosityProperties() const
146  {
147  return viscosityProperties_;
148  }
149 
150  //- Return the strain rate
152 
153  //- Return the laminar viscosity
154  virtual tmp<volScalarField> nu() const = 0;
155 
156  //- Return the laminar viscosity for patch
157  virtual tmp<scalarField> nu(const label patchi) const = 0;
158 
159  //- Correct the laminar viscosity
160  virtual void correct() = 0;
161 
162  //- Read transportProperties dictionary
163  virtual bool read(const dictionary& viscosityProperties) = 0;
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
volFieldsFwd.H
Foam::viscosityModel
An abstract base class for incompressible viscosityModels.
Definition: viscosityModel.H:67
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::viscosityModel::viscosityProperties
const dictionary & viscosityProperties() const
Return the phase transport properties dictionary.
Definition: viscosityModel.H:144
Foam::viscosityModel::nu
virtual tmp< volScalarField > nu() const =0
Return the laminar viscosity.
Foam::viscosityModel::read
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
Definition: viscosityModel.C:66
Foam::viscosityModel::viscosityModel
viscosityModel(const viscosityModel &)=delete
No copy construct.
Foam::viscosityModel::name_
word name_
Definition: viscosityModel.H:74
Foam::viscosityModel::U_
const volVectorField & U_
Definition: viscosityModel.H:77
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::viscosityModel::~viscosityModel
virtual ~viscosityModel()=default
Destructor.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
dimensionedScalar.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::viscosityModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, viscosityModel, dictionary,(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi),(name, viscosityProperties, U, phi))
Foam::viscosityModel::correct
virtual void correct()=0
Correct the laminar viscosity.
Foam::viscosityModel::TypeName
TypeName("viscosityModel")
Runtime type information.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::viscosityModel::viscosityProperties_
dictionary viscosityProperties_
Definition: viscosityModel.H:75
dictionary.H
surfaceFieldsFwd.H
Foam::viscosityModel::operator=
void operator=(const viscosityModel &)=delete
No copy assignment.
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::viscosityModel::phi_
const surfaceScalarField & phi_
Definition: viscosityModel.H:78
Foam::viscosityModel::New
static autoPtr< viscosityModel > New(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Return a reference to the selected viscosity model.
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::viscosityModel::strainRate
tmp< volScalarField > strainRate() const
Return the strain rate.
Definition: viscosityModel.C:60