Commit 2fe94812 authored by Andrew Heather's avatar Andrew Heather Committed by Mark Olesen
Browse files

BUG: ParticleCollector - corrected and simplified parallel reductions. See #2184

parent 76270c07
......@@ -419,8 +419,6 @@ void Foam::ParticleCollector<CloudType>::write()
massTotal_[facei] += mass_[facei];
}
const label proci = Pstream::myProcNo();
Info<< type() << " output:" << nl;
Field<scalar> faceMassTotal(mass_.size(), Zero);
......@@ -434,15 +432,11 @@ void Foam::ParticleCollector<CloudType>::write()
scalar sumAverageMFR = 0.0;
forAll(faces_, facei)
{
scalarList allProcMass(Pstream::nProcs());
allProcMass[proci] = massTotal_[facei];
Pstream::gatherList(allProcMass);
faceMassTotal[facei] += sum(allProcMass);
scalarList allProcMassFlowRate(Pstream::nProcs());
allProcMassFlowRate[proci] = massFlowRate_[facei];
Pstream::gatherList(allProcMassFlowRate);
faceMassFlowRate[facei] += sum(allProcMassFlowRate);
faceMassTotal[facei] +=
returnReduce(massTotal_[facei], sumOp<scalar>());
faceMassFlowRate[facei] +=
returnReduce(massFlowRate_[facei], sumOp<scalar>());
sumTotalMass += faceMassTotal[facei];
sumAverageMFR += faceMassFlowRate[facei];
......
Markdown is supported
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