mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1010 from blattms/ebos-parallel-convergence
Switch off non-owner entries during accumulation in getConvergence
This commit is contained in:
commit
029bc6daa7
@ -774,11 +774,23 @@ namespace Opm {
|
|||||||
R_sum.resize(np);
|
R_sum.resize(np);
|
||||||
maxNormWell.resize(np);
|
maxNormWell.resize(np);
|
||||||
|
|
||||||
|
const std::vector<double>* mask = nullptr;
|
||||||
|
|
||||||
|
#if HAVE_MPI
|
||||||
|
if ( comm.size() > 1 )
|
||||||
|
{
|
||||||
|
// mask[c] is 1 if we need to compute something in parallel
|
||||||
|
const auto & pinfo =
|
||||||
|
boost::any_cast<const ParallelISTLInformation&>(istlSolver().parallelInformation());
|
||||||
|
mask = &pinfo.updateOwnerMask( B[ 0 ] );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// computation
|
// computation
|
||||||
for ( int idx = 0; idx < np; ++idx )
|
for ( int idx = 0; idx < np; ++idx )
|
||||||
{
|
{
|
||||||
B_avg[idx] = std::accumulate( B[ idx ].begin(), B[ idx ].end(), 0.0 ) / double(ncGlobal);
|
B_avg[idx] = accumulateMaskedValues(B[ idx ], mask) / double(ncGlobal);
|
||||||
R_sum[idx] = std::accumulate( R[ idx ].begin(), R[ idx ].end(), 0.0 );
|
R_sum[idx] = accumulateMaskedValues(R[ idx ], mask);
|
||||||
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);
|
||||||
@ -790,8 +802,8 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute total pore volume
|
// Compute total pore volume (use only owned entries)
|
||||||
double pvSum = std::accumulate(pv.begin(), pv.end(), 0.0);
|
double pvSum = accumulateMaskedValues(pv, mask);
|
||||||
|
|
||||||
if( comm.size() > 1 )
|
if( comm.size() > 1 )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user