These new names are more consistent and logical because:
primitiveField():
primitiveFieldRef():
Provides low-level access to the Field<Type> (primitive field)
without dimension or mesh-consistency checking. This should only be
used in the low-level functions where dimensional consistency is
ensured by careful programming and computational efficiency is
paramount.
internalField():
internalFieldRef():
Provides access to the DimensionedField<Type, GeoMesh> of values on
the internal mesh-type for which the GeometricField is defined and
supports dimension and checking and mesh-consistency checking.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/*======================================================================*/
|
|
|
|
// This routine evaluates q(k) (McComb, p61) by summing all wavevectors
|
|
// in a k-shell. Then we divide through by the volume of the box
|
|
// - to be accurate, by the volume of the ellipsoid enclosing the
|
|
// box (assume cells even in each direction). Finally, multiply the
|
|
// q(k) values by k^2 to give the full power spectrum E(k). Integrating
|
|
// this over the whole range gives the energy in turbulence.
|
|
|
|
/*======================================================================*/
|
|
|
|
#include "calcEk.H"
|
|
#include "fft.H"
|
|
#include "Kmesh.H"
|
|
#include "kShellIntegration.H"
|
|
#include "volFields.H"
|
|
#include "graph.H"
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
namespace Foam
|
|
{
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
graph calcEk
|
|
(
|
|
const volVectorField& U,
|
|
const Kmesh& K
|
|
)
|
|
{
|
|
return kShellIntegration
|
|
(
|
|
fft::forwardTransform
|
|
(
|
|
ReComplexField(U.primitiveField()),
|
|
K.nn()
|
|
),
|
|
K
|
|
);
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
} // End namespace Foam
|
|
|
|
// ************************************************************************* //
|