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) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -778,6 +778,10 @@ void Foam::streamLineBase::write()
}
// Note: filenames scattered below since used in global call
fileName scalarVtkFile;
fileName vectorVtkFile;
if (Pstream::master())
{
if (bounds_ != boundBox::greatBox)
@ -873,7 +877,7 @@ void Foam::streamLineBase::write()
}
}
fileName vtkFile
scalarVtkFile = fileName
(
vtkPath
/ scalarFormatterPtr_().getFileName
@ -884,7 +888,7 @@ void Foam::streamLineBase::write()
);
if (log_) Info
<< " Writing data to " << vtkFile.path() << endl;
<< " Writing data to " << scalarVtkFile.path() << endl;
scalarFormatterPtr_().write
(
@ -892,16 +896,8 @@ void Foam::streamLineBase::write()
tracks,
scalarNames_,
scalarValues,
OFstream(vtkFile)()
OFstream(scalarVtkFile)()
);
forAll(scalarNames_, nameI)
{
dictionary propsDict;
propsDict.add("file", vtkFile);
const word& fieldName = scalarNames_[nameI];
setProperty(fieldName, propsDict);
}
}
// Convert vector values
@ -927,7 +923,7 @@ void Foam::streamLineBase::write()
}
}
fileName vtkFile
vectorVtkFile = fileName
(
vtkPath
/ vectorFormatterPtr_().getFileName
@ -937,7 +933,8 @@ void Foam::streamLineBase::write()
)
);
//if (log_) Info<< " Writing vector data to " << vtkFile << endl;
//if (log_) Info<< " Writing vector data to "
// << vectorVtkFile << endl;
vectorFormatterPtr_().write
(
@ -945,18 +942,31 @@ void Foam::streamLineBase::write()
tracks,
vectorNames_,
vectorValues,
OFstream(vtkFile)()
OFstream(vectorVtkFile)()
);
forAll(vectorNames_, nameI)
{
dictionary propsDict;
propsDict.add("file", vtkFile);
const word& fieldName = vectorNames_[nameI];
setProperty(fieldName, propsDict);
}
}
}
// fileNames are generated on the master but setProperty needs to
// be across all procs
Pstream::scatter(scalarVtkFile);
forAll(scalarNames_, nameI)
{
dictionary propsDict;
propsDict.add("file", scalarVtkFile);
const word& fieldName = scalarNames_[nameI];
setProperty(fieldName, propsDict);
}
Pstream::scatter(vectorVtkFile);
forAll(vectorNames_, nameI)
{
dictionary propsDict;
propsDict.add("file", vectorVtkFile);
const word& fieldName = vectorNames_[nameI];
setProperty(fieldName, propsDict);
}
}
}