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  ComplexField(U.primitiveField(), vector::zero),
45  K.nn()
46  )*recRootN,
47  K
48  );
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 } // End namespace Foam
55 
56 // ************************************************************************* //
dimensionedScalar sqrt(const dimensionedScalar &ds)
CGAL::Exact_predicates_exact_constructions_kernel K
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
complexField ComplexField(const UList< scalar > &realValues, const UList< scalar > &imagValues)
Create complex field by zipping two lists of real/imag values.
Definition: complexField.C:150
graph calcEk(const volVectorField &U, const Kmesh &K)
Definition: calcEk.C:27
Calculate the wavenumber vector field corresponding to the space vector field of a finite volume mesh...
Definition: Kmesh.H:47
Integrate a multi-dimensional complexVectorField in k-shells to create the 1D.
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const UList< int > &nn)
Definition: fft.C:236
graph kShellIntegration(const complexVectorField &Ek, const Kmesh &K)
U
Definition: pEqn.H:72
Namespace for OpenFOAM.