Re-introducing check for negative reportStepIdx and adding forgotten hasGroup check.

This commit is contained in:
Vegard Kippe 2023-10-27 20:30:48 +02:00
parent f137565bb6
commit 429b312bc0

View File

@ -912,6 +912,7 @@ BlackoilWellModelGeneric::
assignNodeValues(std::map<std::string, data::NodeData>& nodevalues, const int reportStepIdx) const
{
nodevalues.clear();
if (reportStepIdx < 0) return;
for (const auto& [node, pressure] : node_pressures_) {
nodevalues.emplace(node, data::NodeData{pressure});
@ -938,7 +939,9 @@ assignNodeValues(std::map<std::string, data::NodeData>& nodevalues, const int re
assert(it != nodevalues.end() );
it->second.converged_pressure = converged_pressure;
// Assign node values of group to GPR:WELLNAME
const auto& group = schedule().getGroup(node, reportStepIdx);
const auto& sched = schedule();
if (!sched.hasGroup(node, reportStepIdx)) continue;
const auto& group = sched.getGroup(node, reportStepIdx);
for (const std::string& wellname : group.wells()) {
auto it2 = nodevalues.find(wellname);
assert(it2 != nodevalues.end());