Loading...
Searching...
No Matches
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-2021 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::functionObjects::proudmanAcousticPower
28
29Group
30 grpFieldFunctionObjects
31
32Description
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 | <time>/inputField
63 output file | - | -
64 output field | volScalarField | <time>/outputField
65 \endtable
66
67Usage
68 Minimal example by using \c system/controlDict.functions:
69 \verbatim
70 proudmanAcousticPowerFO
71 {
72 // Mandatory entries
73 type proudmanAcousticPower;
74 libs (fieldFunctionObjects);
75
76 // Optional entries
77 alphaEps <scalar>;
78 // For incompressible flow simulations
79 rhoInf <scalar>;
80 aRef <scalar>;
81 // Turbulence field names (if not retrieved from the turb model)
82 k <word>;
83 epsilon <word>;
84 omega <word>;
85
86 // Inherited entries
87 ...
88 }
89 \endverbatim
90
91 where the entries mean:
92 \table
93 Property | Description | Type | Reqd | Deflt
94 type | Type name: proudmanAcousticPower | word | yes | -
95 libs | Library name: fieldFunctionObjects | word | yes | -
96 rhoInf | Freestream density (for incompressible) | scalar <!--
97 --> | conditional | -
98 aRef | Speed of sound (incompressible) | scalar <!--
99 --> | conditional | -
100 alphaEps | Empirical model coefficient | scalar | no | 0.1
101 k | Turbulence k field name | word | no | none
102 epsilon | Turbulence epsilon field name | word | no | none
103 omega | Turbulence omega field name | word | no | none
104 \endtable
105
106 The inherited entries are elaborated in:
107 - \link functionObject.H \endlink
108
109Note
110 The freestream density and reference speed of sound are only necessary
111 when a thermodynamics package is unavailable, typically for incompressible
112 cases.
113
114SourceFiles
115 proudmanAcousticPower.C
116
117\*---------------------------------------------------------------------------*/
118
119#ifndef Foam_functionObjects_proudmanAcousticPower_H
120#define Foam_functionObjects_proudmanAcousticPower_H
121
122#include "fvMeshFunctionObject.H"
123#include "volFieldsFwd.H"
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127namespace Foam
128{
129namespace functionObjects
130{
131
132/*---------------------------------------------------------------------------*\
133 Class proudmanAcousticPower Declaration
134\*---------------------------------------------------------------------------*/
135
137:
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 //- Name of turbulence k field; default = none
152 word kName_;
153
154 //- Name of turbulence epsilon field; default = none
155 word epsilonName_;
156
157 //- Name of turbulence omega field; default = none
158 word omegaName_;
159
160
161 // Private Member Functions
162
163 //- Multiply the field by density and return
164 tmp<volScalarField> rhoScale(const tmp<volScalarField>& fld) const;
165
166 //- Speed of sound
167 tmp<volScalarField> a() const;
168
169 //- Turbulence kinetic energy dissipation rate
170 tmp<volScalarField> k() const;
171
172 //- Turbulence dissipation
173 tmp<volScalarField> epsilon() const;
174
175
176public:
177
178 //- Runtime type information
179 TypeName("proudmanAcousticPower");
180
181
182 // Constructors
183
184 //- Construct from name, Time and dictionary
186 (
187 const word& name,
188 const Time& runTime,
189 const dictionary&
190 );
191
192 //- No copy construct
194
195 //- No copy assignment
196 void operator=(const proudmanAcousticPower&) = delete;
197
198
199 //- Destructor
200 virtual ~proudmanAcousticPower() = default;
201
202
203 // Member Functions
204
205 //- Read the function-object dictionary
206 virtual bool read(const dictionary& dict);
207
208 //- Execute the function-object operations
209 virtual bool execute();
210
211 //- Write the function-object results
212 virtual bool write();
213};
214
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218} // End namespace functionObjects
219} // End namespace Foam
220
221// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222
223#endif
224
225// ************************************************************************* //
label k
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Computes the acoustic power due to the volume of isotropic turbulence using Proudman's formula.
proudmanAcousticPower(const proudmanAcousticPower &)=delete
No copy construct.
virtual ~proudmanAcousticPower()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
void operator=(const proudmanAcousticPower &)=delete
No copy assignment.
proudmanAcousticPower(const word &name, const Time &runTime, const dictionary &)
Construct from name, Time and dictionary.
virtual bool execute()
Execute the function-object operations.
TypeName("proudmanAcousticPower")
Runtime type information.
virtual bool write()
Write the function-object results.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
scalar epsilon
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
Forwards and collection of common volume field types.