BUG: streamlines: failure on muttley, not on local machine.

The problem was the demand-loading of the functionObjectProperties
IOdictionary which can cause parallel communication (if timeStampMaster
it scatters the headerOk status). So call setProperty on all processors!
Fixes #118.
This commit is contained in:
mattijs
2016-06-15 15:48:38 +01:00
parent 3732d5a9cb
commit 3819cf1659
4 changed files with 69 additions and 44 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -227,8 +227,9 @@ class sampledSets
PtrList<volFieldSampler<T>>& masterFields
);
//- Write set on master, return fileName
template<class Type>
void writeSampleFile
fileName writeSampleFile
(
const coordSet& masterSampleSet,
const PtrList<volFieldSampler<Type>>& masterFields,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -122,7 +122,7 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
template<class Type>
void Foam::sampledSets::writeSampleFile
Foam::fileName Foam::sampledSets::writeSampleFile
(
const coordSet& masterSampleSet,
const PtrList<volFieldSampler<Type>>& masterFields,
@ -155,20 +155,14 @@ void Foam::sampledSets::writeSampleFile
valueSets,
ofs
);
forAll(masterFields, fieldi)
{
dictionary propsDict;
propsDict.add("file", fName);
const word& fieldName = masterFields[fieldi].name();
setProperty(fieldName, propsDict);
}
return fName;
}
else
{
WarningInFunction
<< "File " << ofs.name() << " could not be opened. "
<< "No data will be written" << endl;
return fileName::null;
}
}
@ -326,11 +320,12 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
PtrList<volFieldSampler<Type>> masterFields(sampledFields.size());
combineSampledValues(sampledFields, indexSets_, masterFields);
if (Pstream::master())
forAll(masterSampledSets_, setI)
{
forAll(masterSampledSets_, setI)
fileName sampleFile;
if (Pstream::master())
{
writeSampleFile
sampleFile = writeSampleFile
(
masterSampledSets_[setI],
masterFields,
@ -339,6 +334,18 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
fields.formatter()
);
}
Pstream::scatter(sampleFile);
if (sampleFile.size())
{
forAll(masterFields, fieldi)
{
dictionary propsDict;
propsDict.add("file", sampleFile);
const word& fieldName = masterFields[fieldi].name();
setProperty(fieldName, propsDict);
}
}
}
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,6 +49,9 @@ void Foam::sampledSurfaces::writeSurface
gatheredValues[Pstream::myProcNo()] = values;
Pstream::gatherList(gatheredValues);
fileName sampleFile;
if (Pstream::master())
{
// Combine values into single field
@ -72,7 +75,7 @@ void Foam::sampledSurfaces::writeSurface
// skip surface without faces (eg, a failed cut-plane)
if (mergeList_[surfI].faces.size())
{
fileName fName = formatter_->write
sampleFile = formatter_->write
(
outputDir,
s.name(),
@ -82,12 +85,16 @@ void Foam::sampledSurfaces::writeSurface
allValues,
s.interpolate()
);
dictionary propsDict;
propsDict.add("file", fName);
setProperty(fieldName, propsDict);
}
}
Pstream::scatter(sampleFile);
if (sampleFile.size())
{
dictionary propsDict;
propsDict.add("file", sampleFile);
setProperty(fieldName, propsDict);
}
}
else
{