mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move loadRestartGuideRates(Target) into BlackoilWellModelRestart
This commit is contained in:
parent
ffeddfe280
commit
2e433a5bc2
@ -371,7 +371,7 @@ numPhases() const
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
BlackoilWellModelGeneric::
|
BlackoilWellModelGeneric::
|
||||||
hasWell(const std::string& wname)
|
hasWell(const std::string& wname) const
|
||||||
{
|
{
|
||||||
return std::any_of(this->wells_ecl_.begin(), this->wells_ecl_.end(),
|
return std::any_of(this->wells_ecl_.begin(), this->wells_ecl_.end(),
|
||||||
[&wname](const Well& well)
|
[&wname](const Well& well)
|
||||||
@ -415,22 +415,6 @@ getWellEcl(const std::string& well_name) const
|
|||||||
return *well_ecl;
|
return *well_ecl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
BlackoilWellModelGeneric::
|
|
||||||
loadRestartGuideRates(const int report_step,
|
|
||||||
const GuideRateModel::Target target,
|
|
||||||
const data::Wells& rst_wells)
|
|
||||||
{
|
|
||||||
for (const auto& [well_name, rst_well] : rst_wells) {
|
|
||||||
if (! this->hasWell(well_name) || this->getWellEcl(well_name).isInjector()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->guideRate_.init_grvalue_SI(report_step, well_name,
|
|
||||||
makeGuideRateValue(rst_well.guide_rates, target));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BlackoilWellModelGeneric::
|
BlackoilWellModelGeneric::
|
||||||
loadRestartGuideRates(const int report_step,
|
loadRestartGuideRates(const int report_step,
|
||||||
@ -529,9 +513,10 @@ initFromRestartFile(const RestartValue& restartValues,
|
|||||||
this->phase_usage_, handle_ms_well, this->wellState());
|
this->phase_usage_, handle_ms_well, this->wellState());
|
||||||
|
|
||||||
if (config.has_model()) {
|
if (config.has_model()) {
|
||||||
this->loadRestartGuideRates(report_step,
|
BlackoilWellModelRestart(*this).loadRestartGuideRates(report_step,
|
||||||
config.model().target(),
|
config.model().target(),
|
||||||
restartValues.wells);
|
restartValues.wells,
|
||||||
|
this->guideRate_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
/// return true if wells are available in the reservoir
|
/// return true if wells are available in the reservoir
|
||||||
bool wellsActive() const;
|
bool wellsActive() const;
|
||||||
bool hasWell(const std::string& wname);
|
bool hasWell(const std::string& wname) const;
|
||||||
|
|
||||||
// whether there exists any multisegment well open on this process
|
// whether there exists any multisegment well open on this process
|
||||||
bool anyMSWellOpenLocal() const;
|
bool anyMSWellOpenLocal() const;
|
||||||
@ -286,10 +286,6 @@ protected:
|
|||||||
std::map<std::string, data::GroupData>& gvalues) const;
|
std::map<std::string, data::GroupData>& gvalues) const;
|
||||||
void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues) const;
|
void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues) const;
|
||||||
|
|
||||||
void loadRestartGuideRates(const int report_step,
|
|
||||||
const GuideRateModel::Target target,
|
|
||||||
const data::Wells& rst_wells);
|
|
||||||
|
|
||||||
void loadRestartGuideRates(const int report_step,
|
void loadRestartGuideRates(const int report_step,
|
||||||
const GuideRateConfig& config,
|
const GuideRateConfig& config,
|
||||||
const std::map<std::string, data::GroupData>& rst_groups);
|
const std::map<std::string, data::GroupData>& rst_groups);
|
||||||
|
@ -29,6 +29,38 @@
|
|||||||
#include <opm/simulators/wells/PerforationData.hpp>
|
#include <opm/simulators/wells/PerforationData.hpp>
|
||||||
#include <opm/simulators/wells/SingleWellState.hpp>
|
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
Opm::data::GuideRateValue::Item
|
||||||
|
guideRateRestartItem(const Opm::GuideRateModel::Target target)
|
||||||
|
{
|
||||||
|
using Item = Opm::data::GuideRateValue::Item;
|
||||||
|
using Target = Opm::GuideRateModel::Target;
|
||||||
|
|
||||||
|
static const auto items = std::unordered_map<Target, Item> {
|
||||||
|
{ Target::OIL, Item::Oil },
|
||||||
|
{ Target::GAS, Item::Gas },
|
||||||
|
{ Target::WAT, Item::Water },
|
||||||
|
{ Target::RES, Item::ResV },
|
||||||
|
};
|
||||||
|
|
||||||
|
auto i = items.find(target);
|
||||||
|
return (i == items.end()) ? Item::NumItems : i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
Opm::GuideRate::GuideRateValue
|
||||||
|
makeGuideRateValue(const Opm::data::GuideRateValue& restart,
|
||||||
|
const Opm::GuideRateModel::Target target)
|
||||||
|
{
|
||||||
|
const auto item = guideRateRestartItem(target);
|
||||||
|
|
||||||
|
if (! restart.has(item)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return { 0.0, restart.get(item), target };
|
||||||
|
}
|
||||||
|
} // Anonymous
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
void BlackoilWellModelRestart::
|
void BlackoilWellModelRestart::
|
||||||
@ -144,6 +176,20 @@ loadRestartGroupData(const std::string& group,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlackoilWellModelRestart::
|
||||||
|
loadRestartGuideRates(const int report_step,
|
||||||
|
const GuideRateModel::Target target,
|
||||||
|
const data::Wells& rst_wells,
|
||||||
|
GuideRate& guide_rate) const
|
||||||
|
{
|
||||||
|
for (const auto& [well_name, rst_well] : rst_wells) {
|
||||||
|
if (!wellModel_.hasWell(well_name) || wellModel_.getWellEcl(well_name).isInjector()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
guide_rate.init_grvalue_SI(report_step, well_name,
|
||||||
|
makeGuideRateValue(rst_well.guide_rates, target));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#ifndef OPM_BLACKOILWELLMODEL_RESTART_HEADER_INCLUDED
|
#ifndef OPM_BLACKOILWELLMODEL_RESTART_HEADER_INCLUDED
|
||||||
#define OPM_BLACKOILWELLMODEL_RESTART_HEADER_INCLUDED
|
#define OPM_BLACKOILWELLMODEL_RESTART_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/Schedule/Group/GuideRateModel.hpp>
|
||||||
#include <opm/output/data/Wells.hpp>
|
#include <opm/output/data/Wells.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -34,6 +35,7 @@ namespace data {
|
|||||||
class GroupData;
|
class GroupData;
|
||||||
}
|
}
|
||||||
class GroupState;
|
class GroupState;
|
||||||
|
class GuideRate;
|
||||||
struct PerforationData;
|
struct PerforationData;
|
||||||
class SingleWellState;
|
class SingleWellState;
|
||||||
|
|
||||||
@ -59,6 +61,12 @@ public:
|
|||||||
const data::GroupData& value,
|
const data::GroupData& value,
|
||||||
GroupState& grpState) const;
|
GroupState& grpState) const;
|
||||||
|
|
||||||
|
//! \brief Loads guide rates from restart structures.
|
||||||
|
void loadRestartGuideRates(const int report_step,
|
||||||
|
const GuideRateModel::Target target,
|
||||||
|
const data::Wells& rst_wells,
|
||||||
|
GuideRate& guide_rate) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Loads per-connection data from restart structures.
|
//! \brief Loads per-connection data from restart structures.
|
||||||
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
||||||
|
Loading…
Reference in New Issue
Block a user