energySpectrum.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) 2018-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::functionObjects::energySpectrum
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Calculates the energy spectrum for a structured IJK mesh
34
35Usage
36 Example of function object specification:
37 \verbatim
38 energySpectrum1
39 {
40 type energySpectrum;
41 libs (fieldFunctionObjects);
42 ...
43 log yes;
44 }
45 \endverbatim
46
47 Where the entries comprise:
48 \table
49 Property | Description | Required | Default value
50 type | type name: energySpectrum | yes |
51 log | write info to standard output | no | yes
52 \endtable
53
54 Output data is written to the file <timeDir>/energySpectrum.dat
55
56See also
57 Foam::functionObjects::fvMeshFunctionObject
58 Foam::functionObjects::writeFile
59
60SourceFiles
61 energySpectrum.C
62 energySpectrumTemplates.C
63
64\*---------------------------------------------------------------------------*/
65
66#ifndef functionObjects_energySpectrum_H
67#define functionObjects_energySpectrum_H
68
70#include "writeFile.H"
71#include "Vector.H"
72#include "vectorField.H"
73
74// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75
76namespace Foam
77{
78namespace functionObjects
79{
80
81/*---------------------------------------------------------------------------*\
82 Class energySpectrum Declaration
83\*---------------------------------------------------------------------------*/
84
85class energySpectrum
86:
87 public fvMeshFunctionObject,
88 public writeFile
89{
90protected:
91
92 // Protected data
93
94 //- I-J-K mesh addressing
96
97 //- Name of velocity field, default = U
98 word UName_;
100 //- Number of cells in I-J-K directions
102
103 //- Reference point
104 vector c0_;
105
106 //- Cell length scale
108
109 //- Wave number
110 scalar kappaNorm_;
111
113 // Protected Member Functions
114
116 //- Output file header information
117 virtual void writeFileHeader(Ostream& os);
119 //- Calculate and write the spectrum
122 const vectorField& U,
123 const vectorField& C,
124 const vector& c0,
125 const vector& deltaC,
126 const Vector<int>& N,
127 const scalar kappaNorm
128 );
129
130 //- No copy construct
131 energySpectrum(const energySpectrum&) = delete;
132
133 //- No copy assignment
134 void operator=(const energySpectrum&) = delete;
135
136
137public:
138
139 //- Runtime type information
140 TypeName("energySpectrum");
141
142
143 // Constructors
144
145 //- Construct from Time and dictionary
147 (
148 const word& name,
149 const Time& runTime,
150 const dictionary& dict
151 );
152
153
154 //- Destructor
155 virtual ~energySpectrum() = default;
156
157
158 // Member Functions
159
160 //- Read the field min/max data
161 virtual bool read(const dictionary&);
162
163 //- Execute, currently does nothing
164 virtual bool execute();
165
166 //- Write the energySpectrum
167 virtual bool write();
168};
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173} // End namespace functionObjects
174} // End namespace Foam
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178#endif
179
180// ************************************************************************* //
Graphite solid properties.
Definition: C.H:53
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Calculates the energy spectrum for a structured IJK mesh.
labelList cellAddr_
I-J-K mesh addressing.
word UName_
Name of velocity field, default = U.
void calcAndWriteSpectrum(const vectorField &U, const vectorField &C, const vector &c0, const vector &deltaC, const Vector< int > &N, const scalar kappaNorm)
Calculate and write the spectrum.
vector deltaC_
Cell length scale.
Vector< int > N_
Number of cells in I-J-K directions.
energySpectrum(const energySpectrum &)=delete
No copy construct.
virtual void writeFileHeader(Ostream &os)
Output file header information.
void operator=(const energySpectrum &)=delete
No copy assignment.
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Write the energySpectrum.
virtual ~energySpectrum()=default
Destructor.
TypeName("energySpectrum")
Runtime type information.
virtual bool read(const dictionary &)
Read the field min/max data.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
const Vector< label > N(dict.get< Vector< label > >("N"))