mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
WellGroupHelpers: make sure we have a GuideRate value or potential for well
this is not the case when WTEST executes at the beginning of (the first time step of) a report step if the well was created at that report step. this led to an exception being thrown trying to deref the potentials array
This commit is contained in:
parent
b90cf68d46
commit
7f58ad69ac
@ -923,7 +923,11 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu)
|
const PhaseUsage& pu)
|
||||||
{
|
{
|
||||||
if (schedule.hasWell(name, reportStepIdx)) {
|
if (schedule.hasWell(name, reportStepIdx)) {
|
||||||
|
if (guideRate->has(name) || guideRate->hasPotentials(name)) {
|
||||||
return guideRate->get(name, target, getWellRateVector(wellState, pu, name));
|
return guideRate->get(name, target, getWellRateVector(wellState, pu, name));
|
||||||
|
} else {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guideRate->has(name)) {
|
if (guideRate->has(name)) {
|
||||||
@ -955,7 +959,9 @@ namespace WellGroupHelpers
|
|||||||
if (!wellState.isProductionGrup(wellName))
|
if (!wellState.isProductionGrup(wellName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
totalGuideRate += guideRate->get(wellName, target, getWellRateVector(wellState, pu, wellName));
|
totalGuideRate += getGuideRate(wellName, schedule, wellState, group_state,
|
||||||
|
reportStepIdx, guideRate, target, pu);
|
||||||
|
|
||||||
}
|
}
|
||||||
return totalGuideRate;
|
return totalGuideRate;
|
||||||
}
|
}
|
||||||
@ -972,7 +978,8 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu)
|
const PhaseUsage& pu)
|
||||||
{
|
{
|
||||||
if (schedule.hasWell(name, reportStepIdx)) {
|
if (schedule.hasWell(name, reportStepIdx)) {
|
||||||
return guideRate->get(name, target, getWellRateVector(wellState, pu, name));
|
return getGuideRate(name, schedule, wellState, group_state,
|
||||||
|
reportStepIdx, guideRate, target, pu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guideRate->has(name, injectionPhase)) {
|
if (guideRate->has(name, injectionPhase)) {
|
||||||
@ -1142,7 +1149,8 @@ namespace WellGroupHelpers
|
|||||||
double FractionCalculator::guideRate(const std::string& name, const std::string& always_included_child)
|
double FractionCalculator::guideRate(const std::string& name, const std::string& always_included_child)
|
||||||
{
|
{
|
||||||
if (schedule_.hasWell(name, report_step_)) {
|
if (schedule_.hasWell(name, report_step_)) {
|
||||||
return guide_rate_->get(name, target_, getWellRateVector(well_state_, pu_, name));
|
return getGuideRate(name, schedule_, well_state_, group_state_,
|
||||||
|
report_step_, guide_rate_, target_, pu_);
|
||||||
} else {
|
} else {
|
||||||
if (groupControlledWells(name, always_included_child) > 0) {
|
if (groupControlledWells(name, always_included_child) > 0) {
|
||||||
if (is_producer_ && guide_rate_->has(name)) {
|
if (is_producer_ && guide_rate_->has(name)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user