Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for zero guiderates computed from NETV #4391

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 4 additions & 4 deletions tests/parser/GroupTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,10 @@ GCONINJE
GuideRate gr = GuideRate(schedule);
const auto& g1 = schedule.getGroup("G1", 1);
const auto& g2 = schedule.getGroup("G2", 1);
gr.compute(g1.name(), Phase::WATER, 1, 0.0);
gr.compute(g1.name(), Phase::GAS, 1, 0.0);
gr.compute(g2.name(), Phase::WATER, 1, 0.0);
gr.compute(g2.name(), Phase::GAS, 1, 0.0);
gr.compute(g1.name(), Phase::WATER, 1, std::nullopt);
gr.compute(g1.name(), Phase::GAS, 1, std::nullopt);
gr.compute(g2.name(), Phase::WATER, 1, std::nullopt);
gr.compute(g2.name(), Phase::GAS, 1, std::nullopt);

BOOST_CHECK( gr.has(g1.name(), Phase::WATER));
BOOST_CHECK( gr.has(g1.name(), Phase::GAS));
Expand Down