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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fv::velocityDampingConstraint
26 
27 Description
28  Constraint for velocity to dampen velocity fluctuations in
29  steady simulations
30 
31  In case of velocity exceeding limit applies
32  a source sink to remove the excess velocity by adding a term
33  that drives the velocity to 0 (note that we cannot use the old
34  term velocity since it most likely is already excessive). This
35  additional constraint is scaled with (U-UMax)/dt
36  where dt is a local time scale (= velocity/cellsize) so it switches off
37  if the velocity is below UMax.
38 
39  Constraint described by:
40 
41  velocityDampingConstraintCoeffs
42  {
43  UMax 100;
44 
45  // Optional: name of velocity field (default: U)
46  //UName U;
47  }
48 
49 
50 SourceFiles
51  velocityDampingConstraint.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef velocityDampingConstraint_H
56 #define velocityDampingConstraint_H
57 
58 #include "cellSetOption.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace fv
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class velocityDampingConstraint Declaration
69 \*---------------------------------------------------------------------------*/
70 
72 :
73  public cellSetOption
74 {
75 
76 protected:
77 
78  // Protected data
79 
80  //- Maximum velocity
81  scalar UMax_;
82 
83 
84  // Protected Member Functions
85 
86  void addDamping(fvMatrix<vector>& eqn);
87 
88 
89 private:
90 
91  // Private Member Functions
92 
93  //- Disallow default bitwise copy construct
95 
96  //- Disallow default bitwise assignment
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("velocityDampingConstraint");
104 
105 
106  // Constructors
107 
108  //- Construct from components
110  (
111  const word& name,
112  const word& modelType,
113  const dictionary& dict,
114  const fvMesh& mesh
115  );
116 
117 
118  //- Destructor
120  {}
121 
122 
123  // Member Functions
124 
125  // Set values directly
126 
127  //- Constrain vector matrix
128  virtual void constrain(fvMatrix<vector>& eqn, const label fieldI);
129 
130 
131  // I-O
132 
133  //- Write data
134  virtual void writeData(Ostream&) const;
135 
136  //- Read dictionary
137  virtual bool read(const dictionary& dict);
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace fv
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::cellSetOption
Cell-set options abtract base class. Provides a base set of controls, e.g.
Definition: cellSetOption.H:71
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
Foam::fv::velocityDampingConstraint::velocityDampingConstraint
velocityDampingConstraint(const velocityDampingConstraint &)
Disallow default bitwise copy construct.
Foam::fv::velocityDampingConstraint::TypeName
TypeName("velocityDampingConstraint")
Runtime type information.
cellSetOption.H
Foam::fv::velocityDampingConstraint::operator=
void operator=(const velocityDampingConstraint &)
Disallow default bitwise assignment.
Foam::fv::velocityDampingConstraint::addDamping
void addDamping(fvMatrix< vector > &eqn)
Definition: velocityDampingConstraint.C:50
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:59
Foam::fv::velocityDampingConstraint::writeData
virtual void writeData(Ostream &) const
Write data.
Definition: velocityDampingConstraint.C:114
Foam::fv::velocityDampingConstraint::UMax_
scalar UMax_
Maximum velocity.
Definition: velocityDampingConstraint.H:80
Foam::fv::velocityDampingConstraint
Constraint for velocity to dampen velocity fluctuations in steady simulations.
Definition: velocityDampingConstraint.H:70
Foam::fv::velocityDampingConstraint::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: velocityDampingConstraint.C:121
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::velocityDampingConstraint::~velocityDampingConstraint
virtual ~velocityDampingConstraint()
Destructor.
Definition: velocityDampingConstraint.H:118
fv
labelList fv(nPoints)
Foam::fv::velocityDampingConstraint::constrain
virtual void constrain(fvMatrix< vector > &eqn, const label fieldI)
Constrain vector matrix.
Definition: velocityDampingConstraint.C:105
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
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:53