Make the parallel reduction when applying the Wells.

The B matrix is basically a component-wise multiplication
with a vector followed by a parallel reduction. We do that
reduction to all ranks computing for the well to save the
broadcast when applying C^T.
This commit is contained in:
Markus Blatt
2020-10-09 15:09:28 +02:00
parent 3996967344
commit 8ee58096ba
11 changed files with 188 additions and 13 deletions

View File

@@ -217,11 +217,23 @@ namespace Opm {
template<typename TypeTag>
std::vector< Well >
BlackoilWellModel<TypeTag>::
getLocalNonshutWells(const int timeStepIdx, int& globalNumWells) const
getLocalNonshutWells(const int timeStepIdx, int& globalNumWells)
{
auto w = schedule().getWells(timeStepIdx);
globalNumWells = w.size();
w.erase(std::remove_if(w.begin(), w.end(), is_shut_or_defunct_), w.end());
local_parallel_well_info_.clear();
local_parallel_well_info_.reserve(w.size());
for (const auto& well : w)
{
auto wellPair = std::make_pair(well.name(), true);
auto pwell = std::lower_bound(parallel_well_info_.begin(),
parallel_well_info_.end(),
wellPair);
assert(pwell != parallel_well_info_.end() &&
*pwell == wellPair);
local_parallel_well_info_.push_back(&(*pwell));
}
return w;
}
@@ -802,6 +814,7 @@ namespace Opm {
const auto& perf_data = this->well_perf_data_[wellID];
return std::make_unique<WellType>(this->wells_ecl_[wellID],
*local_parallel_well_info_[wellID],
time_step,
this->param_,
*this->rateConverter_,