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  // Write the forcing fields: forcing:scale, forcing:forceCoeff
83  writeForceFields true;
84  }
85  \endverbatim
86 
87 See also
88  Foam::fv::forcing
89  Foam::fv::isotropicDamping
90 
91 SourceFiles
92  verticalDamping.C
93 
94 \*---------------------------------------------------------------------------*/
95 
96 #ifndef verticalDamping_H
97 #define verticalDamping_H
98 
99 #include "forcing.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 namespace fv
106 {
107 
108 /*---------------------------------------------------------------------------*\
109  Class verticalDamping Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 class verticalDamping
113 :
114  public forcing
115 {
116  // Private Data
117 
118  //- Name of the velocity field
119  word UName_;
120 
121 
122  // Private Member Functions
123 
124  //- Non-virtual read
125  void readCoeffs();
126 
127  //- Source term to momentum equation
128  void add
129  (
130  const volVectorField& alphaRhoU,
131  fvMatrix<vector>& eqn
132  ) const;
133 
134 
135 public:
136 
137  //- Runtime type information
138  TypeName("verticalDamping");
139 
140 
141  // Constructors
142 
143  //- Construct from components
145  (
146  const word& name,
147  const word& modelType,
148  const fvMesh& mesh,
149  const dictionary& dict
150  );
151 
152 
153  //- Destructor
154  virtual ~verticalDamping()
155  {}
156 
157 
158  // Member Functions
159 
160  //- Read dictionary
161  virtual bool read(const dictionary& dict);
162 
163 
164  // Checks
165 
166  //- Return the list of fields for which the fvModel adds source term
167  // to the transport equation
168  virtual wordList addSupFields() const;
169 
170 
171  // Add explicit and implicit contributions
172 
173  //- Source term to momentum equation
174  virtual void addSup
175  (
176  const volVectorField& U,
177  fvMatrix<vector>& eqn
178  ) const;
179 
180  //- Source term to compressible momentum equation
181  virtual void addSup
182  (
183  const volScalarField& rho,
184  const volVectorField& U,
185  fvMatrix<vector>& eqn
186  ) const;
187 
188  //- Source term to phase momentum equation
189  virtual void addSup
190  (
191  const volScalarField& alpha,
192  const volScalarField& rho,
193  const volVectorField& U,
194  fvMatrix<vector>& eqn
195  ) const;
196 
197 
198  // Mesh changes
199 
200  //- Update for mesh motion
201  virtual bool movePoints();
202 
203  //- Update topology using the given map
204  virtual void topoChange(const polyTopoChangeMap&);
205 
206  //- Update from another mesh using the given map
207  virtual void mapMesh(const polyMeshMap&);
208 
209  //- Redistribute or update using the given distribution map
210  virtual void distribute(const polyDistributionMap&);
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace fv
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
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:99
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
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 void addSup(const volVectorField &U, fvMatrix< vector > &eqn) const
Source term to momentum equation.
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 bool read(const dictionary &dict)
Read dictionary.
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
U
Definition: pEqn.H:72
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