mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
faceSource: Corrected handling of totalArea in parallel
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1693
This commit is contained in:
@ -142,10 +142,12 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volume_ = volume();
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":"
|
Info<< type() << " " << name_ << ":"
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||||
<< " total cells = " << nCells_ << nl
|
<< " total cells = " << nCells_ << nl
|
||||||
<< " total volume = " << gSum(filterField(mesh().V()))
|
<< " total volume = " << volume_
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
if (dict.readIfPresent("weightField", weightFieldName_))
|
if (dict.readIfPresent("weightField", weightFieldName_))
|
||||||
@ -164,7 +166,7 @@ void Foam::fieldValues::cellSource::writeFileHeader(const label i)
|
|||||||
writeCommented(file(), "Cells : ");
|
writeCommented(file(), "Cells : ");
|
||||||
file() << nCells_ << endl;
|
file() << nCells_ << endl;
|
||||||
writeCommented(file(), "Volume : ");
|
writeCommented(file(), "Volume : ");
|
||||||
file() << volume() << endl;
|
file() << volume_ << endl;
|
||||||
|
|
||||||
writeCommented(file(), "Time");
|
writeCommented(file(), "Time");
|
||||||
if (writeVolume_)
|
if (writeVolume_)
|
||||||
@ -238,10 +240,12 @@ void Foam::fieldValues::cellSource::write()
|
|||||||
|
|
||||||
if (writeVolume_)
|
if (writeVolume_)
|
||||||
{
|
{
|
||||||
|
volume_ = volume();
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
file() << tab << volume();
|
file() << tab << volume_;
|
||||||
}
|
}
|
||||||
|
Info(log_)<< " total volume = " << volume_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fields_, i)
|
forAll(fields_, i)
|
||||||
|
|||||||
@ -192,6 +192,9 @@ protected:
|
|||||||
//- Weight field name - only used for opWeightedAverage mode
|
//- Weight field name - only used for opWeightedAverage mode
|
||||||
word weightFieldName_;
|
word weightFieldName_;
|
||||||
|
|
||||||
|
//- Volume of the cellSource
|
||||||
|
scalar volume_;
|
||||||
|
|
||||||
//- Optionally write the volume of the cellSource
|
//- Optionally write the volume of the cellSource
|
||||||
bool writeVolume_;
|
bool writeVolume_;
|
||||||
|
|
||||||
|
|||||||
@ -447,10 +447,12 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
|||||||
surfacePtr_().update();
|
surfacePtr_().update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalArea_ = totalArea();
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name_ << ":" << nl
|
||||||
<< " total faces = " << nFaces_
|
<< " total faces = " << nFaces_
|
||||||
<< nl
|
<< nl
|
||||||
<< " total area = " << totalArea()
|
<< " total area = " << totalArea_
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
if (dict.readIfPresent("weightField", weightFieldName_))
|
if (dict.readIfPresent("weightField", weightFieldName_))
|
||||||
@ -534,7 +536,7 @@ void Foam::fieldValues::faceSource::writeFileHeader(const label i)
|
|||||||
writeCommented(file(), "Faces : ");
|
writeCommented(file(), "Faces : ");
|
||||||
file() << nFaces_ << endl;
|
file() << nFaces_ << endl;
|
||||||
writeCommented(file(), "Area : ");
|
writeCommented(file(), "Area : ");
|
||||||
file() << totalArea() << endl;
|
file() << totalArea_ << endl;
|
||||||
|
|
||||||
writeCommented(file(), "Time");
|
writeCommented(file(), "Time");
|
||||||
if (writeArea_)
|
if (writeArea_)
|
||||||
@ -694,10 +696,12 @@ void Foam::fieldValues::faceSource::write()
|
|||||||
|
|
||||||
if (writeArea_)
|
if (writeArea_)
|
||||||
{
|
{
|
||||||
|
totalArea_ = totalArea();
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
file() << tab << totalArea();
|
file() << tab << totalArea_;
|
||||||
}
|
}
|
||||||
|
Info(log_)<< " total area = " << totalArea_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct weight field. Note: zero size means weight = 1
|
// construct weight field. Note: zero size means weight = 1
|
||||||
|
|||||||
@ -258,6 +258,9 @@ protected:
|
|||||||
//- Scale factor - optional
|
//- Scale factor - optional
|
||||||
scalar scaleFactor_;
|
scalar scaleFactor_;
|
||||||
|
|
||||||
|
//- Total area of the faceSource
|
||||||
|
scalar totalArea_;
|
||||||
|
|
||||||
//- Optionally write the area of the faceSource
|
//- Optionally write the area of the faceSource
|
||||||
bool writeArea_;
|
bool writeArea_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user