calcEk.C
Go to the documentation of this file.
1 /*======================================================================*/
2 
3 // This routine evaluates q(k) (McComb, p61) by summing all wavevectors
4 // in a k-shell. Then we divide through by the volume of the box
5 // - to be accurate, by the volume of the ellipsoid enclosing the
6 // box (assume cells even in each direction). Finally, multiply the
7 // q(k) values by k^2 to give the full power spectrum E(k). Integrating
8 // this over the whole range gives the energy in turbulence.
9 
10 /*======================================================================*/
11 
12 #include "calcEk.H"
13 #include "fft.H"
14 #include "Kmesh.H"
15 #include "kShellIntegration.H"
16 #include "volFields.H"
17 #include "graph.H"
18 
19 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
20 
21 namespace Foam
22 {
23 
24 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
25 
26 graph calcEk
27 (
28  const volVectorField& U,
29  const Kmesh& K
30 )
31 {
32  label ntot = 1;
33  forAll(K.nn(), idim)
34  {
35  ntot *= K.nn()[idim];
36  }
37 
38  scalar recRootN = 1.0/sqrt(scalar(ntot));
39 
40  return kShellIntegration
41  (
43  (
44  ReComplexField(U.primitiveField()),
45  K.nn()
46  )*recRootN,
47  K
48  );
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 } // End namespace Foam
55 
56 // ************************************************************************* //
volFields.H
Kmesh.H
Foam::calcEk
graph calcEk(const volVectorField &U, const Kmesh &K)
Definition: calcEk.C:27
Foam::Kmesh
Calculate the wavenumber vector field corresponding to the space vector field of a finite volume mesh...
Definition: Kmesh.H:51
calcEk.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
Foam::ReComplexField
complexField ReComplexField(const UList< scalar > &re)
Create complex field from a list of real (using imag == 0)
Definition: complexField.C:118
kShellIntegration.H
Integrate a multi-dimensional complexVectorField in k-shells to create the 1D.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
U
U
Definition: pEqn.H:72
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::fft::forwardTransform
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const UList< int > &nn)
Definition: fft.C:243
graph.H
Foam::kShellIntegration
graph kShellIntegration(const complexVectorField &Ek, const Kmesh &K)
Definition: kShellIntegration.C:34
fft.H
Foam::GeometricField< vector, fvPatchField, volMesh >