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-2023 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 forcing 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  forcing and the residence time of a perturbation through the forcing zone.
48  For example, if waves moving at 2 [m/s] are travelling through a forcing
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  libs ("libwaves.so");
61 
62  // Define the line along which to apply the graduation
63  origin (1200 0 0);
64  direction (1 0 0);
65 
66  // Or, define multiple lines
67  // origins ((1200 0 0) (1200 -300 0) (1200 300 0));
68  // directions ((1 0 0) (0 -1 0) (0 1 0));
69 
70  scale
71  {
72  type halfCosineRamp;
73  start 0;
74  duration 600;
75  }
76 
77  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
78 
79  timeStart 0;
80  duration 1e6;
81  }
82  \endverbatim
83 
84 See also
85  Foam::fv::forcing
86  Foam::fv::isotropicDamping
87 
88 SourceFiles
89  verticalDamping.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef verticalDamping_H
94 #define verticalDamping_H
95 
96 #include "forcing.H"
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 namespace Foam
101 {
102 namespace fv
103 {
104 
105 /*---------------------------------------------------------------------------*\
106  Class verticalDamping Declaration
107 \*---------------------------------------------------------------------------*/
108 
109 class verticalDamping
110 :
111  public forcing
112 {
113  // Private Data
114 
115  //- Name of the velocity field
116  word UName_;
117 
118 
119  // Private Member Functions
120 
121  //- Source term to momentum equation
122  void add
123  (
124  const volVectorField& alphaRhoU,
125  fvMatrix<vector>& eqn
126  ) const;
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("verticalDamping");
133 
134 
135  // Constructors
136 
137  //- Construct from components
139  (
140  const word& name,
141  const word& modelType,
142  const fvMesh& mesh,
143  const dictionary& dict
144  );
145 
146 
147  //- Destructor
148  virtual ~verticalDamping()
149  {}
150 
151 
152  // Member Functions
153 
154  // Checks
155 
156  //- Return the list of fields for which the fvModel adds source term
157  // to the transport equation
158  virtual wordList addSupFields() const;
159 
160 
161  // Add explicit and implicit contributions
162 
163  //- Source term to momentum equation
164  virtual void addSup
165  (
166  fvMatrix<vector>& eqn,
167  const word& fieldName
168  ) const;
169 
170  //- Source term to compressible momentum equation
171  virtual void addSup
172  (
173  const volScalarField& rho,
174  fvMatrix<vector>& eqn,
175  const word& fieldName
176  ) const;
177 
178  //- Source term to phase momentum equation
179  virtual void addSup
180  (
181  const volScalarField& alpha,
182  const volScalarField& rho,
183  fvMatrix<vector>& eqn,
184  const word& fieldName
185  ) const;
186 
187 
188  // Mesh changes
189 
190  //- Update for mesh motion
191  virtual bool movePoints();
192 
193  //- Update topology using the given map
194  virtual void topoChange(const polyTopoChangeMap&);
195 
196  //- Update from another mesh using the given map
197  virtual void mapMesh(const polyMeshMap&);
198 
199  //- Redistribute or update using the given distribution map
200  virtual void distribute(const polyDistributionMap&);
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace fv
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
Base fvModel for forcing functions.
Definition: forcing.H:59
This fvModel applies an explicit forcing force to components of the vector field in the direction of ...
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
verticalDamping(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
TypeName("verticalDamping")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual ~verticalDamping()
Destructor.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict