mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Correctly compute maximum in a parallel flow_ebos run.
This commit is contained in:
@@ -791,6 +791,8 @@ namespace Opm {
|
|||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
if ( comm.size() > 1 )
|
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
|
// mask[c] is 1 if we need to compute something in parallel
|
||||||
const auto & pinfo =
|
const auto & pinfo =
|
||||||
boost::any_cast<const ParallelISTLInformation&>(istlSolver().parallelInformation());
|
boost::any_cast<const ParallelISTLInformation&>(istlSolver().parallelInformation());
|
||||||
@@ -803,7 +805,22 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
B_avg[idx] = accumulateMaskedValues(B[ idx ], mask) / double(ncGlobal);
|
B_avg[idx] = accumulateMaskedValues(B[ idx ], mask) / double(ncGlobal);
|
||||||
R_sum[idx] = accumulateMaskedValues(R[ idx ], mask);
|
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() ));
|
maxCoeff[idx] = *(std::max_element( tempV[ idx ].begin(), tempV[ idx ].end() ));
|
||||||
|
}
|
||||||
|
|
||||||
assert(np >= np);
|
assert(np >= np);
|
||||||
if (idx < np) {
|
if (idx < np) {
|
||||||
|
|||||||
Reference in New Issue
Block a user