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-2021 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 damping 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 damping force coefficient \f$\lambda\f$ should be set based on the
34  desired level of damping and the residence time of a perturbation through
35  the damping zone. For example, if waves moving at 2 [m/s] are travelling
36  through a damping 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  // Define the line along which to apply the graduation
48  origin (1200 0 0);
49  direction (1 0 0);
50 
51  // // Or, define multiple lines
52  // origins ((1200 0 0) (1200 -300 0) (1200 300 0));
53  // directions ((1 0 0) (0 -1 0) (0 1 0));
54 
55  scale
56  {
57  type halfCosineRamp;
58  start 0;
59  duration 600;
60  }
61 
62  value (2 0 0); // Value towards which the field is
63  // relaxed
64  lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
65  }
66  \endverbatim
67 
68 See also
69  Foam::fv::damping
70  Foam::fv::verticalDamping
71 
72 SourceFiles
73  isotropicDamping.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef isotropicDamping_H
78 #define isotropicDamping_H
79 
80 #include "damping.H"
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 namespace fv
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class isotropicDamping Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class isotropicDamping
94 :
95  public damping
96 {
97  // Private Data
98 
99  //- Reference value
100  dimensionedVector value_;
101 
102 
103  // Private Member Functions
104 
105  //- Non-virtual read
106  void readCoeffs();
107 
108  //- Source term to momentum equation
109  void add
110  (
112  fvMatrix<vector>& eqn
113  ) const;
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("isotropicDamping");
120 
121 
122  // Constructors
123 
124  //- Construct from components
126  (
127  const word& name,
128  const word& modelType,
129  const dictionary& dict,
130  const fvMesh& mesh
131  );
132 
133 
134  //- Destructor
135  virtual ~isotropicDamping()
136  {}
137 
138 
139  // Member Functions
140 
141  // Add explicit and implicit contributions
142 
143  //- Source term to momentum equation
144  virtual void addSup
145  (
146  fvMatrix<vector>& eqn,
147  const word& fieldName
148  ) const;
149 
150  //- Source term to compressible momentum equation
151  virtual void addSup
152  (
153  const volScalarField& rho,
154  fvMatrix<vector>& eqn,
155  const word& fieldName
156  ) const;
157 
158  //- Source term to phase momentum equation
159  virtual void addSup
160  (
161  const volScalarField& alpha,
162  const volScalarField& rho,
163  fvMatrix<vector>& eqn,
164  const word& fieldName
165  ) const;
166 
167 
168  // IO
169 
170  //- Read dictionary
171  virtual bool read(const dictionary& dict);
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace fv
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
dictionary dict
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
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
Base fvModel 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.
This fvModel applies an implicit damping force to all components of the vector field to relax the fie...
tmp< volScalarField::Internal > forceCoeff() const
Return the force coefficient.
Definition: damping.C:121
Namespace for OpenFOAM.