Loading...
Searching...
No Matches
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
35 Operands:
36 \table
37 Operand | Type | Location
38 input | - | -
39 output file | dat | <time>/energySpectrum.dat
40 output field | - | -
41 \endtable
42
43Usage
44 Minimal example by using \c system/controlDict.functions:
45 \verbatim
46 energySpectrumFO
47 {
48 // Mandatory entries
49 type energySpectrum;
50 libs (fieldFunctionObjects);
51
52 // Optional entries
53 U <word>;
54
55 // Inherited entries
56 ...
57 }
58 \endverbatim
59
60 where the entries mean:
61 \table
62 Property | Description | Type | Reqd | Deflt
63 type | Type name: energySpectrum | word | yes | -
64 libs | Library name: fieldFunctionObjects | word | yes | -
65 U | Name of the velocity field | word | no | U
66 \endtable
67
68 The inherited entries are elaborated in:
69 - \link functionObject.H \endlink
70 - \link writeFile.H \endlink
71 - \link populationBalanceModel.H \endlink
72
73SourceFiles
74 energySpectrum.C
75
76\*---------------------------------------------------------------------------*/
77
78#ifndef Foam_functionObjects_energySpectrum_H
79#define Foam_functionObjects_energySpectrum_H
80
82#include "writeFile.H"
83#include "Vector.H"
84#include "vectorField.H"
85
86// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87
88namespace Foam
89{
90namespace functionObjects
91{
92
93/*---------------------------------------------------------------------------*\
94 Class energySpectrum Declaration
95\*---------------------------------------------------------------------------*/
96
98:
100 public writeFile
101{
102protected:
103
104 // Protected Data
105
106 //- I-J-K mesh addressing
108
109 //- Name of velocity field, default = U
110 word UName_;
111
112 //- Number of cells in I-J-K directions
113 Vector<int> N_;
114
115 //- Reference point
116 vector c0_;
117
118 //- Cell length scale
120
121 //- Wave number
122 scalar kappaNorm_;
123
124
125 // Protected Member Functions
126
127 //- Output file header information
128 virtual void writeFileHeader(Ostream& os);
129
130 //- Calculate and write the spectrum
133 const vectorField& U,
134 const vectorField& C,
135 const vector& c0,
136 const vector& deltaC,
137 const Vector<int>& N,
138 const scalar kappaNorm
139 );
140
141 //- No copy construct
142 energySpectrum(const energySpectrum&) = delete;
143
144 //- No copy assignment
145 void operator=(const energySpectrum&) = delete;
146
147
148public:
150 //- Runtime type information
151 TypeName("energySpectrum");
152
153
154 // Constructors
155
156 //- Construct from name, Time and dictionary
158 (
159 const word& name,
160 const Time& runTime,
161 const dictionary& dict
162 );
163
165 //- Destructor
166 virtual ~energySpectrum() = default;
167
168
169 // Member Functions
170
171 //- Read the function-object dictionary
172 virtual bool read(const dictionary&);
173
174 //- Execute the function-object operations
175 virtual bool execute();
176
177 //- Write the function-object results
178 virtual bool write();
179};
180
181
182// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183
184} // End namespace functionObjects
185} // End namespace Foam
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189#endif
190
191// ************************************************************************* //
Graphite solid properties.
Definition C.H:49
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition Vector.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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< 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 the function-object operations.
virtual bool write()
Write the function-object results.
virtual ~energySpectrum()=default
Destructor.
TypeName("energySpectrum")
Runtime type information.
virtual bool read(const dictionary &)
Read the function-object dictionary.
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
U
Definition pEqn.H:72
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
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
Field< vector > vectorField
Specialisation of Field<T> for vector.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
Vector< scalar > vector
Definition vector.H:57
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
const Vector< label > N(dict.get< Vector< label > >("N"))