mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-02 20:30:55 -06:00
Master groups with GCONPROD cmode NONE and guide rate caused a crash in getProductionGroupTargetForMode_(), which only handles rate-specific cmodes (ORAT, WRAT, GRAT, LRAT, RESV). The crash path: TopToBottomCalculator falls through to getGroupConstraintNoGuideRate() when the bottom group has zero or negative production (first time step on RC master with no local wells). That function passes the group's NONE cmode to getProductionGroupTargetForMode(), which throws. Two fixes in GroupConstraintCalculator.cpp: 1. getGroupConstraintNoGuideRate(): return std::nullopt when the production cmode is FLD or NONE, since these groups have no own target. 2. TopToBottomCalculator::calculateGroupConstraint() fallback: when the bottom group has no own constraint (nullopt from fix 1), return the guide-rate-distributed target from above, capped by any limit the bottom group defines for the top-level control mode.