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 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  Constraint on velocity field to dampen velocity fluctuations.
35 
36  This constraint is primarily used to dampen velocity fluctuations in
37  the start-up phase of simulations. When the local velocity magnitude
38  exceeds the user-supplied maximum value a sink term is activated in
39  the affected region to lower the velocity to the limiting value.
40 
41 Usage
42  Example of functionality specification in \c fvOptions:
43  \verbatim
44  velocityDamper
45  {
46  // Mandatory entries
47  type velocityDampingConstraint;
48  UMax 200;
49 
50  // Optional entries
51  selectionMode all;
52  UNames (U); // names of given velocity fields
53  U U; // name of given velocity field if
54  //`UNames` is not present (default: U)
55 
56  // Optional fvOptions entries
57  active true;
58  }
59  \endverbatim
60 
61 Note
62  When active, this constraint manipulates the system of equations.
63  Users should ensure that it is not active when the case is converged
64  (steady-state) or during the period of interest (transient) to ensure
65  that its presence does not pollute the results.
66 
67 SourceFiles
68  velocityDampingConstraint.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef velocityDampingConstraint_H
73 #define velocityDampingConstraint_H
74 
75 #include "cellSetOption.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 namespace fv
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class velocityDampingConstraint Declaration
86 \*---------------------------------------------------------------------------*/
87 
89 :
90  public cellSetOption
91 {
92 
93 protected:
94 
95  // Protected Data
96 
97  //- Maximum velocity magnitude
98  scalar UMax_;
99 
100 
101  // Protected Member Functions
102 
103  void addDamping(fvMatrix<vector>& eqn);
104 
105 
106 private:
107 
108  // Private Member Functions
109 
110  //- No copy construct
112 
113  //- No copy assignment
114  void operator=(const velocityDampingConstraint&) = delete;
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("velocityDampingConstraint");
121 
122 
123  // Constructors
124 
125  //- Construct from components
127  (
128  const word& name,
129  const word& modelType,
130  const dictionary& dict,
131  const fvMesh& mesh
132  );
133 
134 
135  //- Destructor
136  virtual ~velocityDampingConstraint() = default;
137 
138 
139  // Member Functions
140 
141  // Set values directly
142 
143  //- Constrain vector matrix
144  virtual void constrain(fvMatrix<vector>& eqn, const label fieldi);
145 
146 
147  // I-O
148 
149  //- Write data
150  virtual void writeData(Ostream& os) const;
151 
152  //- Read dictionary
153  virtual bool read(const dictionary& dict);
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace fv
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::cellSetOption
Cell-set options abtract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:30
Foam::fv::velocityDampingConstraint::TypeName
TypeName("velocityDampingConstraint")
Runtime type information.
cellSetOption.H
Foam::fv::velocityDampingConstraint::addDamping
void addDamping(fvMatrix< vector > &eqn)
Definition: velocityDampingConstraint.C:53
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::fv::velocityDampingConstraint::UMax_
scalar UMax_
Maximum velocity magnitude.
Definition: velocityDampingConstraint.H:97
Foam::fv::velocityDampingConstraint
Constraint on velocity field to dampen velocity fluctuations.
Definition: velocityDampingConstraint.H:87
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:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::fv::velocityDampingConstraint::constrain
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Constrain vector matrix.
Definition: velocityDampingConstraint.C:108
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:36
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56