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  \endverbatim
69 
70 See also
71  Foam::fv::forcing
72  Foam::fv::verticalDamping
73 
74 SourceFiles
75  isotropicDamping.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef isotropicDamping_H
80 #define isotropicDamping_H
81 
82 #include "forcing.H"
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 namespace fv
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class isotropicDamping Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class isotropicDamping
96 :
97  public forcing
98 {
99  // Private Data
100 
101  //- Name of the velocity field
102  word UName_;
103 
104  //- Reference value
105  dimensionedVector value_;
106 
107 
108  // Private Member Functions
109 
110  //- Non-virtual read
111  void readCoeffs();
112 
113  //- Source term to momentum equation
114  void add
115  (
117  fvMatrix<vector>& eqn
118  ) const;
119 
120 
121 public:
122 
123  //- Runtime type information
124  TypeName("isotropicDamping");
125 
126 
127  // Constructors
128 
129  //- Construct from components
131  (
132  const word& name,
133  const word& modelType,
134  const fvMesh& mesh,
135  const dictionary& dict
136  );
137 
138 
139  //- Destructor
140  virtual ~isotropicDamping()
141  {}
142 
143 
144  // Member Functions
145 
146  // Checks
147 
148  //- Return the list of fields for which the fvModel adds source term
149  // to the transport equation
150  virtual wordList addSupFields() const;
151 
152 
153  // Add explicit and implicit contributions
154 
155  //- Source term to momentum equation
156  virtual void addSup
157  (
158  fvMatrix<vector>& eqn,
159  const word& fieldName
160  ) const;
161 
162  //- Source term to compressible momentum equation
163  virtual void addSup
164  (
165  const volScalarField& rho,
166  fvMatrix<vector>& eqn,
167  const word& fieldName
168  ) const;
169 
170  //- Source term to phase momentum equation
171  virtual void addSup
172  (
173  const volScalarField& alpha,
174  const volScalarField& rho,
175  fvMatrix<vector>& eqn,
176  const word& fieldName
177  ) const;
178 
179 
180  // Mesh changes
181 
182  //- Update for mesh motion
183  virtual bool movePoints();
184 
185  //- Update topology using the given map
186  virtual void topoChange(const polyTopoChangeMap&);
187 
188  //- Update from another mesh using the given map
189  virtual void mapMesh(const polyMeshMap&);
190 
191  //- Redistribute or update using the given distribution map
192  virtual void distribute(const polyDistributionMap&);
193 
194 
195  // IO
196 
197  //- Read dictionary
198  virtual bool read(const dictionary& dict);
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace fv
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
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: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
tmp< volScalarField::Internal > forceCoeff() const
Return the force coefficient.
Definition: forcing.C:194
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 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.
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
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
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