velocityDampingConstraint.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) 2015 OpenFOAM Foundation
9  Copyright (C) 2015-2020 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::velocityDampingConstraint
29 
30 Group
31  grpFvOptionsConstraints
32 
33 Description
34  Constrain given velocity fields to dampen velocity
35  fluctuations exceeding a given value within a specified region.
36 
37  This constraint is primarily used to dampen velocity fluctuations in
38  the start-up phase of simulations. When the local velocity magnitude
39  exceeds the user-supplied maximum value a sink term is activated in
40  the affected region to lower the velocity to the limiting value.
41 
42  Constraints applied to:
43  \verbatim
44  U | Velocity [m/s]
45  \endverbatim
46 
47  Required fields:
48  \verbatim
49  U | Velocity [m/s]
50  \endverbatim
51 
52 Usage
53  Minimal example by using \c constant/fvOptions:
54  \verbatim
55  velocityDampingConstraint1
56  {
57  // Mandatory entries (unmodifiable)
58  type velocityDampingConstraint;
59 
60  // Mandatory entries (runtime modifiable)
61  UMax 200;
62 
63  // Optional entries (runtime modifiable)
64  UNames (<Uname1> <Uname2> ... <UnameN>);
65 
66  // Conditional optional entries (runtime modifiable)
67 
68  // when UNames entry is not present
69  U U;
70 
71  // Mandatory/Optional (inherited) entries
72  ...
73  }
74  \endverbatim
75 
76  where the entries mean:
77  \table
78  Property | Description | Type | Reqd | Dflt
79  type | Type name: velocityDampingConstraint | word | yes | -
80  UMax | Maximum velocity magnitude | scalar | yes | -
81  UNames | Names of operand velocity fields | wordList | no | -
82  U | Name of operand velocity field | word | cndtnl | U
83  \endtable
84 
85  The inherited entries are elaborated in:
86  - \link fvOption.H \endlink
87  - \link cellSetOption.H \endlink
88 
89 Note
90  - When active, this constraint manipulates the system of equations.
91  Users should ensure that it is not active when the case is converged
92  (steady-state) or during the period of interest (transient) to ensure
93  that its presence does not pollute the results.
94 
95 See also
96  - Foam::fv::limitVelocity
97 
98 SourceFiles
99  velocityDampingConstraint.C
100 
101 \*---------------------------------------------------------------------------*/
102 
103 #ifndef velocityDampingConstraint_H
104 #define velocityDampingConstraint_H
105 
106 #include "cellSetOption.H"
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 namespace Foam
111 {
112 namespace fv
113 {
114 
115 /*---------------------------------------------------------------------------*\
116  Class velocityDampingConstraint Declaration
117 \*---------------------------------------------------------------------------*/
118 
119 class velocityDampingConstraint
120 :
121  public fv::cellSetOption
122 {
123 protected:
124 
125  // Protected Data
126 
127  //- Maximum velocity magnitude
128  scalar UMax_;
129 
130 
131  // Protected Member Functions
132 
133  //- Constrain the given velocity fields by a given maximum value
134  void addDamping(fvMatrix<vector>& eqn);
135 
136 
137 public:
138 
139  //- Runtime type information
140  TypeName("velocityDampingConstraint");
141 
142 
143  // Constructors
144 
145  //- Construct from components
147  (
148  const word& name,
149  const word& modelType,
150  const dictionary& dict,
151  const fvMesh& mesh
152  );
153 
154  //- No copy construct
156 
157  //- No copy assignment
158  void operator=(const velocityDampingConstraint&) = delete;
159 
160 
161  //- Destructor
162  virtual ~velocityDampingConstraint() = default;
163 
164 
165  // Member Functions
166 
167  // Set values directly
168 
169  //- Constrain vector matrix
170  virtual void constrain(fvMatrix<vector>& eqn, const label fieldi);
171 
172 
173  // I-O
174 
175  //- Write data
176  virtual void writeData(Ostream& os) const;
177 
178  //- Read dictionary
179  virtual bool read(const dictionary& dict);
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace fv
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::fv::velocityDampingConstraint::TypeName
TypeName("velocityDampingConstraint")
Runtime type information.
cellSetOption.H
Foam::fv::velocityDampingConstraint::addDamping
void addDamping(fvMatrix< vector > &eqn)
Constrain the given velocity fields by a given maximum value.
Definition: velocityDampingConstraint.C:53
Foam::fv::velocityDampingConstraint::UMax_
scalar UMax_
Maximum velocity magnitude.
Definition: velocityDampingConstraint.H:157
Foam::fv::velocityDampingConstraint
Constrain given velocity fields to dampen velocity fluctuations exceeding a given value within a spec...
Definition: velocityDampingConstraint.H:148
Foam::fv::velocityDampingConstraint::writeData
virtual void writeData(Ostream &os) const
Write data.
Definition: velocityDampingConstraint.C:117
Foam::fv::velocityDampingConstraint::~velocityDampingConstraint
virtual ~velocityDampingConstraint()=default
Destructor.
Foam::fv::velocityDampingConstraint::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: velocityDampingConstraint.C:123
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::velocityDampingConstraint::constrain
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Constrain vector matrix.
Definition: velocityDampingConstraint.C:108
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fv::velocityDampingConstraint::operator=
void operator=(const velocityDampingConstraint &)=delete
No copy assignment.
Foam::fv::velocityDampingConstraint::velocityDampingConstraint
velocityDampingConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: velocityDampingConstraint.C:92