diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C index b7e16296222255b1aebd2949b01b5122a10f8b2f..744ce0d2befe0e57be6ee1f2f3015cf00cd759a0 100644 --- a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C +++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -141,7 +141,7 @@ namespace Foam { tmp<scalarField> safeLog10(const scalarField& fld) { - auto tresult = tmp<scalarField>::New(fld.size(), Zero); + auto tresult = tmp<scalarField>::New(fld.size(), -GREAT); auto& result = tresult.ref(); forAll(result, i) @@ -594,6 +594,7 @@ Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields) windowModelPtr_(), graphFormat_("raw"), SPLweighting_(weightingType::none), + dBRef_(2e-5), minPressure_(-0.5*VGREAT), maxPressure_(0.5*VGREAT), outputPrefix_(), @@ -663,6 +664,11 @@ bool Foam::noiseModel::read(const dictionary& dict) Info<< " Weighting: " << weightingTypeNames_[SPLweighting_] << endl; + if (dict.readIfPresent("dBRef", dBRef_)) + { + Info<< " Reference for dB calculation: " << dBRef_ << endl; + } + Info<< " Write options:" << endl; dictionary optDict(dict.subOrEmptyDict("writeOptions")); readWriteOption(optDict, "writePrmsf", writePrmsf_); @@ -708,7 +714,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseModel::PSD const scalarField& PSDf ) const { - return 10*safeLog10(PSDf/sqr(2e-5)); + return 10*safeLog10(PSDf/sqr(dBRef_)); } @@ -718,7 +724,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseModel::SPL const scalar f ) const { - tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(2e-5))); + tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(dBRef_))); scalarField& spl = tspl.ref(); switch (SPLweighting_) @@ -765,7 +771,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseModel::SPL const scalarField& f ) const { - tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(2e-5))); + tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(dBRef_))); scalarField& spl = tspl.ref(); switch (SPLweighting_) diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H index af26b9ba953d85bbd95d58cb7e0903a730b10f3e..254373cc73c20ebfe3ff5ebd3d41ff1cfb511a12 100644 --- a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H +++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,6 +63,7 @@ Description startTime | Start time | no | 0 outputPrefix | Prefix applied to output files| no | '' SPLweighting | Weighting: dBA, dBB, dBC, DBD | no | none + dBRef | Reference for dB calculation | no | 2e-5 graphFormat | Graph format | no | raw writePrmsf | Write Prmsf data | no | yes writeSPL | Write SPL data | no | yes @@ -178,6 +179,9 @@ protected: //- Weighting weightingType SPLweighting_; + //- Reference for dB calculation, default = 2e-5 + scalar dBRef_; + // Data validation