move getGuideRateValues(Well) into BlackoilWellModelGuideRates

This commit is contained in:
Arne Morten Kvarving 2022-10-24 09:36:05 +02:00
parent dc607ce3ff
commit 41b1a38de3
4 changed files with 33 additions and 29 deletions

View File

@ -929,33 +929,6 @@ setWsolvent(const Group& group,
}
}
data::GuideRateValue
BlackoilWellModelGeneric::
getGuideRateValues(const Well& well) const
{
auto grval = data::GuideRateValue{};
const auto& wname = well.name();
if (!this->wellState().has(wname)) {
// No flow rates for 'wname' -- might be before well comes
// online (e.g., for the initial condition before simulation
// starts).
return grval;
}
if (!this->guideRate_.has(wname)) {
// No guiderates exist for 'wname'.
return grval;
}
const auto qs = WellGroupHelpers::
getWellRateVector(this->wellState(), this->phase_usage_, wname);
BlackoilWellModelGuideRates(*this).getGuideRateValues(qs, well.isInjector(), wname, grval);
return grval;
}
data::GuideRateValue
BlackoilWellModelGeneric::
getGuideRateValues(const Group& group) const
@ -1195,7 +1168,7 @@ calculateAllGroupGuiderates(const int reportStepIdx) const
? gr[gname].injection
: gr[gname].production;
grval += this->getGuideRateValues(well);
grval += BlackoilWellModelGuideRates(*this).getGuideRateValues(well);
});
// Visit wells and groups before their parents, meaning no group is

View File

@ -272,7 +272,6 @@ protected:
std::vector<double>& resv_coeff) = 0;
data::GuideRateValue getGuideRateValues(const Group& group) const;
data::GuideRateValue getGuideRateValues(const Well& well) const;
data::GuideRateValue getGuideRateInjectionGroupValues(const Group& group) const;
void assignWellGuideRates(data::Wells& wsrpt,

View File

@ -58,4 +58,32 @@ getGuideRateValues(const GuideRate::RateVector& qs,
}
}
data::GuideRateValue
BlackoilWellModelGuideRates::
getGuideRateValues(const Well& well) const
{
auto grval = data::GuideRateValue{};
const auto& wname = well.name();
if (!wellModel_.wellState().has(wname)) {
// No flow rates for 'wname' -- might be before well comes
// online (e.g., for the initial condition before simulation
// starts).
return grval;
}
if (!wellModel_.guideRate().has(wname)) {
// No guiderates exist for 'wname'.
return grval;
}
const auto qs = WellGroupHelpers::
getWellRateVector(wellModel_.wellState(), wellModel_.phaseUsage(), wname);
this->getGuideRateValues(qs, well.isInjector(), wname, grval);
return grval;
}
}

View File

@ -32,6 +32,7 @@ namespace Opm {
class BlackoilWellModelGeneric;
namespace data { class GuideRateValue; }
class Group;
class Well;
/// Class for handling the guide rates in the blackoil well model.
class BlackoilWellModelGuideRates
@ -48,6 +49,9 @@ public:
const std::string& wgname,
data::GuideRateValue& grval) const;
//! \brief Obtain guide rate values for well.
data::GuideRateValue getGuideRateValues(const Well& well) const;
private:
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
};