store well and group event in same map
This commit is contained in:
@@ -204,10 +204,8 @@ namespace Opm
|
||||
|
||||
const RFTConfig& rftConfig() const;
|
||||
const Events& getEvents() const;
|
||||
const Events& getWellEvents(const std::string& well) const;
|
||||
bool hasWellEvent(const std::string& well, uint64_t event_mask, size_t reportStep) const;
|
||||
const Events& getGroupEvents(const std::string& group) const;
|
||||
bool hasGroupEvent(const std::string& group, uint64_t event_mask, size_t reportStep) const;
|
||||
const Events& getWellGroupEvents(const std::string& wellGroup) const;
|
||||
bool hasWellGroupEvent(const std::string& wellGroup, uint64_t event_mask, size_t reportStep) const;
|
||||
const Deck& getModifierDeck(size_t timeStep) const;
|
||||
bool hasOilVaporizationProperties() const;
|
||||
const VFPProdTable& getVFPProdTable(int table_id, size_t timeStep) const;
|
||||
@@ -248,9 +246,7 @@ namespace Opm
|
||||
DynamicState<int> m_nupcol;
|
||||
|
||||
|
||||
std::map<std::string,Events> well_events;
|
||||
std::map<std::string,Events> group_events;
|
||||
|
||||
std::map<std::string,Events> wellgroup_events;
|
||||
|
||||
GTNode groupTree(const std::string& root_node, std::size_t report_step, const GTNode * parent) const;
|
||||
void updateGroup(std::shared_ptr<Group> group, size_t reportStep);
|
||||
@@ -325,9 +321,7 @@ namespace Opm
|
||||
const Eclipse3DProperties& eclipseProperties,
|
||||
const UnitSystem& unit_system,
|
||||
std::vector<std::pair<const DeckKeyword*, size_t > >& rftProperties);
|
||||
void addWellEvent(const std::string& well, ScheduleEvents::Events event, size_t reportStep);
|
||||
void addGroupEvent(const std::string& group, ScheduleEvents::Events event, size_t reportStep);
|
||||
|
||||
void addWellGroupEvent(const std::string& wellGroup, ScheduleEvents::Events event, size_t reportStep);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ namespace {
|
||||
|
||||
if (update) {
|
||||
this->updateWell(well2, currentStep);
|
||||
this->addWellEvent(well2->name(), ScheduleEvents::WELL_WELSPECS_UPDATE, currentStep);
|
||||
this->addWellGroupEvent(well2->name(), ScheduleEvents::WELL_WELSPECS_UPDATE, currentStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -774,7 +774,7 @@ namespace {
|
||||
|
||||
if (update_well) {
|
||||
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep);
|
||||
this->addWellEvent( well2->name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
|
||||
this->addWellGroupEvent( well2->name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
|
||||
this->updateWell(well2, currentStep);
|
||||
}
|
||||
if ( !well2->getAllowCrossFlow()) {
|
||||
@@ -836,7 +836,7 @@ namespace {
|
||||
|
||||
if (update_well) {
|
||||
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep);
|
||||
this->addWellEvent( well2->name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
|
||||
this->addWellGroupEvent( well2->name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
|
||||
this->updateWell(well2, currentStep);
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ namespace {
|
||||
auto well2 = std::make_shared<Well>(*dynamic_state[reportStep]);
|
||||
if (well2->updateStatus(status)) {
|
||||
m_events.addEvent( ScheduleEvents::WELL_STATUS_CHANGE, reportStep );
|
||||
this->addWellEvent( well2->name(), ScheduleEvents::WELL_STATUS_CHANGE, reportStep);
|
||||
this->addWellGroupEvent( well2->name(), ScheduleEvents::WELL_STATUS_CHANGE, reportStep);
|
||||
this->updateWell(well2, reportStep);
|
||||
update = true;
|
||||
}
|
||||
@@ -923,7 +923,7 @@ namespace {
|
||||
if (update_well) {
|
||||
this->updateWell(well2, currentStep);
|
||||
m_events.addEvent( ScheduleEvents::INJECTION_UPDATE , currentStep );
|
||||
this->addWellEvent( well_name, ScheduleEvents::INJECTION_UPDATE, currentStep);
|
||||
this->addWellGroupEvent( well_name, ScheduleEvents::INJECTION_UPDATE, currentStep);
|
||||
}
|
||||
|
||||
// if the well has zero surface rate limit or reservior rate limit, while does not allow crossflow,
|
||||
@@ -986,7 +986,7 @@ namespace {
|
||||
if (update_well) {
|
||||
this->updateWell(well2, currentStep);
|
||||
m_events.addEvent( ScheduleEvents::INJECTION_UPDATE , currentStep );
|
||||
this->addWellEvent( well_name, ScheduleEvents::INJECTION_UPDATE, currentStep);
|
||||
this->addWellGroupEvent( well_name, ScheduleEvents::INJECTION_UPDATE, currentStep);
|
||||
}
|
||||
|
||||
if ( ! well2->getAllowCrossFlow() && (injection->surfaceInjectionRate.get<double>() == 0)) {
|
||||
@@ -1509,7 +1509,7 @@ namespace {
|
||||
if (group_ptr->updateInjection(injection)) {
|
||||
this->updateGroup(std::move(group_ptr), currentStep);
|
||||
m_events.addEvent( ScheduleEvents::GROUP_INJECTION_UPDATE , currentStep);
|
||||
this->addGroupEvent(group_name, ScheduleEvents::GROUP_INJECTION_UPDATE, currentStep);
|
||||
this->addWellGroupEvent(group_name, ScheduleEvents::GROUP_INJECTION_UPDATE, currentStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1594,7 +1594,7 @@ namespace {
|
||||
|
||||
this->updateGroup(std::move(group_ptr), currentStep);
|
||||
m_events.addEvent( ScheduleEvents::GROUP_PRODUCTION_UPDATE , currentStep);
|
||||
this->addGroupEvent(group_name, ScheduleEvents::GROUP_PRODUCTION_UPDATE, currentStep);
|
||||
this->addWellGroupEvent(group_name, ScheduleEvents::GROUP_PRODUCTION_UPDATE, currentStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1901,7 +1901,7 @@ namespace {
|
||||
if (well2->updateConnections(connections))
|
||||
this->updateWell(well2, currentStep);
|
||||
}
|
||||
this->addWellEvent(name, ScheduleEvents::COMPLETION_CHANGE, currentStep);
|
||||
this->addWellGroupEvent(name, ScheduleEvents::COMPLETION_CHANGE, currentStep);
|
||||
}
|
||||
}
|
||||
m_events.addEvent(ScheduleEvents::COMPLETION_CHANGE, currentStep);
|
||||
@@ -2134,8 +2134,8 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
|
||||
dynamic_state.update(timeStep, well_ptr);
|
||||
}
|
||||
m_events.addEvent( ScheduleEvents::NEW_WELL , timeStep );
|
||||
well_events.insert( std::make_pair(wellName, Events(this->m_timeMap)));
|
||||
this->addWellEvent(wellName, ScheduleEvents::NEW_WELL, timeStep);
|
||||
wellgroup_events.insert( std::make_pair(wellName, Events(this->m_timeMap)));
|
||||
this->addWellGroupEvent(wellName, ScheduleEvents::NEW_WELL, timeStep);
|
||||
}
|
||||
|
||||
size_t Schedule::numWells() const {
|
||||
@@ -2414,8 +2414,8 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
|
||||
dynamic_state.update(timeStep, group_ptr);
|
||||
|
||||
m_events.addEvent( ScheduleEvents::NEW_GROUP , timeStep );
|
||||
group_events.insert( std::make_pair(groupName, Events(this->m_timeMap)));
|
||||
this->addGroupEvent(groupName, ScheduleEvents::NEW_GROUP, timeStep);
|
||||
wellgroup_events.insert( std::make_pair(groupName, Events(this->m_timeMap)));
|
||||
this->addWellGroupEvent(groupName, ScheduleEvents::NEW_GROUP, timeStep);
|
||||
|
||||
// All newly created groups are attached to the field group,
|
||||
// can then be relocated with the GRUPTREE keyword.
|
||||
@@ -2477,7 +2477,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
|
||||
auto well_ptr = std::make_shared<Well>( well );
|
||||
well_ptr->updateGroup(group_name);
|
||||
this->updateWell(well_ptr, timeStep);
|
||||
this->addWellEvent(well_ptr->name(), ScheduleEvents::WELL_WELSPECS_UPDATE, timeStep);
|
||||
this->addWellGroupEvent(well_ptr->name(), ScheduleEvents::WELL_WELSPECS_UPDATE, timeStep);
|
||||
|
||||
// Remove well child reference from previous group
|
||||
auto group = std::make_shared<Group>(this->getGroup(old_gname, timeStep));
|
||||
@@ -2507,37 +2507,20 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
|
||||
}
|
||||
|
||||
|
||||
const Events& Schedule::getWellEvents(const std::string& well) const {
|
||||
if (this->well_events.count(well) > 0)
|
||||
return this->well_events.at(well);
|
||||
const Events& Schedule::getWellGroupEvents(const std::string& wellGroup) const {
|
||||
if (this->wellgroup_events.count(wellGroup) > 0)
|
||||
return this->wellgroup_events.at(wellGroup);
|
||||
else
|
||||
throw std::invalid_argument("No such well " + well);
|
||||
throw std::invalid_argument("No such well og group " + wellGroup);
|
||||
}
|
||||
|
||||
void Schedule::addWellEvent(const std::string& well, ScheduleEvents::Events event, size_t reportStep) {
|
||||
auto& events = this->well_events.at(well);
|
||||
void Schedule::addWellGroupEvent(const std::string& wellGroup, ScheduleEvents::Events event, size_t reportStep) {
|
||||
auto& events = this->wellgroup_events.at(wellGroup);
|
||||
events.addEvent(event, reportStep);
|
||||
}
|
||||
|
||||
bool Schedule::hasWellEvent(const std::string& well, uint64_t event_mask, size_t reportStep) const {
|
||||
const auto& events = this->getWellEvents(well);
|
||||
return events.hasEvent(event_mask, reportStep);
|
||||
}
|
||||
|
||||
const Events& Schedule::getGroupEvents(const std::string& group) const {
|
||||
if (this->group_events.count(group) > 0)
|
||||
return this->group_events.at(group);
|
||||
else
|
||||
throw std::invalid_argument("No such group " + group);
|
||||
}
|
||||
|
||||
void Schedule::addGroupEvent(const std::string& group, ScheduleEvents::Events event, size_t reportStep) {
|
||||
auto& events = this->group_events.at(group);
|
||||
events.addEvent(event, reportStep);
|
||||
}
|
||||
|
||||
bool Schedule::hasGroupEvent(const std::string& group, uint64_t event_mask, size_t reportStep) const {
|
||||
const auto& events = this->getGroupEvents(group);
|
||||
bool Schedule::hasWellGroupEvent(const std::string& wellGroup, uint64_t event_mask, size_t reportStep) const {
|
||||
const auto& events = this->getWellGroupEvents(wellGroup);
|
||||
return events.hasEvent(event_mask, reportStep);
|
||||
}
|
||||
|
||||
|
||||
@@ -885,11 +885,11 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_CombineShutCompletionsAndAddN
|
||||
const auto& well_5 = schedule.getWell("OP_1", 5);
|
||||
// timestep 3. Close all completions with WELOPEN and immediately open new completions with COMPDAT.
|
||||
BOOST_CHECK(Well::Status::OPEN == well_3.getStatus());
|
||||
BOOST_CHECK( !schedule.hasWellEvent( "OP_1", ScheduleEvents::WELL_STATUS_CHANGE , 3 ));
|
||||
BOOST_CHECK( !schedule.hasWellGroupEvent( "OP_1", ScheduleEvents::WELL_STATUS_CHANGE , 3 ));
|
||||
// timestep 4. Close all completions with WELOPEN. The well will be shut since no completions
|
||||
// are open.
|
||||
BOOST_CHECK(Well::Status::SHUT == well_4.getStatus());
|
||||
BOOST_CHECK( schedule.hasWellEvent( "OP_1", ScheduleEvents::WELL_STATUS_CHANGE , 4 ));
|
||||
BOOST_CHECK( schedule.hasWellGroupEvent( "OP_1", ScheduleEvents::WELL_STATUS_CHANGE , 4 ));
|
||||
// timestep 5. Open new completions. But keep the well shut,
|
||||
BOOST_CHECK(Well::Status::SHUT == well_5.getStatus());
|
||||
}
|
||||
@@ -1294,8 +1294,8 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
|
||||
auto gh = schedule.getGroup("H1", 1);
|
||||
|
||||
|
||||
BOOST_CHECK( !schedule.hasGroupEvent( "G2", ScheduleEvents::GROUP_PRODUCTION_UPDATE , 1 ));
|
||||
BOOST_CHECK( schedule.hasGroupEvent( "G2", ScheduleEvents::GROUP_PRODUCTION_UPDATE , 2 ));
|
||||
BOOST_CHECK( !schedule.hasWellGroupEvent( "G2", ScheduleEvents::GROUP_PRODUCTION_UPDATE , 1 ));
|
||||
BOOST_CHECK( schedule.hasWellGroupEvent( "G2", ScheduleEvents::GROUP_PRODUCTION_UPDATE , 2 ));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -835,17 +835,17 @@ BOOST_AUTO_TEST_CASE(TestWellEvents) {
|
||||
Runspec runspec(deck);
|
||||
Schedule sched(deck , grid , eclipseProperties, runspec);
|
||||
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::NEW_WELL , 0 ));
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_2", ScheduleEvents::NEW_WELL , 2 ));
|
||||
BOOST_CHECK( !sched.hasWellEvent( "W_2", ScheduleEvents::NEW_WELL , 3 ));
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_2", ScheduleEvents::WELL_WELSPECS_UPDATE , 3 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::NEW_WELL , 0 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_2", ScheduleEvents::NEW_WELL , 2 ));
|
||||
BOOST_CHECK( !sched.hasWellGroupEvent( "W_2", ScheduleEvents::NEW_WELL , 3 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_2", ScheduleEvents::WELL_WELSPECS_UPDATE , 3 ));
|
||||
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 0 ));
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 1 ));
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 3 ));
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 4 ));
|
||||
BOOST_CHECK( !sched.hasWellEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 5 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 0 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 1 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 3 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 4 ));
|
||||
BOOST_CHECK( !sched.hasWellGroupEvent( "W_1", ScheduleEvents::WELL_STATUS_CHANGE , 5 ));
|
||||
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::COMPLETION_CHANGE , 0 ));
|
||||
BOOST_CHECK( sched.hasWellEvent( "W_1", ScheduleEvents::COMPLETION_CHANGE , 5 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::COMPLETION_CHANGE , 0 ));
|
||||
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::COMPLETION_CHANGE , 5 ));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user