Set and communicate ALQ properly in parallel.

This commit is contained in:
Atgeirr Flø Rasmussen 2020-11-16 10:36:44 +01:00
parent 8716dbfcfd
commit 69d04b7000
2 changed files with 18 additions and 1 deletions

View File

@ -1347,6 +1347,16 @@ namespace Opm {
// We use the rates from the privious time-step to reduce oscilations // We use the rates from the privious time-step to reduce oscilations
WellGroupHelpers::updateWellRates(fieldGroup, schedule(), reportStepIdx, previous_well_state_, well_state_); WellGroupHelpers::updateWellRates(fieldGroup, schedule(), reportStepIdx, previous_well_state_, well_state_);
// Set ALQ for off-process wells to zero
for (const auto& wname : schedule().wellNames(reportStepIdx)) {
const bool is_producer = schedule().getWell(wname, reportStepIdx).isProducer();
const bool not_on_this_process = well_state_.wellMap().count(wname) == 0;
if (is_producer && not_on_this_process) {
well_state_.setALQ(wname, 0.0);
}
}
well_state_.communicateGroupRates(comm); well_state_.communicateGroupRates(comm);
// compute wsolvent fraction for REIN wells // compute wsolvent fraction for REIN wells

View File

@ -1042,7 +1042,7 @@ namespace Opm
iterateContainer(injection_group_reduction_rates, func); iterateContainer(injection_group_reduction_rates, func);
iterateContainer(injection_group_reservoir_rates, func); iterateContainer(injection_group_reservoir_rates, func);
iterateContainer(production_group_rates, func); iterateContainer(production_group_rates, func);
iterateContainer(well_rates,func); iterateContainer(well_rates, func);
}; };
// Compute the size of the data. // Compute the size of the data.
@ -1052,6 +1052,7 @@ namespace Opm
}; };
forAllGroupData(computeSize); forAllGroupData(computeSize);
sz += injection_group_vrep_rates.size(); sz += injection_group_vrep_rates.size();
sz += current_alq_.size();
// Make a vector and collect all data into it. // Make a vector and collect all data into it.
std::vector<double> data(sz); std::vector<double> data(sz);
@ -1065,6 +1066,9 @@ namespace Opm
for (const auto& x : injection_group_vrep_rates) { for (const auto& x : injection_group_vrep_rates) {
data[pos++] = x.second; data[pos++] = x.second;
} }
for (const auto& x : current_alq_) {
data[pos++] = x.second;
}
assert(pos == sz); assert(pos == sz);
// Communicate it with a single sum() call. // Communicate it with a single sum() call.
@ -1081,6 +1085,9 @@ namespace Opm
for (auto& x : injection_group_vrep_rates) { for (auto& x : injection_group_vrep_rates) {
x.second = data[pos++]; x.second = data[pos++];
} }
for (auto& x : current_alq_) {
x.second = data[pos++];
}
assert(pos == sz); assert(pos == sz);
} }