writeEk.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "writeEk.H"
27 #include "fft.H"
28 #include "kShellIntegration.H"
29 #include "volFields.H"
30 #include "setWriter.H"
31 #include "writeFile.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 void writeEk
41 (
42  const volVectorField& U,
43  const Kmesh& K
44 )
45 {
46  const Pair<scalarField> Ek
47  (
49  (
51  (
52  ReComplexField(U.primitiveField()),
53  K.nn()
54  ),
55  K
56  )
57  );
58 
59  autoPtr<setWriter> writer
60  (
61  setWriter::New(U.time().controlDict().lookup("graphFormat"))
62  );
63 
64  writer->write
65  (
66  U.time().path()
68  /"graphs"
69  /U.time().name(),
70  "Ek",
71  coordSet(true,"k", Ek.first()),
72  "E(k)",
73  Ek.second()
74  );
75 }
76 
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 } // End namespace Foam
81 
82 // ************************************************************************* //
Generic GeometricField class.
Calculate the wavenumber vector field corresponding to the space vector field of a finite volume mesh...
Definition: Kmesh.H:52
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Holds list of sampling positions.
Definition: coordSet.H:51
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const labelList &nn)
Definition: fft.C:187
static const word outputPrefix
Directory prefix.
Definition: writeFile.H:72
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
Definition: setWriter.C:286
Integrate a multi-dimensional complexVectorField in k-shells to create the 1D.
K
Definition: pEqn.H:75
U
Definition: pEqn.H:72
Namespace for OpenFOAM.
Pair< scalarField > kShellIntegration(const complexVectorField &Ek, const Kmesh &K)
complexField ReComplexField(const UList< scalar > &sf)
Definition: complexFields.C:56
tmp< scalarField > Ek(const scalar Ea, const scalar k0, const scalarField &k)
Definition: Ek.H:10
void writeEk(const volVectorField &U, const Kmesh &K)
Definition: writeEk.C:41
This function evaluates q(k) (McComb, p61) by summing all wavevectors in a k-shell....