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-2021 OpenFOAM Foundation
6  \\/ M anipulation |
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::verticalDamping
26 
27 Description
28  This fvModel 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  // Define the line along which to apply the graduation
61  origin (1200 0 0);
62  direction (1 0 0);
63 
64  // Or, define multiple lines
65  // origins ((1200 0 0) (1200 -300 0) (1200 300 0));
66  // directions ((1 0 0) (0 -1 0) (0 1 0));
67 
68  scale
69  {
70  type halfCosineRamp;
71  start 0;
72  duration 600;
73  }
74 
75  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
76 
77  timeStart 0;
78  duration 1e6;
79  }
80  \endverbatim
81 
82 See also
83  Foam::fv::damping
84  Foam::fv::isotropicDamping
85 
86 SourceFiles
87  verticalDamping.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef verticalDamping_H
92 #define verticalDamping_H
93 
94 #include "damping.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 namespace fv
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class verticalDamping Declaration
105 \*---------------------------------------------------------------------------*/
107 class verticalDamping
108 :
109  public damping
110 {
111  // Private Member Functions
112 
113  //- Source term to momentum equation
114  void add
115  (
116  const volVectorField& alphaRhoU,
117  fvMatrix<vector>& eqn
118  ) const;
119 
120 
121 public:
122 
123  //- Runtime type information
124  TypeName("verticalDamping");
125 
126 
127  // Constructors
128 
129  //- Construct from components
131  (
132  const word& name,
133  const word& modelType,
134  const dictionary& dict,
135  const fvMesh& mesh
136  );
137 
138 
139  //- Destructor
140  virtual ~verticalDamping()
141  {}
142 
143 
144  // Member Functions
145 
146  // Add explicit and implicit contributions
147 
148  //- Source term to momentum equation
149  virtual void addSup
150  (
151  fvMatrix<vector>& eqn,
152  const word& fieldName
153  ) const;
154 
155  //- Source term to compressible momentum equation
156  virtual void addSup
157  (
158  const volScalarField& rho,
159  fvMatrix<vector>& eqn,
160  const word& fieldName
161  ) const;
162 
163  //- Source term to phase momentum equation
164  virtual void addSup
165  (
166  const volScalarField& alpha,
167  const volScalarField& rho,
168  fvMatrix<vector>& eqn,
169  const word& fieldName
170  ) const;
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace fv
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
dictionary dict
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
virtual ~verticalDamping()
Destructor.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
This fvModel 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
TypeName("verticalDamping")
Runtime type information.
verticalDamping(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Base fvModel for damping functions.
Definition: damping.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Namespace for OpenFOAM.