Skip to content

Return group/well potentials from GuideRate object #4567

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

Closed
wants to merge 5 commits into from
Closed
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
11 changes: 11 additions & 0 deletions opm/input/eclipse/Schedule/Group/GuideRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <opm/input/eclipse/Units/Units.hpp>

#include <algorithm>
#include <cassert>
#include <memory>
#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -132,6 +133,16 @@ double Opm::GuideRate::get(const std::string& name, const Phase& phase) const
return iter->second;
}

const Opm::GuideRate::RateVector& Opm::GuideRate::getPotentials(const std::string& name) const
{
if (const auto candidate = this->potentials.find(name); candidate == this->potentials.end()) {
auto message = fmt::format("Potentials for '{}' do not exist.", name);
throw std::logic_error {message};
} else {
return candidate->second;
}
}

double Opm::GuideRate::getSI(const std::string& well,
const Well::GuideRateTarget target,
const RateVector& rates) const
Expand Down
1 change: 1 addition & 0 deletions opm/input/eclipse/Schedule/Group/GuideRate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class GuideRate
double get(const std::string& group, const Group::GuideRateProdTarget target, const RateVector& rates) const;
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;
const RateVector& getPotentials(const std::string& name) 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;
Expand Down
22 changes: 11 additions & 11 deletions opm/output/data/GuideRateValue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,6 @@ namespace Opm { namespace data {
return val;
}

private:
enum { Size = static_cast<std::size_t>(Item::NumItems) };

std::bitset<Size> mask_{};
std::array<double, Size> value_{};

constexpr std::size_t index(const Item p) const noexcept
{
return static_cast<std::size_t>(p);
}

std::string itemName(const Item p) const
{
switch (p) {
Expand All @@ -173,6 +162,17 @@ namespace Opm { namespace data {

return "Unknown (" + std::to_string(this->index(p)) + ')';
}
private:
enum { Size = static_cast<std::size_t>(Item::NumItems) };

std::bitset<Size> mask_{};
std::array<double, Size> value_{};

constexpr std::size_t index(const Item p) const noexcept
{
return static_cast<std::size_t>(p);
}

};

}} // namespace Opm::data
Expand Down