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
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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 (Pstream::master())
|
||||||
{
|
{
|
||||||
if (bounds_ != boundBox::greatBox)
|
if (bounds_ != boundBox::greatBox)
|
||||||
@ -873,7 +877,7 @@ void Foam::streamLineBase::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName vtkFile
|
scalarVtkFile = fileName
|
||||||
(
|
(
|
||||||
vtkPath
|
vtkPath
|
||||||
/ scalarFormatterPtr_().getFileName
|
/ scalarFormatterPtr_().getFileName
|
||||||
@ -884,7 +888,7 @@ void Foam::streamLineBase::write()
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (log_) Info
|
if (log_) Info
|
||||||
<< " Writing data to " << vtkFile.path() << endl;
|
<< " Writing data to " << scalarVtkFile.path() << endl;
|
||||||
|
|
||||||
scalarFormatterPtr_().write
|
scalarFormatterPtr_().write
|
||||||
(
|
(
|
||||||
@ -892,16 +896,8 @@ void Foam::streamLineBase::write()
|
|||||||
tracks,
|
tracks,
|
||||||
scalarNames_,
|
scalarNames_,
|
||||||
scalarValues,
|
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
|
// Convert vector values
|
||||||
@ -927,7 +923,7 @@ void Foam::streamLineBase::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName vtkFile
|
vectorVtkFile = fileName
|
||||||
(
|
(
|
||||||
vtkPath
|
vtkPath
|
||||||
/ vectorFormatterPtr_().getFileName
|
/ 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
|
vectorFormatterPtr_().write
|
||||||
(
|
(
|
||||||
@ -945,18 +942,31 @@ void Foam::streamLineBase::write()
|
|||||||
tracks,
|
tracks,
|
||||||
vectorNames_,
|
vectorNames_,
|
||||||
vectorValues,
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -227,8 +227,9 @@ class sampledSets
|
|||||||
PtrList<volFieldSampler<T>>& masterFields
|
PtrList<volFieldSampler<T>>& masterFields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Write set on master, return fileName
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void writeSampleFile
|
fileName writeSampleFile
|
||||||
(
|
(
|
||||||
const coordSet& masterSampleSet,
|
const coordSet& masterSampleSet,
|
||||||
const PtrList<volFieldSampler<Type>>& masterFields,
|
const PtrList<volFieldSampler<Type>>& masterFields,
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -122,7 +122,7 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::sampledSets::writeSampleFile
|
Foam::fileName Foam::sampledSets::writeSampleFile
|
||||||
(
|
(
|
||||||
const coordSet& masterSampleSet,
|
const coordSet& masterSampleSet,
|
||||||
const PtrList<volFieldSampler<Type>>& masterFields,
|
const PtrList<volFieldSampler<Type>>& masterFields,
|
||||||
@ -155,20 +155,14 @@ void Foam::sampledSets::writeSampleFile
|
|||||||
valueSets,
|
valueSets,
|
||||||
ofs
|
ofs
|
||||||
);
|
);
|
||||||
|
return fName;
|
||||||
forAll(masterFields, fieldi)
|
|
||||||
{
|
|
||||||
dictionary propsDict;
|
|
||||||
propsDict.add("file", fName);
|
|
||||||
const word& fieldName = masterFields[fieldi].name();
|
|
||||||
setProperty(fieldName, propsDict);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "File " << ofs.name() << " could not be opened. "
|
<< "File " << ofs.name() << " could not be opened. "
|
||||||
<< "No data will be written" << endl;
|
<< "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());
|
PtrList<volFieldSampler<Type>> masterFields(sampledFields.size());
|
||||||
combineSampledValues(sampledFields, indexSets_, masterFields);
|
combineSampledValues(sampledFields, indexSets_, masterFields);
|
||||||
|
|
||||||
if (Pstream::master())
|
forAll(masterSampledSets_, setI)
|
||||||
{
|
{
|
||||||
forAll(masterSampledSets_, setI)
|
fileName sampleFile;
|
||||||
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writeSampleFile
|
sampleFile = writeSampleFile
|
||||||
(
|
(
|
||||||
masterSampledSets_[setI],
|
masterSampledSets_[setI],
|
||||||
masterFields,
|
masterFields,
|
||||||
@ -339,6 +334,18 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
|
|||||||
fields.formatter()
|
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
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,6 +49,9 @@ void Foam::sampledSurfaces::writeSurface
|
|||||||
gatheredValues[Pstream::myProcNo()] = values;
|
gatheredValues[Pstream::myProcNo()] = values;
|
||||||
Pstream::gatherList(gatheredValues);
|
Pstream::gatherList(gatheredValues);
|
||||||
|
|
||||||
|
|
||||||
|
fileName sampleFile;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// Combine values into single field
|
// Combine values into single field
|
||||||
@ -72,7 +75,7 @@ void Foam::sampledSurfaces::writeSurface
|
|||||||
// skip surface without faces (eg, a failed cut-plane)
|
// skip surface without faces (eg, a failed cut-plane)
|
||||||
if (mergeList_[surfI].faces.size())
|
if (mergeList_[surfI].faces.size())
|
||||||
{
|
{
|
||||||
fileName fName = formatter_->write
|
sampleFile = formatter_->write
|
||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
s.name(),
|
s.name(),
|
||||||
@ -82,12 +85,16 @@ void Foam::sampledSurfaces::writeSurface
|
|||||||
allValues,
|
allValues,
|
||||||
s.interpolate()
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user