proudmanAcousticPower.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) 2019-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::functionObjects::proudmanAcousticPower
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Computes the acoustic power due to the volume of isotropic turbulence
34  using Proudman's formula.
35 
36  The acoustic power, i.e. \f$ P_A \f$ [\f$W/m^3\f$], in terms of turbulent
37  kinetic energy, i.e. \f$ k \f$, and turbulent kinetic energy dissipation
38  rate, i.e. \f$ \epsilon \f$, is given as:
39 
40  \f[
41  P_A = \alpha_\epsilon \rho \epsilon M_t^5
42  \f]
43 
44  where \f$ \alpha_\epsilon = 0.1 \f$ is a constant and
45 
46  \f[
47  M_t = \frac{\sqrt{2 k}}{a_0}
48  \f]
49 
50  with \f$ a_0 \f$ the speed of sound. The acoustic power is also output in
51  dB using:
52 
53  \f[
54  L_P = 10 \log \frac{P_A}{P_{ref}}
55  \f]
56 
57  where \f$ P_{ref} = 1e^{-12} \f$ [\f$W/m^3\f$] is a constant.
58 
59  Operands:
60  \table
61  Operand | Type | Location
62  input | volScalarField | $FOAM_CASE/<time>/<inpField>
63  output file | - | -
64  output field | volScalarField | $FOAM_CASE/<time>/<outField>
65  \endtable
66 
67 Usage
68  Minimal example by using \c system/controlDict.functions:
69  \verbatim
70  proudmanAcousticPower1
71  {
72  // Mandatory entries (unmodifiable)
73  type proudmanAcousticPower;
74  libs (fieldFunctionObjects);
75 
76  // Optional entries (runtime modifiable)
77  alphaEps 0.1;
78  // For incompressible flow simulations
79  rhoInf 1.225;
80  aRef 340;
81 
82  // Optional (inherited) entries
83  ...
84  }
85  \endverbatim
86 
87  where the entries mean:
88  \table
89  Property | Description | Type | Req'd | Dflt
90  type | Type name: proudmanAcousticPower | word | yes | -
91  libs | Library name: fieldFunctionObjects | word | yes | -
92  rhoInf | Freestream density (for incompressible) | scalar <!--
93  --> | conditional | -
94  aRef | Speed of sound (incompressible) | scalar <!--
95  --> | conditional | -
96  alphaEps | Empirical model coefficient | scalar | no | 0.1
97  \endtable
98 
99  The inherited entries are elaborated in:
100  - \link functionObject.H \endlink
101 
102  Usage by the \c postProcess utility is not available.
103 
104 Note
105  The freestream density and reference speed of sound are only necessary
106  when a thermodynamics package is unavailable, typically for incompressible
107  cases.
108 
109 See also
110  - Foam::functionObject
111  - Foam::functionObjects::fvMeshFunctionObject
112  - ExtendedCodeGuide::functionObjects::field::proudmanAcousticPower
113 
114 SourceFiles
115  proudmanAcousticPower.C
116 
117 \*---------------------------------------------------------------------------*/
118 
119 #ifndef functionObjects_proudmanAcousticPower_H
120 #define functionObjects_proudmanAcousticPower_H
121 
122 #include "fvMeshFunctionObject.H"
123 #include "volFieldsFwd.H"
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 namespace Foam
128 {
129 namespace functionObjects
130 {
131 
132 /*---------------------------------------------------------------------------*\
133  Class proudmanAcousticPower Declaration
134 \*---------------------------------------------------------------------------*/
135 
136 class proudmanAcousticPower
137 :
138  public fvMeshFunctionObject
139 {
140  // Private Data
141 
142  //- Empirical model coefficient
143  scalar alphaEps_;
144 
145  //- Freestream density (incompressible calcs only)
146  dimensionedScalar rhoInf_;
147 
148  //- Reference speed of sound (incompressible calcs only)
149  dimensionedScalar aRef_;
150 
151 
152  // Private Member Functions
153 
154  //- Multiply the field by density and return
155  tmp<volScalarField> rhoScale(const tmp<volScalarField>& fld) const;
156 
157  //- Speed of sound
158  tmp<volScalarField> a() const;
159 
160 
161 public:
162 
163  //- Runtime type information
164  TypeName("proudmanAcousticPower");
165 
166 
167  // Constructors
168 
169  //- Construct from Time and dictionary
171  (
172  const word& name,
173  const Time& runTime,
174  const dictionary&
175  );
176 
177  //- No copy construct
179 
180  //- No copy assignment
181  void operator=(const proudmanAcousticPower&) = delete;
182 
183 
184  //- Destructor
185  virtual ~proudmanAcousticPower() = default;
186 
187 
188  // Member Functions
189 
190  //- Read the Proudman acoustic power data
191  virtual bool read(const dictionary&);
192 
193  //- Calculate the Proudman acoustic power
194  virtual bool execute();
195 
196  //- Write the Proudman acoustic power
197  virtual bool write();
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace functionObjects
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
volFieldsFwd.H
Foam::functionObjects::proudmanAcousticPower::execute
virtual bool execute()
Calculate the Proudman acoustic power.
Definition: proudmanAcousticPower.C:181
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
fvMeshFunctionObject.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::functionObjects::proudmanAcousticPower::write
virtual bool write()
Write the Proudman acoustic power.
Definition: proudmanAcousticPower.C:202
Foam::functionObjects::proudmanAcousticPower
Computes the acoustic power due to the volume of isotropic turbulence using Proudman's formula.
Definition: proudmanAcousticPower.H:191
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::functionObjects::proudmanAcousticPower::operator=
void operator=(const proudmanAcousticPower &)=delete
No copy assignment.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::proudmanAcousticPower::proudmanAcousticPower
proudmanAcousticPower(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
Definition: proudmanAcousticPower.C:111
Foam::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::proudmanAcousticPower::TypeName
TypeName("proudmanAcousticPower")
Runtime type information.
Foam::functionObjects::proudmanAcousticPower::~proudmanAcousticPower
virtual ~proudmanAcousticPower()=default
Destructor.
Foam::functionObjects::proudmanAcousticPower::read
virtual bool read(const dictionary &)
Read the Proudman acoustic power data.
Definition: proudmanAcousticPower.C:166