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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::fv::acousticDampingSource
28
29Group
30 grpFvOptionsSources
31
32Description
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
46Usage
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
96SourceFiles
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
109namespace Foam
110{
111
112class porosityModel;
113
114namespace fv
115{
116
117/*---------------------------------------------------------------------------*\
118 Class acousticDampingSource Declaration
119\*---------------------------------------------------------------------------*/
120
121class acousticDampingSource
122:
123 public fv::cellSetOption
124{
125protected:
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
157public:
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
175 acousticDampingSource(const acousticDampingSource&) = delete;
176
177 //- No copy assignment
178 void operator=(const acousticDampingSource&) = delete;
179
181 //- Destructor
182 virtual ~acousticDampingSource() = default;
183
184
185 // Member Functions
186
187 //- Add implicit contribution to momentum equation
188 virtual void addSup
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 );
202 //- Add implicit contribution to phase momentum equation
203 virtual void addSup
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// ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Applies sources on velocity (i.e. U) within a specified region to enable acoustic damping.
volScalarField blendFactor_
Blending factor [-].
void operator=(const acousticDampingSource &)=delete
No copy assignment.
acousticDampingSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual bool read(const dictionary &dict)
Read dictionary.
word URefName_
Name of reference velocity field.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldI)
Add implicit contribution to momentum equation.
TypeName("acousticDampingSource")
Runtime type information.
virtual ~acousticDampingSource()=default
Destructor.
void setBlendingFactor()
Helper function to set the blending factor.
dimensionedScalar frequency_
Frequency [Hz].
acousticDampingSource(const acousticDampingSource &)=delete
No copy construct.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
vector point
Point is a vector.
Definition: point.H:43
labelList fv(nPoints)
volScalarField & alpha
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73