Skip to content
Open
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
22 changes: 21 additions & 1 deletion opm/input/eclipse/Schedule/Group/GuideRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ double Opm::GuideRate::get(const std::string& name, const Phase& phase) const
return iter->second;
}

double Opm::GuideRate::getPotential(const std::string& name,
const GuideRateModel::Target model_target) const
{
if ((model_target == GuideRateModel::Target::NONE) ||
(model_target == GuideRateModel::Target::COMB))
{
// No potential can be associated with these targets.
return 0.0;
}

auto pot = this->potentials.find(name);
if (pot == this->potentials.end()) {
return 0.0;
}

return pot->second.eval(model_target);
}

double Opm::GuideRate::getSI(const std::string& well,
const Well::GuideRateTarget target,
const RateVector& rates) const
Expand Down Expand Up @@ -340,9 +358,11 @@ void Opm::GuideRate::well_compute(const std::string& wgname,

const auto& model = config.has_model() ? config.model() : GuideRateModel{};
this->assign_grvalue(wgname, model, { sim_time, well.guide_rate, model_target });
return;
}
}
else if (config.has_model()) { // GUIDERAT
// A well can have WGRUPCON with defaulted guide rate, in which case we must check for GUIDRAT
if (config.has_model()) { // GUIDERAT
if (! this->schedule.hasWell(wgname, report_step)) {
// 'wgname' might be a group or the well is not yet online.
return;
Expand Down
8 changes: 8 additions & 0 deletions opm/input/eclipse/Schedule/Group/GuideRate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ class GuideRate
double get(const std::string& name, const GuideRateModel::Target model_target, const RateVector& rates) const;
double get(const std::string& group, const Phase& phase) const;

/// \brief Guide rate of a well or group based on its potentials alone.
///
/// This is the value that get() returns when no GUIDERAT/WGRUPCON guide
/// rate has been computed for 'name'. Callers that need the "default"
/// (potential based) guide rate irrespective of whether GUIDERAT is
/// active use this accessor. Returns 0.0 if no potentials are stored.
double getPotential(const std::string& name, const GuideRateModel::Target model_target) const;

double getSI(const std::string& well, const WellGuideRateTarget target, const RateVector& rates) const;
double getSI(const std::string& group, const Group::GuideRateProdTarget target, const RateVector& rates) const;
double getSI(const std::string& wgname, const GuideRateModel::Target target, const RateVector& rates) const;
Expand Down