ENH: surfaceNoise - only write on the master process

This commit is contained in:
Andrew Heather 2018-04-17 16:00:03 +01:00
parent a230e8d408
commit a1b4b20bf4
2 changed files with 95 additions and 56 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,6 +44,9 @@ void Foam::noiseModel::readWriteOption
{ {
dict.readIfPresent(lookup, option); dict.readIfPresent(lookup, option);
// Only writing on the master process
option = option && Pstream::master();
if (option) if (option)
{ {
Info<< " " << lookup << ": " << "yes" << endl; Info<< " " << lookup << ": " << "yes" << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -679,6 +679,8 @@ void surfaceNoise::calculate()
} }
} }
if (Pstream::master())
{
graph Prmsfg graph Prmsfg
( (
"Average Prms(f)", "Average Prms(f)",
@ -687,7 +689,12 @@ void surfaceNoise::calculate()
fOut, fOut,
PrmsfAve PrmsfAve
); );
Prmsfg.write(outDir, graph::wordify(Prmsfg.title()), graphFormat_); Prmsfg.write
(
outDir,
graph::wordify(Prmsfg.title()),
graphFormat_
);
graph PSDfg graph PSDfg
( (
@ -697,7 +704,12 @@ void surfaceNoise::calculate()
fOut, fOut,
PSDfAve PSDfAve
); );
PSDfg.write(outDir, graph::wordify(PSDfg.title()), graphFormat_); PSDfg.write
(
outDir,
graph::wordify(PSDfg.title()),
graphFormat_
);
graph PSDg graph PSDg
( (
@ -707,7 +719,12 @@ void surfaceNoise::calculate()
fOut, fOut,
noiseFFT::PSD(PSDfAve) noiseFFT::PSD(PSDfAve)
); );
PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_); PSDg.write
(
outDir,
graph::wordify(PSDg.title()),
graphFormat_
);
graph SPLg graph SPLg
( (
@ -717,7 +734,13 @@ void surfaceNoise::calculate()
fOut, fOut,
noiseFFT::SPL(PSDfAve*deltaf) noiseFFT::SPL(PSDfAve*deltaf)
); );
SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_); SPLg.write
(
outDir,
graph::wordify(SPLg.title()),
graphFormat_
);
}
} }
@ -765,6 +788,8 @@ void surfaceNoise::calculate()
surfaceAverage(surfPrms13f2[i], procFaceOffset); surfaceAverage(surfPrms13f2[i], procFaceOffset);
} }
if (Pstream::master())
{
graph PSD13g graph PSD13g
( (
"Average PSD13_dB_Hz(fm)", "Average PSD13_dB_Hz(fm)",
@ -773,7 +798,12 @@ void surfaceNoise::calculate()
octave13FreqCentre, octave13FreqCentre,
noiseFFT::PSD(PSDfAve) noiseFFT::PSD(PSDfAve)
); );
PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_); PSD13g.write
(
outDir,
graph::wordify(PSD13g.title()),
graphFormat_
);
graph SPL13g graph SPL13g
( (
@ -783,7 +813,13 @@ void surfaceNoise::calculate()
octave13FreqCentre, octave13FreqCentre,
noiseFFT::SPL(Prms13f2Ave) noiseFFT::SPL(Prms13f2Ave)
); );
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_); SPL13g.write
(
outDir,
graph::wordify(SPL13g.title()),
graphFormat_
);
}
} }
} }
} }