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 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 
29  This fvOption applies an implicit damping force to all components of the
30  vector field to relax the field towards a specified uniform value. Its
31  intended purpose is to damp the motions of an interface in the region
32  approaching an outlet so that no reflections are generated.
33 
34  The damping force coefficient \f$\lambda\f$ should be set based on the
35  desired level of damping and the residence time of a perturbation through
36  the damping zone. For example, if waves moving at 2 [m/s] are travelling
37  through a damping zone 8 [m] in length, then the residence time is 4 [s]. If
38  it is deemed necessary to damp for 5 time-scales, then \f$\lambda\f$ should
39  be set to equal 5/(4 [s]) = 1.2 [1/s].
40 
41 Usage
42  Example usage:
43  \verbatim
44  isotropicDamping1
45  {
46  type isotropicDamping;
47 
48  selectionMode cellZone;
49  cellZone nearOutlet;
50 
51  value (2 0 0); // Value towards which the field it relaxed
52  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
53 
54  timeStart 0;
55  duration 1e6;
56  }
57  \endverbatim
58 
59  Example usage with graduated onset:
60  \verbatim
61  isotropicDamping1
62  {
63  type isotropicDamping;
64 
65  selectionMode all;
66 
67  // Define the line along which to apply the graduation
68  origin (1200 0 0);
69  direction (1 0 0);
70 
71  // Or, define multiple lines
72  // origins ((1200 0 0) (1200 -300 0) (1200 300 0));
73  // directions ((1 0 0) (0 -1 0) (0 1 0));
74 
75  scale
76  {
77  type halfCosineRamp;
78  start 0;
79  duration 600;
80  }
81 
82  value (2 0 0); // Value towards which the field it relaxed
83  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
84 
85  timeStart 0;
86  duration 1e6;
87  }
88  \endverbatim
89 
90 See also
91  Foam::fv::damping
92  Foam::fv::verticalDamping
93 
94 SourceFiles
95  isotropicDamping.C
96 
97 \*---------------------------------------------------------------------------*/
98 
99 #ifndef isotropicDamping_H
100 #define isotropicDamping_H
101 
102 #include "damping.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 namespace fv
109 {
110 
111 /*---------------------------------------------------------------------------*\
112  Class isotropicDamping Declaration
113 \*---------------------------------------------------------------------------*/
115 class isotropicDamping
116 :
117  public damping
118 {
119  // Private Data
120 
121  //- Reference value
122  dimensionedVector value_;
123 
124 
125  // Private Member Functions
126 
127  //- Source term to momentum equation
128  void add
129  (
131  fvMatrix<vector>& eqn
132  );
133 
134 
135 public:
136 
137  //- Runtime type information
138  TypeName("isotropicDamping");
139 
140 
141  // Constructors
142 
143  //- Construct from components
145  (
146  const word& name,
147  const word& modelType,
148  const dictionary& dict,
149  const fvMesh& mesh
150  );
151 
152 
153  //- Destructor
154  virtual ~isotropicDamping()
155  {}
156 
157 
158  // Member Functions
159 
160  // Add explicit and implicit contributions
161 
162  //- Source term to momentum equation
163  virtual void addSup
164  (
165  fvMatrix<vector>& eqn,
166  const label fieldi
167  );
168 
169  //- Source term to compressible momentum equation
170  virtual void addSup
171  (
172  const volScalarField& rho,
173  fvMatrix<vector>& eqn,
174  const label fieldi
175  );
176 
177  //- Source term to phase momentum equation
178  virtual void addSup
179  (
180  const volScalarField& alpha,
181  const volScalarField& rho,
182  fvMatrix<vector>& eqn,
183  const label fieldi
184  );
185 
186 
187  // IO
188 
189  //- Read dictionary
190  virtual bool read(const dictionary& dict);
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace fv
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
virtual ~isotropicDamping()
Destructor.
isotropicDamping(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
virtual bool read(const dictionary &dict)
Read dictionary.
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
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
Base fvOption for damping functions.
Definition: damping.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("isotropicDamping")
Runtime type information.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
This fvOption applies an implicit damping force to all components of the vector field to relax the fi...
tmp< volScalarField::Internal > forceCoeff() const
Definition: damping.C:43
Namespace for OpenFOAM.