mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: noiseModel updates. Fixes #2263
- updated safeLog10 - returns -GREAT instead of zero - enabled reference for dB calc to be user defined Cross reference exchange platform 1689
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -141,7 +141,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
tmp<scalarField> safeLog10(const scalarField& fld)
|
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();
|
auto& result = tresult.ref();
|
||||||
|
|
||||||
forAll(result, i)
|
forAll(result, i)
|
||||||
@ -594,6 +594,7 @@ Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
|
|||||||
windowModelPtr_(),
|
windowModelPtr_(),
|
||||||
graphFormat_("raw"),
|
graphFormat_("raw"),
|
||||||
SPLweighting_(weightingType::none),
|
SPLweighting_(weightingType::none),
|
||||||
|
dBRef_(2e-5),
|
||||||
minPressure_(-0.5*VGREAT),
|
minPressure_(-0.5*VGREAT),
|
||||||
maxPressure_(0.5*VGREAT),
|
maxPressure_(0.5*VGREAT),
|
||||||
outputPrefix_(),
|
outputPrefix_(),
|
||||||
@ -663,6 +664,11 @@ bool Foam::noiseModel::read(const dictionary& dict)
|
|||||||
|
|
||||||
Info<< " Weighting: " << weightingTypeNames_[SPLweighting_] << endl;
|
Info<< " Weighting: " << weightingTypeNames_[SPLweighting_] << endl;
|
||||||
|
|
||||||
|
if (dict.readIfPresent("dBRef", dBRef_))
|
||||||
|
{
|
||||||
|
Info<< " Reference for dB calculation: " << dBRef_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
Info<< " Write options:" << endl;
|
Info<< " Write options:" << endl;
|
||||||
dictionary optDict(dict.subOrEmptyDict("writeOptions"));
|
dictionary optDict(dict.subOrEmptyDict("writeOptions"));
|
||||||
readWriteOption(optDict, "writePrmsf", writePrmsf_);
|
readWriteOption(optDict, "writePrmsf", writePrmsf_);
|
||||||
@ -708,7 +714,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseModel::PSD
|
|||||||
const scalarField& PSDf
|
const scalarField& PSDf
|
||||||
) const
|
) 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 scalar f
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(2e-5)));
|
tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(dBRef_)));
|
||||||
scalarField& spl = tspl.ref();
|
scalarField& spl = tspl.ref();
|
||||||
|
|
||||||
switch (SPLweighting_)
|
switch (SPLweighting_)
|
||||||
@ -765,7 +771,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseModel::SPL
|
|||||||
const scalarField& f
|
const scalarField& f
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(2e-5)));
|
tmp<scalarField> tspl(10*safeLog10(Prms2/sqr(dBRef_)));
|
||||||
scalarField& spl = tspl.ref();
|
scalarField& spl = tspl.ref();
|
||||||
|
|
||||||
switch (SPLweighting_)
|
switch (SPLweighting_)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,6 +63,7 @@ Description
|
|||||||
startTime | Start time | no | 0
|
startTime | Start time | no | 0
|
||||||
outputPrefix | Prefix applied to output files| no | ''
|
outputPrefix | Prefix applied to output files| no | ''
|
||||||
SPLweighting | Weighting: dBA, dBB, dBC, DBD | no | none
|
SPLweighting | Weighting: dBA, dBB, dBC, DBD | no | none
|
||||||
|
dBRef | Reference for dB calculation | no | 2e-5
|
||||||
graphFormat | Graph format | no | raw
|
graphFormat | Graph format | no | raw
|
||||||
writePrmsf | Write Prmsf data | no | yes
|
writePrmsf | Write Prmsf data | no | yes
|
||||||
writeSPL | Write SPL data | no | yes
|
writeSPL | Write SPL data | no | yes
|
||||||
@ -178,6 +179,9 @@ protected:
|
|||||||
//- Weighting
|
//- Weighting
|
||||||
weightingType SPLweighting_;
|
weightingType SPLweighting_;
|
||||||
|
|
||||||
|
//- Reference for dB calculation, default = 2e-5
|
||||||
|
scalar dBRef_;
|
||||||
|
|
||||||
|
|
||||||
// Data validation
|
// Data validation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user