Change to msim: set rates explicitly to zero for closed wells

This commit is contained in:
Joakim Hove 2020-09-09 16:42:19 +02:00
parent eb5787fd54
commit 8c2d74f348

View File

@ -159,15 +159,17 @@ void msim::simulate(const Schedule& schedule, const SummaryState& st, data::Solu
for (const auto& well_pair : this->well_rates) { for (const auto& well_pair : this->well_rates) {
const std::string& well_name = well_pair.first; const std::string& well_name = well_pair.first;
const auto& sched_well = schedule.getWell(well_name, report_step); const auto& sched_well = schedule.getWell(well_name, report_step);
if (sched_well.getStatus() != Well::Status::OPEN) bool well_open = (sched_well.getStatus() == Well::Status::OPEN);
continue;
data::Well& well = well_data[well_name]; data::Well& well = well_data[well_name];
for (const auto& rate_pair : well_pair.second) { for (const auto& rate_pair : well_pair.second) {
auto rate = rate_pair.first; auto rate = rate_pair.first;
auto func = rate_pair.second; auto func = rate_pair.second;
well.rates.set(rate, func(this->state, schedule, st, sol, report_step, seconds_elapsed + time_step)); if (well_open)
well.rates.set(rate, func(this->state, schedule, st, sol, report_step, seconds_elapsed + time_step));
else
well.rates.set(rate, 0.0);
} }
// This is complete bogus; a temporary fix to pass an assert() in the // This is complete bogus; a temporary fix to pass an assert() in the