Loading...
Searching...
No Matches
Curle.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) 2017-2023 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::Curle
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the acoustic pressure based on Curle's analogy.
34
35 Curle's analogy is implemented as:
36
37 \f[
38 p' = \frac{1}{4 \pi}
39 \frac{\vec{r}}{| \vec{r} | ^2} \cdot
40 \left(
41 \frac{\vec{F}}{| \vec{r} |}
42 + \frac{1}{c_0}\frac{d(\vec{F})}{d(t)}
43 \right)
44 \f]
45
46 where
47 \vartable
48 p' | Curle's acoustic pressure [Pa] or [Pa (m3/kg)]
49 c_0 | Reference speed of sound [m/s]
50 \vec{r} | Distance vector to observer locations [m]
51 \vec{F} | Force [N] or [N (m3/kg)]
52 t | time [s]
53 \endvartable
54
55 Operands:
56 \table
57 Operand | Type | Location
58 input | volScalarField | <time>/inputField
59 output file | - | -
60 output field | volScalarField | <time>/outputField
61 \endtable
62
63Usage
64 Minimal example by using \c system/controlDict.functions:
65 \verbatim
66 CurleFO
67 {
68 type Curle;
69 libs (fieldFunctionObjects);
70 patches (<wordRes>); // (surface1 surface2);
71 c0 <scalar>;
72 input <word>; // point or surface
73 output <word>; // point or surface
74
75 // Optional entries
76 p <word>;
77 observerPositions (<pointList>); // ((x1 y1 z1)(x2 y2 z2) ... )
78 surface <fileName>; // inputSurface.obj
79 surfaceType <word>; // ensight, vtk, obj
80
81 // Inherited entries
82 ...
83 }
84 \endverbatim
85
86 where the entries mean:
87 \table
88 Property | Description | Type | Reqd | Deflt
89 type | Type name: Curle | word | yes | -
90 libs | Library name: fieldFunctionObjects | word | yes | -
91 p | Pressure field name | word | no | p
92 patches | Sound generation patch names | wordRes | yes | -
93 c0 | Reference speed of sound | scalar | yes | -
94 input | Input type | word | yes | -
95 output | Output type | word | yes | -
96 observerPositions | List of observer positions (x y z) | pointList | no |-
97 surface | Input surface file name | word | no | -
98 surfaceType | Output surface type | word | no | -
99 \endtable
100
101 The inherited entries are elaborated in:
102 - \link fieldExpression.H \endlink
103 - \link writeFile.H \endlink
104
105Note
106 Only the normal-pressure force is included in the force calculation.
107
108SourceFiles
109 Curle.C
110
111\*---------------------------------------------------------------------------*/
112
113#ifndef Foam_functionObjects_Curle_H
114#define Foam_functionObjects_Curle_H
115
116#include "fvMeshFunctionObject.H"
117#include "writeFile.H"
118#include "Enum.H"
119#include "MeshedSurface.H"
120#include "surfaceWriter.H"
121
122// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123
124namespace Foam
125{
126namespace functionObjects
127{
128
129/*---------------------------------------------------------------------------*\
130 Class Curle Declaration
131\*---------------------------------------------------------------------------*/
132
133class Curle
134:
136 public writeFile
137{
138 // Private Enumerations
139
140 //- Options for the mode types
141 enum class modeType
142 {
143 point,
144 surface
145 };
146
147 //- Names for modeType
148 static const Enum<modeType> modeTypeNames_;
149
150
151 // Private Data
152
153 //- Name of pressure field; default = p
154 word pName_;
155
156 //- List of patches to process
157 labelList patchIDs_;
158
159 //- Observer positions
160 List<point> observerPositions_;
161
162 //- Reference speed of sound
163 scalar c0_;
164
165 //- Output files when sampling points
166 PtrList<OFstream> rawFilePtrs_;
167
168 //- Input surface when sampling a surface
169 MeshedSurface<face> inputSurface_;
170
171 //- Ouput surface when sampling a surface
172 autoPtr<surfaceWriter> surfaceWriterPtr_;
173
174
175public:
176
177 //- Runtime type information
178 TypeName("Curle");
179
180
181 // Constructors
182
183 //- Construct from name, Time and dictionary
184 Curle
185 (
186 const word& name,
187 const Time& runTime,
188 const dictionary& dict
189 );
190
191 //- No copy construct
192 Curle(const Curle&) = delete;
193
194 //- No copy assignment
195 void operator=(const Curle&) = delete;
196
197
198 //- Destructor
199 virtual ~Curle() = default;
200
201
202 // Member Functions
203
204 //- Read the function-object dictionary
205 virtual bool read(const dictionary& dict);
206
207 //- Execute the function-object operations
208 virtual bool execute();
209
210 //- Write the function-object results
211 virtual bool write();
212};
213
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217} // End namespace functionObjects
218} // End namespace Foam
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#endif
223
224// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
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.
Computes the acoustic pressure based on Curle's analogy.
Definition Curle.H:234
void operator=(const Curle &)=delete
No copy assignment.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition Curle.C:71
TypeName("Curle")
Runtime type information.
Curle(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition Curle.C:50
virtual ~Curle()=default
Destructor.
Curle(const Curle &)=delete
No copy construct.
virtual bool execute()
Execute the function-object operations.
Definition Curle.C:183
virtual bool write()
Write the function-object results.
Definition Curle.C:258
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
vector point
Point is a vector.
Definition point.H:37
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68