Make sure well has been defined before creating PAvgCalculator

This commit is contained in:
Joakim Hove 2020-12-01 10:32:38 +01:00
parent 1ac1582f12
commit de6a067906

View File

@ -2904,9 +2904,11 @@ internal_store(const SummaryState& st, const int report_step)
Opm::PAvgCalculatorCollection Opm::out::Summary::SummaryImplementation::wbp_calculators(std::size_t report_step) const {
Opm::PAvgCalculatorCollection calculators;
for (const auto& wname : this->wbp_wells) {
const auto& well = this->sched_.get().getWell(wname, report_step);
if (well.getStatus() == Opm::Well::Status::OPEN)
calculators.add(well.pavg_calculator(this->grid_));
if (this->sched_.get().hasWell(wname, report_step)) {
const auto& well = this->sched_.get().getWell(wname, report_step);
if (well.getStatus() == Opm::Well::Status::OPEN)
calculators.add(well.pavg_calculator(this->grid_));
}
}
return calculators;
}