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-2018 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  ramp
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
100 SourceFiles
101  verticalDamping.C
102
103 \*---------------------------------------------------------------------------*/
104
105 #ifndef verticalDamping_H
106 #define verticalDamping_H
107
108 #include "cellSetOption.H"
109
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112 namespace Foam
113 {
115 template<class Type> class Function1;
116
117 namespace fv
118 {
119
120 /*---------------------------------------------------------------------------*\
121  Class verticalDamping Declaration
122 \*---------------------------------------------------------------------------*/
124 class verticalDamping
125 :
126  public cellSetOption
127 {
128 private:
129
130  // Private data
131
132  //- Damping coefficient [1/s]
133  dimensionedScalar lambda_;
134
135  //- The ramping function
137
138  //- Origins of the ramping coordinate
139  vectorField origins_;
140
141  //- Directions of increasing ramping coordinate
142  vectorField directions_;
143
144
145  // Private Member Functions
146
147  //- Source term to momentum equation
149  (
150  const volVectorField& alphaRhoU,
151  fvMatrix<vector>& eqn,
152  const label fieldi
153  );
154
155
156 public:
157
158  //- Runtime type information
159  TypeName("verticalDamping");
160
161
162  // Constructors
163
164  //- Construct from components
166  (
167  const word& name,
168  const word& modelType,
169  const dictionary& dict,
170  const fvMesh& mesh
171  );
172
173
174  //- Destructor
175  virtual ~verticalDamping()
176  {}
177
178
179  // Member Functions
180
181  // Add explicit and implicit contributions
182
183  //- Source term to momentum equation
185  (
186  fvMatrix<vector>& eqn,
187  const label fieldi
188  );
189
190  //- Source term to compressible momentum equation
192  (
193  const volScalarField& rho,
194  fvMatrix<vector>& eqn,
195  const label fieldi
196  );
197
198  //- Source term to phase momentum equation
200  (
201  const volScalarField& alpha,
202  const volScalarField& rho,
203  fvMatrix<vector>& eqn,
204  const label fieldi
205  );
206
207
208  // IO
209
211  virtual bool read(const dictionary& dict);
212 };
213
214
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217 } // End namespace fv
218 } // End namespace Foam
219
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222 #endif
223
224 // ************************************************************************* //
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
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:137
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
Definition: fvOptionI.H:28