Skip to content

Commit

Permalink
Allow for zero guiderates computed from NETV
Browse files Browse the repository at this point in the history
  • Loading branch information
Tor Harald Sandve committed Dec 20, 2024
1 parent f9d1e94 commit eec3534
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions opm/input/eclipse/Schedule/Group/Group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ class Group {
VOID = 2,
NETV = 3,
RESV = 4,
POTN = 5,
NO_GUIDE_RATE = 6
NO_GUIDE_RATE = 5
};
static GuideRateInjTarget GuideRateInjTargetFromString( const std::string& stringValue );
static GuideRateInjTarget GuideRateInjTargetFromInt(int ecl_id);
Expand Down
14 changes: 7 additions & 7 deletions opm/input/eclipse/Schedule/Group/GuideRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,22 +283,22 @@ void Opm::GuideRate::group_compute(const std::string& wgname,
}
}

void Opm::GuideRate::compute(const std::string& wgname,
const Phase& phase,
const std::size_t report_step,
const double guide_rate)
void Opm::GuideRate::compute(const std::string& wgname,
const Phase& phase,
const std::size_t report_step,
const std::optional<double> guide_rate)
{
const auto& config = this->schedule[report_step].guide_rate();
if (!config.has_injection_group(phase, wgname))
return;

if (guide_rate > 0) {
this->injection_group_values[std::make_pair(phase, wgname)] = guide_rate;
if (guide_rate) {
this->injection_group_values[std::make_pair(phase, wgname)] = *guide_rate;
return;
}

const auto& group = config.injection_group(phase, wgname);
if (group.target == Group::GuideRateInjTarget::POTN) {
if (group.target == Group::GuideRateInjTarget::NO_GUIDE_RATE) {
return;
}
this->injection_group_values[std::make_pair(phase, wgname)] = group.guide_rate;
Expand Down
8 changes: 4 additions & 4 deletions opm/input/eclipse/Schedule/Group/GuideRate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class GuideRate
const double gas_pot,
const double wat_pot);

void compute(const std::string& wgname,
const Phase& phase,
const std::size_t report_step,
const double guide_rate);
void compute(const std::string& wgname,
const Phase& phase,
const std::size_t report_step,
const std::optional<double> guide_rate);

bool has(const std::string& name) const;
bool hasPotentials(const std::string& name) const;
Expand Down

0 comments on commit eec3534

Please sign in to comment.