isotropicDamping.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) 2019-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::isotropicDamping
26 
27 Description
28  This fvModel applies an implicit forcing force to all components of the
29  vector field to relax the field towards a specified uniform value. Its
30  intended purpose is to damp the motions of an interface in the region
31  approaching an outlet so that no reflections are generated.
32 
33  The forcing force coefficient \f$\lambda\f$ should be set based on the
34  desired level of forcing and the residence time of a perturbation through
35  the forcing zone. For example, if waves moving at 2 [m/s] are travelling
36  through a forcing zone 8 [m] in length, then the residence time is 4 [s]. If
37  it is deemed necessary to damp for 5 time-scales, then \f$\lambda\f$ should
38  be set to equal 5/(4 [s]) = 1.2 [1/s].
39 
40 Usage
41  Example usage:
42  \verbatim
43  isotropicDamping1
44  {
45  type isotropicDamping;
46 
47  libs ("libwaves.so");
48 
49  // Define the line along which to apply the graduation
50  origin (1200 0 0);
51  direction (1 0 0);
52 
53  // // Or, define multiple lines
54  // origins ((1200 0 0) (1200 -300 0) (1200 300 0));
55  // directions ((1 0 0) (0 -1 0) (0 1 0));
56 
57  scale
58  {
59  type halfCosineRamp;
60  start 0;
61  duration 600;
62  }
63 
64  value (2 0 0); // Value towards which the field is
65  // relaxed
66  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
67 
68  // Write the forcing fields: forcing:scale, forcing:forceCoeff
69  writeForceFields true;
70  }
71  \endverbatim
72 
73 See also
74  Foam::fv::forcing
75  Foam::fv::verticalDamping
76 
77 SourceFiles
78  isotropicDamping.C
79 
80 \*---------------------------------------------------------------------------*/
81 
82 #ifndef isotropicDamping_H
83 #define isotropicDamping_H
84 
85 #include "forcing.H"
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 namespace fv
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class isotropicDamping Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class isotropicDamping
99 :
100  public forcing
101 {
102  // Private Data
103 
104  //- Name of the velocity field
105  word UName_;
106 
107  //- Reference value
108  dimensionedVector value_;
109 
110 
111  // Private Member Functions
112 
113  //- Non-virtual read
114  void readCoeffs();
115 
116  //- Source term to momentum equation
117  void add
118  (
120  fvMatrix<vector>& eqn
121  ) const;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("isotropicDamping");
128 
129 
130  // Constructors
131 
132  //- Construct from components
134  (
135  const word& name,
136  const word& modelType,
137  const fvMesh& mesh,
138  const dictionary& dict
139  );
140 
141 
142  //- Destructor
143  virtual ~isotropicDamping()
144  {}
145 
146 
147  // Member Functions
148 
149  //- Read dictionary
150  virtual bool read(const dictionary& dict);
151 
152 
153  // Checks
154 
155  //- Return the list of fields for which the fvModel adds source term
156  // to the transport equation
157  virtual wordList addSupFields() const;
158 
159 
160  // Add explicit and implicit contributions
161 
162  //- Source term to momentum equation
163  virtual void addSup
164  (
165  const volVectorField& U,
166  fvMatrix<vector>& eqn
167  ) const;
168 
169  //- Source term to compressible momentum equation
170  virtual void addSup
171  (
172  const volScalarField& rho,
173  const volVectorField& U,
174  fvMatrix<vector>& eqn
175  ) const;
176 
177  //- Source term to phase momentum equation
178  virtual void addSup
179  (
180  const volScalarField& alpha,
181  const volScalarField& rho,
182  const volVectorField& U,
183  fvMatrix<vector>& eqn
184  ) const;
185 
186 
187  // Mesh changes
188 
189  //- Update for mesh motion
190  virtual bool movePoints();
191 
192  //- Update topology using the given map
193  virtual void topoChange(const polyTopoChangeMap&);
194 
195  //- Update from another mesh using the given map
196  virtual void mapMesh(const polyMeshMap&);
197 
198  //- Redistribute or update using the given distribution map
199  virtual void distribute(const polyDistributionMap&);
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace fv
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
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
virtual tmp< volScalarField::Internal > forceCoeff() const
Return the force coefficient.
Definition: forcing.C:184
This fvModel applies an implicit forcing force to all components of the vector field to relax the fie...
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.
virtual ~isotropicDamping()
Destructor.
TypeName("isotropicDamping")
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.
isotropicDamping(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
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