The OpenFOAM Foundation
verticalDamping.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
9  This file is part of OpenFOAM.
10
11  OpenFOAM is free software: you can redistribute it and/or modify it
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::verticalDamping
26
27 Description
28  This fvOption applies an explicit damping force to components of the vector
29  field in the direction of gravity. Its intended purpose is to damp the
30  vertical motions of an interface in the region approaching an outlet so that
31  no reflections are generated.
32
33  Damping is achieved by applying a force to the momentum equation
34  proportional to the momentum of the flow in the direction of gravity. The
35  constant of proportionality is given by a coefficient \f$\lambda\f$ which
36  has units of inverse-time. In the absence of any other forces this would
37  generate an exponential decay of the vertical velocity.
38
39  \f[
40  \frac{d (m u_z)}{d t} = - \lambda m u_z
41  \f]
42  \f[
43  u_z = u_{z0} e^{- \lambda t}
44  \f]
45
46  The coefficient \f$\lambda\f$ should be set based on the desired level of
47  damping and the residence time of a perturbation through the damping zone.
48  For example, if waves moving at 2 [m/s] are travelling through a damping
49  zone 8 [m] in length, then the residence time is 4 [s]. If it is deemed
50  necessary to damp for 5 time-scales, then \f$\lambda\f$ should be set to
51  equal 5/(4 [s]) = 1.2 [1/s].
52
53 Usage
54  Example usage:
55  \verbatim
56  verticalDamping1
57  {
58  type verticalDamping;
59
60  selectionMode cellZone;
61  cellZone nearOutlet;
62
63  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
64
65  timeStart 0;
66  duration 1e6;
67  }
68  \endverbatim
69
70  Example usage with graduated onset:
71  \verbatim
72  verticalDamping1
73  {
74  type verticalDamping;
75
76  selectionMode all;
77
78  // Define the line along which to apply the graduation
79  origin (1200 0 0);
80  direction (1 0 0);
81
82  // Or, define multiple lines
83  // origins ((1200 0 0) (1200 -300 0) (1200 300 0));
84  // directions ((1 0 0) (0 -1 0) (0 1 0));
85
86  scale
87  {
88  type halfCosineRamp;
89  start 0;
90  duration 600;
91  }
92
93  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
94
95  timeStart 0;
96  duration 1e6;
97  }
98  \endverbatim
99
101  Foam::fv::damping
102  Foam::fv::isotropicDamping
103
104 SourceFiles
105  verticalDamping.C
106
107 \*---------------------------------------------------------------------------*/
108
109 #ifndef verticalDamping_H
110 #define verticalDamping_H
111
112 #include "damping.H"
113
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115
116 namespace Foam
117 {
118 namespace fv
119 {
120
121 /*---------------------------------------------------------------------------*\
122  Class verticalDamping Declaration
123 \*---------------------------------------------------------------------------*/
125 class verticalDamping
126 :
127  public damping
128 {
129  // Private Member Functions
130
131  //- Source term to momentum equation
133  (
134  const volVectorField& alphaRhoU,
135  fvMatrix<vector>& eqn
136  );
137
138
139 public:
140
141  //- Runtime type information
142  TypeName("verticalDamping");
143
144
145  // Constructors
146
147  //- Construct from components
149  (
150  const word& name,
151  const word& modelType,
152  const dictionary& dict,
153  const fvMesh& mesh
154  );
155
156
157  //- Destructor
158  virtual ~verticalDamping()
159  {}
160
161
162  // Member Functions
163
164  // Add explicit and implicit contributions
165
166  //- Source term to momentum equation
168  (
169  fvMatrix<vector>& eqn,
170  const label fieldi
171  );
172
173  //- Source term to compressible momentum equation
175  (
176  const volScalarField& rho,
177  fvMatrix<vector>& eqn,
178  const label fieldi
179  );
180
181  //- Source term to phase momentum equation
183  (
184  const volScalarField& alpha,
185  const volScalarField& rho,
186  fvMatrix<vector>& eqn,
187  const label fieldi
188  );
189 };
190
191
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193
194 } // End namespace fv
195 } // End namespace Foam
196
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199 #endif
200
201 // ************************************************************************* //
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
dictionary dict
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const fvMesh & mesh() const
Definition: fvOptionI.H:34
virtual ~verticalDamping()
Destructor.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
This fvOption applies an explicit damping force to components of the vector field in the direction of...
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
const word & name() const