mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: FFT - removed power-of-2 constraint on number of samples
This commit is contained in:
@ -74,8 +74,7 @@ Usage
|
||||
}
|
||||
}
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
// Write interval for FFT data, default = 1
|
||||
|
||||
@ -72,8 +72,7 @@ surfaceNoiseCoeffs
|
||||
// Reference density (to convert from kinematic to static pressure)
|
||||
rhoRef 1.205;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096; // 8192; // 4096;
|
||||
|
||||
// Lower frequency limit, default = 25Hz
|
||||
@ -123,8 +122,7 @@ pointNoiseCoeffs
|
||||
// Reference density (to convert from kinematic to static pressure)
|
||||
rhoRef 1.2;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
// Lower frequency limit, default = 25Hz
|
||||
|
||||
@ -95,20 +95,6 @@ void Foam::fft::transform
|
||||
transformDirection dir
|
||||
)
|
||||
{
|
||||
forAll(nn, idim)
|
||||
{
|
||||
// Check for power of two
|
||||
unsigned int dimCount = nn[idim];
|
||||
if (!dimCount || (dimCount & (dimCount - 1)))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "number of elements in direction " << idim
|
||||
<< " is not a power of 2" << endl
|
||||
<< " Number of elements in each direction = " << nn
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy field into fftw containers
|
||||
const label N = field.size();
|
||||
fftw_complex in[N], out[N];
|
||||
|
||||
@ -206,16 +206,6 @@ bool Foam::noiseModel::read(const dictionary& dict)
|
||||
dict.readIfPresent("maxPressure", maxPressure_);
|
||||
dict.readIfPresent("outputPrefix", outputPrefix_);
|
||||
|
||||
// Check number of samples - must be a power of 2 for our FFT
|
||||
bool powerOf2 = ((nSamples_ != 0) && !(nSamples_ & (nSamples_ - 1)));
|
||||
if (!powerOf2)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "N: Number of samples in sampling windows must be a "
|
||||
<< "power of 2"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (fLower_ < 0)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
|
||||
@ -66,9 +66,6 @@ Description
|
||||
writeOctaves | Write octaves data | no | yes
|
||||
\endtable
|
||||
|
||||
Note
|
||||
The number of samples in the sampling window must be a power of 2
|
||||
|
||||
|
||||
SourceFiles
|
||||
noiseModel.C
|
||||
|
||||
@ -33,8 +33,7 @@ Description
|
||||
// Pressure reference
|
||||
pRef 0;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
// Lower frequency bounds
|
||||
|
||||
@ -33,8 +33,7 @@ Description
|
||||
// Pressure reference
|
||||
pRef 0;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
// Lower frequency bounds
|
||||
|
||||
@ -45,7 +45,7 @@ pointNoiseCoeffs
|
||||
separator " ";
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
rhoRef 1.205;
|
||||
|
||||
@ -56,7 +56,7 @@ surfaceNoiseCoeffs
|
||||
p Curle;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// default = 2^16 (=65536)
|
||||
N 1024;
|
||||
|
||||
rhoRef 1.205;
|
||||
|
||||
Reference in New Issue
Block a user