Merge pull request #2199 from joakim-hove/sched-global-whistctl-mode

Sched global whistctl mode
This commit is contained in:
Joakim Hove
2021-01-12 12:25:00 +01:00
committed by GitHub
5 changed files with 22 additions and 12 deletions

View File

@@ -233,7 +233,7 @@ namespace Opm
std::vector<const Group*> getChildGroups2(const std::string& group_name, std::size_t timeStep) const;
std::vector<Well> getChildWells2(const std::string& group_name, std::size_t timeStep) const;
const Well::ProducerCMode& getGlobalWhistctlMmode(std::size_t timestep) const;
Well::ProducerCMode getGlobalWhistctlMmode(std::size_t timestep) const;
const UDQActive& udqActive(std::size_t timeStep) const;
const WellTestConfig& wtestConfig(std::size_t timestep) const;
@@ -325,7 +325,6 @@ namespace Opm
guide_rate_config.serializeOp(serializer);
gconsale.serializeOp(serializer);
gconsump.serializeOp(serializer);
global_whistctl_mode.template serializeOp<Serializer, false>(serializer);
m_actions.serializeOp(serializer);
m_network.serializeOp(serializer);
m_glo.serializeOp(serializer);
@@ -361,7 +360,6 @@ namespace Opm
DynamicState<std::shared_ptr<GuideRateConfig>> guide_rate_config;
DynamicState<std::shared_ptr<GConSale>> gconsale;
DynamicState<std::shared_ptr<GConSump>> gconsump;
DynamicState<Well::ProducerCMode> global_whistctl_mode;
DynamicState<std::shared_ptr<Action::Actions>> m_actions;
DynamicState<std::shared_ptr<Network::ExtNetwork>> m_network;
DynamicState<std::shared_ptr<GasLiftOpt>> m_glo;

View File

@@ -30,6 +30,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
namespace Opm {
@@ -88,6 +89,9 @@ namespace Opm {
MessageLimits& message_limits();
const MessageLimits& message_limits() const;
Well::ProducerCMode whistctl() const;
void whistctl(Well::ProducerCMode whistctl);
template<class Serializer>
void serializeOp(Serializer& serializer) {
serializer(m_start_time);
@@ -100,6 +104,7 @@ namespace Opm {
m_wellgroup_events.serializeOp(serializer);
serializer.vector(m_geo_keywords);
m_message_limits.serializeOp(serializer);
serializer(m_whistctl_mode);
}
private:
@@ -114,6 +119,7 @@ namespace Opm {
WellGroupEvents m_wellgroup_events;
std::vector<DeckKeyword> m_geo_keywords;
MessageLimits m_message_limits;
Well::ProducerCMode m_whistctl_mode = Well::ProducerCMode::CMODE_UNDEFINED;
};
}

View File

@@ -1387,9 +1387,8 @@ namespace {
std::string msg = "The WHISTCTL keyword specifies an un-supported control mode " + cmodeString
+ ", which makes WHISTCTL keyword not affect the simulation at all";
OpmLog::warning(msg);
} else {
this->global_whistctl_mode.update(handlerContext.currentStep, controlMode);
}
} else
this->snapshots.back().whistctl( controlMode );
}
const std::string bhp_terminate = record.getItem("BPH_TERMINATE").getTrimmedString(0);

View File

@@ -121,7 +121,6 @@ namespace {
guide_rate_config(this->m_timeMap, std::make_shared<GuideRateConfig>()),
gconsale(this->m_timeMap, std::make_shared<GConSale>() ),
gconsump(this->m_timeMap, std::make_shared<GConSump>() ),
global_whistctl_mode(this->m_timeMap, Well::ProducerCMode::CMODE_UNDEFINED),
m_actions(this->m_timeMap, std::make_shared<Action::Actions>()),
m_network(this->m_timeMap, std::make_shared<Network::ExtNetwork>()),
m_glo(this->m_timeMap, std::make_shared<GasLiftOpt>()),
@@ -275,7 +274,6 @@ namespace {
result.guide_rate_config = {{std::make_shared<GuideRateConfig>(GuideRateConfig::serializeObject())}, 1};
result.gconsale = {{std::make_shared<GConSale>(GConSale::serializeObject())}, 1};
result.gconsump = {{std::make_shared<GConSump>(GConSump::serializeObject())}, 1};
result.global_whistctl_mode = {{Well::ProducerCMode::CRAT}, 1};
result.m_actions = {{std::make_shared<Action::Actions>(Action::Actions::serializeObject())}, 1};
result.rft_config = RFTConfig::serializeObject();
result.restart_config = RestartConfig::serializeObject();
@@ -965,6 +963,7 @@ void Schedule::iterateScheduleSection(std::optional<std::size_t> load_offset,
std::size_t timeStep,
Connection::Order wellConnectionOrder) {
const auto& sched_state = this->operator[](timeStep);
Well well(wellName,
group,
timeStep,
@@ -972,7 +971,7 @@ void Schedule::iterateScheduleSection(std::optional<std::size_t> load_offset,
headI, headJ,
ref_depth,
WellType(preferredPhase),
this->global_whistctl_mode[timeStep],
sched_state.whistctl(),
wellConnectionOrder,
this->unit_system,
this->getUDQConfig(timeStep).params().undefinedValue(),
@@ -1378,8 +1377,8 @@ void Schedule::iterateScheduleSection(std::optional<std::size_t> load_offset,
const Well::ProducerCMode& Schedule::getGlobalWhistctlMmode(std::size_t timestep) const {
return global_whistctl_mode.get(timestep);
Well::ProducerCMode Schedule::getGlobalWhistctlMmode(std::size_t timestep) const {
return this->operator[](timestep).whistctl();
}
@@ -1676,7 +1675,6 @@ void Schedule::iterateScheduleSection(std::optional<std::size_t> load_offset,
compareDynState(this->guide_rate_config, data.guide_rate_config) &&
compareDynState(this->gconsale, data.gconsale) &&
compareDynState(this->gconsump, data.gconsump) &&
this->global_whistctl_mode == data.global_whistctl_mode &&
compareDynState(this->m_actions, data.m_actions) &&
compareDynState(this->rpt_config, data.rpt_config) &&
rft_config == data.rft_config &&

View File

@@ -112,6 +112,13 @@ MessageLimits& ScheduleState::message_limits() {
return this->m_message_limits;
}
Well::ProducerCMode ScheduleState::whistctl() const {
return this->m_whistctl_mode;
}
void ScheduleState::whistctl(Well::ProducerCMode whistctl) {
this->m_whistctl_mode = whistctl;
}
bool ScheduleState::operator==(const ScheduleState& other) const {
return this->m_start_time == other.m_start_time &&
@@ -122,6 +129,7 @@ bool ScheduleState::operator==(const ScheduleState& other) const {
this->m_wellgroup_events == other.m_wellgroup_events &&
this->m_geo_keywords == other.m_geo_keywords &&
this->m_message_limits == other.m_message_limits &&
this->m_whistctl_mode == other.m_whistctl_mode &&
this->m_nupcol == other.m_nupcol;
}
@@ -133,6 +141,7 @@ ScheduleState ScheduleState::serializeObject() {
ts.nupcol(77);
ts.oilvap( Opm::OilVaporizationProperties::serializeObject() );
ts.m_message_limits = MessageLimits::serializeObject();
ts.m_whistctl_mode = Well::ProducerCMode::THP;
return ts;
}