mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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,20 +942,33 @@ void Foam::streamLineBase::write()
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
OFstream(vectorVtkFile)()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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", vtkFile);
|
||||
propsDict.add("file", vectorVtkFile);
|
||||
const word& fieldName = vectorNames_[nameI];
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::updateMesh(const mapPolyMesh&)
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
{
|
||||
writeSampleFile
|
||||
fileName sampleFile;
|
||||
if (Pstream::master())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user