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 -------------------------------------------------------------------------------
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::energySpectrum
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Calculates the energy spectrum for a structured IJK mesh
34 
35 Usage
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 
56 See also
57  Foam::functionObjects::fvMeshFunctionObject
58  Foam::functionObjects::writeFile
59 
60 SourceFiles
61  energySpectrum.C
62  energySpectrumTemplates.C
63 
64 \*---------------------------------------------------------------------------*/
65 
66 #ifndef functionObjects_energySpectrum_H
67 #define functionObjects_energySpectrum_H
68 
69 #include "fvMeshFunctionObject.H"
70 #include "writeFile.H"
71 #include "Vector.H"
72 #include "vectorField.H"
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 namespace Foam
77 {
78 namespace functionObjects
79 {
80 
81 /*---------------------------------------------------------------------------*\
82  Class energySpectrum Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class energySpectrum
86 :
87  public fvMeshFunctionObject,
88  public writeFile
89 {
90 protected:
91 
92  // Protected data
93 
94  //- I-J-K mesh addressing
96 
97  //- Name of velocity field, default = U
98  word UName_;
99 
100  //- Number of cells in I-J-K directions
101  Vector<int> N_;
102 
103  //- Reference point
104  vector c0_;
105 
106  //- Cell length scale
107  vector deltaC_;
108 
109  //- Wave number
110  scalar kappaNorm_;
111 
112 
113  // Protected Member Functions
114 
115 
116  //- Output file header information
117  virtual void writeFileHeader(Ostream& os);
118 
119  //- Calculate and write the spectrum
121  (
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 
137 public:
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 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace functionObjects
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::functionObjects::energySpectrum::operator=
void operator=(const energySpectrum &)=delete
No copy assignment.
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
runTime
engineTime & runTime
Definition: createEngineTime.H:13
writeFile.H
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:65
Foam::functionObjects::energySpectrum::calcAndWriteSpectrum
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.
Definition: energySpectrum.C:62
fvMeshFunctionObject.H
Foam::functionObjects::energySpectrum::UName_
word UName_
Name of velocity field, default = U.
Definition: energySpectrum.H:112
Foam::functionObjects::energySpectrum::deltaC_
vector deltaC_
Cell length scale.
Definition: energySpectrum.H:121
Foam::functionObjects::energySpectrum::read
virtual bool read(const dictionary &)
Read the field min/max data.
Definition: energySpectrum.C:143
Vector.H
Foam::functionObjects::energySpectrum
Calculates the energy spectrum for a structured IJK mesh.
Definition: energySpectrum.H:99
Foam::functionObjects::energySpectrum::kappaNorm_
scalar kappaNorm_
Wave number.
Definition: energySpectrum.H:124
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::functionObjects::energySpectrum::N_
Vector< int > N_
Number of cells in I-J-K directions.
Definition: energySpectrum.H:115
Foam::functionObjects::energySpectrum::execute
virtual bool execute()
Execute, currently does nothing.
Definition: energySpectrum.C:210
Foam::functionObjects::energySpectrum::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: energySpectrum.C:51
Foam::Field< vector >
Foam::functionObjects::energySpectrum::~energySpectrum
virtual ~energySpectrum()=default
Destructor.
Foam::functionObjects::energySpectrum::TypeName
TypeName("energySpectrum")
Runtime type information.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::energySpectrum::energySpectrum
energySpectrum(const energySpectrum &)=delete
No copy construct.
Foam::functionObjects::energySpectrum::write
virtual bool write()
Write the energySpectrum.
Definition: energySpectrum.C:216
Foam::functionObjects::energySpectrum::cellAddr_
labelList cellAddr_
I-J-K mesh addressing.
Definition: energySpectrum.H:109
U
U
Definition: pEqn.H:72
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::Vector< int >
Foam::List< label >
vectorField.H
Foam::functionObjects::energySpectrum::c0_
vector c0_
Reference point.
Definition: energySpectrum.H:118
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
N
const Vector< label > N(dict.get< Vector< label >>("N"))
Foam::C
Graphite solid properties.
Definition: C.H:50