Skip to content
Snippets Groups Projects
Commit 83a874cd authored by Henry Weller's avatar Henry Weller
Browse files

functionObjects::volRegion: Improved parallel efficiency

Based on patch contributed by Kevin Nordin-Bates
Resolves bug-report https://bugs.openfoam.org/view.php?id=2401
parent 6cae0fda
Branches
Tags
No related merge requests found
......@@ -84,52 +84,52 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
{
case opSum:
{
result = sum(values);
result = gSum(values);
break;
}
case opSumMag:
{
result = sum(cmptMag(values));
result = gSum(cmptMag(values));
break;
}
case opAverage:
{
result = sum(values)/values.size();
result = gSum(values)/nCells();
break;
}
case opWeightedAverage:
{
result = sum(weightField*values)/sum(weightField);
result = gSum(weightField*values)/gSum(weightField);
break;
}
case opVolAverage:
{
result = sum(V*values)/sum(V);
result = gSum(V*values)/this->V();
break;
}
case opWeightedVolAverage:
{
result = sum(weightField*V*values)/sum(weightField*V);
result = gSum(weightField*V*values)/gSum(weightField*V);
break;
}
case opVolIntegrate:
{
result = sum(V*values);
result = gSum(V*values);
break;
}
case opMin:
{
result = min(values);
result = gMin(values);
break;
}
case opMax:
{
result = max(values);
result = gMax(values);
break;
}
case opCoV:
{
Type meanValue = sum(values*V)/sum(V);
Type meanValue = gSum(values*V)/this->V();
const label nComp = pTraits<Type>::nComponents;
......@@ -139,7 +139,7 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
scalar mean = component(meanValue, d);
scalar& res = setComponent(result, d);
res = sqrt(sum(V*sqr(vals - mean))/sum(V))/mean;
res = sqrt(gSum(V*sqr(vals - mean))/this->V())/mean;
}
break;
......@@ -173,15 +173,10 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
weightField = setFieldValues<scalar>(weightFieldName_, true);
}
// Combine onto master
combineFields(values);
combineFields(V);
combineFields(weightField);
Type result = processValues(values, V, weightField);
if (Pstream::master())
{
Type result = processValues(values, V, weightField);
// Add to result dictionary, over-writing any previous entry
resultDict_.add(fieldName, result, true);
......
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