limitTurbulenceViscosity.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) 2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fv::limitTurbulenceViscosity
28 
29 Group
30  grpFvOptionsCorrections
31 
32 Description
33  Corrects turbulence viscosity field (e.g. \c nut) within a specified
34  region by applying a maximum limit, set according to a coefficient
35  multiplied by the laminar viscosity:
36 
37  \f[
38  \nu_{t,max} = c \nu
39  \f]
40 
41  Corrections applied to:
42  \verbatim
43  nut | Turbulence vicosity [m2/s2]
44  \endverbatim
45 
46 Usage
47  Minimal example by using \c constant/fvOptions:
48  \verbatim
49  limitTurbulenceViscosity1
50  {
51  // Mandatory entries (unmodifiable)
52  type limitTurbulenceViscosity;
53 
54  // Optional entries (runtime modifiable)
55  nut nut;
56  c 1e5;
57 
58  // Mandatory/Optional (inherited) entries
59  ...
60  }
61  \endverbatim
62 
63  where the entries mean:
64  \table
65  Property | Description | Type | Reqd | Dflt
66  type | Type name: limitTurbulenceViscosity | word | yes | -
67  nut | Name of nut field | word | no | nut
68  c | Limiting coefficient | scalar | yes | 1e5
69  \endtable
70 
71  The inherited entries are elaborated in:
72  - \link fvOption.H \endlink
73  - \link cellSetOption.H \endlink
74  - \link writeFile.H \endlink
75 
76 SourceFiles
77  limitTurbulenceViscosity.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef fv_limitTurbulenceViscosity_H
82 #define fv_limitTurbulenceViscosity_H
83 
84 #include "cellSetOption.H"
85 #include "writeFile.H"
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 namespace fv
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class limitTurbulenceViscosity Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class limitTurbulenceViscosity
99 :
100  public fv::cellSetOption,
101  public functionObjects::writeFile
102 {
103 protected:
104 
105  // Protected Data
106 
107  //- Name of turbulence viscosity field
108  word nutName_;
109 
110  //- Limiting coefficient []
111  scalar c_;
112 
113 
114  // Protected Member Functions
115 
116  //- Write file header information
118 
119  //- Return laminar viscosity
120  tmp<volScalarField> nu() const;
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("limitTurbulenceViscosity");
127 
128 
129  // Constructors
130 
131  //- Construct from components
133  (
134  const word& name,
135  const word& modelType,
136  const dictionary& dict,
137  const fvMesh& mesh
138  );
139 
140  //- No copy construct
142 
143  //- No copy assignment
144  void operator=(const limitTurbulenceViscosity&) = delete;
145 
146 
147  //- Destructor
148  virtual ~limitTurbulenceViscosity() = default;
149 
150 
151  // Member Functions
152 
153  //- Read dictionary
154  virtual bool read(const dictionary& dict);
155 
156  //- Correct the energy field
157  virtual void correct(volScalarField& nut);
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace fv
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
dictionary dict
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:30
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A class for handling words, derived from Foam::string.
Definition: word.H:63
labelList fv(nPoints)
void writeFileHeader(Ostream &os)
Write file header information.
limitTurbulenceViscosity(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
TypeName("limitTurbulenceViscosity")
Runtime type information.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:24
void operator=(const limitTurbulenceViscosity &)=delete
No copy assignment.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
scalar c_
Limiting coefficient [].
tmp< volScalarField > nu() const
Return laminar viscosity.
virtual ~limitTurbulenceViscosity()=default
Destructor.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Corrects turbulence viscosity field (e.g. nut) within a specified region by applying a maximum limit...
word nutName_
Name of turbulence viscosity field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void correct(volScalarField &nut)
Correct the energy field.
scalar nut
Namespace for OpenFOAM.