63 <<
"Cannot read file " << pFileName
69 scalar dummyt, dummyp;
71 for (
label i=0; i<skip; i++)
75 if (!pFile.
good() || pFile.
eof())
78 <<
"Number of points in file " << pFileName
79 <<
" is less than the number to be skipped = " << skip
91 while (!(pFile >> t).eof())
97 deltat_ =
T/pData.
size();
123 label windowOffset = N;
125 if ((N + ni*windowOffset) > size())
128 <<
"Requested window is outside set of data" <<
endl
129 <<
"number of data = " << size() <<
endl
130 <<
"size of window = " << N <<
endl
142 pw[i] = operator[](i +
offset);
157 scalar
T = N*deltat_;
191 Pn *= 2.0/
sqrt(scalar(tPn2().size()));
207 <<
"Requested window is outside set of data" <<
nl
208 <<
"number of data = " << size() <<
nl
209 <<
"size of window = " << N <<
nl
218 for (
label wi=0; wi<nw; ++wi)
220 MeanPf += Pf(Hwf*window(N, wi));
226 scalar deltaf = 1.0/(N*deltat_);
246 <<
"Requested window is outside set of data" <<
endl
247 <<
"number of data = " << size() <<
endl
248 <<
"size of window = " << N <<
endl
257 for (
label wi=0; wi<nw; ++wi)
259 RMSMeanPf +=
sqr(Pf(Hwf*window(N, wi)));
262 RMSMeanPf =
sqrt(RMSMeanPf/nw);
265 scalar deltaf = 1.0/(N*deltat_);
298 scalar fratio =
cbrt(2.0);
299 scalar deltaf = 1.0/(2*Lf.
size()*deltat_);
301 scalar fl = f1/
sqrt(fratio);
302 scalar fu = fratio*fl;
309 scalar fmi =
sqrt(fu*fl);
311 if (fmi > fU + 1)
break;
316 ldelta[j] = 10*
log10(ldelta[j]);
324 ldelta[j] +=
pow(10, Lf[i]/10.0);
347 scalar fratio =
cbrt(2.0);
348 scalar deltaf = 1.0/(2*Pf.
size()*deltat_);
350 scalar fl = f1/
sqrt(fratio);
351 scalar fu = fratio*fl;
353 label istart =
label(fl/deltaf + 1.0 - small);
358 scalar fmi =
sqrt(fu*fl);
360 if (fmi > fU + 1)
break;
365 pdelta[j] =
sqrt((2.0/3.0)*pdelta[j]);
373 pdelta[j] +=
sqr(Pf[i]);
391 lsum +=
pow(10, Lf[i]/10.0);
394 lsum = 10*
log10(lsum);
402 return p0*
pow(10.0, db/20.0);
411 return p0*
pow(10.0, db/20.0);
#define forAll(list, i)
Loop across all elements in list.
tmp< Field< scalar > > T() const
Return the field transpose (only defined for second rank tensors)
bool good() const
Return true if next operation might succeed.
bool eof() const
Return true if end of input seen.
void transfer(List< scalar > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
An ordered pair of two objects of type <T> with first() and second() elements.
const Type & second() const
Return second.
const Type & first() const
Return first.
Pre-declare related SubField type.
static tmp< complexField > reverseTransform(const tmp< complexField > &field, const labelList &nn)
A class for handling file names.
noiseFFT(const scalar deltat, const scalarField &pressure)
Construct from pressure field.
static scalar p0
Reference pressure.
Pair< scalarField > Ldelta(const Pair< scalarField > &gLf, const scalar f1, const scalar fU) const
Return the one-third-octave-band PFL spectrum.
Pair< scalarField > pt() const
Return p(t)
Pair< scalarField > RMSmeanPf(const label N, const label nw) const
Return the multi-window RMS mean fft of the complete pressure data.
scalar Lsum(const Pair< scalarField > &gLf) const
Return the total PFL as the sum of Lf over all frequencies.
Pair< scalarField > Pdelta(const Pair< scalarField > &gLf, const scalar f1, const scalar fU) const
Return the one-third-octave-band pressure spectrum.
Pair< scalarField > meanPf(const label N, const label nw) const
Return the multi-window mean fft of the complete pressure data.
tmp< scalarField > Hanning(const label N) const
Return the Hanning window function.
scalar dbToPa(const scalar db) const
Convert the db into Pa.
Pair< scalarField > Lf(const Pair< scalarField > &gPf) const
Return the narrow-band PFL (pressure-fluctuation level) spectrum.
tmp< scalarField > window(const label N, const label n) const
Return the nth window.
tmp< scalarField > Pf(const tmp< scalarField > &pn) const
Return the fft of the given pressure data.
A class for managing temporary objects.
void clear() const
If object pointer points to valid object:
T & ref() const
Return non-const reference or generate a fatal error.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar e
Elementary charge.
const scalar twoPi(2 *pi)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar log10(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar sqrt(const dimensionedScalar &ds)
complexField ReComplexField(const UList< scalar > &sf)
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar cbrt(const dimensionedScalar &ds)
void offset(label &lst, const label o)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar cos(const dimensionedScalar &ds)