limitVelocity.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) 2016-2017 OpenFOAM Foundation
9  Copyright (C) 2020-2022 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 Class
28  Foam::fv::limitVelocity
29 
30 Description
31  Corrects velocity field (i.e. \c T) within a specified
32  region by applying a given maximum velocity magnitude limit.
33 
34  Corrections applied to:
35  \verbatim
36  U | Velocity [m/s]
37  \endverbatim
38 
39  Required fields:
40  \verbatim
41  U | Velocity [m/s]
42  \endverbatim
43 
44 Usage
45  Minimal example by using \c constant/fvOptions:
46  \verbatim
47  limitVelocity1
48  {
49  // Mandatory entries (unmodifiable)
50  type limitVelocity;
51 
52  // Mandatory entries (runtime modifiable)
53  max <maxValue>;
54 
55  // Optional entries (runtime modifiable)
56  U <Uname>;
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: limitVelocity | word | yes | -
67  max | Maximum velocity limit [m/s] | scalar | yes | -
68  U | Name of operand velocity field | word | no | U
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 See also
77  - Foam::fv::velocityDampingConstraint
78 
79 SourceFiles
80  limitVelocity.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef fv_limitVelocity_H
85 #define fv_limitVelocity_H
86 
87 #include "cellSetOption.H"
88 #include "writeFile.H"
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 namespace fv
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class limitVelocity Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class limitVelocity
102 :
103  public fv::cellSetOption,
104  public functionObjects::writeFile
105 {
106 protected:
107 
108  // Protected Data
109 
110  //- Name of operand velocity field
111  word UName_;
112 
113  //- Maximum velocity magnitude
114  scalar max_;
115 
116 
117  // Protected Member Functions
118 
119  //- Write file header information
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("limitVelocity");
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
141  limitVelocity(const limitVelocity&) = delete;
142 
143  //- No copy assignment
144  void operator=(const limitVelocity&) = delete;
145 
146 
147  //- Destructor
148  virtual ~limitVelocity() = default;
149 
150 
151  // Member Functions
152 
153  //- Read dictionary
154  virtual bool read(const dictionary& dict);
155 
156  //- Correct the velocity field
157  virtual void correct(volVectorField& U);
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace fv
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
word UName_
Name of operand velocity field.
dictionary dict
Corrects velocity field (i.e. T) within a specified region by applying a given maximum velocity magni...
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
TypeName("limitVelocity")
Runtime type information.
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: limitVelocity.C:76
void operator=(const limitVelocity &)=delete
No copy assignment.
virtual ~limitVelocity()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
void writeFileHeader(Ostream &os)
Write file header information.
Definition: limitVelocity.C:40
labelList fv(nPoints)
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:24
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
U
Definition: pEqn.H:72
scalar max_
Maximum velocity magnitude.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
limitVelocity(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: limitVelocity.C:58
virtual void correct(volVectorField &U)
Correct the velocity field.
Namespace for OpenFOAM.