Refactor MPI version of convergenceReduction().

This commit is contained in:
Atgeirr Flø Rasmussen
2015-10-01 11:05:35 +02:00
parent d29ee6967c
commit 39a0766b8c

View File

@@ -2330,9 +2330,8 @@ namespace detail {
auto nc_and_pv_containers = std::make_tuple(v, geo_.poreVolume());
info.computeReduction(nc_and_pv_containers, nc_and_pv_operators, nc_and_pv);
for ( int idx=0; idx<MaxNumPhases; ++idx )
for ( int idx = 0; idx < nm; ++idx )
{
if (active_[idx]) {
auto values = std::tuple<double,double,double>(0.0 ,0.0 ,0.0);
auto containers = std::make_tuple(B.col(idx),
tempV.col(idx),
@@ -2344,18 +2343,15 @@ namespace detail {
B_avg[idx] = std::get<0>(values)/std::get<0>(nc_and_pv);
maxCoeff[idx] = std::get<1>(values);
R_sum[idx] = std::get<2>(values);
assert(nm >= np);
if (idx < np) {
maxNormWell[idx] = 0.0;
for ( int w=0; w<nw; ++w )
{
for ( int w = 0; w < nw; ++w ) {
maxNormWell[idx] = std::max(maxNormWell[idx], std::abs(residual_.well_flux_eq.value()[nw*idx + w]));
}
}
else
{
maxNormWell[idx] = R_sum[idx] = B_avg[idx] = maxCoeff[idx] = 0.0;
}
}
info.communicator().max(&maxNormWell[0], MaxNumPhases);
info.communicator().max(maxNormWell.data(), np);
// Compute pore volume
return std::get<1>(nc_and_pv);
}
@@ -2405,8 +2401,6 @@ namespace detail {
const V pv = geo_.poreVolume();
const std::vector<PhasePresence> cond = phaseCondition();
std::vector<double> R_sum(nm);
std::vector<double> B_avg(nm);
std::vector<double> maxCoeff(nm);