mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
using new constant definitions
This commit is contained in:
@ -27,7 +27,7 @@ License
|
||||
#include "Kmesh.H"
|
||||
#include "polyMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "mathConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -57,14 +57,11 @@ Foam::Kmesh::Kmesh(const fvMesh& mesh)
|
||||
vectorField(mesh.V().size()),
|
||||
NN(vector::dim)
|
||||
{
|
||||
const scalar pi = mathematicalConstant::pi;
|
||||
const scalar twoPi = 2.0*pi;
|
||||
|
||||
boundBox box = mesh.bounds();
|
||||
L = box.span();
|
||||
|
||||
vector cornerCellCentre = ::Foam::max(mesh.C().internalField());
|
||||
vector cellL = 2 * (box.max() - cornerCellCentre);
|
||||
vector cellL = 2*(box.max() - cornerCellCentre);
|
||||
|
||||
vector rdeltaByL;
|
||||
label nTot = 1;
|
||||
@ -92,15 +89,15 @@ Foam::Kmesh::Kmesh(const fvMesh& mesh)
|
||||
|
||||
for (i=0; i<NN[0]; i++)
|
||||
{
|
||||
scalar k1 = (i - NN[0]/2)*twoPi/L[0];
|
||||
scalar k1 = (i - NN[0]/2)*constant::math::twoPi/L[0];
|
||||
|
||||
for (label j=0; j<NN[1]; j++)
|
||||
{
|
||||
scalar k2 = (j - NN[1]/2)*twoPi/L[1];
|
||||
scalar k2 = (j - NN[1]/2)*constant::math::twoPi/L[1];
|
||||
|
||||
for (label k=0; k<NN[2]; k++)
|
||||
{
|
||||
scalar k3 = (k - NN[2]/2)*twoPi/L[2];
|
||||
scalar k3 = (k - NN[2]/2)*constant::math::twoPi/L[2];
|
||||
|
||||
(*this)[rep(i, j, k, NN)] = vector(k1, k2, k3);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "kShellIntegration.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "mathConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,12 +51,12 @@ graph kShellIntegration
|
||||
// spectra E(k). int E(k) dk is now the total energy in a box
|
||||
// of side 2pi
|
||||
|
||||
y *= sqr(x)*4.0*mathematicalConstant::pi;
|
||||
y *= sqr(x)*4.0*constant::math::pi;
|
||||
|
||||
// now scale this to get the energy in a box of side l0
|
||||
|
||||
scalar l0(K.sizeOfBox()[0]*(scalar(K.nn()[0])/(scalar(K.nn()[0])-1.0)));
|
||||
scalar factor = pow((l0/(2.0*mathematicalConstant::pi)),3.0);
|
||||
scalar l0(K.sizeOfBox()[0]*(scalar(K.nn()[0])/(scalar(K.nn()[0]) - 1.0)));
|
||||
scalar factor = pow3(l0/constant::math::twoPi);
|
||||
|
||||
y *= factor;
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "IFstream.H"
|
||||
#include "DynamicList.H"
|
||||
#include "fft.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "mathConstants.H"
|
||||
#include "SubField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * //
|
||||
@ -170,7 +170,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Hanning(const label N) const
|
||||
|
||||
scalar T = N*deltat_;
|
||||
|
||||
return 2*(0.5 - 0.5*cos(2*mathematicalConstant::pi*t/T));
|
||||
return 2*(0.5 - 0.5*cos(constant::math::twoPi*t/T));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "Kmesh.H"
|
||||
#include "primitiveFields.H"
|
||||
#include "Ek.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "mathConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,8 +53,6 @@ turbGen::turbGen(const Kmesh& k, const scalar EA, const scalar K0)
|
||||
// generate and return a velocity field
|
||||
vectorField turbGen::U()
|
||||
{
|
||||
scalar pi2=2*mathematicalConstant::pi;
|
||||
|
||||
vectorField s(K.size());
|
||||
scalarField rndPhases(K.size());
|
||||
|
||||
@ -69,11 +67,13 @@ vectorField turbGen::U()
|
||||
|
||||
s = Ek(Ea, k0, mag(K))*s;
|
||||
|
||||
complexVectorField up = fft::reverseTransform
|
||||
(
|
||||
ComplexField(cos(pi2*rndPhases)*s, sin(pi2*rndPhases)*s),
|
||||
K.nn()
|
||||
);
|
||||
complexVectorField up =
|
||||
fft::reverseTransform
|
||||
(
|
||||
ComplexField(cos(constant::math::twoPi*rndPhases)*s,
|
||||
sin(constant::math::twoPi*rndPhases)*s),
|
||||
K.nn()
|
||||
);
|
||||
|
||||
return ReImSum(up);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user