Commit 7edfb4d0 authored by Henry's avatar Henry
Browse files

faceSource: Corrected handling of totalArea in parallel

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1693
parent b5d3f85b
......@@ -142,10 +142,12 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
return;
}
volume_ = volume();
Info<< type() << " " << name_ << ":"
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " total cells = " << nCells_ << nl
<< " total volume = " << gSum(filterField(mesh().V()))
<< " total volume = " << volume_
<< nl << endl;
if (dict.readIfPresent("weightField", weightFieldName_))
......@@ -164,7 +166,7 @@ void Foam::fieldValues::cellSource::writeFileHeader(const label i)
writeCommented(file(), "Cells : ");
file() << nCells_ << endl;
writeCommented(file(), "Volume : ");
file() << volume() << endl;
file() << volume_ << endl;
writeCommented(file(), "Time");
if (writeVolume_)
......@@ -238,10 +240,12 @@ void Foam::fieldValues::cellSource::write()
if (writeVolume_)
{
volume_ = volume();
if (Pstream::master())
{
file() << tab << volume();
file() << tab << volume_;
}
Info(log_)<< " total volume = " << volume_ << endl;
}
forAll(fields_, i)
......
......@@ -192,6 +192,9 @@ protected:
//- Weight field name - only used for opWeightedAverage mode
word weightFieldName_;
//- Volume of the cellSource
scalar volume_;
//- Optionally write the volume of the cellSource
bool writeVolume_;
......
......@@ -447,10 +447,12 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
surfacePtr_().update();
}
totalArea_ = totalArea();
Info<< type() << " " << name_ << ":" << nl
<< " total faces = " << nFaces_
<< nl
<< " total area = " << totalArea()
<< " total area = " << totalArea_
<< nl;
if (dict.readIfPresent("weightField", weightFieldName_))
......@@ -534,7 +536,7 @@ void Foam::fieldValues::faceSource::writeFileHeader(const label i)
writeCommented(file(), "Faces : ");
file() << nFaces_ << endl;
writeCommented(file(), "Area : ");
file() << totalArea() << endl;
file() << totalArea_ << endl;
writeCommented(file(), "Time");
if (writeArea_)
......@@ -694,10 +696,12 @@ void Foam::fieldValues::faceSource::write()
if (writeArea_)
{
totalArea_ = totalArea();
if (Pstream::master())
{
file() << tab << totalArea();
file() << tab << totalArea_;
}
Info(log_)<< " total area = " << totalArea_ << endl;
}
// construct weight field. Note: zero size means weight = 1
......
......@@ -258,6 +258,9 @@ protected:
//- Scale factor - optional
scalar scaleFactor_;
//- Total area of the faceSource
scalar totalArea_;
//- Optionally write the area of the faceSource
bool writeArea_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment