acousticDampingSource.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fv::acousticDampingSource
28 
29 Group
30  grpFvOptionsSources
31 
32 Description
33  Applies sources on velocity (i.e. \c U)
34  within a specified region to enable acoustic damping.
35 
36  Sources applied to:
37  \verbatim
38  U | Velocity [m/s]
39  \endverbatim
40 
41  Required fields:
42  \verbatim
43  U | Velocity [m/s]
44  \endverbatim
45 
46 Usage
47  Minimal example by using \c constant/fvOptions:
48  \verbatim
49  acousticDampingSource1
50  {
51  // Mandatory entries (unmodifiable)
52  type acousticDampingSource;
53 
54  // Mandatory entries (runtime modifiable)
55  frequency 3000;
56  URef UMean;
57  origin (-1.25 0 0);
58  radius1 1.2;
59  radius2 1.65;
60 
61  // Optional entries (runtime modifiable)
62  w 20;
63 
64  // Conditional optional entries (runtime modifiable)
65  // Either of the below
66 
67  // Option-1
68  UNames (<UName1> <UName2> ... <UNameN>);
69 
70  // Option-2
71  U U;
72 
73  // Mandatory/Optional (inherited) entries
74  ...
75  }
76  \endverbatim
77 
78  where the entries mean:
79  \table
80  Property | Description | Type | Reqd | Dflt
81  type | Type name: acousticDampingSource | word | yes | -
82  frequency | Frequency value [Hz] | scalar | yes | -
83  URef | Name of reference velocity field | word | yes | -
84  origin | Sphere centre location or damping | vector | yes | -
85  radius1 | Inner radius at which to start damping | scalar | yes | -
86  radius2 | Outer radius beyond which damping is applied | scalar | yes | -
87  w | Stencil width | label | no | 20
88  UNames | Names of operand velocity fields | wordList | cndtnl | -
89  U | Name of operand velocity field | word | cndtnl | U
90  \endtable
91 
92  The inherited entries are elaborated in:
93  - \link fvOption.H \endlink
94  - \link cellSetOption.H \endlink
95 
96 SourceFiles
97  acousticDampingSource.C
98 
99 \*---------------------------------------------------------------------------*/
100 
101 #ifndef acousticDampingSource_H
102 #define acousticDampingSource_H
103 
104 #include "cellSetOption.H"
105 #include "volFields.H"
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 namespace Foam
110 {
111 
112 class porosityModel;
113 
114 namespace fv
115 {
116 
117 /*---------------------------------------------------------------------------*\
118  Class acousticDampingSource Declaration
119 \*---------------------------------------------------------------------------*/
120 
121 class acousticDampingSource
122 :
123  public fv::cellSetOption
124 {
125 protected:
126 
127  // Protected Data
128 
129  //- Blending factor [-]
131 
132  //- Frequency [Hz]
134 
135  // Sphere centre location or damping
136  point x0_;
137 
138  // Inner radius at which to start damping
139  scalar r1_;
140 
141  // Outer radius beyond which damping is applied
142  scalar r2_;
143 
144  //- Name of reference velocity field
145  word URefName_;
146 
147  //- Stencil width
148  label w_;
149 
150 
151  // Protected Member Functions
152 
153  //- Helper function to set the blending factor
154  void setBlendingFactor();
155 
156 
157 public:
158 
159  //- Runtime type information
160  TypeName("acousticDampingSource");
161 
162 
163  // Constructors
164 
165  //- Construct from components
167  (
168  const word& name,
169  const word& modelType,
170  const dictionary& dict,
171  const fvMesh& mesh
172  );
173 
174  //- No copy construct
176 
177  //- No copy assignment
178  void operator=(const acousticDampingSource&) = delete;
179 
180 
181  //- Destructor
182  virtual ~acousticDampingSource() = default;
183 
184 
185  // Member Functions
186 
187  //- Add implicit contribution to momentum equation
188  virtual void addSup
189  (
190  fvMatrix<vector>& eqn,
191  const label fieldI
192  );
193 
194  //- Add implicit contribution to compressible momentum equation
195  virtual void addSup
196  (
197  const volScalarField& rho,
199  const label fieldI
200  );
201 
202  //- Add implicit contribution to phase momentum equation
203  virtual void addSup
204  (
205  const volScalarField& alpha,
206  const volScalarField& rho,
208  const label fieldI
209  );
210 
211 
212  //- Read dictionary
213  virtual bool read(const dictionary& dict);
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace fv
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
volFields.H
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::fv::acousticDampingSource::addSup
virtual void addSup(fvMatrix< vector > &eqn, const label fieldI)
Add implicit contribution to momentum equation.
Definition: acousticDampingSource.C:119
Foam::fv::acousticDampingSource::r2_
scalar r2_
Definition: acousticDampingSource.H:201
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::fv::acousticDampingSource::setBlendingFactor
void setBlendingFactor()
Helper function to set the blending factor.
Definition: acousticDampingSource.C:50
Foam::fv::acousticDampingSource::frequency_
dimensionedScalar frequency_
Frequency [Hz].
Definition: acousticDampingSource.H:192
Foam::fv::acousticDampingSource::URefName_
word URefName_
Name of reference velocity field.
Definition: acousticDampingSource.H:204
Foam::fv::acousticDampingSource::x0_
point x0_
Definition: acousticDampingSource.H:195
Foam::fv::acousticDampingSource::r1_
scalar r1_
Definition: acousticDampingSource.H:198
Foam::fv::acousticDampingSource::TypeName
TypeName("acousticDampingSource")
Runtime type information.
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::fv::acousticDampingSource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: acousticDampingSource.C:175
Foam::fv::acousticDampingSource::~acousticDampingSource
virtual ~acousticDampingSource()=default
Destructor.
Foam::fv::acousticDampingSource
Applies sources on velocity (i.e. U) within a specified region to enable acoustic damping.
Definition: acousticDampingSource.H:180
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< scalar >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::acousticDampingSource::operator=
void operator=(const acousticDampingSource &)=delete
No copy assignment.
fv
labelList fv(nPoints)
Foam::fv::acousticDampingSource::w_
label w_
Stencil width.
Definition: acousticDampingSource.H:207
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::acousticDampingSource::acousticDampingSource
acousticDampingSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: acousticDampingSource.C:80
Foam::Vector< scalar >
Foam::fv::acousticDampingSource::blendFactor_
volScalarField blendFactor_
Blending factor [-].
Definition: acousticDampingSource.H:189
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::GeometricField< scalar, fvPatchField, volMesh >