Correctly compute maximum in a parallel flow_ebos run.

This commit is contained in:
Markus Blatt
2017-04-12 13:12:36 +02:00
parent f88e527a0c
commit b72a167c76

View File

@@ -791,6 +791,8 @@ namespace Opm {
#if HAVE_MPI
if ( comm.size() > 1 )
{
// Initialize maxCoeff with minimum.
std::fill(maxCoeff.begin(), maxCoeff.end(), std::numeric_limits<Scalar>::lowest());
// mask[c] is 1 if we need to compute something in parallel
const auto & pinfo =
boost::any_cast<const ParallelISTLInformation&>(istlSolver().parallelInformation());
@@ -803,7 +805,22 @@ namespace Opm {
{
B_avg[idx] = accumulateMaskedValues(B[ idx ], mask) / double(ncGlobal);
R_sum[idx] = accumulateMaskedValues(R[ idx ], mask);
if(comm.size()>1)
{
auto mi = mask->begin();
for(auto elem = tempV[idx].begin(), end = tempV[idx].end(); elem != end; ++elem, ++mi)
{
if ( *mi )
{
maxCoeff[idx] = std::max( maxCoeff[idx], *elem);
}
}
}
else
{
maxCoeff[idx] = *(std::max_element( tempV[ idx ].begin(), tempV[ idx ].end() ));
}
assert(np >= np);
if (idx < np) {