Add Guiderate Value Accessor for SI Units
This is mostly for reporting purposes if the calling code knows that the values stored in the GuideRate container are in output units. The output layer, and particularly the Summary facility, expects that its input values are strictly SI.
This commit is contained in:
parent
612cbf749c
commit
2a374fc53b
@ -98,6 +98,11 @@ public:
|
||||
double get(const std::string& group, Group::GuideRateProdTarget target, const RateVector& rates) const;
|
||||
double get(const std::string& name, GuideRateModel::Target model_target, const RateVector& rates) const;
|
||||
double get(const std::string& group, const Phase& phase) const;
|
||||
|
||||
double getSI(const std::string& well, const Well::GuideRateTarget 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;
|
||||
|
||||
bool has(const std::string& name) const;
|
||||
bool has(const std::string& name, const Phase& phase) const;
|
||||
void init_grvalue(std::size_t report_step, const std::string& wgname, GuideRateValue value);
|
||||
|
@ -27,10 +27,13 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
double GuideRate::RateVector::eval(Well::GuideRateTarget target) const
|
||||
@ -117,6 +120,51 @@ double GuideRate::get(const std::string& name, const Phase& phase) const
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
double GuideRate::getSI(const std::string& well,
|
||||
const Well::GuideRateTarget target,
|
||||
const RateVector& rates) const
|
||||
{
|
||||
return this->getSI(well, GuideRateModel::convert_target(target), rates);
|
||||
}
|
||||
|
||||
double GuideRate::getSI(const std::string& group,
|
||||
const Group::GuideRateProdTarget target,
|
||||
const RateVector& rates) const
|
||||
{
|
||||
return this->getSI(group, GuideRateModel::convert_target(target), rates);
|
||||
}
|
||||
|
||||
double GuideRate::getSI(const std::string& wgname,
|
||||
const GuideRateModel::Target target,
|
||||
const RateVector& rates) const
|
||||
{
|
||||
using M = UnitSystem::measure;
|
||||
|
||||
const auto gr = this->get(wgname, target, rates);
|
||||
|
||||
switch (target) {
|
||||
case GuideRateModel::Target::OIL:
|
||||
case GuideRateModel::Target::WAT:
|
||||
case GuideRateModel::Target::LIQ:
|
||||
return this->schedule.getUnits().to_si(M::liquid_surface_rate, gr);
|
||||
|
||||
case GuideRateModel::Target::GAS:
|
||||
return this->schedule.getUnits().to_si(M::gas_surface_rate, gr);
|
||||
|
||||
case GuideRateModel::Target::RES:
|
||||
return this->schedule.getUnits().to_si(M::rate, gr);
|
||||
|
||||
case GuideRateModel::Target::NONE:
|
||||
case GuideRateModel::Target::COMB:
|
||||
return gr;
|
||||
}
|
||||
|
||||
throw std::invalid_argument {
|
||||
fmt::format("Unsupported Guiderate Target '{}'",
|
||||
static_cast<std::underlying_type_t<GuideRateModel::Target>>(target))
|
||||
};
|
||||
}
|
||||
|
||||
bool GuideRate::has(const std::string& name) const
|
||||
{
|
||||
return this->values.count(name) > 0;
|
||||
|
Loading…
Reference in New Issue
Block a user